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/12 14:36:35 UTC
[11/11] stratos git commit: Merge the latest changes of integration
test from master branch
Merge the latest changes of integration test from master branch
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7fae8a72
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7fae8a72
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7fae8a72
Branch: refs/heads/tenant-isolation
Commit: 7fae8a72eebd6bf6bf49fec4aa1748f4680361fb
Parents: 6c6f4cc
Author: Gayan Gunarathne <ga...@wso2.com>
Authored: Wed Aug 12 17:46:54 2015 +0530
Committer: Gayan Gunarathne <ga...@wso2.com>
Committed: Wed Aug 12 17:46:54 2015 +0530
----------------------------------------------------------------------
.../application/ApplicationUpdateTest.java | 243 ++++
.../application/GroupStartupOrderTest.java | 226 ++++
.../GroupTerminationBehaviorTest.java | 27 +
.../PartitionOneAfterAnotherClusterTest.java | 298 +++++
.../PartitionRoundRobinClusterTest.java | 305 +++++
.../tests/rest/IntegrationMockClient.java | 105 ++
.../application-policy-3.json.orig | 18 +
...cation-policy-application-bursting-test.json | 18 +
...caling-policy-application-bursting-test.json | 14 +
...esb-php-group-application-bursting-test.json | 19 +
.../mock/esb-application-bursting-test.json | 50 +
.../mock/php-application-bursting-test.json | 51 +
.../mock/tomcat-application-bursting-test.json | 53 +
...oyment-policy-application-bursting-test.json | 32 +
...k-partition-application-bursting-test-1.json | 15 +
...k-partition-application-bursting-test-2.json | 24 +
...lication-policy-application-policy-test.json | 18 +
...ork-partition-application-policy-test-1.json | 24 +
...ork-partition-application-policy-test-2.json | 15 +
...lication-policy-application-update-test.json | 18 +
.../g-sc-G123-1-application-update-test-v1.json | 86 ++
...-G123-1-application-update-test-v1.json.orig | 91 ++
.../g-sc-G123-1-application-update-test.json | 86 ++
...oscaling-policy-application-update-test.json | 14 +
...rdige-nested-application-update-test-v1.json | 50 +
...artrdige-nested-application-update-test.json | 50 +
.../mock/c1-application-update-test.json | 45 +
.../mock/c2-application-update-test.json | 45 +
.../mock/c3-application-update-test.json | 45 +
...yment-policy-application-update-test-v1.json | 36 +
...ployment-policy-application-update-test.json | 32 +
...-partition-application-update-test-1-v1.json | 28 +
...ork-partition-application-update-test-1.json | 15 +
...ork-partition-application-update-test-2.json | 24 +
...aling-policy-autoscaling-policy-test-v1.json | 14 +
...oscaling-policy-autoscaling-policy-test.json | 14 +
.../g4-g5-g6-cartridge-group-test-v1.json | 50 +
.../g4-g5-g6-cartridge-group-test.json | 50 +
.../mock/c4-cartridge-group-test.json | 45 +
.../mock/c5-cartridge-group-test.json | 124 +++
.../mock/c6-cartridge-group-test.json | 45 +
.../cartridges/mock/c0-cartridge-test-v1.json | 124 +++
.../cartridges/mock/c0-cartridge-test.json | 124 +++
...oyment-policy-deployment-policy-test-v1.json | 36 +
...eployment-policy-deployment-policy-test.json | 32 +
...k-partition-deployment-policy-test-1-v1.json | 28 +
...work-partition-deployment-policy-test-1.json | 15 +
...work-partition-deployment-policy-test-2.json | 24 +
...cation-policy-application-bursting-test.json | 18 +
.../app-bursting-single-cartriddge-group.json | 70 ++
...caling-policy-application-bursting-test.json | 14 +
...esb-php-group-application-bursting-test.json | 19 +
.../mock/esb-application-bursting-test.json | 50 +
.../mock/php-application-bursting-test.json | 51 +
.../mock/tomcat-application-bursting-test.json | 53 +
...oyment-policy-application-bursting-test.json | 32 +
...k-partition-application-bursting-test-1.json | 15 +
...k-partition-application-bursting-test-2.json | 24 +
.../RegionOne.json | 17 +
.../application-martin.json | 100 ++
.../application-policy-1.json | 17 +
.../application-s-g-c1-c2-c3-s.json | 130 +++
.../application.json | 108 ++
.../application.json.orig | 89 ++
.../startup-order-termination-behavior/c1.json | 45 +
.../startup-order-termination-behavior/c2.json | 45 +
.../startup-order-termination-behavior/c3.json | 45 +
.../startup-order-termination-behavior/c4.json | 45 +
.../startup-order-termination-behavior/c5.json | 132 +++
.../cartridge-groups-s-g-c1-c2-c3-s.json | 26 +
.../cartridge-groups-working.json | 34 +
.../cartridge-groups.json | 77 ++
.../cartridge-groups.json.back | 53 +
.../deploy.sh | 43 +
.../economy-policy.json | 15 +
.../static-1.json | 17 +
.../wso2carbon 2.log | 992 +++++++++++++++++
.../wso2carbon-working 2.log | 1053 ++++++++++++++++++
.../wso2carbon-working.log | 1053 ++++++++++++++++++
.../wso2carbon.log | 992 +++++++++++++++++
...cation-policy-application-bursting-test.json | 17 +
.../group-termination-behavior-test.json | 101 ++
...caling-policy-application-bursting-test.json | 14 +
...-groups-group-termination-behavior-test.json | 58 +
.../c1-group-termination-behavior-test.json | 45 +
.../c2-group-termination-behavior-test.json | 45 +
.../c3-group-termination-behavior-test.json | 45 +
.../c4-group-termination-behavior-test.json | 45 +
...oyment-policy-termination-behavior-test.json | 22 +
...k-partition-application-bursting-test-1.json | 15 +
...ork-partition-network-partition-test-v1.json | 28 +
...etwork-partition-network-partition-test.json | 15 +
...ation-policy-partition-round-robin-test.json | 13 +
.../partition-round-robin-test.json | 28 +
...aling-policy-partition-round-robin-test.json | 14 +
.../mock/c7-partition-round-robin-test.json | 45 +
...yment-policy-partition-round-robin-test.json | 22 +
...rk-partition-partition-round-robin-test.json | 24 +
...ication-policy-sample-applications-test.json | 18 +
...g-sc-G123-1-sample-applications-test-v1.json | 86 ++
.../g-sc-G123-1-sample-applications-test.json | 86 ++
...scaling-policy-sample-applications-test.json | 14 +
...dige-nested-sample-applications-test-v1.json | 50 +
...rtrdige-nested-sample-applications-test.json | 50 +
.../mock/c1-sample-applications-test.json | 45 +
.../mock/c2-sample-applications-test.json | 45 +
.../mock/c3-sample-applications-test.json | 45 +
...ment-policy-sample-applications-test-v1.json | 36 +
...loyment-policy-sample-applications-test.json | 32 +
...partition-sample-applications-test-1-v1.json | 28 +
...rk-partition-sample-applications-test-1.json | 15 +
...rk-partition-sample-applications-test-2.json | 24 +
...tion-policy-single-cluster-scaling-test.json | 13 +
.../single-cluster-scaling-test.json | 28 +
...ling-policy-single-cluster-scaling-test.json | 14 +
.../mock/c7-single-cluster-scaling-test.json | 45 +
...ment-policy-single-cluster-scaling-test.json | 22 +
...k-partition-single-cluster-scaling-test.json | 24 +
118 files changed, 9735 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/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
new file mode 100644
index 0000000..c9e64b2
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License 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 org.apache.stratos.integration.tests.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.application.ApplicationBean;
+import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
+import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
+import org.apache.stratos.integration.tests.RestConstants;
+import org.apache.stratos.integration.tests.StratosTestServerManager;
+import org.apache.stratos.integration.tests.TopologyHandler;
+import org.apache.stratos.messaging.domain.application.ApplicationStatus;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+/**
+ * Sample application tests with application add, .
+ */
+public class ApplicationUpdateTest extends StratosTestServerManager {
+ private static final Log log = LogFactory.getLog(ApplicationUpdateTest.class);
+ private static final String RESOURCES_PATH = "/application-update-test";
+
+ @Test
+ public void testDeployApplication() {
+ try {
+ log.info("-------------------------Started application runtime update test case-------------------------");
+
+ String autoscalingPolicyId = "autoscaling-policy-application-update-test";
+
+ boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+ + "/" + autoscalingPolicyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(addedScalingPolicy, true);
+
+ boolean addedC1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c1-application-update-test.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC1, true);
+
+ boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c2-application-update-test.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC2, true);
+
+ boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c3-application-update-test.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC3, true);
+
+ boolean addedG1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
+ "/" + "cartrdige-nested-application-update-test.json", RestConstants.CARTRIDGE_GROUPS,
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(addedG1, true);
+
+ CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(beanG1.getName(), "G1-application-update-test");
+
+ boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-application-update-test-1.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN1, true);
+
+ boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-application-update-test-2.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN2, true);
+
+ boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ "deployment-policy-application-update-test.json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(addedDep, true);
+
+ boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+ "g-sc-G123-1-application-update-test.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(added, true);
+
+ ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(bean.getApplicationId(), "g-sc-G123-1-application-update-test");
+
+ boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ "application-policy-application-update-test.json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(addAppPolicy, true);
+
+ ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+ RestConstants.APPLICATION_POLICIES,
+ "application-policy-application-update-test", ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
+
+ //deploy the application
+ String resourcePath = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
+ RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-application-update-test";
+ boolean deployed = restClient.deployEntity(resourcePath,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(deployed, true);
+
+ //Application active handling
+ TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
+ ApplicationStatus.Active);
+
+ //Group active handling
+ TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId());
+
+ //Cluster active handling
+ TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+
+ //Updating application
+ boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+ "g-sc-G123-1-application-update-test-v1.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(updated, true);
+
+ TopologyHandler.getInstance().assertGroupInstanceCount(bean.getApplicationId(), "group3-application-update-test", 2);
+
+ TopologyHandler.getInstance().assertClusterMinMemberCount(bean.getApplicationId(), 2);
+
+ ApplicationBean updatedBean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(updatedBean.getApplicationId(), "g-sc-G123-1-application-update-test");
+
+ boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(removedGroup, false);
+
+ boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, false);
+
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-update-test-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
+ //Trying to remove the used network partition
+ assertEquals(removedNet, false);
+
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, false);
+
+ //Un-deploying the application
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY;
+
+ boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(unDeployed, true);
+
+ boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test");
+ 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");
+
+ restClient.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");
+ assertEquals(String.format("Forceful undeployment failed for the application %s",
+ "g-sc-G123-1-application-update-test"), forceUndeployed, true);
+
+ }
+
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(removed, true);
+
+ ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(beanRemoved, null);
+
+ removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(removedGroup, true);
+
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c1-application-update-test",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC1, true);
+
+ boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c2-application-update-test",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC2, true);
+
+ boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c3-application-update-test",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC3, true);
+
+ removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, true);
+
+ removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, false);
+
+ boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN2, false);
+
+ boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+ "application-policy-application-update-test", RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(removeAppPolicy, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, true);
+
+ removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN2, true);
+
+ log.info("-------------------------Ended application runtime update test case-------------------------");
+
+ } catch (Exception e) {
+ log.error("An error occurred while handling application deployment/undeployment and update", e);
+ assertTrue("An error occurred while handling application deployment/undeployment and update", false);
+ }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
new file mode 100644
index 0000000..1f3aa56
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License 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 org.apache.stratos.integration.tests.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.application.ApplicationBean;
+import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
+import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
+import org.apache.stratos.integration.tests.RestConstants;
+import org.apache.stratos.integration.tests.StratosTestServerManager;
+import org.apache.stratos.integration.tests.TopologyHandler;
+import org.apache.stratos.messaging.domain.application.ApplicationStatus;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+/**
+ * Handling the startup order of the group
+ */
+public class GroupStartupOrderTest extends StratosTestServerManager {
+ private static final Log log = LogFactory.getLog(SampleApplicationsTest.class);
+ private static final String RESOURCES_PATH = "/application-bursting-test";
+
+ @Test
+ public void testApplicationBusting() {
+ try {
+ log.info("-------------------------------Started application Bursting test case-------------------------------");
+
+ String autoscalingPolicyId = "autoscaling-policy-application-bursting-test";
+
+ boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+ + "/" + autoscalingPolicyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(addedScalingPolicy, true);
+
+ boolean addedC1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "esb-application-bursting-test.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC1, true);
+
+ boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "php-application-bursting-test.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC2, true);
+
+ boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "tomcat-application-bursting-test.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC3, true);
+
+ boolean addedG1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
+ "/" + "esb-php-group-application-bursting-test.json", RestConstants.CARTRIDGE_GROUPS,
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(addedG1, true);
+
+ CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(beanG1.getName(), "esb-php-group-application-bursting-test");
+
+ boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-application-bursting-test-1.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN1, true);
+
+ boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-application-bursting-test-2.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN2, true);
+
+ boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ "deployment-policy-application-bursting-test.json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(addedDep, true);
+
+ boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+ "app-bursting-single-cartriddge-group.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(added, true);
+
+ ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "application-bursting-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(bean.getApplicationId(), "application-bursting-test");
+
+ boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ "application-policy-application-bursting-test.json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(addAppPolicy, true);
+
+ ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+ RestConstants.APPLICATION_POLICIES,
+ "application-policy-application-bursting-test", ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
+
+ //deploy the application
+ String resourcePath = RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
+ RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-application-bursting-test";
+ boolean deployed = restClient.deployEntity(resourcePath,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(deployed, true);
+
+ //Application active handling
+ TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
+ ApplicationStatus.Active);
+
+ //Group active handling
+ TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId());
+
+ //Cluster active handling
+ TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+
+ boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(removedGroup, false);
+
+ boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, false);
+
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-bursting-test-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
+ //Trying to remove the used network partition
+ assertEquals(removedNet, false);
+
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-application-bursting-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, false);
+
+ //Un-deploying the application
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY;
+
+ boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(unDeployed, true);
+
+ boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
+ if (!undeploy) {
+ //Need to forcefully undeploy the application
+ log.info("Force undeployment is going to start for the [application] " + "application-bursting-test");
+
+ restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
+
+ boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
+ assertEquals(String.format("Forceful undeployment failed for the application %s",
+ "application-bursting-test"), forceUndeployed, true);
+
+ }
+
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "application-bursting-test",
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(removed, true);
+
+ ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "application-bursting-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(beanRemoved, null);
+
+ removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(removedGroup, true);
+
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "esb-application-bursting-test",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC1, true);
+
+ boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "php-application-bursting-test",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC2, true);
+
+ boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "tomcat-application-bursting-test",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC3, true);
+
+ removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, true);
+
+ removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-application-bursting-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-bursting-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, false);
+
+ boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-bursting-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN2, false);
+
+ boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+ "application-policy-application-bursting-test", RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(removeAppPolicy, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-bursting-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, true);
+
+ removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-application-bursting-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN2, true);
+
+ log.info("-------------------------------Ended application bursting test case-------------------------------");
+
+ } catch (Exception e) {
+ log.error("An error occurred while handling application bursting", e);
+ assertTrue("An error occurred while handling application bursting", false);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupTerminationBehaviorTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupTerminationBehaviorTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupTerminationBehaviorTest.java
new file mode 100644
index 0000000..b86d674
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupTerminationBehaviorTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License 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 org.apache.stratos.integration.tests.application;
+
+import org.apache.stratos.integration.tests.StratosTestServerManager;
+
+/**
+ * Handling the termination behavior of the group
+ */
+public class GroupTerminationBehaviorTest extends StratosTestServerManager {
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
new file mode 100644
index 0000000..d8f6965
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License 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 org.apache.stratos.integration.tests.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.application.ApplicationBean;
+import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
+import org.apache.stratos.integration.tests.RestConstants;
+import org.apache.stratos.integration.tests.StratosTestServerManager;
+import org.apache.stratos.integration.tests.TopologyHandler;
+import org.apache.stratos.messaging.domain.application.Application;
+import org.apache.stratos.messaging.domain.application.ApplicationStatus;
+import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
+import org.apache.stratos.messaging.domain.instance.ClusterInstance;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.topology.Member;
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+import org.testng.annotations.Test;
+
+import java.util.*;
+
+import static junit.framework.Assert.*;
+
+/**
+ * This will handle the scale-up and scale-down of a particular cluster bursting test cases
+ */
+public class PartitionOneAfterAnotherClusterTest extends StratosTestServerManager {
+ private static final Log log = LogFactory.getLog(SampleApplicationsTest.class);
+ private static final String RESOURCES_PATH = "/partition-round-robin-cluster-test";
+
+
+ @Test
+ public void testDeployApplication() {
+ try {
+ log.info("-------------------------------Started Partition One after another test case-------------------------------");
+
+ String autoscalingPolicyId = "autoscaling-policy-3";
+
+ boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+ + "/" + autoscalingPolicyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(addedScalingPolicy, true);
+
+ boolean addedC1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c7.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC1, true);
+
+ boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-11.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN1, true);
+
+ boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ "deployment-policy-5.json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(addedDep, true);
+
+ boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+ "single-cluster-scaling-test.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(added, true);
+
+ ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "single-cluster-scaling-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(bean.getApplicationId(), "single-cluster-scaling-test");
+
+ boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ "application-policy-4.json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(addAppPolicy, true);
+
+ ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+ RestConstants.APPLICATION_POLICIES,
+ "application-policy-4", ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
+
+ //deploy the application
+ String resourcePath = RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" +
+ RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-4";
+ boolean deployed = restClient.deployEntity(resourcePath,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(deployed, true);
+
+ //Application active handling
+ TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
+ ApplicationStatus.Active);
+
+ //Cluster active handling
+ TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+
+ //Verifying whether members got created using round robin algorithm
+ assertClusterWithRoundRobinAlgorithm(bean.getApplicationId());
+
+ //Removing one member from cluster and check for auto healing
+
+
+ boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, false);
+
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-11",
+ RestConstants.NETWORK_PARTITIONS_NAME);
+ //Trying to remove the used network partition
+ assertEquals(removedNet, false);
+
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-5", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, false);
+
+ //Un-deploying the application
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY;
+
+ boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(unDeployed, true);
+
+ boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test");
+ if (!undeploy) {
+ //Need to forcefully undeploy the application
+ log.info("Force undeployment is going to start for the [application] " + "single-cluster-scaling-test");
+
+ restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
+
+ boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test");
+ assertEquals(String.format("Forceful undeployment failed for the application %s",
+ "single-cluster-scaling-test"), forceUndeployed, true);
+
+ }
+
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "single-cluster-scaling-test",
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(removed, true);
+
+ ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "single-cluster-scaling-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(beanRemoved, null);
+
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c7",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC1, true);
+
+
+ removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, true);
+
+ removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-5", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-11", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, false);
+
+
+ boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+ "application-policy-4", RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(removeAppPolicy, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-11", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, true);
+
+ log.info("-------------------------------Ended Partition one after another test case-------------------------------");
+
+ } catch (Exception e) {
+ log.error("An error occurred while handling application bursting", e);
+ assertTrue("An error occurred while handling application bursting", false);
+ }
+ }
+
+ /**
+ * Assert application activation
+ *
+ * @param applicationName
+ */
+ private void assertClusterWithRoundRobinAlgorithm(String applicationName) {
+ Application application = ApplicationManager.getApplications().getApplication(applicationName);
+ assertNotNull(String.format("Application is not found: [application-id] %s",
+ applicationName), application);
+
+ Set<ClusterDataHolder> clusterDataHolderSet = application.getClusterDataRecursively();
+ for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
+ String serviceName = clusterDataHolder.getServiceType();
+ String clusterId = clusterDataHolder.getClusterId();
+ Service service = TopologyManager.getTopology().getService(serviceName);
+ assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
+ applicationName, serviceName), service);
+
+ Cluster cluster = service.getCluster(clusterId);
+ assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
+ applicationName, serviceName, clusterId), cluster);
+
+ for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
+ List<String> partitionsUsedInMembers = new ArrayList<String>();
+ Map<String, List<Long>> partitionIdToMembersMap = new HashMap<String, List<Long>>();
+ for (Member member : cluster.getMembers()) {
+ String partitionId = member.getPartitionId();
+ if (!partitionIdToMembersMap.containsKey(partitionId)) {
+ List<Long> members = new ArrayList<Long>();
+ members.add(member.getInitTime());
+ partitionIdToMembersMap.put(partitionId, members);
+ } else {
+ partitionIdToMembersMap.get(partitionId).add(member.getInitTime());
+ }
+ if (!partitionsUsedInMembers.contains(partitionId)) {
+ partitionsUsedInMembers.add(partitionId);
+ }
+ }
+ String p1 = "network-partition-11-partition-1";
+ String p2 = "network-partition-11-partition-2";
+ List<Long> p1InitTime = partitionIdToMembersMap.get(p1);
+ Collections.sort(p1InitTime);
+
+ List<Long> p2InitTime = partitionIdToMembersMap.get(p2);
+ Collections.sort(p2InitTime);
+
+ List<Long> allInitTime = new ArrayList<Long>();
+ allInitTime.addAll(p1InitTime);
+ allInitTime.addAll(p2InitTime);
+ Collections.sort(allInitTime);
+
+ int p1Index = -1;
+ int p2Index = -1;
+ String previousPartition = null;
+ for (int i = 0; i < allInitTime.size(); i++) {
+ if (previousPartition == null) {
+ if (p1InitTime.get(0) == allInitTime.get(i)) {
+ previousPartition = p1;
+ p1Index++;
+ } else if (p2InitTime.get(0) == allInitTime.get(i)) {
+ previousPartition = p2;
+ p2Index++;
+
+ }
+ } else if (previousPartition.equals(p1)) {
+ p2Index++;
+ previousPartition = p2;
+ assertEquals("Partition-2 doesn't not contain correct values in current " +
+ "iteration", allInitTime.get(i), p2InitTime.get(p2Index));
+ if (p1Index >= 0) {
+ assertEquals("Partition-1 doesn't not contain correct values in the " +
+ "previous iteration", allInitTime.get(i - 1), p1InitTime.get(p1Index));
+ if (p1Index + 1 <= (p1InitTime.size() - 1) && i + 1 <= (allInitTime.size() - 1)) {
+ assertEquals("Partition-1 doesn't not contain correct " +
+ "values in the next iteration",
+ allInitTime.get(i + 1), p1InitTime.get(p1Index + 1));
+
+ }
+ }
+ } else {
+ p1Index++;
+ previousPartition = p1;
+ assertEquals("Partition-1 doesn't not contain correct values in current " +
+ "iteration", allInitTime.get(i), p1InitTime.get(p1Index));
+ if (p2Index >= 0) {
+ assertEquals("Partition-2 doesn't not contain correct values " +
+ "in the previous iteration", allInitTime.get(i - 1), p2InitTime.get(p2Index));
+ if ((p2Index + 1) <= (p2InitTime.size() - 1) && (i + 1) <= (allInitTime.size() - 1)) {
+ assertEquals("Partition-2 doesn't not contain correct values " +
+ "in the next iteration",
+ allInitTime.get(i + 1), p2InitTime.get(p2Index + 1));
+ }
+ }
+ }
+
+ }
+
+
+ }
+
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
new file mode 100644
index 0000000..ab7d592
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License 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 org.apache.stratos.integration.tests.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.application.ApplicationBean;
+import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
+import org.apache.stratos.integration.tests.RestConstants;
+import org.apache.stratos.integration.tests.StratosTestServerManager;
+import org.apache.stratos.integration.tests.TopologyHandler;
+import org.apache.stratos.messaging.domain.application.Application;
+import org.apache.stratos.messaging.domain.application.ApplicationStatus;
+import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
+import org.apache.stratos.messaging.domain.instance.ClusterInstance;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.topology.Member;
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+import org.testng.annotations.Test;
+
+import java.util.*;
+
+import static junit.framework.Assert.*;
+
+/**
+ * This will handle the scale-up and scale-down of a particular cluster bursting test cases
+ */
+public class PartitionRoundRobinClusterTest extends StratosTestServerManager {
+ private static final Log log = LogFactory.getLog(SampleApplicationsTest.class);
+ private static final String RESOURCES_PATH = "/partition-round-robin-cluster-test";
+
+
+ @Test
+ public void testDeployApplication() {
+ try {
+ log.info("-------------------------------Started application Bursting test case-------------------------------");
+
+ String autoscalingPolicyId = "autoscaling-policy-partition-round-robin-test";
+
+ boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+ + "/" + autoscalingPolicyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(addedScalingPolicy, true);
+
+ boolean addedC1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c7-partition-round-robin-test.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC1, true);
+
+ boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-partition-round-robin-test.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN1, true);
+
+ boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ "deployment-policy-partition-round-robin-test.json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(addedDep, true);
+
+ boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+ "partition-round-robin-test.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(added, true);
+
+ ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "partition-round-robin-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(bean.getApplicationId(), "partition-round-robin-test");
+
+ boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ "application-policy-partition-round-robin-test.json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(addAppPolicy, true);
+
+ //deploy the application
+ String resourcePath = RestConstants.APPLICATIONS + "/" + "partition-round-robin-test" +
+ RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-partition-round-robin-test";
+ boolean deployed = restClient.deployEntity(resourcePath,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(deployed, true);
+
+
+ //Application active handling
+ TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
+ ApplicationStatus.Active);
+
+ //Cluster active handling
+ TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+
+ //Verifying whether members got created using round robin algorithm
+ assertClusterWithRoundRobinAlgorithm(bean.getApplicationId());
+
+ //Application in-active handling
+ log.info("Waiting for the faulty member detection from " +
+ "CEP as the statistics are stopped...");
+ TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
+ ApplicationStatus.Inactive);
+
+ //Application active handling after application becomes active again
+ TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
+ ApplicationStatus.Active);
+
+ //Cluster active handling
+ TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+
+ boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, false);
+
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-partition-round-robin-test",
+ RestConstants.NETWORK_PARTITIONS_NAME);
+ //Trying to remove the used network partition
+ assertEquals(removedNet, false);
+
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-partition-round-robin-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, false);
+
+ //Un-deploying the application
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "partition-round-robin-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY;
+
+ boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(unDeployed, true);
+
+ boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("partition-round-robin-test");
+ if (!undeploy) {
+ //Need to forcefully undeploy the application
+ log.info("Force undeployment is going to start for the [application] " + "partition-round-robin-test");
+
+ restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "partition-round-robin-test" +
+ RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
+
+ boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("partition-round-robin-test");
+ assertEquals(String.format("Forceful undeployment failed for the application %s",
+ "partition-round-robin-test"), forceUndeployed, true);
+
+ }
+
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "partition-round-robin-test",
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(removed, true);
+
+ ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "partition-round-robin-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(beanRemoved, null);
+
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c7-partition-round-robin-test",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC1, true);
+
+
+ removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(removedAuto, true);
+
+ removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-partition-round-robin-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-partition-round-robin-test", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, false);
+
+
+ boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+ "application-policy-partition-round-robin-test", RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(removeAppPolicy, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-partition-round-robin-test", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, true);
+
+ log.info("-------------------------------Ended application bursting test case-------------------------------");
+
+ } catch (Exception e) {
+ log.error("An error occurred while handling application bursting", e);
+ assertTrue("An error occurred while handling application bursting", false);
+ }
+ }
+
+ /**
+ * Assert application activation
+ *
+ * @param applicationName
+ */
+ private void assertClusterWithRoundRobinAlgorithm(String applicationName) {
+ Application application = ApplicationManager.getApplications().getApplication(applicationName);
+ assertNotNull(String.format("Application is not found: [application-id] %s",
+ applicationName), application);
+
+ Set<ClusterDataHolder> clusterDataHolderSet = application.getClusterDataRecursively();
+ for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
+ String serviceName = clusterDataHolder.getServiceType();
+ String clusterId = clusterDataHolder.getClusterId();
+ Service service = TopologyManager.getTopology().getService(serviceName);
+ assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
+ applicationName, serviceName), service);
+
+ Cluster cluster = service.getCluster(clusterId);
+ assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
+ applicationName, serviceName, clusterId), cluster);
+
+ for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
+ List<String> partitionsUsedInMembers = new ArrayList<String>();
+ Map<String, List<Long>> partitionIdToMembersMap = new HashMap<String, List<Long>>();
+ for (Member member : cluster.getMembers()) {
+ String partitionId = member.getPartitionId();
+ if (!partitionIdToMembersMap.containsKey(partitionId)) {
+ List<Long> members = new ArrayList<Long>();
+ members.add(member.getInitTime());
+ partitionIdToMembersMap.put(partitionId, members);
+ } else {
+ partitionIdToMembersMap.get(partitionId).add(member.getInitTime());
+ }
+ if (!partitionsUsedInMembers.contains(partitionId)) {
+ partitionsUsedInMembers.add(partitionId);
+ }
+ }
+ String p1 = "network-partition-11-partition-1";
+ String p2 = "network-partition-11-partition-2";
+ List<Long> p1InitTime = partitionIdToMembersMap.get(p1);
+ Collections.sort(p1InitTime);
+
+ List<Long> p2InitTime = partitionIdToMembersMap.get(p2);
+ Collections.sort(p2InitTime);
+
+ List<Long> allInitTime = new ArrayList<Long>();
+ allInitTime.addAll(p1InitTime);
+ allInitTime.addAll(p2InitTime);
+ Collections.sort(allInitTime);
+
+ int p1Index = -1;
+ int p2Index = -1;
+ String previousPartition = null;
+ for (int i = 0; i < allInitTime.size(); i++) {
+ if (previousPartition == null) {
+ if (p1InitTime.get(0) == allInitTime.get(i)) {
+ previousPartition = p1;
+ p1Index++;
+ } else if (p2InitTime.get(0) == allInitTime.get(i)) {
+ previousPartition = p2;
+ p2Index++;
+
+ }
+ } else if (previousPartition.equals(p1)) {
+ p2Index++;
+ previousPartition = p2;
+ assertEquals("Partition-2 doesn't not contain correct values in current " +
+ "iteration", allInitTime.get(i), p2InitTime.get(p2Index));
+ if (p1Index >= 0) {
+ assertEquals("Partition-1 doesn't not contain correct values in the " +
+ "previous iteration", allInitTime.get(i - 1), p1InitTime.get(p1Index));
+ if (p1Index + 1 <= (p1InitTime.size() - 1) && i + 1 <= (allInitTime.size() - 1)) {
+ assertEquals("Partition-1 doesn't not contain correct " +
+ "values in the next iteration",
+ allInitTime.get(i + 1), p1InitTime.get(p1Index + 1));
+
+ }
+ }
+ } else {
+ p1Index++;
+ previousPartition = p1;
+ assertEquals("Partition-1 doesn't not contain correct values in current " +
+ "iteration", allInitTime.get(i), p1InitTime.get(p1Index));
+ if (p2Index >= 0) {
+ assertEquals("Partition-2 doesn't not contain correct values " +
+ "in the previous iteration", allInitTime.get(i - 1), p2InitTime.get(p2Index));
+ if ((p2Index + 1) <= (p2InitTime.size() - 1) && (i + 1) <= (allInitTime.size() - 1)) {
+ assertEquals("Partition-2 doesn't not contain correct values " +
+ "in the next iteration",
+ allInitTime.get(i + 1), p2InitTime.get(p2Index + 1));
+ }
+ }
+ }
+
+ }
+
+
+ }
+
+ }
+
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
new file mode 100644
index 0000000..2b094a4
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License 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 org.apache.stratos.integration.tests.rest;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
+import org.apache.stratos.mock.iaas.client.MockIaasApiClient;
+import org.apache.stratos.mock.iaas.client.rest.*;
+import org.apache.stratos.mock.iaas.client.rest.HttpResponse;
+import org.apache.stratos.mock.iaas.client.rest.HttpResponseHandler;
+import org.apache.stratos.mock.iaas.client.rest.RestClient;
+import org.apache.stratos.mock.iaas.domain.*;
+
+import java.net.URI;
+
+/**
+ * Mock client
+ */
+public class IntegrationMockClient extends MockIaasApiClient {
+ private static final Log log = LogFactory.getLog(IntegrationMockClient.class);
+ private static final String INSTANCES_CONTEXT = "/instances/";
+ private DefaultHttpClient httpClient;
+ private String endpoint;
+
+ public IntegrationMockClient(String endpoint) {
+ super(endpoint);
+ this.endpoint = endpoint;
+ PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
+ // Increase max total connection to 200
+ cm.setMaxTotal(200);
+ // Increase default max connection per route to 50
+ cm.setDefaultMaxPerRoute(50);
+
+ httpClient = new DefaultHttpClient(cm);
+ httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient);
+ }
+
+ public void terminateInstance(String instanceId) {
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Terminate instance: [instance-id] %s", instanceId));
+ }
+ URI uri = new URIBuilder(endpoint + INSTANCES_CONTEXT + instanceId).build();
+ org.apache.stratos.mock.iaas.client.rest.HttpResponse response = doDelete(uri);
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return;
+ } else {
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ Gson gson = gsonBuilder.create();
+ ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
+ if (errorResponse != null) {
+ throw new RuntimeException(errorResponse.getErrorMessage());
+ }
+ }
+ }
+ throw new RuntimeException("An unknown error occurred");
+ } catch (Exception e) {
+ String message = "Could not start mock instance";
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public HttpResponse doDelete(URI resourcePath) throws Exception {
+ HttpDelete httpDelete = null;
+ try {
+ httpDelete = new HttpDelete(resourcePath);
+ httpDelete.addHeader("Content-Type", "application/json");
+
+ return httpClient.execute(httpDelete, new HttpResponseHandler());
+ } finally {
+ releaseConnection(httpDelete);
+ }
+ }
+
+ private void releaseConnection(HttpRequestBase request) {
+ if (request != null) {
+ request.releaseConnection();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json.orig
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json.orig b/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json.orig
new file mode 100644
index 0000000..a461844
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json.orig
@@ -0,0 +1,18 @@
+{
+ "id": "application-policy-3",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-9",
+ "network-partition-10"
+ ],
+ "properties": [
+ {
+ "name": "key-1",
+ "value": "network-partition-9|network-partition-10"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json
new file mode 100644
index 0000000..4d1d35f
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json
@@ -0,0 +1,18 @@
+{
+ "id": "application-policy-application-bursting-test",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-application-bursting-test-1",
+ "network-partition-application-bursting-test-2"
+ ],
+ "properties": [
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-application-bursting-test-1|network-partition-application-bursting-test-2"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json
new file mode 100644
index 0000000..697cb70
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscaling-policy-application-bursting-test",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 35
+ },
+ "memoryConsumption": {
+ "threshold": 45
+ },
+ "loadAverage": {
+ "threshold": 25
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json
new file mode 100644
index 0000000..8fbab89
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json
@@ -0,0 +1,19 @@
+{
+ "name": "esb-php-group-application-bursting-test",
+ "cartridges": [
+ "esb-application-bursting-test",
+ "php-application-bursting-test"
+ ],
+ "dependencies": {
+ "startupOrders": [
+ {
+ "aliases": [
+ "cartridge.my-esb-application-bursting-test",
+ "cartridge.my-php-application-bursting-test"
+ ]
+ }
+ ],
+ "terminationBehaviour": "terminate-none"
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json
new file mode 100755
index 0000000..d97f9ff
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json
@@ -0,0 +1,50 @@
+{
+ "type": "esb-application-bursting-test",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "framework",
+ "displayName": "esb-application-bursting-test",
+ "description": "esb-application-bursting-test Cartridge",
+ "version": "7",
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "name": "http-22",
+ "protocol": "http",
+ "port": "22",
+ "proxyPort": "8280"
+ }
+ ],
+ "deployment": {
+ },
+ "iaasProvider": [
+ {
+ "type": "mock",
+ "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e",
+ "networkInterfaces": [
+ {
+ "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594"
+ },
+ {
+ "name": "keyPair",
+ "value": "vishanth-key"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default"
+ }
+ ]
+ }
+ ],
+ "metadataKeys": [
+ "server_ip",
+ "username",
+ "password"
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json
new file mode 100755
index 0000000..02d0d9d
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json
@@ -0,0 +1,51 @@
+{
+ "type": "php-application-bursting-test",
+ "provider": "apache",
+ "category": "framework",
+ "host": "php.stratos.org",
+ "displayName": "php-application-bursting-test",
+ "description": "php-application-bursting-test Cartridge",
+ "version": "7",
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "name": "http-80",
+ "protocol": "http",
+ "port": "8080",
+ "proxyPort": "8280"
+ },
+ {
+ "name": "http-22",
+ "protocol": "tcp",
+ "port": "22",
+ "proxyPort": "8222"
+ }
+ ],
+ "deployment": {
+ },
+ "iaasProvider": [
+ {
+ "type": "mock",
+ "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e",
+ "networkInterfaces": [
+ {
+ "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594"
+ },
+ {
+ "name": "keyPair",
+ "value": "reka"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7fae8a72/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json
new file mode 100755
index 0000000..b63d568
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json
@@ -0,0 +1,53 @@
+{
+ "type": "tomcat-application-bursting-test",
+ "provider": "apache",
+ "host": "tomcat.stratos.org",
+ "category": "framework",
+ "displayName": "tomcat-application-bursting-test",
+ "description": "tomcat-application-bursting-test Cartridge",
+ "version": "7",
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "name": "http-22",
+ "protocol": "http",
+ "port": "22",
+ "proxyPort": "8280"
+ },
+ {
+ "protocol": "http",
+ "port": "8080",
+ "proxyPort": "80"
+ }
+ ],
+ "deployment": {
+ },
+ "iaasProvider": [
+ {
+ "type": "mock",
+ "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e",
+ "networkInterfaces": [
+ {
+ "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594"
+ },
+ {
+ "name": "keyPair",
+ "value": "vishanth-key"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default"
+ }
+ ]
+ }
+ ],
+ "metadataKeys": [
+ "url"
+ ]
+}