You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/08/19 06:40:11 UTC
[3/6] stratos git commit: Update the integration test with tenant
operations
Update the integration test with tenant operations
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7c8a22cf
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7c8a22cf
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7c8a22cf
Branch: refs/heads/tenant-isolation
Commit: 7c8a22cfff505e6dba1251e4a2adc8a2b72fb63e
Parents: 86fdc88
Author: gayangunarathne <ga...@wso2.com>
Authored: Tue Aug 18 21:17:47 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Aug 18 21:17:47 2015 +0530
----------------------------------------------------------------------
.../application/ApplicationUpdateTest.java | 100 +++++--------------
.../src/test/resources/stratos-testing.xml | 9 +-
2 files changed, 26 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/7c8a22cf/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
index 092e6c4..9ba62f6 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
@@ -58,7 +58,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
RestConstants.APPLICATIONS_NAME);
assertEquals(updated, true);
- TopologyHandler.getInstance().assertGroupInstanceCount(applicationId, "group3-application-update-test", 2, tenant1Id);
+ TopologyHandler.getInstance().assertGroupInstanceCount(applicationId, "group3-application-update-test", 1, tenant1Id);
TopologyHandler.getInstance().assertClusterMinMemberCount(applicationId, 1, tenant1Id);
@@ -88,81 +88,9 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
testApplicationRuntimeForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
- //Un-deploying the application
- String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
- RestConstants.APPLICATIONS_UNDEPLOY;
+ testApplicationUndeplymentForTenant(restClientTenant1,tenant1Id,autoscalingPolicyId);
- boolean unDeployed = restClientTenant1.undeployEntity(resourcePathUndeploy,
- RestConstants.APPLICATIONS_NAME);
- assertEquals(unDeployed, true);
-
-
- boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test", tenant1Id);
- if (!undeploy) {
- //Need to forcefully undeploy the application
- log.info("Force undeployment is going to start for the [application] " + "g-sc-G123-1-application-update-test");
-
- restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
- RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
-
- boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test", tenant1Id);
- assertEquals(String.format("Forceful undeployment failed for the application %s",
- "g-sc-G123-1-application-update-test"), forceUndeployed, true);
-
- }
-
-
- boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
- RestConstants.APPLICATIONS_NAME);
- assertEquals(removed, true);
-
- ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
- "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
- assertEquals(beanRemoved, null);
-
- removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertEquals(removedGroup, true);
-
- boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c1-application-update-test",
- RestConstants.CARTRIDGES_NAME);
- assertEquals(removedC1, true);
-
- boolean removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c2-application-update-test",
- RestConstants.CARTRIDGES_NAME);
- assertEquals(removedC2, true);
-
- boolean removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c3-application-update-test",
- RestConstants.CARTRIDGES_NAME);
- assertEquals(removedC3, true);
-
- removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
- autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
- assertEquals(removedAuto, true);
-
- removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
- "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
- assertEquals(removedDep, true);
-
- removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
- assertEquals(removedNet, false);
-
- boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
- assertEquals(removedN2, false);
-
- boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
- "application-policy-application-update-test", RestConstants.APPLICATION_POLICIES_NAME);
- assertEquals(removeAppPolicy, true);
-
- removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
- assertEquals(removedNet, true);
-
- removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
- assertEquals(removedN2, true);
+ TopologyHandler.getInstance().assertApplicationForNonAvailability(applicationId,tenant1Id);
testApplicationUndeplymentForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
@@ -256,6 +184,28 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
}
private void testApplicationUndeplymentForTenant(RestClient restClientTenant,int tenantId,String autoscalingPolicyId){
+
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY;
+
+ boolean unDeployed = restClientTenant.undeployEntity(resourcePathUndeploy,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(unDeployed, true);
+
+ boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test", tenantId);
+ if (!undeploy) {
+ //Need to forcefully undeploy the application
+ log.info("Force undeployment is going to start for the [application] " + "g-sc-G123-1-application-update-test");
+
+ restClientTenant.undeployEntity(RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
+
+ boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test", tenantId);
+ assertEquals(String.format("Forceful undeployment failed for the application %s",
+ "g-sc-G123-1-application-update-test"), forceUndeployed, true);
+
+ }
+
boolean removed = restClientTenant.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
RestConstants.APPLICATIONS_NAME);
assertEquals(removed, true);
http://git-wip-us.apache.org/repos/asf/stratos/blob/7c8a22cf/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
index c9de52a..ede5ff3 100644
--- a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
+++ b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
@@ -21,7 +21,7 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="StratosIntegrationSuite">
- <!--
+
<test name="CartridgeTest">
<classes>
<class name="org.apache.stratos.integration.tests.group.CartridgeTest" />
@@ -85,11 +85,4 @@
<class name="org.apache.stratos.integration.tests.application.GroupTerminationBehaviorTest" />
</classes>
</test>
- -->
- <test name="ApplicationUpdateTest">
- <classes>
- <class name="org.apache.stratos.integration.tests.application.ApplicationUpdateTest" />
- </classes>
- </test>
-
</suite>