This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataService integration test: happy case! (#366)
* Add Junit integration test for data service createEnvironment * Break data service integration test into separate files * Use the default account id, environment and cluster for testing
- Loading branch information
xuejing
authored
Feb 1, 2018
1 parent
25a41e7
commit 905306c
Showing
6 changed files
with
217 additions
and
43 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
38 changes: 38 additions & 0 deletions
38
...est/java/com/amazonaws/blox/dataservice/integration/DeleteEnvironmentIntegrationTest.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,38 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may | ||
* not use this file except in compliance with the License. A copy of the | ||
* License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "LICENSE" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.amazonaws.blox.dataservice.integration; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.amazonaws.blox.dataservicemodel.v1.model.EnvironmentId; | ||
import com.amazonaws.blox.dataservicemodel.v1.model.wrappers.DeleteEnvironmentResponse; | ||
import org.junit.Test; | ||
|
||
public class DeleteEnvironmentIntegrationTest extends DataServiceIntegrationTestBase { | ||
private static final DataServiceModelBuilder models = DataServiceModelBuilder.builder().build(); | ||
private static final EnvironmentId createdEnvironmentId = models.environmentId().build(); | ||
|
||
@Test | ||
public void testDeleteEnvironment() throws Exception { | ||
dataService.createEnvironment( | ||
models.createEnvironmentRequest().environmentId(createdEnvironmentId).build()); | ||
final DeleteEnvironmentResponse deleteEnvironmentResponse = | ||
dataService.deleteEnvironment( | ||
models.deleteEnvironmentRequest().environmentId(createdEnvironmentId).build()); | ||
|
||
assertThat(deleteEnvironmentResponse.getEnvironment().getEnvironmentId()) | ||
.isEqualTo(createdEnvironmentId); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...t/java/com/amazonaws/blox/dataservice/integration/DescribeEnvironmentIntegrationTest.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 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may | ||
* not use this file except in compliance with the License. A copy of the | ||
* License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "LICENSE" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.amazonaws.blox.dataservice.integration; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.amazonaws.blox.dataservicemodel.v1.model.EnvironmentId; | ||
import com.amazonaws.blox.dataservicemodel.v1.model.wrappers.DescribeEnvironmentResponse; | ||
import org.junit.Test; | ||
|
||
public class DescribeEnvironmentIntegrationTest extends DataServiceIntegrationTestBase { | ||
private static final DataServiceModelBuilder models = DataServiceModelBuilder.builder().build(); | ||
private static final EnvironmentId createdEnvironmentId1 = models.environmentId().build(); | ||
|
||
@Test | ||
public void testDescribeEnvironment() throws Exception { | ||
dataService.createEnvironment( | ||
models.createEnvironmentRequest().environmentId(createdEnvironmentId1).build()); | ||
final DescribeEnvironmentResponse describeEnvironmentResponse = | ||
dataService.describeEnvironment( | ||
models.describeEnvironmentRequest().environmentId(createdEnvironmentId1).build()); | ||
assertThat(describeEnvironmentResponse.getEnvironment().getEnvironmentId()) | ||
.isEqualTo(createdEnvironmentId1); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...src/test/java/com/amazonaws/blox/dataservice/integration/ListClustersIntegrationTest.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,47 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may | ||
* not use this file except in compliance with the License. A copy of the | ||
* License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "LICENSE" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.amazonaws.blox.dataservice.integration; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.amazonaws.blox.dataservicemodel.v1.model.EnvironmentId; | ||
import com.amazonaws.blox.dataservicemodel.v1.model.wrappers.ListClustersResponse; | ||
import java.util.Arrays; | ||
import org.junit.Test; | ||
|
||
public class ListClustersIntegrationTest extends DataServiceIntegrationTestBase { | ||
private static final String CLUSTER_ONE = "cluster1"; | ||
private static final String CLUSTER_TWO = "cluster2"; | ||
private static final DataServiceModelBuilder models = DataServiceModelBuilder.builder().build(); | ||
private static final EnvironmentId createdEnvironmentId1 = | ||
models.environmentId().cluster(CLUSTER_ONE).build(); | ||
private static final EnvironmentId createdEnvironmentId2 = | ||
models.environmentId().cluster(CLUSTER_TWO).build(); | ||
|
||
@Test | ||
public void testListClusterWithTwoEnvironments() throws Exception { | ||
dataService.createEnvironment( | ||
models.createEnvironmentRequest().environmentId(createdEnvironmentId1).build()); | ||
dataService.createEnvironment( | ||
models.createEnvironmentRequest().environmentId(createdEnvironmentId2).build()); | ||
final ListClustersResponse listClustersResponse = | ||
dataService.listClusters(models.listClustersRequest().clusterNamePrefix(null).build()); | ||
assertThat(listClustersResponse.getClusters()) | ||
.isEqualTo( | ||
Arrays.asList( | ||
models.cluster().clusterName(CLUSTER_ONE).build(), | ||
models.cluster().clusterName(CLUSTER_TWO).build())); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...test/java/com/amazonaws/blox/dataservice/integration/ListEnvironmentsIntegrationTest.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,49 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may | ||
* not use this file except in compliance with the License. A copy of the | ||
* License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "LICENSE" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.amazonaws.blox.dataservice.integration; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.amazonaws.blox.dataservicemodel.v1.model.EnvironmentId; | ||
import com.amazonaws.blox.dataservicemodel.v1.model.wrappers.ListEnvironmentsResponse; | ||
import java.util.Arrays; | ||
import org.junit.Test; | ||
|
||
public class ListEnvironmentsIntegrationTest extends DataServiceIntegrationTestBase { | ||
private static final String ENVIRONMENT_NAME_ONE = "environmentName1"; | ||
private static final String ENVIRONMENT_NAME_TWO = "environmentName2"; | ||
private static final DataServiceModelBuilder models = DataServiceModelBuilder.builder().build(); | ||
private static final EnvironmentId createdEnvironmentId1 = | ||
models.environmentId().environmentName(ENVIRONMENT_NAME_ONE).build(); | ||
private static final EnvironmentId createdEnvironmentId3 = | ||
models.environmentId().environmentName(ENVIRONMENT_NAME_TWO).build(); | ||
|
||
@Test | ||
public void testListEnvironments() throws Exception { | ||
dataService.createEnvironment( | ||
models.createEnvironmentRequest().environmentId(createdEnvironmentId1).build()); | ||
dataService.createEnvironment( | ||
models.createEnvironmentRequest().environmentId(createdEnvironmentId3).build()); | ||
final ListEnvironmentsResponse listEnvironmentsResponse = | ||
dataService.listEnvironments( | ||
models | ||
.listEnvironmentsRequest() | ||
.cluster(models.cluster().build()) | ||
.environmentNamePrefix(null) | ||
.build()); | ||
assertThat(listEnvironmentsResponse.getEnvironmentIds()) | ||
.isEqualTo(Arrays.asList(createdEnvironmentId1, createdEnvironmentId3)); | ||
} | ||
} |