This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#298 Checking for REST API existence now accounts for a group name
- Loading branch information
Showing
6 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/com/marklogic/appdeployer/command/restapis/CreateRestApiInOtherGroupTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.marklogic.appdeployer.command.restapis; | ||
|
||
import com.marklogic.appdeployer.AbstractAppDeployerTest; | ||
import com.marklogic.appdeployer.command.groups.DeployGroupsCommand; | ||
import com.marklogic.mgmt.resource.appservers.ServerManager; | ||
import org.junit.After; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
|
||
public class CreateRestApiInOtherGroupTest extends AbstractAppDeployerTest { | ||
|
||
@After | ||
public void tearDown() { | ||
undeploySampleApp(); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
final String groupName = "ml-app-deployer-other-group"; | ||
final String serverName = appConfig.getRestServerName(); | ||
|
||
appConfig.setGroupName(groupName); | ||
appConfig.getFirstConfigDir().setBaseDir(new File("src/test/resources/sample-app/rest-api-other-group")); | ||
initializeAppDeployer(new DeployGroupsCommand(), new DeployRestApiServersCommand()); | ||
|
||
deploySampleApp(); | ||
assertTrue(new ServerManager(manageClient, groupName).exists(serverName)); | ||
assertFalse(new ServerManager(manageClient).exists(serverName)); | ||
|
||
deploySampleApp(); | ||
assertTrue("The deployment should have succeeded because RestApiManager now checks to see if the REST API server " + | ||
"exists in the group defined by appConfig.getGroupName as opposed to just the Default group", | ||
new ServerManager(manageClient, groupName).exists(serverName)); | ||
assertFalse(new ServerManager(manageClient).exists(serverName)); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/test/resources/sample-app/rest-api-other-group/groups/group.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"group-name": "ml-app-deployer-other-group" | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/resources/sample-app/rest-api-other-group/rest-api.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"rest-api": { | ||
"name": "%%NAME%%", | ||
"group": "ml-app-deployer-other-group", | ||
"database": "%%DATABASE%%", | ||
"modules-database": "%%MODULES_DATABASE%%", | ||
"port": "%%PORT%%", | ||
"xdbc-enabled": true, | ||
"forests-per-host": 1, | ||
"error-format": "json" | ||
} | ||
} |