Skip to content

Commit 1cbe793

Browse files
committed
fixed issue with updating to new hub version
1 parent ed5aff1 commit 1cbe793

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

marklogic-data-hub/src/test/java/com/marklogic/hub/TracingTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public static void setup() throws IOException, URISyntaxException {
2929

3030
@AfterClass
3131
public static void teardown() throws IOException {
32+
uninstallHub();
3233
}
3334

3435
@Before

quick-start/src/main/java/com/marklogic/quickstart/service/DataHubService.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
import com.marklogic.hub.deploy.commands.LoadUserModulesCommand;
2222
import com.marklogic.hub.deploy.util.HubDeployStatusListener;
2323
import com.marklogic.hub.util.PerformanceLogger;
24+
import com.marklogic.quickstart.auth.ConnectionAuthenticationToken;
2425
import com.marklogic.quickstart.exception.DataHubException;
2526
import com.marklogic.quickstart.listeners.DeployUserModulesListener;
2627
import com.marklogic.quickstart.listeners.ValidateListener;
28+
import com.marklogic.quickstart.model.EnvironmentConfig;
2729
import org.springframework.scheduling.annotation.Async;
30+
import org.springframework.security.core.context.SecurityContextHolder;
2831
import org.springframework.stereotype.Service;
2932

3033
import java.io.*;
@@ -148,9 +151,18 @@ private String getQuickStartVersion() throws IOException {
148151
return (String)properties.get("version");
149152
}
150153

151-
public boolean updateHub(HubConfig config) {
154+
public boolean updateHub(HubConfig config) throws IOException {
152155
DataHub dataHub = new DataHub(config);
153-
return dataHub.updateHub();
156+
boolean result = dataHub.updateHub();
157+
if (result) {
158+
ConnectionAuthenticationToken authenticationToken = (ConnectionAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
159+
if (authenticationToken != null) {
160+
EnvironmentConfig environmentConfig = authenticationToken.getEnvironmentConfig();
161+
environmentConfig.checkIfInstalled();
162+
}
163+
}
164+
return result;
165+
154166
}
155167

156168
public void clearContent(HubConfig config, String database) {

quick-start/src/main/java/com/marklogic/quickstart/web/CurrentProjectController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public ResponseEntity<?> clearDatabase() {
186186
}
187187

188188
@RequestMapping(value = "/update-hub", method = RequestMethod.POST)
189-
public ResponseEntity<?> updateHub() {
189+
public ResponseEntity<?> updateHub() throws IOException {
190190
if (dataHubService.updateHub(envConfig().getMlSettings())) {
191191
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
192192
}

0 commit comments

Comments
 (0)