Skip to content

Commit

Permalink
Environment test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissmiller committed Oct 5, 2022
1 parent 0fad3ae commit 0361c29
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,29 @@ class EnvironmentTests extends DevCenterClientTestBase {
public void testCreateEnvironment() {
String projectName = Configuration.getGlobalConfiguration().get("DEFAULT_PROJECT_NAME");
String environmentTypeName = Configuration.getGlobalConfiguration().get("DEFAULT_ENVIRONMENT_TYPE_NAME");
String catalogName = Configuration.getGlobalConfiguration().get("DEFAULT_CATALOG_NAME");
String catalogItemName = Configuration.getGlobalConfiguration().get("DEFAULT_CATALOG_ITEM_NAME");

// Create an environment
BinaryData environmentBody = BinaryData.fromString("{\"catalogItemName\":\"" + catalogItemName + "\", \"environmentType\":\"" + environmentTypeName + "\"}");
BinaryData environmentBody = BinaryData.fromString(
"{\"catalogItemName\":\"" + catalogItemName
+ "\", \"catalogName\":\"" + catalogName
+ "\", \"environmentType\":\"" + environmentTypeName + "\"}");
SyncPoller<BinaryData, BinaryData> environmentCreateResponse =
environmentsClient.beginCreateOrUpdateEnvironment(projectName, "me", "TestEnvironment", environmentBody, null);
environmentsClient.beginCreateOrUpdateEnvironment(projectName, "me", "SdkTestEnvironment", environmentBody, null);
Assertions.assertEquals(
LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, environmentCreateResponse.waitForCompletion().getStatus());


// Fetch the deployment artifacts:
PagedIterable<BinaryData> artifactListResponse = environmentsClient.listArtifactsByEnvironment("myProject", "me", "TestEnvironment", null);
PagedIterable<BinaryData> artifactListResponse = environmentsClient.listArtifactsByEnvironment(projectName, "me", "SdkTestEnvironment", null);
for (BinaryData p: artifactListResponse) {
System.out.println(p);
}

// Delete the environment when we're finished:
SyncPoller<BinaryData, BinaryData> environmentDeleteResponse =
environmentsClient.beginDeleteEnvironment("myProject", "me", "TestEnvironment", null);
environmentsClient.beginDeleteEnvironment(projectName, "me", "SdkTestEnvironment", null);
Assertions.assertEquals(
LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, environmentDeleteResponse.waitForCompletion().getStatus());
}
Expand Down

0 comments on commit 0361c29

Please sign in to comment.