You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2015/08/06 16:06:17 UTC
[01/12] stratos git commit: fixing samples issue
Repository: stratos
Updated Branches:
refs/heads/master d5680aa89 -> 955c37a6c
fixing samples issue
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/955c37a6
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/955c37a6
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/955c37a6
Branch: refs/heads/master
Commit: 955c37a6ce6733c03bb0e8e9908f58465aa67099
Parents: 5bdc2f8
Author: reka <rt...@gmail.com>
Authored: Thu Aug 6 19:23:37 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Aug 6 19:33:43 2015 +0530
----------------------------------------------------------------------
.../integration/tests/CartridgeTest.java | 2 +-
.../application-policy-2.json | 18 +++++++++++++++
.../application-policy-3.json | 18 ---------------
.../mock/network-partition-10.json | 24 --------------------
.../mock/network-partition-7.json | 15 ++++++++++++
.../mock/network-partition-8.json | 24 ++++++++++++++++++++
.../mock/network-partition-9.json | 15 ------------
7 files changed, 58 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/955c37a6/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
index 21171ff..f3456a4 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
@@ -33,7 +33,7 @@ import static junit.framework.Assert.assertTrue;
*/
public class CartridgeTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(CartridgeTest.class);
- private static final String TEST_PATH = "/cartridge-group-test";
+ private static final String TEST_PATH = "/cartridge-test";
@Test
http://git-wip-us.apache.org/repos/asf/stratos/blob/955c37a6/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-2.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-2.json
new file mode 100644
index 0000000..1137942
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-2.json
@@ -0,0 +1,18 @@
+{
+ "id": "application-policy-2",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-7",
+ "network-partition-8"
+ ],
+ "properties": [
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-7,network-partition-8"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/955c37a6/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json
deleted file mode 100644
index 2cecc06..0000000
--- a/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "id": "application-policy-3",
- "algorithm": "one-after-another",
- "networkPartitions": [
- "network-partition-9",
- "network-partition-10"
- ],
- "properties": [
- {
- "name": "networkPartitionGroups",
- "value": "network-partition-9|network-partition-10"
- },
- {
- "name": "key-2",
- "value": "value-2"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/955c37a6/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json
deleted file mode 100644
index 1e1ec23..0000000
--- a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "id": "network-partition-10",
- "provider": "mock",
- "partitions": [
- {
- "id": "network-partition-10-partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "network-partition-10-partition-2",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/955c37a6/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-7.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-7.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-7.json
new file mode 100644
index 0000000..6250504
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-7.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-7",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/955c37a6/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-8.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-8.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-8.json
new file mode 100644
index 0000000..354b837
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-8.json
@@ -0,0 +1,24 @@
+{
+ "id": "network-partition-8",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "network-partition-8-partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "network-partition-8-partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/955c37a6/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json
deleted file mode 100644
index 9f12343..0000000
--- a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-9",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
[11/12] stratos git commit: Introducing stratos integration test
suite for the artifacts
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
index 096dd60..7641b18 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
@@ -19,266 +19,78 @@
package org.apache.stratos.integration.tests;
-import org.apache.commons.exec.CommandLine;
-import org.apache.commons.exec.DefaultExecutor;
-import org.apache.commons.exec.PumpStreamHandler;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.autoscaler.stub.pojo.ApplicationContext;
-import org.apache.stratos.common.beans.PropertyBean;
import org.apache.stratos.common.beans.application.ApplicationBean;
-import org.apache.stratos.common.beans.cartridge.CartridgeBean;
import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
-import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
-import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
-import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
-import org.apache.stratos.common.client.AutoscalerServiceClient;
-import org.apache.stratos.common.threading.StratosThreadPool;
-import org.apache.stratos.integration.tests.rest.RestClient;
-import org.apache.stratos.messaging.domain.application.*;
-import org.apache.stratos.messaging.domain.instance.ClusterInstance;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.messaging.domain.topology.Member;
-import org.apache.stratos.messaging.domain.topology.MemberStatus;
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationsEventReceiver;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.rmi.RemoteException;
-import java.util.Collection;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-
-import static junit.framework.Assert.*;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
/**
- * Sample application tests.
+ * Sample application tests with application add, .
*/
public class SampleApplicationsTest extends StratosTestServerManager {
+ private static final Log log = LogFactory.getLog(SampleApplicationsTest.class);
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-
- public static final int APPLICATION_ACTIVATION_TIMEOUT = 120000;
- public static final String APPLICATION_STATUS_CREATED = "Created";
- public static final String APPLICATION_STATUS_UNDEPLOYING = "Undeploying";
- private String endpoint = "https://localhost:9443";
-
- private ApplicationsEventReceiver applicationsEventReceiver;
- private TopologyEventReceiver topologyEventReceiver;
- private RestClient restClient;
- private AutoscalingPolicyTest autoscalingPolicyTest;
- private NetworkPartitionTest networkPartitionTest;
- private CartridgeTest cartridgeTest;
- private DeploymentPolicyTest deploymentPolicyTest;
- private CartridgeGroupTest cartridgeGroupTest;
- private ApplicationTest applicationTest;
- private ApplicationPolicyTest applicationPolicyTest;
-
-
- @BeforeClass
- public void setUp() {
- // Set jndi.properties.dir system property for initializing event receivers
- System.setProperty("jndi.properties.dir", getResourcesFolderPath());
- System.setProperty("autoscaler.service.url", "https://localhost:9443/services/AutoscalerService");
- restClient = new RestClient(endpoint, "admin", "admin");
- autoscalingPolicyTest = new AutoscalingPolicyTest();
- networkPartitionTest = new NetworkPartitionTest();
- cartridgeTest = new CartridgeTest();
- deploymentPolicyTest = new DeploymentPolicyTest();
- cartridgeGroupTest = new CartridgeGroupTest();
- applicationTest = new ApplicationTest();
- applicationPolicyTest = new ApplicationPolicyTest();
- }
-
- @Test
- public void testSingleCartridgeApplication() {
- try {
- initializeApplicationEventReceiver();
- //runApplicationTest("simple/single-cartridge-app", "single-cartridge-app");
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred", false);
- }
- }
-
- @Test
- public void testAutoscalingPolicy() {
- log.info("Started autoscaling policy test case**************************************");
- String policyId = "autoscaling-policy-c0";
- try {
- boolean added = autoscalingPolicyTest.addAutoscalingPolicy(policyId + ".json",
- restClient);
- assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), added, true);
- AutoscalePolicyBean bean = autoscalingPolicyTest.getAutoscalingPolicy(policyId,
- restClient);
- assertEquals(String.format("[autoscaling-policy-id] %s is not correct", bean.getId()),
- bean.getId(), policyId);
- assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId),
- bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 35.0, 0.0);
- assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
- bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 45.0, 0.0);
- assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
- bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0);
-
- boolean updated = autoscalingPolicyTest.updateAutoscalingPolicy(policyId + ".json",
- restClient);
- assertEquals(String.format("[autoscaling-policy-id] %s update failed", policyId), updated, true);
- AutoscalePolicyBean updatedBean = autoscalingPolicyTest.getAutoscalingPolicy(policyId,
- restClient);
- assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId),
- updatedBean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0);
- assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
- updatedBean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 0.0);
- assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
- updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
-
- boolean removed = autoscalingPolicyTest.removeAutoscalingPolicy(policyId,
- restClient);
- assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
- removed, true);
-
- AutoscalePolicyBean beanRemoved = autoscalingPolicyTest.getAutoscalingPolicy(policyId,
- restClient);
- assertEquals(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
- policyId), beanRemoved, null);
- log.info("Ended autoscaling policy test case**************************************");
- } catch (Exception e) {
- log.error("An error occurred while handling [autoscaling policy] " + policyId, e);
- assertTrue("An error occurred while handling [autoscaling policy] " + policyId, false);
- }
- }
-
- @Test
- public void testCartridgeGroup() {
- try {
- log.info("Started Cartridge group test case**************************************");
-
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", restClient);
- assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c1"), addedC1, true);
-
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", restClient);
- assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c2"), addedC2, true);
-
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", restClient);
- assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c3"), addedC3, true);
-
- boolean added = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- restClient);
- assertEquals(String.format("Cartridge Group did not added: [cartridge-group-name] %s",
- "cartrdige-nested"), added, true);
- CartridgeGroupBean bean = cartridgeGroupTest.getCartridgeGroup("G1",
- restClient);
- assertEquals(String.format("Cartridge Group name did not match: [cartridge-group-name] %s",
- "cartrdige-nested"), bean.getName(), "G1");
-
- boolean updated = cartridgeGroupTest.updateCartridgeGroup("cartrdige-nested.json",
- restClient);
- assertEquals(String.format("Cartridge Group did not updated: [cartridge-group-name] %s",
- "cartrdige-nested"), updated, true);
- CartridgeGroupBean updatedBean = cartridgeGroupTest.getCartridgeGroup("G1",
- restClient);
- assertEquals(String.format("Updated Cartridge Group didn't match: [cartridge-group-name] %s",
- "cartrdige-nested"), updatedBean.getName(), "G1");
-
- boolean removedC1 = cartridgeTest.removeCartridge("c1",
- restClient);
- assertEquals(String.format("Cartridge can be removed while it is used in cartridge group: [cartridge-name] %s",
- "c1"), removedC1, false);
-
- boolean removedC2 = cartridgeTest.removeCartridge("c2",
- restClient);
- assertEquals(String.format("Cartridge can be removed while it is used in cartridge group: [cartridge-name] %s",
- "c2"), removedC2, false);
-
- boolean removedC3 = cartridgeTest.removeCartridge("c3",
- restClient);
- assertEquals(String.format("Cartridge can be removed while it is used in cartridge group: [cartridge-name] %s",
- "c2"), removedC3, false);
-
- boolean removed = cartridgeGroupTest.removeCartridgeGroup("G1",
- restClient);
- assertEquals(String.format("Cartridge Group did not removed: [cartridge-group-name] %s",
- "cartrdige-nested"), removed, true);
-
- CartridgeGroupBean beanRemoved = cartridgeGroupTest.getCartridgeGroup("G1",
- restClient);
- assertEquals(String.format("Cartridge Group did not removed completely: [cartridge-group-name] %s",
- "cartrdige-nested"), beanRemoved, null);
-
- removedC1 = cartridgeTest.removeCartridge("c1",
- restClient);
- assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c1"), removedC1, true);
-
- removedC2 = cartridgeTest.removeCartridge("c2",
- restClient);
- assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c2"), removedC2, true);
-
- removedC3 = cartridgeTest.removeCartridge("c3",
- restClient);
- assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c3"), removedC3, true);
-
- log.info("Ended Cartridge group test case**************************************");
-
- } catch (Exception e) {
- log.error("An error occurred while handling Cartridge group test case", e);
- assertTrue("An error occurred while handling Cartridge group test case", false);
- }
- }
@Test
public void testApplication() {
log.info("Started application test case**************************************");
+ String autoscalingPolicyId = "autoscaling-policy-1";
try {
- boolean addedScalingPolicy = autoscalingPolicyTest.addAutoscalingPolicy("autoscaling-policy-1.json",
- restClient);
+ boolean addedScalingPolicy = restClient.addEntity(RestConstants.AUTOSCALING_POLICIES_PATH
+ + "/" + autoscalingPolicyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(addedScalingPolicy, true);
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", restClient);
+ boolean addedC1 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c1.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC1, true);
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", restClient);
+ boolean addedC2 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c2.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC2, true);
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", restClient);
+ boolean addedC3 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c3.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC3, true);
- boolean addedG1 = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- restClient);
+ boolean addedG1 = restClient.addEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ "/" + "cartrdige-nested.json", RestConstants.CARTRIDGE_GROUPS,
+ RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(addedG1, true);
- CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1",
- restClient);
+
+ CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "G1",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(beanG1.getName(), "G1");
- boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- restClient);
+ boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-1.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN1, true);
- boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- restClient);
+ boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-2.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN2, true);
- boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- restClient);
+ boolean addedDep = restClient.addEntity(RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ "deployment-policy-1.json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(addedDep, true);
- boolean added = applicationTest.addApplication("g-sc-G123-1.json",
- restClient);
+ boolean added = restClient.addEntity(RestConstants.APPLICATIONS_PATH + "/" +
+ "g-sc-G123-1.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
assertEquals(added, true);
- ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1",
- restClient);
+
+ ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
assertEquals(bean.getApplicationId(), "g-sc-G123-1");
assertEquals(bean.getComponents().getGroups().get(0).getName(), "G1");
@@ -308,12 +120,12 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 1);
assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 2);
- boolean updated = applicationTest.updateApplication("g-sc-G123-1.json",
- restClient);
+ boolean updated = restClient.updateEntity(RestConstants.APPLICATIONS_PATH + "/g-sc-G123-1-v1.json",
+ RestConstants.APPLICATIONS, RestConstants.APPLICATIONS_NAME);
assertEquals(updated, true);
- ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1",
- restClient);
+ ApplicationBean updatedBean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
assertEquals(bean.getApplicationId(), "g-sc-G123-1");
assertEquals(updatedBean.getComponents().getGroups().get(0).getName(), "G1");
@@ -344,61 +156,62 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 3);
- boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
- restClient);
+ boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(removedGroup, false);
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
- restClient);
+ boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(removedAuto, false);
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
//Trying to remove the used network partition
assertEquals(removedNet, false);
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
- restClient);
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-1", RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(removedDep, false);
- boolean removed = applicationTest.removeApplication("g-sc-G123-1",
- restClient);
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1",
+ RestConstants.APPLICATIONS_NAME);
assertEquals(removed, true);
- ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1",
- restClient);
+ ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
assertEquals(beanRemoved, null);
- removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
- restClient);
+ removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(removedGroup, true);
- boolean removedC1 = cartridgeTest.removeCartridge("c1",
- restClient);
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c1",
+ RestConstants.CARTRIDGES_NAME);
assertEquals(removedC1, true);
- boolean removedC2 = cartridgeTest.removeCartridge("c2",
- restClient);
+ boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c2",
+ RestConstants.CARTRIDGES_NAME);
assertEquals(removedC2, true);
- boolean removedC3 = cartridgeTest.removeCartridge("c3",
- restClient);
+ boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c3",
+ RestConstants.CARTRIDGES_NAME);
assertEquals(removedC3, true);
- removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
- restClient);
+ removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(removedAuto, true);
- removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
- restClient);
+ removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-1", RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(removedDep, true);
- removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-1", RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(removedNet, true);
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
- restClient);
+ boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-2", RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(removedN2, true);
log.info("Ended application test case**************************************");
@@ -409,167 +222,194 @@ public class SampleApplicationsTest extends StratosTestServerManager {
}
}
- @Test
+ @Test(dependsOnMethods = {"testApplication"})
public void testDeployApplication() {
try {
log.info("Started application deploy/undeploy test case**************************************");
- //Initializing event Receivers
- initializeApplicationEventReceiver();
- initializeTopologyEventReceiver();
-
- //Verifying whether the relevant Topologies are initialized
- assertApplicationTopologyInitialized();
- assertTopologyInitialized();
+ String autoscalingPolicyId = "autoscaling-policy-1";
- boolean addedScalingPolicy = autoscalingPolicyTest.addAutoscalingPolicy("autoscaling-policy-1.json",
- restClient);
+ boolean addedScalingPolicy = restClient.addEntity(RestConstants.AUTOSCALING_POLICIES_PATH
+ + "/" + autoscalingPolicyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(addedScalingPolicy, true);
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", restClient);
+ boolean addedC1 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c1.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC1, true);
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", restClient);
+ boolean addedC2 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c2.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC2, true);
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", restClient);
+ boolean addedC3 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c3.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC3, true);
- boolean addedG1 = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- restClient);
+ boolean addedG1 = restClient.addEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ "/" + "cartrdige-nested.json", RestConstants.CARTRIDGE_GROUPS,
+ RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(addedG1, true);
- CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1",
- restClient);
+
+ CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "G1",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(beanG1.getName(), "G1");
- boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- restClient);
+ boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-1.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN1, true);
- boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- restClient);
+ boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-2.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN2, true);
- boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- restClient);
+ boolean addedDep = restClient.addEntity(RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ "deployment-policy-1.json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(addedDep, true);
- boolean added = applicationTest.addApplication("g-sc-G123-1.json",
- restClient);
+ boolean added = restClient.addEntity(RestConstants.APPLICATIONS_PATH + "/" +
+ "g-sc-G123-1.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
assertEquals(added, true);
- ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1",
- restClient);
+
+ ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
assertEquals(bean.getApplicationId(), "g-sc-G123-1");
- boolean addAppPolicy = applicationPolicyTest.addApplicationPolicy(
- "application-policy-1.json", restClient);
+ boolean addAppPolicy = restClient.addEntity(RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ "application-policy-1.json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertEquals(addAppPolicy, true);
- ApplicationPolicyBean policyBean = applicationPolicyTest.getApplicationPolicy(
- "application-policy-1", restClient);
+ ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+ RestConstants.APPLICATION_POLICIES,
+ "application-policy-1", ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
//deploy the application
- boolean deployed = applicationTest.deployApplication(bean.getApplicationId(),
- policyBean.getId(), restClient);
+ String resourcePath = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1" +
+ RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-1";
+ boolean deployed = restClient.deployEntity(resourcePath,
+ RestConstants.APPLICATIONS_NAME);
assertEquals(deployed, true);
//Application active handling
- assertApplicationActivation(bean.getApplicationId());
+ TopologyHandler.getInstance().assertApplicationActivation(bean.getApplicationId());
//Group active handling
- assertGroupActivation(bean.getApplicationId());
+ TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId());
//Cluster active handling
- assertClusterActivation(bean.getApplicationId());
+ TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
//Updating application
- boolean updated = applicationTest.updateApplication("g-sc-G123-1.json",
- restClient);
+ boolean updated = restClient.updateEntity(RestConstants.APPLICATIONS_PATH + "/" +
+ "g-sc-G123-1-v1.json", RestConstants.APPLICATIONS,
+ RestConstants.APPLICATIONS_NAME);
assertEquals(updated, true);
- assertGroupInstanceCount(bean.getApplicationId(), "group3", 2);
+ TopologyHandler.getInstance().assertGroupInstanceCount(bean.getApplicationId(), "group3", 2);
- assertClusterMinMemberCount(bean.getApplicationId(), 2);
+ TopologyHandler.getInstance().assertClusterMinMemberCount(bean.getApplicationId(), 2);
- ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1",
- restClient);
+ ApplicationBean updatedBean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
assertEquals(updatedBean.getApplicationId(), "g-sc-G123-1");
- boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
- restClient);
+ boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(removedGroup, false);
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
- restClient);
+ boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(removedAuto, false);
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
//Trying to remove the used network partition
assertEquals(removedNet, false);
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
- restClient);
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-1", RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(removedDep, false);
//Un-deploying the application
- boolean unDeployed = applicationTest.undeployApplication("g-sc-G123-1",
- restClient);
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1" +
+ RestConstants.APPLICATIONS_UNDEPLOY;
+
+ boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+ RestConstants.APPLICATIONS_NAME);
assertEquals(unDeployed, true);
- assertApplicationUndeploy("g-sc-G123-1");
+ boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1");
+ if (!undeploy) {
+ //Need to forcefully undeploy the application
+ log.info("Force undeployment is going to start for the [application] " + "g-sc-G123-1");
+
+ restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "g-sc-G123-1" +
+ RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
+
+ boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1");
+ assertEquals(String.format("Forceful undeployment failed for the application %s",
+ "g-sc-G123-1"), forceUndeployed, true);
- boolean removed = applicationTest.removeApplication("g-sc-G123-1",
- restClient);
+ }
+
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1",
+ RestConstants.APPLICATIONS_NAME);
assertEquals(removed, true);
- ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1",
- restClient);
+ ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "g-sc-G123-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
assertEquals(beanRemoved, null);
- removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
- restClient);
+ removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(removedGroup, true);
- boolean removedC1 = cartridgeTest.removeCartridge("c1",
- restClient);
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c1",
+ RestConstants.CARTRIDGES_NAME);
assertEquals(removedC1, true);
- boolean removedC2 = cartridgeTest.removeCartridge("c2",
- restClient);
+ boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c2",
+ RestConstants.CARTRIDGES_NAME);
assertEquals(removedC2, true);
- boolean removedC3 = cartridgeTest.removeCartridge("c3",
- restClient);
+ boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c3",
+ RestConstants.CARTRIDGES_NAME);
assertEquals(removedC3, true);
- removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
- restClient);
+ removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(removedAuto, true);
- removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
- restClient);
+ removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-1", RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(removedDep, true);
- //Remove network partition used by application policy
- removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-1", RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(removedNet, false);
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
- restClient);
+ boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-2", RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(removedN2, false);
- boolean removeAppPolicy = applicationPolicyTest.removeApplicationPolicy("application-policy-1",
- restClient);
+ boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+ "application-policy-1", RestConstants.APPLICATION_POLICIES_NAME);
assertEquals(removeAppPolicy, true);
- removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-1", RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(removedNet, true);
- removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
- restClient);
+ removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-2", RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(removedN2, true);
log.info("Ended application deploy/undeploy test case**************************************");
@@ -580,604 +420,5 @@ public class SampleApplicationsTest extends StratosTestServerManager {
}
}
- @Test
- public void testNetworkPartition() {
- try {
- log.info("Started network partition test case**************************************");
-
- boolean added = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- restClient);
- assertEquals(added, true);
- NetworkPartitionBean bean = networkPartitionTest.getNetworkPartition("network-partition-1",
- restClient);
- assertEquals(bean.getId(), "network-partition-1");
- assertEquals(bean.getPartitions().size(), 1);
- assertEquals(bean.getPartitions().get(0).getId(), "partition-1");
- assertEquals(bean.getPartitions().get(0).getProperty().get(0).getName(), "region");
- assertEquals(bean.getPartitions().get(0).getProperty().get(0).getValue(), "default");
-
- boolean updated = networkPartitionTest.updateNetworkPartition("network-partition-1.json",
- restClient);
- assertEquals(updated, true);
- NetworkPartitionBean updatedBean = networkPartitionTest.getNetworkPartition("network-partition-1",
- restClient);
- assertEquals(updatedBean.getId(), "network-partition-1");
- assertEquals(updatedBean.getPartitions().size(), 2);
- assertEquals(updatedBean.getPartitions().get(1).getId(), "partition-2");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(0).getName(), "region");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(0).getValue(), "default1");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getName(), "zone");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getValue(), "z1");
-
- boolean removed = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
- assertEquals(removed, true);
-
- NetworkPartitionBean beanRemoved = networkPartitionTest.getNetworkPartition("network-partition-1",
- restClient);
- assertEquals(beanRemoved, null);
-
- log.info("Ended network partition test case**************************************");
- } catch (Exception e) {
- log.error("An error occurred while handling network partitions",e);
- assertTrue("An error occurred while handling network partitions", false);
- }
- }
-
- @Test
- public void testDeploymentPolicy() {
- try {
- log.info("Started deployment policy test case**************************************");
-
- boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- restClient);
- assertEquals(addedN1, true);
-
- boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- restClient);
- assertEquals(addedN2, true);
-
- boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- restClient);
- assertEquals(addedDep, true);
-
- DeploymentPolicyBean bean = deploymentPolicyTest.getDeploymentPolicy(
- "deployment-policy-1", restClient);
- assertEquals(bean.getId(), "deployment-policy-1");
- assertEquals(bean.getNetworkPartitions().size(), 2);
- assertEquals(bean.getNetworkPartitions().get(0).getId(), "network-partition-1");
- assertEquals(bean.getNetworkPartitions().get(0).getPartitionAlgo(), "one-after-another");
- assertEquals(bean.getNetworkPartitions().get(0).getPartitions().size(), 1);
- assertEquals(bean.getNetworkPartitions().get(0).getPartitions().get(0).getId(), "partition-1");
- assertEquals(bean.getNetworkPartitions().get(0).getPartitions().get(0).getPartitionMax(), 20);
-
- assertEquals(bean.getNetworkPartitions().get(1).getId(), "network-partition-2");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitionAlgo(), "round-robin");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().size(), 2);
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(0).getId(),
- "network-partition-2-partition-1");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(0).getPartitionMax(), 10);
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(1).getId(),
- "network-partition-2-partition-2");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 9);
-
- //update network partition
- boolean updated = networkPartitionTest.updateNetworkPartition("network-partition-1.json",
- restClient);
- assertEquals(updated, true);
-
- //update deployment policy with new partition and max values
- boolean updatedDep = deploymentPolicyTest.updateDeploymentPolicy("deployment-policy-1.json",
- restClient);
- assertEquals(updatedDep, true);
-
- DeploymentPolicyBean updatedBean = deploymentPolicyTest.getDeploymentPolicy(
- "deployment-policy-1", restClient);
- assertEquals(updatedBean.getId(), "deployment-policy-1");
- assertEquals(updatedBean.getNetworkPartitions().size(), 2);
- assertEquals(updatedBean.getNetworkPartitions().get(0).getId(), "network-partition-1");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitionAlgo(), "one-after-another");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().size(), 2);
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(0).getId(), "partition-1");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(0).getPartitionMax(), 25);
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(1).getId(), "partition-2");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(1).getPartitionMax(), 20);
-
- assertEquals(updatedBean.getNetworkPartitions().get(1).getId(), "network-partition-2");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitionAlgo(), "round-robin");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().size(), 2);
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(0).getId(),
- "network-partition-2-partition-1");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(0).getPartitionMax(), 15);
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(1).getId(),
- "network-partition-2-partition-2");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 5);
-
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
- //Trying to remove the used network partition
- assertEquals(removedNet, false);
-
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
- restClient);
- assertEquals(removedDep, true);
-
- DeploymentPolicyBean beanRemovedDep = deploymentPolicyTest.getDeploymentPolicy("deployment-policy-1",
- restClient);
- assertEquals(beanRemovedDep, null);
-
- boolean removedN1 = networkPartitionTest.removeNetworkPartition("network-partition-1",
- restClient);
- assertEquals(removedN1, true);
-
- NetworkPartitionBean beanRemovedN1 = networkPartitionTest.getNetworkPartition("network-partition-1",
- restClient);
- assertEquals(beanRemovedN1, null);
-
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
- restClient);
- assertEquals(removedN2, true);
-
- NetworkPartitionBean beanRemovedN2 = networkPartitionTest.getNetworkPartition("network-partition-2",
- restClient);
- assertEquals(beanRemovedN2, null);
-
- log.info("Ended deployment policy test case**************************************");
-
- } catch (Exception e) {
- log.error("An error occurred while handling deployment policy", e);
- assertTrue("An error occurred while handling deployment policy", false);
- }
- }
-
- @Test
- public void testCartridge() {
- log.info("Started Cartridge test case**************************************");
-
- try {
- boolean added = cartridgeTest.addCartridge("c0.json", restClient);
- assertEquals(added, true);
- CartridgeBean bean = cartridgeTest.getCartridge("c0", restClient);
- assertEquals(bean.getType(), "c0");
- assertEquals(bean.getCategory(), "Application");
- assertEquals(bean.getHost(), "qmog.cisco.com");
- for (PropertyBean property : bean.getProperty()) {
- if (property.getName().equals("payload_parameter.CEP_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com");
- } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com");
- } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
- assertEquals(property.getValue(), "1");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin");
- } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
- assertEquals(property.getValue(), "test");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
- assertEquals(property.getValue(), "7711");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
- assertEquals(property.getValue(), "7611");
- } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
- assertEquals(property.getValue(), "7611");
- } else if (property.getName().equals("payload_parameter.MB_PORT")) {
- assertEquals(property.getValue(), "61616");
- }
- }
-
- boolean updated = cartridgeTest.updateCartridge("c0.json",
- restClient);
- assertEquals(updated, true);
- CartridgeBean updatedBean = cartridgeTest.getCartridge("c0",
- restClient);
- assertEquals(updatedBean.getType(), "c0");
- assertEquals(updatedBean.getCategory(), "Data");
- assertEquals(updatedBean.getHost(), "qmog.cisco.com12");
- for (PropertyBean property : updatedBean.getProperty()) {
- if (property.getName().equals("payload_parameter.CEP_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com123");
- } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin123");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com123");
- } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
- assertEquals(property.getValue(), "3");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin123");
- } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
- assertEquals(property.getValue(), "test123");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
- assertEquals(property.getValue(), "7712");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
- assertEquals(property.getValue(), "7612");
- } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
- assertEquals(property.getValue(), "7612");
- } else if (property.getName().equals("payload_parameter.MB_PORT")) {
- assertEquals(property.getValue(), "61617");
- }
- }
-
- boolean removed = cartridgeTest.removeCartridge("c0",
- restClient);
- assertEquals(removed, true);
-
- CartridgeBean beanRemoved = cartridgeTest.getCartridge("c0",
- restClient);
- assertEquals(beanRemoved, null);
-
- log.info("Ended Cartridge test case**************************************");
- } catch (Exception e) {
- log.error("An error occurred while handling cartridges", e);
- assertTrue("An error occurred while handling cartridges", false);
- }
- }
-
-
- private void runApplicationTest(String applicationId) {
- runApplicationTest(applicationId, applicationId);
- }
-
- private void runApplicationTest(String applicationFolderName, String applicationId) {
- executeCommand(getApplicationsPath() + "/" + applicationFolderName + "/scripts/mock/deploy.sh");
- assertApplicationActivation(applicationId);
- executeCommand(getApplicationsPath() + "/" + applicationFolderName + "/scripts/mock/undeploy.sh");
- assertApplicationNotExists(applicationId);
- }
-
- /**
- * Initialize application event receiver
- */
- private void initializeApplicationEventReceiver() {
- if (applicationsEventReceiver == null) {
- applicationsEventReceiver = new ApplicationsEventReceiver();
- ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER", 1);
- applicationsEventReceiver.setExecutorService(executorService);
- applicationsEventReceiver.execute();
- }
- }
-
- /**
- * Initialize Topology event receiver
- */
- private void initializeTopologyEventReceiver() {
- if (topologyEventReceiver == null) {
- topologyEventReceiver = new TopologyEventReceiver();
- ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER1", 1);
- topologyEventReceiver.setExecutorService(executorService);
- topologyEventReceiver.execute();
- }
- }
-
- /**
- * Execute shell command
- *
- * @param commandText
- */
- private void executeCommand(String commandText) {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- try {
- CommandLine commandline = CommandLine.parse(commandText);
- DefaultExecutor exec = new DefaultExecutor();
- PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream);
- exec.setStreamHandler(streamHandler);
- exec.execute(commandline);
- log.info(outputStream.toString());
- } catch (Exception e) {
- log.error(outputStream.toString(), e);
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Assert application Topology initialization
- *
- */
- private void assertApplicationTopologyInitialized() {
- long startTime = System.currentTimeMillis();
- boolean applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
- while (!applicationTopologyInitialized) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- assertEquals(String.format("Application Topology didn't get initialized "), applicationTopologyInitialized, true);
- }
-
- /**
- * Assert Topology initialization
- *
- */
- private void assertTopologyInitialized() {
- long startTime = System.currentTimeMillis();
- boolean topologyInitialized = TopologyManager.getTopology().isInitialized();
- while (!topologyInitialized) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- topologyInitialized = TopologyManager.getTopology().isInitialized();
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- assertEquals(String.format("Topology didn't get initialized "), topologyInitialized, true);
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- private void assertApplicationActivation(String applicationName) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- while (!((application != null) && (application.getStatus() == ApplicationStatus.Active))) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplication(applicationName);
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
- assertEquals(String.format("Application status did not change to active: [application-id] %s", applicationName),
- ApplicationStatus.Active, application.getStatus());
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- private void assertGroupActivation(String applicationName) {
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationName), application);
-
- Collection<Group> groups = application.getAllGroupsRecursively();
- for (Group group : groups) {
- assertEquals(group.getInstanceContextCount() >= group.getGroupMinInstances(), true);
- }
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- private void assertClusterActivation(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);
- boolean clusterActive = false;
-
- for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
- int activeInstances = 0;
- for (Member member : cluster.getMembers()) {
- if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
- if (member.getStatus().equals(MemberStatus.Active)) {
- activeInstances++;
- }
- }
- }
- clusterActive = activeInstances >= clusterDataHolder.getMinInstances();
-
- if (!clusterActive) {
- break;
- }
- }
- assertEquals(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId),
- clusterActive, true);
- }
-
- }
-
- private void assertClusterMinMemberCount(String applicationName, int minMembers) {
- long startTime = System.currentTimeMillis();
-
- 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);
- boolean clusterActive = false;
-
- for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
- int activeInstances = 0;
- for (Member member : cluster.getMembers()) {
- if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
- if (member.getStatus().equals(MemberStatus.Active)) {
- activeInstances++;
- }
- }
- }
- clusterActive = activeInstances >= minMembers;
-
- while (!clusterActive) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- service = TopologyManager.getTopology().getService(serviceName);
- assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
- applicationName, serviceName), service);
-
- cluster = service.getCluster(clusterId);
- activeInstances = 0;
- for (Member member : cluster.getMembers()) {
- if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
- if (member.getStatus().equals(MemberStatus.Active)) {
- activeInstances++;
- }
- }
- }
- clusterActive = activeInstances >= minMembers;
- assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
- applicationName, serviceName, clusterId), cluster);
-
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- }
- assertEquals(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId),
- clusterActive, true);
- }
-
- }
-
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- private void assertApplicationUndeploy(String applicationName) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- ApplicationContext applicationContext = null;
- try {
- applicationContext = AutoscalerServiceClient.getInstance().getApplication(applicationName);
- } catch (RemoteException e) {
- log.error("Error while getting the application context for [application] " + applicationName);
- }
- while (((application != null) && application.getInstanceContextCount() > 0) ||
- (applicationContext == null || applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING))) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplication(applicationName);
- try {
- applicationContext = AutoscalerServiceClient.getInstance().getApplication(applicationName);
- } catch (RemoteException e) {
- log.error("Error while getting the application context for [application] " + applicationName);
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
-
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationName), application);
- assertNotNull(String.format("Application Context is not found: [application-id] %s",
- applicationName), applicationContext);
-
- //Force undeployment after the graceful deployment
- if (application.getInstanceContextCount() > 0 ||
- applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
- log.info("Force undeployment is going to start for the [application] " + applicationName);
-
- applicationTest.forceUndeployApplication(applicationName, restClient);
- while (application.getInstanceContextCount() > 0 ||
- applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplication(applicationName);
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- }
- assertEquals(String.format("Application status did not change to Created: [application-id] %s", applicationName),
- APPLICATION_STATUS_CREATED, applicationContext.getStatus());
-
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- private void assertGroupInstanceCount(String applicationName, String groupAlias, int count) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- if (application != null) {
- Group group = application.getGroupRecursively(groupAlias);
- while (group.getInstanceContextCount() != count) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- for (GroupInstance instance : group.getInstanceIdToInstanceContextMap().values()) {
- while (!instance.getStatus().equals(GroupStatus.Active)) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- }
- assertEquals(String.format("Application status did not change to active: [application-id] %s", applicationName),
- group.getInstanceContextCount(), count);
- }
- assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
-
- }
-
- private void assertApplicationNotExists(String applicationName) {
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNull(String.format("Application is found in the topology : [application-id] %s", applicationName), application);
- }
-
- /**
- * Get applications folder path
- *
- * @return
- */
- private String getApplicationsPath() {
- return getResourcesFolderPath() + "/../../../../../../samples/applications";
- }
-
- /**
- * Get resources folder path
- *
- * @return
- */
- private String getResourcesFolderPath() {
- String path = getClass().getResource("/").getPath();
- return StringUtils.removeEnd(path, File.separator);
- }
-
- private String getArtifactsPath() {
- return getResourcesFolderPath() + "/../../src/test/resources";
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
index 020ce41..5453bbd 100755
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
@@ -26,6 +26,9 @@ import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.stratos.common.test.TestLogAppender;
+import org.apache.stratos.integration.tests.rest.RestClient;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationsEventReceiver;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.wso2.carbon.integration.framework.TestServerManager;
@@ -53,6 +56,8 @@ public class StratosTestServerManager extends TestServerManager {
private static final String MOCK_IAAS_XML_FILE = "mock-iaas.xml";
private static final String JNDI_PROPERTIES_FILE = "jndi.properties";
private static final String JMS_OUTPUT_ADAPTER_FILE = "JMSOutputAdaptor.xml";
+ protected RestClient restClient;
+ private String endpoint = "https://localhost:9443";
private BrokerService broker = new BrokerService();
private TestLogAppender testLogAppender = new TestLogAppender();
@@ -62,6 +67,7 @@ public class StratosTestServerManager extends TestServerManager {
public StratosTestServerManager() {
super(CARBON_ZIP, PORT_OFFSET);
serverUtils = new ServerUtils();
+ restClient = new RestClient(endpoint, "admin", "admin");
}
@Override
[07/12] stratos git commit: fixing intellij idea suggestions
Posted by re...@apache.org.
fixing intellij idea suggestions
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/08b9696b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/08b9696b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/08b9696b
Branch: refs/heads/master
Commit: 08b9696b409c475cb6750fda8dcfb9e99e83f73d
Parents: f995fb3
Author: reka <rt...@gmail.com>
Authored: Wed Aug 5 14:26:33 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Aug 6 19:33:43 2015 +0530
----------------------------------------------------------------------
.../tests/ApplicationPolicyTest.java | 3 +-
.../integration/tests/ApplicationTest.java | 3 +-
.../tests/AutoscalingPolicyTest.java | 3 +-
.../integration/tests/CartridgeGroupTest.java | 3 +-
.../integration/tests/CartridgeTest.java | 3 +-
.../integration/tests/DeploymentPolicyTest.java | 3 +-
.../integration/tests/NetworkPartitionTest.java | 3 +-
.../integration/tests/rest/RestClient.java | 50 +++++++++++++-------
8 files changed, 41 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
index ec5bf04..dafa36e 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
@@ -41,10 +41,9 @@ public class ApplicationPolicyTest {
public ApplicationPolicyBean getApplicationPolicy(String applicationPolicyId, RestClient restClient) {
- ApplicationPolicyBean bean = (ApplicationPolicyBean) restClient.
+ return (ApplicationPolicyBean) restClient.
getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
ApplicationPolicyBean.class, entityName);
- return bean;
}
public boolean updateApplicationPolicy(String applicationPolicyId, RestClient restClient) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
index af18163..c886644 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
@@ -40,10 +40,9 @@ public class ApplicationTest {
public ApplicationBean getApplication(String applicationId,
RestClient restClient) {
- ApplicationBean bean = (ApplicationBean) restClient.
+ return (ApplicationBean) restClient.
getEntity(RestConstants.APPLICATIONS, applicationId,
ApplicationBean.class, entityName);
- return bean;
}
public boolean updateApplication(String applicationId, RestClient restClient) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
index 7c04d92..1c99cad 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
@@ -39,10 +39,9 @@ public class AutoscalingPolicyTest {
}
public AutoscalePolicyBean getAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
- AutoscalePolicyBean bean = (AutoscalePolicyBean) restClient.
+ return (AutoscalePolicyBean) restClient.
getEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyName,
AutoscalePolicyBean.class, entityName);
- return bean;
}
public boolean updateAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
index caf2838..9aae646 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
@@ -39,10 +39,9 @@ public class CartridgeGroupTest {
}
public CartridgeGroupBean getCartridgeGroup(String groupName, RestClient restClient) {
- CartridgeGroupBean bean = (CartridgeGroupBean) restClient.
+ return (CartridgeGroupBean) restClient.
getEntity(RestConstants.CARTRIDGE_GROUPS, groupName,
CartridgeGroupBean.class, entityName);
- return bean;
}
public boolean updateCartridgeGroup(String groupName, RestClient restClient) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
index fc5cfa0..1d135dd 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
@@ -42,10 +42,9 @@ public class CartridgeTest {
public CartridgeBean getCartridge(String cartridgeType,
RestClient restClient) {
- CartridgeBean bean = (CartridgeBean) restClient.
+ return (CartridgeBean) restClient.
getEntity(RestConstants.CARTRIDGES, cartridgeType,
CartridgeBean.class, entityName);
- return bean;
}
public boolean updateCartridge(String cartridgeType, RestClient restClient) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
index 707f750..eeb3ed9 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
@@ -40,10 +40,9 @@ public class DeploymentPolicyTest {
public DeploymentPolicyBean getDeploymentPolicy(String deploymentPolicyId,
RestClient restClient) {
- DeploymentPolicyBean bean = (DeploymentPolicyBean) restClient.
+ return (DeploymentPolicyBean) restClient.
getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
DeploymentPolicyBean.class, entityName);
- return bean;
}
public boolean updateDeploymentPolicy(String deploymentPolicyId, RestClient restClient) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
index ff27ea6..8593a09 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
@@ -40,10 +40,9 @@ public class NetworkPartitionTest {
public NetworkPartitionBean getNetworkPartition(String networkPartitionId,
RestClient restClient) {
- NetworkPartitionBean bean = (NetworkPartitionBean) restClient.
+ return (NetworkPartitionBean) restClient.
getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
NetworkPartitionBean.class, entityName);
- return bean;
}
public boolean updateNetworkPartition(String networkPartitionId, RestClient restClient) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/08b9696b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
index a1b07e1..5ff8fd3 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
@@ -80,7 +80,7 @@ public class RestClient {
input.setContentType("application/json");
postRequest.setEntity(input);
- String userPass = "admin" + ":" + "admin";
+ String userPass = getUsernamePassword();
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
postRequest.addHeader("Authorization", basicAuth);
@@ -103,7 +103,7 @@ public class RestClient {
try {
getRequest = new HttpGet(resourcePath);
getRequest.addHeader("Content-Type", "application/json");
- String userPass = "admin" + ":" + "admin";
+ String userPass = getUsernamePassword();
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
getRequest.addHeader("Authorization", basicAuth);
@@ -118,7 +118,7 @@ public class RestClient {
try {
httpDelete = new HttpDelete(resourcePath);
httpDelete.addHeader("Content-Type", "application/json");
- String userPass = "admin" + ":" + "admin";
+ String userPass = getUsernamePassword();
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
httpDelete.addHeader("Authorization", basicAuth);
return httpClient.execute(httpDelete, new HttpResponseHandler());
@@ -136,7 +136,7 @@ public class RestClient {
StringEntity input = new StringEntity(jsonParamString);
input.setContentType("application/json");
putRequest.setEntity(input);
- String userPass = "admin" + ":" + "admin";
+ String userPass = getUsernamePassword();
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
putRequest.addHeader("Authorization", basicAuth);
return httpClient.execute(putRequest, new HttpResponseHandler());
@@ -169,8 +169,9 @@ public class RestClient {
}
}
}
- log.error("An unknown error occurred while trying to add " + entityName);
- throw new RuntimeException("An unknown error occurred while trying to add" + entityName);
+ String msg = "An unknown error occurred while trying to add ";
+ log.error(msg + entityName);
+ throw new RuntimeException(msg + entityName);
} catch (Exception e) {
String message = "Could not add " + entityName;
log.error(message, e);
@@ -195,8 +196,9 @@ public class RestClient {
}
}
}
- log.error("An unknown error occurred while trying to deploy " + entityName);
- throw new RuntimeException("An unknown error occurred while trying to deploy " + entityName);
+ String msg = "An unknown error occurred while trying to deploy ";
+ log.error(msg + entityName);
+ throw new RuntimeException(msg + entityName);
} catch (Exception e) {
String message = "Could not deploy " + entityName;
log.error(message, e);
@@ -221,8 +223,9 @@ public class RestClient {
}
}
}
- log.error("An unknown error occurred while trying to deploy " + entityName);
- throw new RuntimeException("An unknown error occurred while trying to deploy " + entityName);
+ String msg = "An unknown error occurred while trying to undeploy ";
+ log.error(msg + entityName);
+ throw new RuntimeException(msg + entityName);
} catch (Exception e) {
String message = "Could not deploy " + entityName;
log.error(message, e);
@@ -308,8 +311,9 @@ public class RestClient {
}
}
}
- log.error("An unknown error occurred while trying to update " + entityName);
- throw new RuntimeException("An unknown error occurred while trying to update" + entityName);
+ String msg = "An unknown error occurred while trying to update ";
+ log.error(msg + entityName);
+ throw new RuntimeException(msg + entityName);
} catch (Exception e) {
String message = "Could not add " + entityName;
log.error(message, e);
@@ -317,23 +321,37 @@ public class RestClient {
}
}
+ /**
+ * Get the json string from the artifacts directory
+ *
+ * @param filePath path of the artifacts
+ * @return json string of the relevant artifact
+ * @throws FileNotFoundException
+ */
public String getJsonStringFromFile(String filePath) throws FileNotFoundException {
JsonParser parser = new JsonParser();
Object object = parser.parse(new FileReader(getResourcesFolderPath() + filePath));
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
- String content = gson.toJson(object);
- return content;
-
+ return gson.toJson(object);
}
/**
* Get resources folder path
*
- * @return
+ * @return the resource path
*/
private String getResourcesFolderPath() {
String path = getClass().getResource("/").getPath();
return StringUtils.removeEnd(path, File.separator);
}
+
+ /**
+ * Get the username and password
+ *
+ * @return username:password
+ */
+ private String getUsernamePassword() {
+ return this.userName + ":" + this.password;
+ }
}
[03/12] stratos git commit: refining the resources to have the
samples with the reference of the test case
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0.json
deleted file mode 100644
index 4bcef26..0000000
--- a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "id": "autoscaling-policy-c0",
- "loadThresholds": {
- "requestsInFlight": {
- "threshold": 35
- },
- "memoryConsumption": {
- "threshold": 45
- },
- "loadAverage": {
- "threshold": 25
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0-v1.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0-v1.json
new file mode 100644
index 0000000..31c2b84
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0-v1.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscaling-policy-c0",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 30
+ },
+ "memoryConsumption": {
+ "threshold": 40
+ },
+ "loadAverage": {
+ "threshold": 20
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0.json
new file mode 100644
index 0000000..4bcef26
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-c0.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscaling-policy-c0",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 35
+ },
+ "memoryConsumption": {
+ "threshold": 45
+ },
+ "loadAverage": {
+ "threshold": 25
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6-v1.json b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6-v1.json
new file mode 100644
index 0000000..c0132f0
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6-v1.json
@@ -0,0 +1,50 @@
+{
+ "name": "G4",
+ "dependencies": {
+ "terminationBehaviour": "terminate-none",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group2",
+ "cartridge.c1-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c4"
+ ],
+ "groups": [
+ {
+ "name": "G5",
+ "dependencies": {
+ "terminationBehaviour": "terminate-dependents",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group6",
+ "cartridge.c5-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c5"
+ ],
+ "groups": [
+ {
+ "name": "G6",
+ "dependencies": {
+ "terminationBehaviour": "terminate-all",
+ "startupOrders": []
+ },
+ "cartridges": [
+ "c6"
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6.json b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6.json
new file mode 100644
index 0000000..ef28723
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges-groups/g4-g5-g6.json
@@ -0,0 +1,50 @@
+{
+ "name": "G4",
+ "dependencies": {
+ "terminationBehaviour": "terminate-none",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group5",
+ "cartridge.c4-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c4"
+ ],
+ "groups": [
+ {
+ "name": "G5",
+ "dependencies": {
+ "terminationBehaviour": "terminate-dependents",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group6",
+ "cartridge.c5-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c5"
+ ],
+ "groups": [
+ {
+ "name": "G6",
+ "dependencies": {
+ "terminationBehaviour": "terminate-all",
+ "startupOrders": []
+ },
+ "cartridges": [
+ "c6"
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c4.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c4.json b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c4.json
new file mode 100755
index 0000000..ec7d8b2
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c4.json
@@ -0,0 +1,45 @@
+{
+ "type": "c4",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c4",
+ "description": "c4 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"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c5.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c5.json b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c5.json
new file mode 100755
index 0000000..0e438fd
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c5.json
@@ -0,0 +1,124 @@
+{
+ "category": "Application",
+ "description": "c5 Cartridge",
+ "displayName": "c5",
+ "host": "qmog.cisco.com",
+ "iaasProvider": [
+ {
+ "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9dde0f",
+ "maxInstanceLimit": "4",
+ "networkInterfaces": [
+ {
+ "floatingNetworks": [
+ {
+ "name": "public",
+ "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc211af6"
+ }
+ ],
+ "name": "core",
+ "networkUuid": "5e107fbd-4820-47ad-84ea-6f135496f889"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb809"
+ },
+ {
+ "name": "keyPair",
+ "value": "phoenix"
+ },
+ {
+ "name": "autoAssignIp",
+ "value": "false"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default"
+ }
+ ],
+ "type": "mock"
+ }
+ ],
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "port": "22",
+ "protocol": "http",
+ "proxyPort": "8280"
+ }
+ ],
+ "property": [
+ {
+ "name": "payload_parameter.MB_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.MB_PORT",
+ "value": "61616"
+ },
+ {
+ "name": "payload_parameter.CEP_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.CEP_PORT",
+ "value": "7611"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_PASSWORD",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CERT_TRUSTSTORE",
+ "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
+ },
+ {
+ "name": "payload_parameter.TRUSTSTORE_PASSWORD",
+ "value": "wso2carbon"
+ },
+ {
+ "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
+ "value": "false"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_PORT",
+ "value": "7611"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
+ "value": "7711"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.QTCM_DNS_SEGMENT",
+ "value": "test"
+ },
+ {
+ "name": "payload_parameter.QTCM_NETWORK_COUNT",
+ "value": "1"
+ },
+ {
+ "name": "payload_parameter.SIMPLE_PROPERTY",
+ "value": "value"
+ }
+ ],
+ "provider": "cisco",
+ "type": "c5",
+ "version": "1.0"
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c6.json b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c6.json
new file mode 100755
index 0000000..8f41441
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridge-group-test/cartridges/mock/c6.json
@@ -0,0 +1,45 @@
+{
+ "type": "c6",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c6",
+ "description": "c6 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"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0-v1.json b/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0-v1.json
new file mode 100755
index 0000000..6d922a9
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0-v1.json
@@ -0,0 +1,124 @@
+{
+ "category": "Data",
+ "description": "c0 Cartridge",
+ "displayName": "c0",
+ "host": "qmog.cisco.com12",
+ "iaasProvider": [
+ {
+ "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9d123",
+ "maxInstanceLimit": "4",
+ "networkInterfaces": [
+ {
+ "floatingNetworks": [
+ {
+ "name": "private",
+ "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc2112121"
+ }
+ ],
+ "name": "core1",
+ "networkUuid": "5e107fbd-4820-47ad-84ea-6f1354961212"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb812"
+ },
+ {
+ "name": "keyPair",
+ "value": "phoenix12"
+ },
+ {
+ "name": "autoAssignIp",
+ "value": "true"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default123"
+ }
+ ],
+ "type": "mock"
+ }
+ ],
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "port": "22",
+ "protocol": "http",
+ "proxyPort": "8280"
+ }
+ ],
+ "property": [
+ {
+ "name": "payload_parameter.MB_IP",
+ "value": "octl.qmog.cisco.com123"
+ },
+ {
+ "name": "payload_parameter.MB_PORT",
+ "value": "61617"
+ },
+ {
+ "name": "payload_parameter.CEP_IP",
+ "value": "octl.qmog.cisco.com123"
+ },
+ {
+ "name": "payload_parameter.CEP_PORT",
+ "value": "7612"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_PASSWORD",
+ "value": "admin123"
+ },
+ {
+ "name": "payload_parameter.CERT_TRUSTSTORE",
+ "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
+ },
+ {
+ "name": "payload_parameter.TRUSTSTORE_PASSWORD",
+ "value": "wso2carbon"
+ },
+ {
+ "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
+ "value": "false"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_IP",
+ "value": "octl.qmog.cisco.com123"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_PORT",
+ "value": "7612"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
+ "value": "7712"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
+ "value": "admin123"
+ },
+ {
+ "name": "payload_parameter.QTCM_DNS_SEGMENT",
+ "value": "test123"
+ },
+ {
+ "name": "payload_parameter.QTCM_NETWORK_COUNT",
+ "value": "3"
+ },
+ {
+ "name": "payload_parameter.SIMPLE_PROPERTY",
+ "value": "value"
+ }
+ ],
+ "provider": "apache",
+ "type": "c0",
+ "version": "1.0"
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0.json b/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0.json
new file mode 100755
index 0000000..44066e1
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridge-test/cartridges/mock/c0.json
@@ -0,0 +1,124 @@
+{
+ "category": "Application",
+ "description": "c0 Cartridge",
+ "displayName": "c0",
+ "host": "qmog.cisco.com",
+ "iaasProvider": [
+ {
+ "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9dde0f",
+ "maxInstanceLimit": "4",
+ "networkInterfaces": [
+ {
+ "floatingNetworks": [
+ {
+ "name": "public",
+ "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc211af6"
+ }
+ ],
+ "name": "core",
+ "networkUuid": "5e107fbd-4820-47ad-84ea-6f135496f889"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb809"
+ },
+ {
+ "name": "keyPair",
+ "value": "phoenix"
+ },
+ {
+ "name": "autoAssignIp",
+ "value": "false"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default"
+ }
+ ],
+ "type": "mock"
+ }
+ ],
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "port": "22",
+ "protocol": "http",
+ "proxyPort": "8280"
+ }
+ ],
+ "property": [
+ {
+ "name": "payload_parameter.MB_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.MB_PORT",
+ "value": "61616"
+ },
+ {
+ "name": "payload_parameter.CEP_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.CEP_PORT",
+ "value": "7611"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_PASSWORD",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CERT_TRUSTSTORE",
+ "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
+ },
+ {
+ "name": "payload_parameter.TRUSTSTORE_PASSWORD",
+ "value": "wso2carbon"
+ },
+ {
+ "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
+ "value": "false"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_PORT",
+ "value": "7611"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
+ "value": "7711"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.QTCM_DNS_SEGMENT",
+ "value": "test"
+ },
+ {
+ "name": "payload_parameter.QTCM_NETWORK_COUNT",
+ "value": "1"
+ },
+ {
+ "name": "payload_parameter.SIMPLE_PROPERTY",
+ "value": "value"
+ }
+ ],
+ "provider": "cisco",
+ "type": "c0",
+ "version": "1.0"
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json
deleted file mode 100644
index 6020e1e..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "name": "G1",
- "dependencies": {
- "terminationBehaviour": "terminate-none",
- "startupOrders": [
- {
- "aliases": [
- "group.group2",
- "cartridge.c1-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c1"
- ],
- "groups": [
- {
- "name": "G2",
- "dependencies": {
- "terminationBehaviour": "terminate-dependents",
- "startupOrders": [
- {
- "aliases": [
- "group.group3",
- "cartridge.c2-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c2"
- ],
- "groups": [
- {
- "name": "G3",
- "dependencies": {
- "terminationBehaviour": "terminate-all",
- "startupOrders": []
- },
- "cartridges": [
- "c3"
- ],
- "groups": []
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested.json
deleted file mode 100644
index 6020e1e..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "name": "G1",
- "dependencies": {
- "terminationBehaviour": "terminate-none",
- "startupOrders": [
- {
- "aliases": [
- "group.group2",
- "cartridge.c1-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c1"
- ],
- "groups": [
- {
- "name": "G2",
- "dependencies": {
- "terminationBehaviour": "terminate-dependents",
- "startupOrders": [
- {
- "aliases": [
- "group.group3",
- "cartridge.c2-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c2"
- ],
- "groups": [
- {
- "name": "G3",
- "dependencies": {
- "terminationBehaviour": "terminate-all",
- "startupOrders": []
- },
- "cartridges": [
- "c3"
- ],
- "groups": []
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json
deleted file mode 100644
index c0132f0..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "name": "G4",
- "dependencies": {
- "terminationBehaviour": "terminate-none",
- "startupOrders": [
- {
- "aliases": [
- "group.group2",
- "cartridge.c1-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c4"
- ],
- "groups": [
- {
- "name": "G5",
- "dependencies": {
- "terminationBehaviour": "terminate-dependents",
- "startupOrders": [
- {
- "aliases": [
- "group.group6",
- "cartridge.c5-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c5"
- ],
- "groups": [
- {
- "name": "G6",
- "dependencies": {
- "terminationBehaviour": "terminate-all",
- "startupOrders": []
- },
- "cartridges": [
- "c6"
- ],
- "groups": []
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json
deleted file mode 100644
index ef28723..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "name": "G4",
- "dependencies": {
- "terminationBehaviour": "terminate-none",
- "startupOrders": [
- {
- "aliases": [
- "group.group5",
- "cartridge.c4-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c4"
- ],
- "groups": [
- {
- "name": "G5",
- "dependencies": {
- "terminationBehaviour": "terminate-dependents",
- "startupOrders": [
- {
- "aliases": [
- "group.group6",
- "cartridge.c5-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c5"
- ],
- "groups": [
- {
- "name": "G6",
- "dependencies": {
- "terminationBehaviour": "terminate-all",
- "startupOrders": []
- },
- "cartridges": [
- "c6"
- ],
- "groups": []
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json
deleted file mode 100755
index 6d922a9..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json
+++ /dev/null
@@ -1,124 +0,0 @@
-{
- "category": "Data",
- "description": "c0 Cartridge",
- "displayName": "c0",
- "host": "qmog.cisco.com12",
- "iaasProvider": [
- {
- "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9d123",
- "maxInstanceLimit": "4",
- "networkInterfaces": [
- {
- "floatingNetworks": [
- {
- "name": "private",
- "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc2112121"
- }
- ],
- "name": "core1",
- "networkUuid": "5e107fbd-4820-47ad-84ea-6f1354961212"
- }
- ],
- "property": [
- {
- "name": "instanceType",
- "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb812"
- },
- {
- "name": "keyPair",
- "value": "phoenix12"
- },
- {
- "name": "autoAssignIp",
- "value": "true"
- },
- {
- "name": "securityGroups",
- "value": "default123"
- }
- ],
- "type": "mock"
- }
- ],
- "multiTenant": "false",
- "portMapping": [
- {
- "port": "22",
- "protocol": "http",
- "proxyPort": "8280"
- }
- ],
- "property": [
- {
- "name": "payload_parameter.MB_IP",
- "value": "octl.qmog.cisco.com123"
- },
- {
- "name": "payload_parameter.MB_PORT",
- "value": "61617"
- },
- {
- "name": "payload_parameter.CEP_IP",
- "value": "octl.qmog.cisco.com123"
- },
- {
- "name": "payload_parameter.CEP_PORT",
- "value": "7612"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_PASSWORD",
- "value": "admin123"
- },
- {
- "name": "payload_parameter.CERT_TRUSTSTORE",
- "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
- },
- {
- "name": "payload_parameter.TRUSTSTORE_PASSWORD",
- "value": "wso2carbon"
- },
- {
- "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
- "value": "false"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_IP",
- "value": "octl.qmog.cisco.com123"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_PORT",
- "value": "7612"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
- "value": "7712"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
- "value": "admin123"
- },
- {
- "name": "payload_parameter.QTCM_DNS_SEGMENT",
- "value": "test123"
- },
- {
- "name": "payload_parameter.QTCM_NETWORK_COUNT",
- "value": "3"
- },
- {
- "name": "payload_parameter.SIMPLE_PROPERTY",
- "value": "value"
- }
- ],
- "provider": "apache",
- "type": "c0",
- "version": "1.0"
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0.json
deleted file mode 100755
index 44066e1..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0.json
+++ /dev/null
@@ -1,124 +0,0 @@
-{
- "category": "Application",
- "description": "c0 Cartridge",
- "displayName": "c0",
- "host": "qmog.cisco.com",
- "iaasProvider": [
- {
- "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9dde0f",
- "maxInstanceLimit": "4",
- "networkInterfaces": [
- {
- "floatingNetworks": [
- {
- "name": "public",
- "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc211af6"
- }
- ],
- "name": "core",
- "networkUuid": "5e107fbd-4820-47ad-84ea-6f135496f889"
- }
- ],
- "property": [
- {
- "name": "instanceType",
- "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb809"
- },
- {
- "name": "keyPair",
- "value": "phoenix"
- },
- {
- "name": "autoAssignIp",
- "value": "false"
- },
- {
- "name": "securityGroups",
- "value": "default"
- }
- ],
- "type": "mock"
- }
- ],
- "multiTenant": "false",
- "portMapping": [
- {
- "port": "22",
- "protocol": "http",
- "proxyPort": "8280"
- }
- ],
- "property": [
- {
- "name": "payload_parameter.MB_IP",
- "value": "octl.qmog.cisco.com"
- },
- {
- "name": "payload_parameter.MB_PORT",
- "value": "61616"
- },
- {
- "name": "payload_parameter.CEP_IP",
- "value": "octl.qmog.cisco.com"
- },
- {
- "name": "payload_parameter.CEP_PORT",
- "value": "7611"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_PASSWORD",
- "value": "admin"
- },
- {
- "name": "payload_parameter.CERT_TRUSTSTORE",
- "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
- },
- {
- "name": "payload_parameter.TRUSTSTORE_PASSWORD",
- "value": "wso2carbon"
- },
- {
- "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
- "value": "false"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_IP",
- "value": "octl.qmog.cisco.com"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_PORT",
- "value": "7611"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
- "value": "7711"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
- "value": "admin"
- },
- {
- "name": "payload_parameter.QTCM_DNS_SEGMENT",
- "value": "test"
- },
- {
- "name": "payload_parameter.QTCM_NETWORK_COUNT",
- "value": "1"
- },
- {
- "name": "payload_parameter.SIMPLE_PROPERTY",
- "value": "value"
- }
- ],
- "provider": "cisco",
- "type": "c0",
- "version": "1.0"
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c1.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c1.json
deleted file mode 100755
index 145e2ce..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c1.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "type": "c1",
- "provider": "apache",
- "host": "stratos.apache.org",
- "category": "data",
- "displayName": "c1",
- "description": "c1 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"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c2.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c2.json
deleted file mode 100755
index fd85892..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c2.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "type": "c2",
- "provider": "apache",
- "host": "stratos.apache.org",
- "category": "data",
- "displayName": "c2",
- "description": "c2 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"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c3.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c3.json
deleted file mode 100755
index 937e8d3..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c3.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "type": "c3",
- "provider": "apache",
- "host": "stratos.apache.org",
- "category": "data",
- "displayName": "c3",
- "description": "c3 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"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json
deleted file mode 100755
index ec7d8b2..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "type": "c4",
- "provider": "apache",
- "host": "stratos.apache.org",
- "category": "data",
- "displayName": "c4",
- "description": "c4 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"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json
deleted file mode 100755
index 0e438fd..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json
+++ /dev/null
@@ -1,124 +0,0 @@
-{
- "category": "Application",
- "description": "c5 Cartridge",
- "displayName": "c5",
- "host": "qmog.cisco.com",
- "iaasProvider": [
- {
- "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9dde0f",
- "maxInstanceLimit": "4",
- "networkInterfaces": [
- {
- "floatingNetworks": [
- {
- "name": "public",
- "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc211af6"
- }
- ],
- "name": "core",
- "networkUuid": "5e107fbd-4820-47ad-84ea-6f135496f889"
- }
- ],
- "property": [
- {
- "name": "instanceType",
- "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb809"
- },
- {
- "name": "keyPair",
- "value": "phoenix"
- },
- {
- "name": "autoAssignIp",
- "value": "false"
- },
- {
- "name": "securityGroups",
- "value": "default"
- }
- ],
- "type": "mock"
- }
- ],
- "multiTenant": "false",
- "portMapping": [
- {
- "port": "22",
- "protocol": "http",
- "proxyPort": "8280"
- }
- ],
- "property": [
- {
- "name": "payload_parameter.MB_IP",
- "value": "octl.qmog.cisco.com"
- },
- {
- "name": "payload_parameter.MB_PORT",
- "value": "61616"
- },
- {
- "name": "payload_parameter.CEP_IP",
- "value": "octl.qmog.cisco.com"
- },
- {
- "name": "payload_parameter.CEP_PORT",
- "value": "7611"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_PASSWORD",
- "value": "admin"
- },
- {
- "name": "payload_parameter.CERT_TRUSTSTORE",
- "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
- },
- {
- "name": "payload_parameter.TRUSTSTORE_PASSWORD",
- "value": "wso2carbon"
- },
- {
- "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
- "value": "false"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_IP",
- "value": "octl.qmog.cisco.com"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_PORT",
- "value": "7611"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
- "value": "7711"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
- "value": "admin"
- },
- {
- "name": "payload_parameter.QTCM_DNS_SEGMENT",
- "value": "test"
- },
- {
- "name": "payload_parameter.QTCM_NETWORK_COUNT",
- "value": "1"
- },
- {
- "name": "payload_parameter.SIMPLE_PROPERTY",
- "value": "value"
- }
- ],
- "provider": "cisco",
- "type": "c5",
- "version": "1.0"
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json
deleted file mode 100755
index 8f41441..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "type": "c6",
- "provider": "apache",
- "host": "stratos.apache.org",
- "category": "data",
- "displayName": "c6",
- "description": "c6 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"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json
deleted file mode 100644
index 2ba5eb3..0000000
--- a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "id": "deployment-policy-1",
- "networkPartitions": [
- {
- "id": "network-partition-1",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "partitionMax": 25
- },
- {
- "id": "partition-2",
- "partitionMax": 20
- }
- ]
- },
- {
- "id": "network-partition-2",
- "partitionAlgo": "round-robin",
- "partitions": [
- {
- "id": "network-partition-2-partition-1",
- "partitionMax": 15
- },
- {
- "id": "network-partition-2-partition-2",
- "partitionMax": 5
- }
- ]
- }
- ]
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1.json
deleted file mode 100644
index e186690..0000000
--- a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "id": "deployment-policy-1",
- "networkPartitions": [
- {
- "id": "network-partition-1",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "partitionMax": 20
- }
- ]
- },
- {
- "id": "network-partition-2",
- "partitionAlgo": "round-robin",
- "partitions": [
- {
- "id": "network-partition-2-partition-1",
- "partitionMax": 10
- },
- {
- "id": "network-partition-2-partition-2",
- "partitionMax": 9
- }
- ]
- }
- ]
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json
deleted file mode 100644
index b5c305c..0000000
--- a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "id": "deployment-policy-2",
- "networkPartitions": [
- {
- "id": "network-partition-5",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "partitionMax": 25
- },
- {
- "id": "partition-2",
- "partitionMax": 20
- }
- ]
- },
- {
- "id": "network-partition-6",
- "partitionAlgo": "round-robin",
- "partitions": [
- {
- "id": "network-partition-6-partition-1",
- "partitionMax": 15
- },
- {
- "id": "network-partition-6-partition-2",
- "partitionMax": 5
- }
- ]
- }
- ]
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json
deleted file mode 100644
index 5df3e24..0000000
--- a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "id": "deployment-policy-2",
- "networkPartitions": [
- {
- "id": "network-partition-5",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "partitionMax": 20
- }
- ]
- },
- {
- "id": "network-partition-6",
- "partitionAlgo": "round-robin",
- "partitions": [
- {
- "id": "network-partition-6-partition-1",
- "partitionMax": 10
- },
- {
- "id": "network-partition-6-partition-2",
- "partitionMax": 9
- }
- ]
- }
- ]
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json
deleted file mode 100644
index d024922..0000000
--- a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "id": "deployment-policy-1",
- "networkPartitions": [
- {
- "id": "network-partition-3",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "partitionMax": 20
- }
- ]
- },
- {
- "id": "network-partition-4",
- "partitionAlgo": "round-robin",
- "partitions": [
- {
- "id": "network-partition-2-partition-1",
- "partitionMax": 10
- },
- {
- "id": "network-partition-2-partition-2",
- "partitionMax": 9
- }
- ]
- }
- ]
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2-v1.json b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2-v1.json
new file mode 100644
index 0000000..b5c305c
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2-v1.json
@@ -0,0 +1,36 @@
+{
+ "id": "deployment-policy-2",
+ "networkPartitions": [
+ {
+ "id": "network-partition-5",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 25
+ },
+ {
+ "id": "partition-2",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-6",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-6-partition-1",
+ "partitionMax": 15
+ },
+ {
+ "id": "network-partition-6-partition-2",
+ "partitionMax": 5
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2.json b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2.json
new file mode 100644
index 0000000..5df3e24
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-2.json
@@ -0,0 +1,32 @@
+{
+ "id": "deployment-policy-2",
+ "networkPartitions": [
+ {
+ "id": "network-partition-5",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-6",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-6-partition-1",
+ "partitionMax": 10
+ },
+ {
+ "id": "network-partition-6-partition-2",
+ "partitionMax": 9
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5-v1.json b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5-v1.json
new file mode 100644
index 0000000..275b536
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5-v1.json
@@ -0,0 +1,28 @@
+{
+ "id": "network-partition-5",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default1"
+ },
+ {
+ "name": "zone",
+ "value": "z1"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5.json b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5.json
new file mode 100644
index 0000000..5464aa9
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-5.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-5",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-6.json b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-6.json
new file mode 100644
index 0000000..d200b70
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/network-partitions/mock/network-partition-6.json
@@ -0,0 +1,24 @@
+{
+ "id": "network-partition-6",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "network-partition-6-partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "network-partition-6-partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3-v1.json b/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3-v1.json
new file mode 100644
index 0000000..c7d4733
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3-v1.json
@@ -0,0 +1,28 @@
+{
+ "id": "network-partition-3",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default1"
+ },
+ {
+ "name": "zone",
+ "value": "z1"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3.json b/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3.json
new file mode 100644
index 0000000..1bb7f2a
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partition-test/network-partitions/mock/network-partition-3.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-3",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json
deleted file mode 100644
index 054265a..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "id": "network-partition-1",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "partition-2",
- "property": [
- {
- "name": "region",
- "value": "default1"
- },
- {
- "name": "zone",
- "value": "z1"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1.json
deleted file mode 100644
index 466da28..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-1",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-2.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-2.json
deleted file mode 100644
index 23236e2..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-2.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "id": "network-partition-2",
- "provider": "mock",
- "partitions": [
- {
- "id": "network-partition-2-partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "network-partition-2-partition-2",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json
deleted file mode 100644
index c7d4733..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "id": "network-partition-3",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "partition-2",
- "property": [
- {
- "name": "region",
- "value": "default1"
- },
- {
- "name": "zone",
- "value": "z1"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3.json
deleted file mode 100644
index 1bb7f2a..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-3",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json
deleted file mode 100644
index 275b536..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "id": "network-partition-5",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "partition-2",
- "property": [
- {
- "name": "region",
- "value": "default1"
- },
- {
- "name": "zone",
- "value": "z1"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json
deleted file mode 100644
index 5464aa9..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-5",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json
deleted file mode 100644
index d200b70..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "id": "network-partition-6",
- "provider": "mock",
- "partitions": [
- {
- "id": "network-partition-6-partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "network-partition-6-partition-2",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json
deleted file mode 100644
index 6250504..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-7",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json
deleted file mode 100644
index 354b837..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "id": "network-partition-8",
- "provider": "mock",
- "partitions": [
- {
- "id": "network-partition-8-partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "network-partition-8-partition-2",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/application-policies/application-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/application-policies/application-policy-1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/application-policies/application-policy-1.json
new file mode 100644
index 0000000..17858bb
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/application-policies/application-policy-1.json
@@ -0,0 +1,18 @@
+{
+ "id": "application-policy-1",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-1",
+ "network-partition-2"
+ ],
+ "properties": [
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-1,network-partition-2"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v1.json
new file mode 100644
index 0000000..ff332c0
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v1.json
@@ -0,0 +1,86 @@
+{
+ "alias": "g-sc-G123-1",
+ "applicationId": "g-sc-G123-1",
+ "components": {
+ "cartridges": [],
+ "groups": [
+ {
+ "name": "G1",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group1",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c1",
+ "subscribableInfo": {
+ "alias": "c1-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group2",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "type": "c2",
+ "subscribableInfo": {
+ "alias": "c2-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "groupMaxInstances": 3,
+ "groupMinInstances": 2,
+ "deploymentPolicy": "static-1",
+ "alias": "group3",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c3",
+ "subscribableInfo": {
+ "alias": "c3-1x0",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
[08/12] stratos git commit: fixing path issue for test cases
Posted by re...@apache.org.
fixing path issue for test cases
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5bdc2f8b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5bdc2f8b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5bdc2f8b
Branch: refs/heads/master
Commit: 5bdc2f8b1903e64c9c5d7ea8ed32526019e63197
Parents: ce00b95
Author: reka <rt...@gmail.com>
Authored: Thu Aug 6 19:08:20 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Aug 6 19:33:43 2015 +0530
----------------------------------------------------------------------
.../stratos/integration/tests/ApplicationPolicyTest.java | 6 +++---
.../stratos/integration/tests/AutoscalingPolicyTest.java | 4 ++--
.../org/apache/stratos/integration/tests/CartridgeTest.java | 4 ++--
.../stratos/modules/integration/src/test/resources/testng.xml | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/5bdc2f8b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
index cc9f976..635931e 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
@@ -43,17 +43,17 @@ public class ApplicationPolicyTest extends StratosTestServerManager {
String applicationPolicyId = "application-policy-2";
log.info("Started Application policy test case**************************************");
- boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN1 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-7" + ".json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN1, true);
- boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN2 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-8" + ".json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN2, true);
- boolean addedDep = restClient.addEntity(RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ boolean addedDep = restClient.addEntity(TEST_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
applicationPolicyId + ".json",
RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
assertEquals(addedDep, true);
http://git-wip-us.apache.org/repos/asf/stratos/blob/5bdc2f8b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
index bcacfc8..c4b52f6 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
@@ -39,7 +39,7 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
log.info("Started autoscaling policy test case**************************************");
String policyId = "autoscaling-policy-c0";
try {
- boolean added = restClient.addEntity(RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json",
+ boolean added = restClient.addEntity(TEST_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json",
RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), added, true);
@@ -56,7 +56,7 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0);
- boolean updated = restClient.updateEntity(RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
+ boolean updated = restClient.updateEntity(TEST_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(String.format("[autoscaling-policy-id] %s update failed", policyId), updated, true);
http://git-wip-us.apache.org/repos/asf/stratos/blob/5bdc2f8b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
index 638d742..21171ff 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
@@ -42,7 +42,7 @@ public class CartridgeTest extends StratosTestServerManager {
try {
String cartridgeType = "c0";
- boolean added = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" +
+ boolean added = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" +
cartridgeType + ".json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(added, true);
@@ -76,7 +76,7 @@ public class CartridgeTest extends StratosTestServerManager {
}
- boolean updated = restClient.updateEntity(RestConstants.CARTRIDGES_PATH + "/" +
+ boolean updated = restClient.updateEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" +
cartridgeType + "-v1.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(updated, true);
http://git-wip-us.apache.org/repos/asf/stratos/blob/5bdc2f8b/products/stratos/modules/integration/src/test/resources/testng.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/testng.xml b/products/stratos/modules/integration/src/test/resources/testng.xml
index 3ea5a01..849a282 100644
--- a/products/stratos/modules/integration/src/test/resources/testng.xml
+++ b/products/stratos/modules/integration/src/test/resources/testng.xml
@@ -57,10 +57,10 @@
<class name="org.apache.stratos.integration.tests.SampleApplicationsTest" />
</classes>
</test>
- <!--test name="ApplicationBurstingTest">
+ <test name="ApplicationBurstingTest">
<classes>
<class name="org.apache.stratos.integration.tests.ApplicationBurstingTest" />
</classes>
- </test-->
+ </test>
</suite>
[12/12] stratos git commit: Introducing stratos integration test
suite for the artifacts
Posted by re...@apache.org.
Introducing stratos integration test suite for the artifacts
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5b844043
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5b844043
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5b844043
Branch: refs/heads/master
Commit: 5b844043cd0572fd2dff3e31fd7ac525ac69beac
Parents: 08b9696
Author: reka <rt...@gmail.com>
Authored: Thu Aug 6 16:45:23 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Aug 6 19:33:43 2015 +0530
----------------------------------------------------------------------
products/stratos/modules/integration/pom.xml | 3 +
.../tests/ApplicationBurstingTest.java | 37 +
.../tests/ApplicationPolicyTest.java | 111 +-
.../integration/tests/ApplicationTest.java | 55 +-
.../tests/AutoscalingPolicyTest.java | 70 +-
.../integration/tests/CartridgeGroupTest.java | 110 +-
.../integration/tests/CartridgeTest.java | 116 +-
.../integration/tests/DeploymentPolicyTest.java | 139 ++-
.../integration/tests/NetworkPartitionTest.java | 74 +-
.../integration/tests/RestConstants.java | 15 +
.../tests/SampleApplicationsTest.java | 1111 +++---------------
.../tests/StratosTestServerManager.java | 6 +
.../integration/tests/TopologyHandler.java | 394 +++++++
.../tests/config/ApplicationBean.java | 25 +
.../tests/config/ApplicationConfigParser.java | 25 +
.../integration/tests/rest/RestClient.java | 2 +-
.../application-policy-2.json | 18 +
.../single-cartridge-app/g-sc-G123-1-v1.json | 86 ++
.../single-cartridge-app/g-sc-G123-1-v2.json | 86 ++
.../single-cartridge-app/g-sc-G123-1-v3.json | 86 ++
.../update/g-sc-G123-1-v1.json | 86 --
.../update/g-sc-G123-1.json | 86 --
.../autoscaling-policy-c0-v1.json | 14 +
.../update/autoscaling-policy-c0.json | 14 -
.../cartridges-groups/cartrdige-nested-v1.json | 50 +
.../cartridges-groups/g4-g5-g6-v1.json | 50 +
.../resources/cartridges-groups/g4-g5-g6.json | 50 +
.../update/cartrdige-nested.json | 50 -
.../test/resources/cartridges/mock/c0-v1.json | 124 ++
.../src/test/resources/cartridges/mock/c4.json | 45 +
.../src/test/resources/cartridges/mock/c5.json | 124 ++
.../src/test/resources/cartridges/mock/c6.json | 45 +
.../resources/cartridges/mock/update/c0.json | 124 --
.../deployment-policy-1-v1.json | 36 +
.../deployment-policy-2-v1.json | 36 +
.../deployment-policy-2.json | 32 +
.../deployment-policy-3.json | 32 +
.../update/deployment-policy-1.json | 36 -
.../ec2/network-partition-1.json | 19 -
.../ec2/network-partition-2.json | 19 -
.../gce/network-partition-1.json | 15 -
.../kubernetes/network-partition-1.json | 15 -
.../kubernetes/network-partition-2.json | 15 -
.../kubernetes/network-partition-3.json | 15 -
.../mock/network-partition-1-v1.json | 28 +
.../mock/network-partition-3-v1.json | 28 +
.../mock/network-partition-4.json | 15 -
.../mock/network-partition-5-v1.json | 28 +
.../mock/network-partition-5.json | 15 +
.../mock/network-partition-6.json | 24 +
.../mock/network-partition-7.json | 15 +
.../mock/network-partition-8.json | 24 +
.../mock/update/network-partition-1.json | 28 -
.../multi/ap-southeast-1-nw-partition.json | 19 -
.../multi/ap-southeast-2-nw-partition.json | 25 -
.../multi/openstack-nw-partition.json | 21 -
.../openstack/network-partition-1.json | 15 -
.../openstack/network-partition-2.json | 15 -
.../integration/src/test/resources/testng.xml | 61 +
59 files changed, 2317 insertions(+), 1745 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/pom.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/pom.xml b/products/stratos/modules/integration/pom.xml
index bf2c684..ca92a8b 100755
--- a/products/stratos/modules/integration/pom.xml
+++ b/products/stratos/modules/integration/pom.xml
@@ -117,6 +117,9 @@
<extracted.dir>stratos-parent-${project.version}</extracted.dir>
<emma.home>${basedir}/target/emma</emma.home>
</systemProperties>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
+ </suiteXmlFiles>
<workingDirectory>${basedir}/target</workingDirectory>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java
new file mode 100644
index 0000000..cefd786
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+import org.apache.stratos.common.beans.application.ApplicationBean;
+import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+/**
+ * This will handle the application bursting test cases
+ */
+public class ApplicationBurstingTest extends StratosTestServerManager {
+
+ @Test
+ public void testApplication() {
+ assertTrue("test passes", true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
index dafa36e..b727e82 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
@@ -21,38 +21,109 @@ package org.apache.stratos.integration.tests;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.PropertyBean;
+import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
-import org.apache.stratos.integration.tests.rest.RestClient;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
/**
* Test to handle Network partition CRUD operations
*/
-public class ApplicationPolicyTest {
+public class ApplicationPolicyTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(ApplicationPolicyTest.class);
- private static final String applicationPolicies = "/application-policies/";
- private static final String applicationPoliciesUpdate = "/application-policies/update/";
- private static final String entityName = "applicationPolicy";
+ @Test
+ public void testApplicationPolicy() {
+ try {
+ String applicationPolicyId = "application-policy-2";
+ log.info("Started Application policy test case**************************************");
- public boolean addApplicationPolicy(String applicationPolicyId, RestClient restClient) {
- return restClient.addEntity(applicationPolicies + "/" + applicationPolicyId,
- RestConstants.APPLICATION_POLICIES, entityName);
- }
+ boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-7" + ".json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN1, true);
- public ApplicationPolicyBean getApplicationPolicy(String applicationPolicyId, RestClient restClient) {
+ boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-8" + ".json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN2, true);
- return (ApplicationPolicyBean) restClient.
- getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
- ApplicationPolicyBean.class, entityName);
- }
+ boolean addedDep = restClient.addEntity(RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ applicationPolicyId + ".json",
+ RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(addedDep, true);
- public boolean updateApplicationPolicy(String applicationPolicyId, RestClient restClient) {
- return restClient.updateEntity(applicationPoliciesUpdate + "/" + applicationPolicyId,
- RestConstants.APPLICATION_POLICIES, entityName);
+ ApplicationPolicyBean bean = (ApplicationPolicyBean) restClient.
+ getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+ ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(bean.getId(), applicationPolicyId);
+ assertEquals(String.format("The expected algorithm %s is not found in %s",
+ "one-after-another", applicationPolicyId), bean.getAlgorithm(), "one-after-another");
+ assertEquals(String.format("The expected id %s is not found",
+ applicationPolicyId), bean.getId(), applicationPolicyId);
+ assertEquals(String.format("The expected networkpartitions size %s is not found in %s",
+ 2, applicationPolicyId), bean.getNetworkPartitions().length, 2);
+ assertEquals(String.format("The first network partition is not %s in %s",
+ "network-partition-7", applicationPolicyId), bean.getNetworkPartitions()[0],
+ "network-partition-7");
+ assertEquals(String.format("The Second network partition is not %s in %s",
+ "network-partition-8", applicationPolicyId), bean.getNetworkPartitions()[1],
+ "network-partition-8");
+ boolean algoFound = false;
+ for (PropertyBean propertyBean : bean.getProperties()) {
+ if (propertyBean.getName().equals("networkPartitionGroups")) {
+ assertEquals(String.format("The networkPartitionGroups algorithm %s is not found in %s",
+ "network-partition-7,network-partition-8", applicationPolicyId),
+ propertyBean.getValue(), "network-partition-7,network-partition-8");
+ algoFound = true;
- }
+ }
+ }
+ if (!algoFound) {
+ assertTrue(String.format("The networkPartitionGroups property is not found in %s",
+ applicationPolicyId), false);
+ }
+
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-7", RestConstants.NETWORK_PARTITIONS_NAME);
+ //Trying to remove the used network partition
+ assertEquals(removedNet, false);
+
+ boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+ applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(removedDep, true);
+
+ ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClient.
+ getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+ ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(beanRemovedDep, null);
+
+ boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-7", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN1, true);
+
+ NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-7",
+ NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(beanRemovedN1, null);
+
+ boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-8", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN2, true);
+
+ NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-8",
+ NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(beanRemovedN2, null);
+
+ log.info("Ended deployment policy test case**************************************");
- public boolean removeApplicationPolicy(String applicationPolicyId, RestClient restClient) {
- return restClient.removeEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId, entityName);
+ } catch (Exception e) {
+ log.error("An error occurred while handling deployment policy", e);
+ assertTrue("An error occurred while handling deployment policy", false);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
index c886644..8ceec4d 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
@@ -16,61 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.stratos.integration.tests;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.beans.application.ApplicationBean;
-import org.apache.stratos.integration.tests.rest.RestClient;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationsEventReceiver;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
/**
- * Test to handle application CRUD operations, deploy and undeploy
+ * Super class for application test cases
*/
-public class ApplicationTest {
- private static final Log log = LogFactory.getLog(ApplicationTest.class);
- String applications = "/applications/simple/single-cartridge-app/";
- String applicationsUpdate = "/applications/simple/single-cartridge-app/update/";
- private static final String entityName = "application";
-
- public boolean addApplication(String applicationId, RestClient restClient) {
- return restClient.addEntity(applications + "/" + applicationId,
- RestConstants.APPLICATIONS, entityName);
- }
-
- public ApplicationBean getApplication(String applicationId,
- RestClient restClient) {
- return (ApplicationBean) restClient.
- getEntity(RestConstants.APPLICATIONS, applicationId,
- ApplicationBean.class, entityName);
- }
-
- public boolean updateApplication(String applicationId, RestClient restClient) {
- return restClient.updateEntity(applicationsUpdate + "/" + applicationId,
- RestConstants.APPLICATIONS, entityName);
- }
-
- public boolean removeApplication(String applicationId, RestClient restClient) {
- return restClient.removeEntity(RestConstants.APPLICATIONS, applicationId, entityName);
-
- }
-
- public boolean deployApplication(String applicationId, String applicationPolicyId,
- RestClient restClient) {
- return restClient.deployEntity(RestConstants.APPLICATIONS + "/" + applicationId +
- RestConstants.APPLICATIONS_DEPLOY + "/" + applicationPolicyId, entityName);
- }
-
- public boolean undeployApplication(String applicationId,
- RestClient restClient) {
- return restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + applicationId +
- RestConstants.APPLICATIONS_UNDEPLOY, entityName);
- }
-
- public boolean forceUndeployApplication(String applicationId,
- RestClient restClient) {
- return restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + applicationId +
- RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", entityName);
- }
+public class ApplicationTest extends StratosTestServerManager {
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
index 1c99cad..d841552 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
@@ -21,37 +21,67 @@ package org.apache.stratos.integration.tests;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
-import org.apache.stratos.integration.tests.rest.RestClient;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
/**
* Test to handle autoscaling policy CRUD operations
*/
-public class AutoscalingPolicyTest {
+public class AutoscalingPolicyTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(AutoscalingPolicyTest.class);
- private static final String autoscalingPolicy = "/autoscaling-policies/";
- private static final String autoscalingPolicyUpdate = "/autoscaling-policies/update/";
- private static final String entityName = "autoscalingPolicy";
- public boolean addAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
- return restClient.addEntity(autoscalingPolicy + "/" + autoscalingPolicyName,
- RestConstants.AUTOSCALING_POLICIES, entityName);
+ @Test
+ public void testAutoscalingPolicy() {
+ log.info("Started autoscaling policy test case**************************************");
+ String policyId = "autoscaling-policy-c0";
+ try {
+ boolean added = restClient.addEntity(RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
- }
+ assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), added, true);
+ AutoscalePolicyBean bean = (AutoscalePolicyBean) restClient.
+ getEntity(RestConstants.AUTOSCALING_POLICIES, policyId,
+ AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
- public AutoscalePolicyBean getAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
- return (AutoscalePolicyBean) restClient.
- getEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyName,
- AutoscalePolicyBean.class, entityName);
- }
+ assertEquals(String.format("[autoscaling-policy-id] %s is not correct", bean.getId()),
+ bean.getId(), policyId);
+ assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId),
+ bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 35.0, 0.0);
+ assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
+ bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 45.0, 0.0);
+ assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
+ bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0);
- public boolean updateAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
- return restClient.updateEntity(autoscalingPolicyUpdate + "/" + autoscalingPolicyName,
- RestConstants.AUTOSCALING_POLICIES, entityName);
+ boolean updated = restClient.updateEntity(RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
- }
+ assertEquals(String.format("[autoscaling-policy-id] %s update failed", policyId), updated, true);
+ AutoscalePolicyBean updatedBean = (AutoscalePolicyBean) restClient.getEntity(
+ RestConstants.AUTOSCALING_POLICIES, policyId,
+ AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId),
+ updatedBean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0);
+ assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
+ updatedBean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 0.0);
+ assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
+ updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
- public boolean removeAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
- return restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyName, entityName);
+ boolean removed = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+ policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
+ removed, true);
+ AutoscalePolicyBean beanRemoved = (AutoscalePolicyBean) restClient.getEntity(
+ RestConstants.AUTOSCALING_POLICIES, policyId,
+ AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
+ policyId), beanRemoved, null);
+ log.info("Ended autoscaling policy test case**************************************");
+ } catch (Exception e) {
+ log.error("An error occurred while handling [autoscaling policy] " + policyId, e);
+ assertTrue("An error occurred while handling [autoscaling policy] " + policyId, false);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
index 9aae646..8bc3a9e 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
@@ -22,35 +22,105 @@ package org.apache.stratos.integration.tests;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
-import org.apache.stratos.integration.tests.rest.RestClient;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
/**
* Test to handle Cartridge group CRUD operations
*/
-public class CartridgeGroupTest {
+public class CartridgeGroupTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(CartridgeGroupTest.class);
- private static final String cartridgeGroups = "/cartridges-groups/";
- private static final String cartridgeGroupsUpdate = "/cartridges-groups/update/";
- private static final String entityName = "cartridgeGroup";
- public boolean addCartridgeGroup(String groupName, RestClient restClient) {
- return restClient.addEntity(cartridgeGroups + "/" + groupName,
- RestConstants.CARTRIDGE_GROUPS, entityName);
- }
+ @Test
+ public void testCartridgeGroup() {
+ try {
+ log.info("Started Cartridge group test case**************************************");
- public CartridgeGroupBean getCartridgeGroup(String groupName, RestClient restClient) {
- return (CartridgeGroupBean) restClient.
- getEntity(RestConstants.CARTRIDGE_GROUPS, groupName,
- CartridgeGroupBean.class, entityName);
- }
+ boolean addedC1 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c4.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c4"), addedC1, true);
- public boolean updateCartridgeGroup(String groupName, RestClient restClient) {
- return restClient.updateEntity(cartridgeGroupsUpdate + "/" + groupName,
- RestConstants.CARTRIDGE_GROUPS, entityName);
- }
+ boolean addedC2 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c5.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c5"), addedC2, true);
+
+ boolean addedC3 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c6.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c6"), addedC3, true);
+
+ boolean added = restClient.addEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ "/" + "g4-g5-g6.json", RestConstants.CARTRIDGE_GROUPS,
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge Group did not added: [cartridge-group-name] %s",
+ "g4-g5-g6"), added, true);
+ CartridgeGroupBean bean = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "G4",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge Group name did not match: [cartridge-group-name] %s",
+ "g4-g5-g6.json"), bean.getName(), "G4");
+
+ boolean updated = restClient.updateEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ "/" + "g4-g5-g6-v1.json",
+ RestConstants.CARTRIDGE_GROUPS, RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge Group did not updated: [cartridge-group-name] %s",
+ "g4-g5-g6"), updated, true);
+ CartridgeGroupBean updatedBean = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "G4",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Updated Cartridge Group didn't match: [cartridge-group-name] %s",
+ "g4-g5-g6"), updatedBean.getName(), "G4");
+
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge can be removed while it is used in " +
+ "cartridge group: [cartridge-name] %s", "c4"), removedC1, false);
+
+ boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge can be removed while it is used in " +
+ "cartridge group: [cartridge-name] %s",
+ "c5"), removedC2, false);
+
+ boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge can be removed while it is used in " +
+ "cartridge group: [cartridge-name] %s",
+ "c6"), removedC3, false);
+
+ boolean removed = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G4",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge Group did not removed: [cartridge-group-name] %s",
+ "g4-g5-g6"), removed, true);
+
+ CartridgeGroupBean beanRemoved = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "G4",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge Group did not removed completely: " +
+ "[cartridge-group-name] %s",
+ "g4-g5-g6"), beanRemoved, null);
+
+ removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
+ "c4"), removedC1, true);
+
+ removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
+ "c5"), removedC2, true);
+
+ removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
+ "c6"), removedC3, true);
- public boolean removeCartridgeGroup(String groupName, RestClient restClient) {
- return restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, groupName, entityName);
+ log.info("Ended Cartridge group test case**************************************");
+ } catch (Exception e) {
+ log.error("An error occurred while handling Cartridge group test case", e);
+ assertTrue("An error occurred while handling Cartridge group test case", false);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
index 1d135dd..26eb881 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
@@ -21,38 +21,106 @@ package org.apache.stratos.integration.tests;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.PropertyBean;
import org.apache.stratos.common.beans.cartridge.CartridgeBean;
-import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
-import org.apache.stratos.integration.tests.rest.RestClient;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
/**
* Test to handle Cartridge CRUD operations
*/
-public class CartridgeTest {
+public class CartridgeTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(CartridgeTest.class);
- private static final String cartridges = "/cartridges/mock/";
- private static final String cartridgesUpdate = "/cartridges/mock/update/";
- private static final String entityName = "cartridge";
-
-
- public boolean addCartridge(String cartridgeType, RestClient restClient) {
- return restClient.addEntity(cartridges + "/" + cartridgeType,
- RestConstants.CARTRIDGES, entityName);
- }
- public CartridgeBean getCartridge(String cartridgeType,
- RestClient restClient) {
- return (CartridgeBean) restClient.
- getEntity(RestConstants.CARTRIDGES, cartridgeType,
- CartridgeBean.class, entityName);
- }
+ @Test
+ public void testCartridge() {
+ log.info("Started Cartridge test case**************************************");
- public boolean updateCartridge(String cartridgeType, RestClient restClient) {
- return restClient.updateEntity(cartridgesUpdate + "/" + cartridgeType,
- RestConstants.CARTRIDGES, entityName);
- }
+ try {
+ String cartridgeType = "c0";
+ boolean added = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" +
+ cartridgeType + ".json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(added, true);
+ CartridgeBean bean = (CartridgeBean) restClient.
+ getEntity(RestConstants.CARTRIDGES, cartridgeType,
+ CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+ assertEquals(bean.getCategory(), "Application");
+ assertEquals(bean.getHost(), "qmog.cisco.com");
+ for (PropertyBean property : bean.getProperty()) {
+ if (property.getName().equals("payload_parameter.CEP_IP")) {
+ assertEquals(property.getValue(), "octl.qmog.cisco.com");
+ } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
+ assertEquals(property.getValue(), "admin");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
+ assertEquals(property.getValue(), "octl.qmog.cisco.com");
+ } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
+ assertEquals(property.getValue(), "1");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
+ assertEquals(property.getValue(), "admin");
+ } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
+ assertEquals(property.getValue(), "test");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
+ assertEquals(property.getValue(), "7711");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
+ assertEquals(property.getValue(), "7611");
+ } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
+ assertEquals(property.getValue(), "7611");
+ } else if (property.getName().equals("payload_parameter.MB_PORT")) {
+ assertEquals(property.getValue(), "61616");
+ }
+ }
+
+
+ boolean updated = restClient.updateEntity(RestConstants.CARTRIDGES_PATH + "/" +
+ cartridgeType + "-v1.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(updated, true);
+ CartridgeBean updatedBean = (CartridgeBean) restClient.
+ getEntity(RestConstants.CARTRIDGES, cartridgeType,
+ CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+ assertEquals(updatedBean.getType(), "c0");
+ assertEquals(updatedBean.getCategory(), "Data");
+ assertEquals(updatedBean.getHost(), "qmog.cisco.com12");
+ for (PropertyBean property : updatedBean.getProperty()) {
+ if (property.getName().equals("payload_parameter.CEP_IP")) {
+ assertEquals(property.getValue(), "octl.qmog.cisco.com123");
+ } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
+ assertEquals(property.getValue(), "admin123");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
+ assertEquals(property.getValue(), "octl.qmog.cisco.com123");
+ } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
+ assertEquals(property.getValue(), "3");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
+ assertEquals(property.getValue(), "admin123");
+ } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
+ assertEquals(property.getValue(), "test123");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
+ assertEquals(property.getValue(), "7712");
+ } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
+ assertEquals(property.getValue(), "7612");
+ } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
+ assertEquals(property.getValue(), "7612");
+ } else if (property.getName().equals("payload_parameter.MB_PORT")) {
+ assertEquals(property.getValue(), "61617");
+ }
+ }
+
+ boolean removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType,
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removed, true);
+
+ CartridgeBean beanRemoved = (CartridgeBean) restClient.
+ getEntity(RestConstants.CARTRIDGES, cartridgeType,
+ CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+ assertEquals(beanRemoved, null);
- public boolean removeCartridge(String cartridgeType, RestClient restClient) {
- return restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType, entityName);
+ log.info("Ended Cartridge test case**************************************");
+ } catch (Exception e) {
+ log.error("An error occurred while handling RESTConstants.CARTRIDGES_PATH", e);
+ assertTrue("An error occurred while handling RESTConstants.CARTRIDGES_PATH", false);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
index eeb3ed9..6c1f4e0 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
@@ -21,36 +21,133 @@ package org.apache.stratos.integration.tests;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
-import org.apache.stratos.integration.tests.rest.RestClient;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
/**
* Test to handle Deployment policy CRUD operations
*/
-public class DeploymentPolicyTest {
+public class DeploymentPolicyTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(DeploymentPolicyTest.class);
- private static final String deploymentPolicies = "/deployment-policies/";
- private static final String deploymentPoliciesUpdate = "/deployment-policies/update/";
- private static final String entityName = "deploymentPolicy";
- public boolean addDeploymentPolicy(String deploymentPolicyId, RestClient restClient) {
- return restClient.addEntity(deploymentPolicies + "/" + deploymentPolicyId,
- RestConstants.DEPLOYMENT_POLICIES, entityName);
- }
+ @Test
+ public void testDeploymentPolicy() {
+ try {
+ String deploymentPolicyId = "deployment-policy-2";
+ log.info("Started deployment policy test case**************************************");
- public DeploymentPolicyBean getDeploymentPolicy(String deploymentPolicyId,
- RestClient restClient) {
- return (DeploymentPolicyBean) restClient.
- getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
- DeploymentPolicyBean.class, entityName);
- }
+ boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-5" + ".json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN1, true);
- public boolean updateDeploymentPolicy(String deploymentPolicyId, RestClient restClient) {
- return restClient.updateEntity(deploymentPoliciesUpdate + "/" + deploymentPolicyId,
- RestConstants.DEPLOYMENT_POLICIES, entityName);
- }
+ boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-6" + ".json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN2, true);
+
+ boolean addedDep = restClient.addEntity(RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ deploymentPolicyId + ".json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(addedDep, true);
+
+ DeploymentPolicyBean bean = (DeploymentPolicyBean) restClient.
+ getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+ DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(bean.getId(), "deployment-policy-2");
+ assertEquals(bean.getNetworkPartitions().size(), 2);
+ assertEquals(bean.getNetworkPartitions().get(0).getId(), "network-partition-5");
+ assertEquals(bean.getNetworkPartitions().get(0).getPartitionAlgo(), "one-after-another");
+ assertEquals(bean.getNetworkPartitions().get(0).getPartitions().size(), 1);
+ assertEquals(bean.getNetworkPartitions().get(0).getPartitions().get(0).getId(), "partition-1");
+ assertEquals(bean.getNetworkPartitions().get(0).getPartitions().get(0).getPartitionMax(), 20);
+
+ assertEquals(bean.getNetworkPartitions().get(1).getId(), "network-partition-6");
+ assertEquals(bean.getNetworkPartitions().get(1).getPartitionAlgo(), "round-robin");
+ assertEquals(bean.getNetworkPartitions().get(1).getPartitions().size(), 2);
+ assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(0).getId(),
+ "network-partition-6-partition-1");
+ assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(0).getPartitionMax(), 10);
+ assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(1).getId(),
+ "network-partition-6-partition-2");
+ assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 9);
+
+ //update network partition
+ boolean updated = restClient.updateEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-5-v1.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(updated, true);
+
+ //update deployment policy with new partition and max values
+ boolean updatedDep = restClient.updateEntity(RestConstants.DEPLOYMENT_POLICIES_PATH +
+ "/" + deploymentPolicyId + "-v1.json", RestConstants.DEPLOYMENT_POLICIES,
+ RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(updatedDep, true);
+
+ DeploymentPolicyBean updatedBean = (DeploymentPolicyBean) restClient.
+ getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+ DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(updatedBean.getId(), "deployment-policy-2");
+ assertEquals(updatedBean.getNetworkPartitions().size(), 2);
+ assertEquals(updatedBean.getNetworkPartitions().get(0).getId(), "network-partition-5");
+ assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitionAlgo(), "one-after-another");
+ assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().size(), 2);
+ assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(0).getId(), "partition-1");
+ assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(0).getPartitionMax(), 25);
+ assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(1).getId(), "partition-2");
+ assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(1).getPartitionMax(), 20);
+
+ assertEquals(updatedBean.getNetworkPartitions().get(1).getId(), "network-partition-6");
+ assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitionAlgo(), "round-robin");
+ assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().size(), 2);
+ assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(0).getId(),
+ "network-partition-6-partition-1");
+ assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(0).getPartitionMax(), 15);
+ assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(1).getId(),
+ "network-partition-6-partition-2");
+ assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 5);
+
+ boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-5", RestConstants.NETWORK_PARTITIONS_NAME);
+ //Trying to remove the used network partition
+ assertEquals(removedNet, false);
+
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, true);
+
+ DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClient.
+ getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+ DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(beanRemovedDep, null);
+
+ boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-5", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN1, true);
+
+ NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-5",
+ NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(beanRemovedN1, null);
+
+ boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-6", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN2, true);
+
+ NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-6",
+ NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(beanRemovedN2, null);
+
+ log.info("Ended deployment policy test case**************************************");
- public boolean removeDeploymentPolicy(String deploymentPolicyId, RestClient restClient) {
- return restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, entityName);
+ } catch (Exception e) {
+ log.error("An error occurred while handling deployment policy", e);
+ assertTrue("An error occurred while handling deployment policy", false);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
index 8593a09..a2ec9dc 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
@@ -22,35 +22,67 @@ package org.apache.stratos.integration.tests;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
-import org.apache.stratos.integration.tests.rest.RestClient;
+import org.testng.annotations.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
/**
* Test to handle Network partition CRUD operations
*/
-public class NetworkPartitionTest {
+public class NetworkPartitionTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(NetworkPartitionTest.class);
- private static final String networkPartitions = "/network-partitions/mock/";
- private static final String networkPartitionsUpdate = "/network-partitions/mock/update/";
- private static final String entityName = "networkPartition";
- public boolean addNetworkPartition(String networkPartitionId, RestClient restClient) {
- return restClient.addEntity(networkPartitions + "/" + networkPartitionId,
- RestConstants.NETWORK_PARTITIONS, entityName);
- }
+ @Test
+ public void testNetworkPartition() {
+ try {
+ String networkPartitionId = "network-partition-3";
+ log.info("Started network partition test case**************************************");
- public NetworkPartitionBean getNetworkPartition(String networkPartitionId,
- RestClient restClient) {
- return (NetworkPartitionBean) restClient.
- getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
- NetworkPartitionBean.class, entityName);
- }
+ boolean added = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ networkPartitionId + ".json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
- public boolean updateNetworkPartition(String networkPartitionId, RestClient restClient) {
- return restClient.updateEntity(networkPartitionsUpdate + "/" + networkPartitionId,
- RestConstants.NETWORK_PARTITIONS, entityName);
- }
+ assertEquals(added, true);
+ NetworkPartitionBean bean = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+ NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+
+ assertEquals(bean.getId(), "network-partition-3");
+ assertEquals(bean.getPartitions().size(), 1);
+ assertEquals(bean.getPartitions().get(0).getId(), "partition-1");
+ assertEquals(bean.getPartitions().get(0).getProperty().get(0).getName(), "region");
+ assertEquals(bean.getPartitions().get(0).getProperty().get(0).getValue(), "default");
+
+ boolean updated = restClient.updateEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ networkPartitionId + "-v1.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+
+ assertEquals(updated, true);
+ NetworkPartitionBean updatedBean = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+ NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(updatedBean.getId(), "network-partition-3");
+ assertEquals(updatedBean.getPartitions().size(), 2);
+ assertEquals(updatedBean.getPartitions().get(1).getId(), "partition-2");
+ assertEquals(updatedBean.getPartitions().get(1).getProperty().get(0).getName(), "region");
+ assertEquals(updatedBean.getPartitions().get(1).getProperty().get(0).getValue(), "default1");
+ assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getName(), "zone");
+ assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getValue(), "z1");
+
+ boolean removed = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removed, true);
+
+ NetworkPartitionBean beanRemoved = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+ NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(beanRemoved, null);
- public boolean removeNetworkPartition(String networkPartitionId, RestClient restClient) {
- return restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, entityName);
+ log.info("Ended network partition test case**************************************");
+ } catch (Exception e) {
+ log.error("An error occurred while handling network partitions", e);
+ assertTrue("An error occurred while handling network partitions", false);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
index 9678c4e..181aaa5 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
@@ -34,4 +34,19 @@ public class RestConstants {
public static final String APPLICATIONS_DEPLOY = "/deploy";
public static final String APPLICATIONS_UNDEPLOY = "/undeploy";
+ public static final String AUTOSCALING_POLICIES_PATH = "/autoscaling-policies/";
+ public static final String AUTOSCALING_POLICIES_NAME = "autoscalingPolicy";
+ public static final String CARTRIDGE_GROUPS_PATH = "/cartridges-groups/";
+ public static final String CARTRIDGE_GROUPS_NAME = "cartridgeGroup";
+ public static final String CARTRIDGES_PATH = "/cartridges/mock/";
+ public static final String CARTRIDGES_NAME = "cartridge";
+ public static final String NETWORK_PARTITIONS_PATH = "/network-partitions/mock/";
+ public static final String NETWORK_PARTITIONS_NAME = "networkPartition";
+ public static final String DEPLOYMENT_POLICIES_PATH = "/deployment-policies/";
+ public static final String DEPLOYMENT_POLICIES_NAME = "deploymentPolicy";
+ public static final String APPLICATIONS_PATH = "/applications/simple/single-cartridge-app/";
+ public static final String APPLICATIONS_NAME = "application";
+ public static final String APPLICATION_POLICIES_PATH = "/application-policies/";
+ public static final String APPLICATION_POLICIES_NAME = "applicationPolicy";
+
}
[10/12] stratos git commit: Introducing stratos integration test
suite for the artifacts
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
new file mode 100644
index 0000000..7162cdf
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
@@ -0,0 +1,394 @@
+/*
+ * 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;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.autoscaler.stub.pojo.ApplicationContext;
+import org.apache.stratos.common.client.AutoscalerServiceClient;
+import org.apache.stratos.common.threading.StratosThreadPool;
+import org.apache.stratos.messaging.domain.application.*;
+import org.apache.stratos.messaging.domain.instance.ClusterInstance;
+import org.apache.stratos.messaging.domain.instance.GroupInstance;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.topology.Member;
+import org.apache.stratos.messaging.domain.topology.MemberStatus;
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationsEventReceiver;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+
+import java.io.File;
+import java.rmi.RemoteException;
+import java.util.Collection;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+
+/**
+ * To start the Topology receivers
+ */
+public class TopologyHandler {
+ private static final Log log = LogFactory.getLog(TopologyHandler.class);
+
+ public static final int APPLICATION_ACTIVATION_TIMEOUT = 120000;
+ public static final int APPLICATION_TOPOLOGY_TIMEOUT = 60000;
+ public static final String APPLICATION_STATUS_CREATED = "Created";
+ public static final String APPLICATION_STATUS_UNDEPLOYING = "Undeploying";
+ private ApplicationsEventReceiver applicationsEventReceiver;
+ private TopologyEventReceiver topologyEventReceiver;
+ public static TopologyHandler topologyHandler;
+
+ private TopologyHandler() {
+ // Set jndi.properties.dir system property for initializing event receivers
+ System.setProperty("jndi.properties.dir", getResourcesFolderPath());
+ System.setProperty("autoscaler.service.url", "https://localhost:9443/services/AutoscalerService");
+ initializeApplicationEventReceiver();
+ initializeTopologyEventReceiver();
+ assertApplicationTopologyInitialized();
+ assertTopologyInitialized();
+ }
+
+ public static TopologyHandler getInstance() {
+ if (topologyHandler == null) {
+ synchronized (TopologyHandler.class) {
+ if (topologyHandler == null) {
+ topologyHandler = new TopologyHandler();
+ }
+ }
+ }
+ return topologyHandler;
+ }
+
+
+ /**
+ * Initialize application event receiver
+ */
+ private void initializeApplicationEventReceiver() {
+ if (applicationsEventReceiver == null) {
+ applicationsEventReceiver = new ApplicationsEventReceiver();
+ ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER", 1);
+ applicationsEventReceiver.setExecutorService(executorService);
+ applicationsEventReceiver.execute();
+ }
+ }
+
+ /**
+ * Initialize Topology event receiver
+ */
+ private void initializeTopologyEventReceiver() {
+ if (topologyEventReceiver == null) {
+ topologyEventReceiver = new TopologyEventReceiver();
+ ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER1", 1);
+ topologyEventReceiver.setExecutorService(executorService);
+ topologyEventReceiver.execute();
+ }
+ }
+
+ /**
+ * Assert application Topology initialization
+ */
+ private void assertApplicationTopologyInitialized() {
+ long startTime = System.currentTimeMillis();
+ boolean applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
+ while (!applicationTopologyInitialized) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_TOPOLOGY_TIMEOUT) {
+ break;
+ }
+ }
+ assertEquals(String.format("Application Topology didn't get initialized "), applicationTopologyInitialized, true);
+ }
+
+ /**
+ * Assert Topology initialization
+ */
+ private void assertTopologyInitialized() {
+ long startTime = System.currentTimeMillis();
+ boolean topologyInitialized = TopologyManager.getTopology().isInitialized();
+ while (!topologyInitialized) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ topologyInitialized = TopologyManager.getTopology().isInitialized();
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_TOPOLOGY_TIMEOUT) {
+ break;
+ }
+ }
+ assertEquals(String.format("Topology didn't get initialized "), topologyInitialized, true);
+ }
+
+ /**
+ * Assert application activation
+ *
+ * @param applicationName
+ */
+ public void assertApplicationActivation(String applicationName) {
+ long startTime = System.currentTimeMillis();
+ Application application = ApplicationManager.getApplications().getApplication(applicationName);
+ while (!((application != null) && (application.getStatus() == ApplicationStatus.Active))) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ application = ApplicationManager.getApplications().getApplication(applicationName);
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
+ break;
+ }
+ }
+ assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
+ assertEquals(String.format("Application status did not change to active: [application-id] %s", applicationName),
+ ApplicationStatus.Active, application.getStatus());
+ }
+
+ /**
+ * Assert application activation
+ *
+ * @param applicationName
+ */
+ public void assertGroupActivation(String applicationName) {
+ Application application = ApplicationManager.getApplications().getApplication(applicationName);
+ assertNotNull(String.format("Application is not found: [application-id] %s",
+ applicationName), application);
+
+ Collection<Group> groups = application.getAllGroupsRecursively();
+ for (Group group : groups) {
+ assertEquals(group.getInstanceContextCount() >= group.getGroupMinInstances(), true);
+ }
+ }
+
+ /**
+ * Assert application activation
+ *
+ * @param applicationName
+ */
+ public void assertClusterActivation(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);
+ boolean clusterActive = false;
+
+ for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
+ int activeInstances = 0;
+ for (Member member : cluster.getMembers()) {
+ if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
+ if (member.getStatus().equals(MemberStatus.Active)) {
+ activeInstances++;
+ }
+ }
+ }
+ clusterActive = activeInstances >= clusterDataHolder.getMinInstances();
+
+ if (!clusterActive) {
+ break;
+ }
+ }
+ assertEquals(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId),
+ clusterActive, true);
+ }
+
+ }
+
+ public void assertClusterMinMemberCount(String applicationName, int minMembers) {
+ long startTime = System.currentTimeMillis();
+
+ 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);
+ boolean clusterActive = false;
+
+ for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
+ int activeInstances = 0;
+ for (Member member : cluster.getMembers()) {
+ if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
+ if (member.getStatus().equals(MemberStatus.Active)) {
+ activeInstances++;
+ }
+ }
+ }
+ clusterActive = activeInstances >= minMembers;
+
+ while (!clusterActive) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ service = TopologyManager.getTopology().getService(serviceName);
+ assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
+ applicationName, serviceName), service);
+
+ cluster = service.getCluster(clusterId);
+ activeInstances = 0;
+ for (Member member : cluster.getMembers()) {
+ if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
+ if (member.getStatus().equals(MemberStatus.Active)) {
+ activeInstances++;
+ }
+ }
+ }
+ clusterActive = activeInstances >= minMembers;
+ assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
+ applicationName, serviceName, clusterId), cluster);
+
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
+ break;
+ }
+ }
+ }
+ assertEquals(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId),
+ clusterActive, true);
+ }
+
+ }
+
+
+ /**
+ * Assert application activation
+ *
+ * @param applicationName
+ */
+ public boolean assertApplicationUndeploy(String applicationName) {
+ long startTime = System.currentTimeMillis();
+ Application application = ApplicationManager.getApplications().getApplication(applicationName);
+ ApplicationContext applicationContext = null;
+ try {
+ applicationContext = AutoscalerServiceClient.getInstance().getApplication(applicationName);
+ } catch (RemoteException e) {
+ log.error("Error while getting the application context for [application] " + applicationName);
+ }
+ while (((application != null) && application.getInstanceContextCount() > 0) ||
+ (applicationContext == null || applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING))) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ application = ApplicationManager.getApplications().getApplication(applicationName);
+ try {
+ applicationContext = AutoscalerServiceClient.getInstance().getApplication(applicationName);
+ } catch (RemoteException e) {
+ log.error("Error while getting the application context for [application] " + applicationName);
+ }
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
+ break;
+ }
+ }
+
+ assertNotNull(String.format("Application is not found: [application-id] %s",
+ applicationName), application);
+ assertNotNull(String.format("Application Context is not found: [application-id] %s",
+ applicationName), applicationContext);
+
+ //Force undeployment after the graceful deployment
+ if (application.getInstanceContextCount() > 0 ||
+ applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
+ return false;
+ }
+ assertEquals(String.format("Application status did not change to Created: [application-id] %s", applicationName),
+ APPLICATION_STATUS_CREATED, applicationContext.getStatus());
+ return true;
+ }
+
+ /**
+ * Assert application activation
+ *
+ * @param applicationName
+ */
+ public void assertGroupInstanceCount(String applicationName, String groupAlias, int count) {
+ long startTime = System.currentTimeMillis();
+ Application application = ApplicationManager.getApplications().getApplication(applicationName);
+ if (application != null) {
+ Group group = application.getGroupRecursively(groupAlias);
+ while (group.getInstanceContextCount() != count) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
+ break;
+ }
+ }
+ for (GroupInstance instance : group.getInstanceIdToInstanceContextMap().values()) {
+ while (!instance.getStatus().equals(GroupStatus.Active)) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
+ break;
+ }
+ }
+ }
+ assertEquals(String.format("Application status did not change to active: [application-id] %s", applicationName),
+ group.getInstanceContextCount(), count);
+ }
+ assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
+
+ }
+
+ public void assertApplicationNotExists(String applicationName) {
+ Application application = ApplicationManager.getApplications().getApplication(applicationName);
+ assertNull(String.format("Application is found in the topology : [application-id] %s", applicationName), application);
+ }
+
+ /**
+ * Get resources folder path
+ *
+ * @return
+ */
+ private String getResourcesFolderPath() {
+ String path = getClass().getResource("/").getPath();
+ return StringUtils.removeEnd(path, File.separator);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationBean.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationBean.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationBean.java
new file mode 100644
index 0000000..ce23728
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationBean.java
@@ -0,0 +1,25 @@
+/*
+ * 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.config;
+
+/**
+ * Created by reka on 5/7/15.
+ */
+public class ApplicationBean {
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationConfigParser.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationConfigParser.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationConfigParser.java
new file mode 100644
index 0000000..ace17e6
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/config/ApplicationConfigParser.java
@@ -0,0 +1,25 @@
+/*
+ * 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.config;
+
+/**
+ * Created by reka on 5/7/15.
+ */
+public class ApplicationConfigParser {
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
index 5ff8fd3..34a9d75 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
@@ -315,7 +315,7 @@ public class RestClient {
log.error(msg + entityName);
throw new RuntimeException(msg + entityName);
} catch (Exception e) {
- String message = "Could not add " + entityName;
+ String message = "Could not update " + entityName;
log.error(message, e);
throw new RuntimeException(message, e);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json b/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json
new file mode 100644
index 0000000..1137942
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json
@@ -0,0 +1,18 @@
+{
+ "id": "application-policy-2",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-7",
+ "network-partition-8"
+ ],
+ "properties": [
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-7,network-partition-8"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json
new file mode 100644
index 0000000..ff332c0
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json
@@ -0,0 +1,86 @@
+{
+ "alias": "g-sc-G123-1",
+ "applicationId": "g-sc-G123-1",
+ "components": {
+ "cartridges": [],
+ "groups": [
+ {
+ "name": "G1",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group1",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c1",
+ "subscribableInfo": {
+ "alias": "c1-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group2",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "type": "c2",
+ "subscribableInfo": {
+ "alias": "c2-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "groupMaxInstances": 3,
+ "groupMinInstances": 2,
+ "deploymentPolicy": "static-1",
+ "alias": "group3",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c3",
+ "subscribableInfo": {
+ "alias": "c3-1x0",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json
new file mode 100644
index 0000000..6f827c2
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json
@@ -0,0 +1,86 @@
+{
+ "alias": "g-sc-G123-1",
+ "applicationId": "g-sc-G123-1",
+ "components": {
+ "cartridges": [],
+ "groups": [
+ {
+ "name": "G1",
+ "groupMaxInstances": 5,
+ "groupMinInstances": 2,
+ "alias": "group1",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c1",
+ "subscribableInfo": {
+ "alias": "c1-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group2",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "type": "c2",
+ "subscribableInfo": {
+ "alias": "c2-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "groupMaxInstances": 3,
+ "groupMinInstances": 2,
+ "deploymentPolicy": "static-1",
+ "alias": "group3",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c3",
+ "subscribableInfo": {
+ "alias": "c3-1x0",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json
new file mode 100644
index 0000000..a6e5fd7
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json
@@ -0,0 +1,86 @@
+{
+ "alias": "g-sc-G123-1",
+ "applicationId": "g-sc-G123-1",
+ "components": {
+ "cartridges": [],
+ "groups": [
+ {
+ "name": "G1",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group1",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c1",
+ "subscribableInfo": {
+ "alias": "c1-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group2",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "type": "c2",
+ "subscribableInfo": {
+ "alias": "c2-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "groupMaxInstances": 4,
+ "groupMinInstances": 3,
+ "deploymentPolicy": "static-1",
+ "alias": "group3",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c3",
+ "subscribableInfo": {
+ "alias": "c3-1x0",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1-v1.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1-v1.json
deleted file mode 100644
index fb5e000..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1-v1.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 5,
- "groupMinInstances": 4,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 4,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 3,
- "groupMinInstances": 2,
- "deploymentPolicy": "static-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json
deleted file mode 100644
index ff332c0..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 4,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 3,
- "groupMinInstances": 2,
- "deploymentPolicy": "static-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json
new file mode 100644
index 0000000..31c2b84
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscaling-policy-c0",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 30
+ },
+ "memoryConsumption": {
+ "threshold": 40
+ },
+ "loadAverage": {
+ "threshold": 20
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/autoscaling-policies/update/autoscaling-policy-c0.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/update/autoscaling-policy-c0.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policies/update/autoscaling-policy-c0.json
deleted file mode 100644
index 31c2b84..0000000
--- a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/update/autoscaling-policy-c0.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "id": "autoscaling-policy-c0",
- "loadThresholds": {
- "requestsInFlight": {
- "threshold": 30
- },
- "memoryConsumption": {
- "threshold": 40
- },
- "loadAverage": {
- "threshold": 20
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json
new file mode 100644
index 0000000..6020e1e
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridges-groups/cartrdige-nested-v1.json
@@ -0,0 +1,50 @@
+{
+ "name": "G1",
+ "dependencies": {
+ "terminationBehaviour": "terminate-none",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group2",
+ "cartridge.c1-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c1"
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "dependencies": {
+ "terminationBehaviour": "terminate-dependents",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group3",
+ "cartridge.c2-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c2"
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "dependencies": {
+ "terminationBehaviour": "terminate-all",
+ "startupOrders": []
+ },
+ "cartridges": [
+ "c3"
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json
new file mode 100644
index 0000000..c0132f0
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6-v1.json
@@ -0,0 +1,50 @@
+{
+ "name": "G4",
+ "dependencies": {
+ "terminationBehaviour": "terminate-none",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group2",
+ "cartridge.c1-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c4"
+ ],
+ "groups": [
+ {
+ "name": "G5",
+ "dependencies": {
+ "terminationBehaviour": "terminate-dependents",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group6",
+ "cartridge.c5-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c5"
+ ],
+ "groups": [
+ {
+ "name": "G6",
+ "dependencies": {
+ "terminationBehaviour": "terminate-all",
+ "startupOrders": []
+ },
+ "cartridges": [
+ "c6"
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json
new file mode 100644
index 0000000..ef28723
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridges-groups/g4-g5-g6.json
@@ -0,0 +1,50 @@
+{
+ "name": "G4",
+ "dependencies": {
+ "terminationBehaviour": "terminate-none",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group5",
+ "cartridge.c4-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c4"
+ ],
+ "groups": [
+ {
+ "name": "G5",
+ "dependencies": {
+ "terminationBehaviour": "terminate-dependents",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group6",
+ "cartridge.c5-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c5"
+ ],
+ "groups": [
+ {
+ "name": "G6",
+ "dependencies": {
+ "terminationBehaviour": "terminate-all",
+ "startupOrders": []
+ },
+ "cartridges": [
+ "c6"
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges-groups/update/cartrdige-nested.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges-groups/update/cartrdige-nested.json b/products/stratos/modules/integration/src/test/resources/cartridges-groups/update/cartrdige-nested.json
deleted file mode 100644
index 6020e1e..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges-groups/update/cartrdige-nested.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "name": "G1",
- "dependencies": {
- "terminationBehaviour": "terminate-none",
- "startupOrders": [
- {
- "aliases": [
- "group.group2",
- "cartridge.c1-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c1"
- ],
- "groups": [
- {
- "name": "G2",
- "dependencies": {
- "terminationBehaviour": "terminate-dependents",
- "startupOrders": [
- {
- "aliases": [
- "group.group3",
- "cartridge.c2-1x0"
- ]
- }
- ]
- },
- "cartridges": [
- "c2"
- ],
- "groups": [
- {
- "name": "G3",
- "dependencies": {
- "terminationBehaviour": "terminate-all",
- "startupOrders": []
- },
- "cartridges": [
- "c3"
- ],
- "groups": []
- }
- ]
- }
- ]
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json
new file mode 100755
index 0000000..6d922a9
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c0-v1.json
@@ -0,0 +1,124 @@
+{
+ "category": "Data",
+ "description": "c0 Cartridge",
+ "displayName": "c0",
+ "host": "qmog.cisco.com12",
+ "iaasProvider": [
+ {
+ "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9d123",
+ "maxInstanceLimit": "4",
+ "networkInterfaces": [
+ {
+ "floatingNetworks": [
+ {
+ "name": "private",
+ "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc2112121"
+ }
+ ],
+ "name": "core1",
+ "networkUuid": "5e107fbd-4820-47ad-84ea-6f1354961212"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb812"
+ },
+ {
+ "name": "keyPair",
+ "value": "phoenix12"
+ },
+ {
+ "name": "autoAssignIp",
+ "value": "true"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default123"
+ }
+ ],
+ "type": "mock"
+ }
+ ],
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "port": "22",
+ "protocol": "http",
+ "proxyPort": "8280"
+ }
+ ],
+ "property": [
+ {
+ "name": "payload_parameter.MB_IP",
+ "value": "octl.qmog.cisco.com123"
+ },
+ {
+ "name": "payload_parameter.MB_PORT",
+ "value": "61617"
+ },
+ {
+ "name": "payload_parameter.CEP_IP",
+ "value": "octl.qmog.cisco.com123"
+ },
+ {
+ "name": "payload_parameter.CEP_PORT",
+ "value": "7612"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_PASSWORD",
+ "value": "admin123"
+ },
+ {
+ "name": "payload_parameter.CERT_TRUSTSTORE",
+ "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
+ },
+ {
+ "name": "payload_parameter.TRUSTSTORE_PASSWORD",
+ "value": "wso2carbon"
+ },
+ {
+ "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
+ "value": "false"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_IP",
+ "value": "octl.qmog.cisco.com123"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_PORT",
+ "value": "7612"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
+ "value": "7712"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
+ "value": "admin123"
+ },
+ {
+ "name": "payload_parameter.QTCM_DNS_SEGMENT",
+ "value": "test123"
+ },
+ {
+ "name": "payload_parameter.QTCM_NETWORK_COUNT",
+ "value": "3"
+ },
+ {
+ "name": "payload_parameter.SIMPLE_PROPERTY",
+ "value": "value"
+ }
+ ],
+ "provider": "apache",
+ "type": "c0",
+ "version": "1.0"
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json
new file mode 100755
index 0000000..ec7d8b2
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c4.json
@@ -0,0 +1,45 @@
+{
+ "type": "c4",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c4",
+ "description": "c4 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"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json
new file mode 100755
index 0000000..0e438fd
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c5.json
@@ -0,0 +1,124 @@
+{
+ "category": "Application",
+ "description": "c5 Cartridge",
+ "displayName": "c5",
+ "host": "qmog.cisco.com",
+ "iaasProvider": [
+ {
+ "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9dde0f",
+ "maxInstanceLimit": "4",
+ "networkInterfaces": [
+ {
+ "floatingNetworks": [
+ {
+ "name": "public",
+ "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc211af6"
+ }
+ ],
+ "name": "core",
+ "networkUuid": "5e107fbd-4820-47ad-84ea-6f135496f889"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb809"
+ },
+ {
+ "name": "keyPair",
+ "value": "phoenix"
+ },
+ {
+ "name": "autoAssignIp",
+ "value": "false"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default"
+ }
+ ],
+ "type": "mock"
+ }
+ ],
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "port": "22",
+ "protocol": "http",
+ "proxyPort": "8280"
+ }
+ ],
+ "property": [
+ {
+ "name": "payload_parameter.MB_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.MB_PORT",
+ "value": "61616"
+ },
+ {
+ "name": "payload_parameter.CEP_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.CEP_PORT",
+ "value": "7611"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CEP_ADMIN_PASSWORD",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.CERT_TRUSTSTORE",
+ "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
+ },
+ {
+ "name": "payload_parameter.TRUSTSTORE_PASSWORD",
+ "value": "wso2carbon"
+ },
+ {
+ "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
+ "value": "false"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_IP",
+ "value": "octl.qmog.cisco.com"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_PORT",
+ "value": "7611"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
+ "value": "7711"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
+ "value": "admin"
+ },
+ {
+ "name": "payload_parameter.QTCM_DNS_SEGMENT",
+ "value": "test"
+ },
+ {
+ "name": "payload_parameter.QTCM_NETWORK_COUNT",
+ "value": "1"
+ },
+ {
+ "name": "payload_parameter.SIMPLE_PROPERTY",
+ "value": "value"
+ }
+ ],
+ "provider": "cisco",
+ "type": "c5",
+ "version": "1.0"
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json
new file mode 100755
index 0000000..8f41441
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/cartridges/mock/c6.json
@@ -0,0 +1,45 @@
+{
+ "type": "c6",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c6",
+ "description": "c6 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"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/cartridges/mock/update/c0.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/cartridges/mock/update/c0.json b/products/stratos/modules/integration/src/test/resources/cartridges/mock/update/c0.json
deleted file mode 100755
index 6d922a9..0000000
--- a/products/stratos/modules/integration/src/test/resources/cartridges/mock/update/c0.json
+++ /dev/null
@@ -1,124 +0,0 @@
-{
- "category": "Data",
- "description": "c0 Cartridge",
- "displayName": "c0",
- "host": "qmog.cisco.com12",
- "iaasProvider": [
- {
- "imageId": "RegionOne/16e7e35b-0c88-4605-90ce-cbef9e9d123",
- "maxInstanceLimit": "4",
- "networkInterfaces": [
- {
- "floatingNetworks": [
- {
- "name": "private",
- "networkUuid": "26b4aa2b-06bc-4e4f-a6eb-c19fbc2112121"
- }
- ],
- "name": "core1",
- "networkUuid": "5e107fbd-4820-47ad-84ea-6f1354961212"
- }
- ],
- "property": [
- {
- "name": "instanceType",
- "value": "RegionOne/2cdbd576-8c9b-4c2d-8b1a-0f79dc4fb812"
- },
- {
- "name": "keyPair",
- "value": "phoenix12"
- },
- {
- "name": "autoAssignIp",
- "value": "true"
- },
- {
- "name": "securityGroups",
- "value": "default123"
- }
- ],
- "type": "mock"
- }
- ],
- "multiTenant": "false",
- "portMapping": [
- {
- "port": "22",
- "protocol": "http",
- "proxyPort": "8280"
- }
- ],
- "property": [
- {
- "name": "payload_parameter.MB_IP",
- "value": "octl.qmog.cisco.com123"
- },
- {
- "name": "payload_parameter.MB_PORT",
- "value": "61617"
- },
- {
- "name": "payload_parameter.CEP_IP",
- "value": "octl.qmog.cisco.com123"
- },
- {
- "name": "payload_parameter.CEP_PORT",
- "value": "7612"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.CEP_ADMIN_PASSWORD",
- "value": "admin123"
- },
- {
- "name": "payload_parameter.CERT_TRUSTSTORE",
- "value": "/opt/apache-stratos-cartridge-agent/security/client-truststore.jks"
- },
- {
- "name": "payload_parameter.TRUSTSTORE_PASSWORD",
- "value": "wso2carbon"
- },
- {
- "name": "payload_parameter.ENABLE_DATA_PUBLISHER",
- "value": "false"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_IP",
- "value": "octl.qmog.cisco.com123"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_PORT",
- "value": "7612"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_SECURE_PORT",
- "value": "7712"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_USERNAME",
- "value": "admin"
- },
- {
- "name": "payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD",
- "value": "admin123"
- },
- {
- "name": "payload_parameter.QTCM_DNS_SEGMENT",
- "value": "test123"
- },
- {
- "name": "payload_parameter.QTCM_NETWORK_COUNT",
- "value": "3"
- },
- {
- "name": "payload_parameter.SIMPLE_PROPERTY",
- "value": "value"
- }
- ],
- "provider": "apache",
- "type": "c0",
- "version": "1.0"
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json
new file mode 100644
index 0000000..2ba5eb3
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-1-v1.json
@@ -0,0 +1,36 @@
+{
+ "id": "deployment-policy-1",
+ "networkPartitions": [
+ {
+ "id": "network-partition-1",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 25
+ },
+ {
+ "id": "partition-2",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-2",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-2-partition-1",
+ "partitionMax": 15
+ },
+ {
+ "id": "network-partition-2-partition-2",
+ "partitionMax": 5
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json
new file mode 100644
index 0000000..b5c305c
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2-v1.json
@@ -0,0 +1,36 @@
+{
+ "id": "deployment-policy-2",
+ "networkPartitions": [
+ {
+ "id": "network-partition-5",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 25
+ },
+ {
+ "id": "partition-2",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-6",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-6-partition-1",
+ "partitionMax": 15
+ },
+ {
+ "id": "network-partition-6-partition-2",
+ "partitionMax": 5
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json
new file mode 100644
index 0000000..5df3e24
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-2.json
@@ -0,0 +1,32 @@
+{
+ "id": "deployment-policy-2",
+ "networkPartitions": [
+ {
+ "id": "network-partition-5",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-6",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-6-partition-1",
+ "partitionMax": 10
+ },
+ {
+ "id": "network-partition-6-partition-2",
+ "partitionMax": 9
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json
new file mode 100644
index 0000000..d024922
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policies/deployment-policy-3.json
@@ -0,0 +1,32 @@
+{
+ "id": "deployment-policy-1",
+ "networkPartitions": [
+ {
+ "id": "network-partition-3",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-4",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-2-partition-1",
+ "partitionMax": 10
+ },
+ {
+ "id": "network-partition-2-partition-2",
+ "partitionMax": 9
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/deployment-policies/update/deployment-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policies/update/deployment-policy-1.json b/products/stratos/modules/integration/src/test/resources/deployment-policies/update/deployment-policy-1.json
deleted file mode 100644
index 2ba5eb3..0000000
--- a/products/stratos/modules/integration/src/test/resources/deployment-policies/update/deployment-policy-1.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "id": "deployment-policy-1",
- "networkPartitions": [
- {
- "id": "network-partition-1",
- "partitionAlgo": "one-after-another",
- "partitions": [
- {
- "id": "partition-1",
- "partitionMax": 25
- },
- {
- "id": "partition-2",
- "partitionMax": 20
- }
- ]
- },
- {
- "id": "network-partition-2",
- "partitionAlgo": "round-robin",
- "partitions": [
- {
- "id": "network-partition-2-partition-1",
- "partitionMax": 15
- },
- {
- "id": "network-partition-2-partition-2",
- "partitionMax": 5
- }
- ]
- }
- ]
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-1.json
deleted file mode 100644
index 3fbeeac..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-1.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "id": "network-partition-1",
- "provider": "ec2",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "ap-southeast-1"
- },
- {
- "name": "zone",
- "value": "ap-southeast-1a"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-2.json b/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-2.json
deleted file mode 100644
index 02f9b1d..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/ec2/network-partition-2.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "id": "network-partition-2",
- "partitions": [
- {
- "id": "partition-2",
- "provider": "ec2",
- "property": [
- {
- "name": "region",
- "value": "ap-southeast-2"
- },
- {
- "name": "region",
- "value": "ap-southeast-2b"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/gce/network-partition-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/gce/network-partition-1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/gce/network-partition-1.json
deleted file mode 100644
index 177e7d2..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/gce/network-partition-1.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-1",
- "provider": "gce",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-1.json
deleted file mode 100644
index bb27086..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-1.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-1",
- "provider": "kubernetes",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "cluster",
- "value": "kubernetes-cluster-2"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-2.json b/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-2.json
deleted file mode 100644
index 8f9f053..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-2.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-2",
- "provider": "kubernetes",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "cluster",
- "value": "kubernetes-cluster-2"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-3.json b/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-3.json
deleted file mode 100644
index 5188f3c..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/kubernetes/network-partition-3.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-3",
- "provider": "kubernetes",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "cluster",
- "value": "kubernetes-cluster-1"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json
new file mode 100644
index 0000000..054265a
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-1-v1.json
@@ -0,0 +1,28 @@
+{
+ "id": "network-partition-1",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default1"
+ },
+ {
+ "name": "zone",
+ "value": "z1"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json
new file mode 100644
index 0000000..c7d4733
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-3-v1.json
@@ -0,0 +1,28 @@
+{
+ "id": "network-partition-3",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default1"
+ },
+ {
+ "name": "zone",
+ "value": "z1"
+ }
+ ]
+ }
+ ]
+}
[02/12] stratos git commit: refining the resources to have the
samples with the reference of the test case
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v2.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v2.json
new file mode 100644
index 0000000..6f827c2
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v2.json
@@ -0,0 +1,86 @@
+{
+ "alias": "g-sc-G123-1",
+ "applicationId": "g-sc-G123-1",
+ "components": {
+ "cartridges": [],
+ "groups": [
+ {
+ "name": "G1",
+ "groupMaxInstances": 5,
+ "groupMinInstances": 2,
+ "alias": "group1",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c1",
+ "subscribableInfo": {
+ "alias": "c1-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group2",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "type": "c2",
+ "subscribableInfo": {
+ "alias": "c2-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "groupMaxInstances": 3,
+ "groupMinInstances": 2,
+ "deploymentPolicy": "static-1",
+ "alias": "group3",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c3",
+ "subscribableInfo": {
+ "alias": "c3-1x0",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v3.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v3.json
new file mode 100644
index 0000000..a6e5fd7
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1-v3.json
@@ -0,0 +1,86 @@
+{
+ "alias": "g-sc-G123-1",
+ "applicationId": "g-sc-G123-1",
+ "components": {
+ "cartridges": [],
+ "groups": [
+ {
+ "name": "G1",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group1",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c1",
+ "subscribableInfo": {
+ "alias": "c1-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group2",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "type": "c2",
+ "subscribableInfo": {
+ "alias": "c2-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "groupMaxInstances": 4,
+ "groupMinInstances": 3,
+ "deploymentPolicy": "static-1",
+ "alias": "group3",
+ "cartridges": [
+ {
+ "cartridgeMin": 2,
+ "cartridgeMax": 3,
+ "type": "c3",
+ "subscribableInfo": {
+ "alias": "c3-1x0",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1.json
new file mode 100644
index 0000000..76d72c8
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/g-sc-G123-1.json
@@ -0,0 +1,86 @@
+{
+ "alias": "g-sc-G123-1",
+ "applicationId": "g-sc-G123-1",
+ "components": {
+ "cartridges": [],
+ "groups": [
+ {
+ "name": "G1",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group1",
+ "cartridges": [
+ {
+ "cartridgeMin": 1,
+ "cartridgeMax": 2,
+ "type": "c1",
+ "subscribableInfo": {
+ "alias": "c1-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "groupMaxInstances": 1,
+ "groupMinInstances": 1,
+ "alias": "group2",
+ "cartridges": [
+ {
+ "cartridgeMin": 1,
+ "cartridgeMax": 2,
+ "type": "c2",
+ "subscribableInfo": {
+ "alias": "c2-1x0",
+ "deploymentPolicy": "deployment-policy-1",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "groupMaxInstances": 2,
+ "groupMinInstances": 1,
+ "deploymentPolicy": "deployment-policy-1",
+ "alias": "group3",
+ "cartridges": [
+ {
+ "cartridgeMin": 1,
+ "cartridgeMax": 2,
+ "type": "c3",
+ "subscribableInfo": {
+ "alias": "c3-1x0",
+ "artifactRepository": {
+ "repoUsername": "user",
+ "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+ "privateRepo": true,
+ "repoPassword": "c-policy"
+ },
+ "autoscalingPolicy": "autoscaling-policy-1"
+ }
+ }
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/autoscaling-policies/autoscaling-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/autoscaling-policies/autoscaling-policy-1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/autoscaling-policies/autoscaling-policy-1.json
new file mode 100644
index 0000000..f82403b
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/autoscaling-policies/autoscaling-policy-1.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscaling-policy-1",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 35
+ },
+ "memoryConsumption": {
+ "threshold": 45
+ },
+ "loadAverage": {
+ "threshold": 25
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested-v1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested-v1.json
new file mode 100644
index 0000000..6020e1e
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested-v1.json
@@ -0,0 +1,50 @@
+{
+ "name": "G1",
+ "dependencies": {
+ "terminationBehaviour": "terminate-none",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group2",
+ "cartridge.c1-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c1"
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "dependencies": {
+ "terminationBehaviour": "terminate-dependents",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group3",
+ "cartridge.c2-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c2"
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "dependencies": {
+ "terminationBehaviour": "terminate-all",
+ "startupOrders": []
+ },
+ "cartridges": [
+ "c3"
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested.json
new file mode 100644
index 0000000..6020e1e
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges-groups/cartrdige-nested.json
@@ -0,0 +1,50 @@
+{
+ "name": "G1",
+ "dependencies": {
+ "terminationBehaviour": "terminate-none",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group2",
+ "cartridge.c1-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c1"
+ ],
+ "groups": [
+ {
+ "name": "G2",
+ "dependencies": {
+ "terminationBehaviour": "terminate-dependents",
+ "startupOrders": [
+ {
+ "aliases": [
+ "group.group3",
+ "cartridge.c2-1x0"
+ ]
+ }
+ ]
+ },
+ "cartridges": [
+ "c2"
+ ],
+ "groups": [
+ {
+ "name": "G3",
+ "dependencies": {
+ "terminationBehaviour": "terminate-all",
+ "startupOrders": []
+ },
+ "cartridges": [
+ "c3"
+ ],
+ "groups": []
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c1.json
new file mode 100755
index 0000000..145e2ce
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c1.json
@@ -0,0 +1,45 @@
+{
+ "type": "c1",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c1",
+ "description": "c1 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"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c2.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c2.json
new file mode 100755
index 0000000..fd85892
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c2.json
@@ -0,0 +1,45 @@
+{
+ "type": "c2",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c2",
+ "description": "c2 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"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c3.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c3.json
new file mode 100755
index 0000000..937e8d3
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/cartridges/mock/c3.json
@@ -0,0 +1,45 @@
+{
+ "type": "c3",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c3",
+ "description": "c3 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"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1-v1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1-v1.json
new file mode 100644
index 0000000..2ba5eb3
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1-v1.json
@@ -0,0 +1,36 @@
+{
+ "id": "deployment-policy-1",
+ "networkPartitions": [
+ {
+ "id": "network-partition-1",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 25
+ },
+ {
+ "id": "partition-2",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-2",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-2-partition-1",
+ "partitionMax": 15
+ },
+ {
+ "id": "network-partition-2-partition-2",
+ "partitionMax": 5
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1.json
new file mode 100644
index 0000000..e186690
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/deployment-policies/deployment-policy-1.json
@@ -0,0 +1,32 @@
+{
+ "id": "deployment-policy-1",
+ "networkPartitions": [
+ {
+ "id": "network-partition-1",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 20
+ }
+ ]
+ },
+ {
+ "id": "network-partition-2",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-2-partition-1",
+ "partitionMax": 10
+ },
+ {
+ "id": "network-partition-2-partition-2",
+ "partitionMax": 9
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1-v1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1-v1.json
new file mode 100644
index 0000000..054265a
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1-v1.json
@@ -0,0 +1,28 @@
+{
+ "id": "network-partition-1",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default1"
+ },
+ {
+ "name": "zone",
+ "value": "z1"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1.json
new file mode 100644
index 0000000..466da28
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-1.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-1",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-2.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-2.json
new file mode 100644
index 0000000..23236e2
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/network-partitions/mock/network-partition-2.json
@@ -0,0 +1,24 @@
+{
+ "id": "network-partition-2",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "network-partition-2-partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "network-partition-2-partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/testng.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/testng.xml b/products/stratos/modules/integration/src/test/resources/testng.xml
index c450bf0..3ea5a01 100644
--- a/products/stratos/modules/integration/src/test/resources/testng.xml
+++ b/products/stratos/modules/integration/src/test/resources/testng.xml
@@ -57,5 +57,10 @@
<class name="org.apache.stratos.integration.tests.SampleApplicationsTest" />
</classes>
</test>
+ <!--test name="ApplicationBurstingTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.ApplicationBurstingTest" />
+ </classes>
+ </test-->
</suite>
[05/12] stratos git commit: Adding assertion of topology
initizlization and refactoring the test classes to use same CRUD operations
from RestClient
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
index d1c9163..096dd60 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
@@ -74,7 +74,7 @@ public class SampleApplicationsTest extends StratosTestServerManager {
private ApplicationsEventReceiver applicationsEventReceiver;
private TopologyEventReceiver topologyEventReceiver;
- private RestClient restClient = new RestClient();
+ private RestClient restClient;
private AutoscalingPolicyTest autoscalingPolicyTest;
private NetworkPartitionTest networkPartitionTest;
private CartridgeTest cartridgeTest;
@@ -89,6 +89,7 @@ public class SampleApplicationsTest extends StratosTestServerManager {
// Set jndi.properties.dir system property for initializing event receivers
System.setProperty("jndi.properties.dir", getResourcesFolderPath());
System.setProperty("autoscaler.service.url", "https://localhost:9443/services/AutoscalerService");
+ restClient = new RestClient(endpoint, "admin", "admin");
autoscalingPolicyTest = new AutoscalingPolicyTest();
networkPartitionTest = new NetworkPartitionTest();
cartridgeTest = new CartridgeTest();
@@ -115,9 +116,9 @@ public class SampleApplicationsTest extends StratosTestServerManager {
String policyId = "autoscaling-policy-c0";
try {
boolean added = autoscalingPolicyTest.addAutoscalingPolicy(policyId + ".json",
- endpoint, restClient);
+ restClient);
assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), added, true);
- AutoscalePolicyBean bean = autoscalingPolicyTest.getAutoscalingPolicy(policyId, endpoint,
+ AutoscalePolicyBean bean = autoscalingPolicyTest.getAutoscalingPolicy(policyId,
restClient);
assertEquals(String.format("[autoscaling-policy-id] %s is not correct", bean.getId()),
bean.getId(), policyId);
@@ -129,9 +130,9 @@ public class SampleApplicationsTest extends StratosTestServerManager {
bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0);
boolean updated = autoscalingPolicyTest.updateAutoscalingPolicy(policyId + ".json",
- endpoint, restClient);
+ restClient);
assertEquals(String.format("[autoscaling-policy-id] %s update failed", policyId), updated, true);
- AutoscalePolicyBean updatedBean = autoscalingPolicyTest.getAutoscalingPolicy(policyId, endpoint,
+ AutoscalePolicyBean updatedBean = autoscalingPolicyTest.getAutoscalingPolicy(policyId,
restClient);
assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId),
updatedBean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0);
@@ -140,12 +141,12 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
- boolean removed = autoscalingPolicyTest.removeAutoscalingPolicy(policyId, endpoint,
+ boolean removed = autoscalingPolicyTest.removeAutoscalingPolicy(policyId,
restClient);
assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
removed, true);
- AutoscalePolicyBean beanRemoved = autoscalingPolicyTest.getAutoscalingPolicy(policyId, endpoint,
+ AutoscalePolicyBean beanRemoved = autoscalingPolicyTest.getAutoscalingPolicy(policyId,
restClient);
assertEquals(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
policyId), beanRemoved, null);
@@ -161,69 +162,69 @@ public class SampleApplicationsTest extends StratosTestServerManager {
try {
log.info("Started Cartridge group test case**************************************");
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", endpoint, restClient);
+ boolean addedC1 = cartridgeTest.addCartridge("c1.json", restClient);
assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c1"), addedC1, true);
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", endpoint, restClient);
+ boolean addedC2 = cartridgeTest.addCartridge("c2.json", restClient);
assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c2"), addedC2, true);
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", endpoint, restClient);
+ boolean addedC3 = cartridgeTest.addCartridge("c3.json", restClient);
assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c3"), addedC3, true);
boolean added = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
+ restClient);
assertEquals(String.format("Cartridge Group did not added: [cartridge-group-name] %s",
"cartrdige-nested"), added, true);
- CartridgeGroupBean bean = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
+ CartridgeGroupBean bean = cartridgeGroupTest.getCartridgeGroup("G1",
restClient);
assertEquals(String.format("Cartridge Group name did not match: [cartridge-group-name] %s",
"cartrdige-nested"), bean.getName(), "G1");
boolean updated = cartridgeGroupTest.updateCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
+ restClient);
assertEquals(String.format("Cartridge Group did not updated: [cartridge-group-name] %s",
"cartrdige-nested"), updated, true);
- CartridgeGroupBean updatedBean = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
+ CartridgeGroupBean updatedBean = cartridgeGroupTest.getCartridgeGroup("G1",
restClient);
assertEquals(String.format("Updated Cartridge Group didn't match: [cartridge-group-name] %s",
"cartrdige-nested"), updatedBean.getName(), "G1");
- boolean removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
+ boolean removedC1 = cartridgeTest.removeCartridge("c1",
restClient);
assertEquals(String.format("Cartridge can be removed while it is used in cartridge group: [cartridge-name] %s",
"c1"), removedC1, false);
- boolean removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
+ boolean removedC2 = cartridgeTest.removeCartridge("c2",
restClient);
assertEquals(String.format("Cartridge can be removed while it is used in cartridge group: [cartridge-name] %s",
"c2"), removedC2, false);
- boolean removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
+ boolean removedC3 = cartridgeTest.removeCartridge("c3",
restClient);
assertEquals(String.format("Cartridge can be removed while it is used in cartridge group: [cartridge-name] %s",
"c2"), removedC3, false);
- boolean removed = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
+ boolean removed = cartridgeGroupTest.removeCartridgeGroup("G1",
restClient);
assertEquals(String.format("Cartridge Group did not removed: [cartridge-group-name] %s",
"cartrdige-nested"), removed, true);
- CartridgeGroupBean beanRemoved = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
+ CartridgeGroupBean beanRemoved = cartridgeGroupTest.getCartridgeGroup("G1",
restClient);
assertEquals(String.format("Cartridge Group did not removed completely: [cartridge-group-name] %s",
"cartrdige-nested"), beanRemoved, null);
- removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
+ removedC1 = cartridgeTest.removeCartridge("c1",
restClient);
assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
"c1"), removedC1, true);
- removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
+ removedC2 = cartridgeTest.removeCartridge("c2",
restClient);
assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
"c2"), removedC2, true);
- removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
+ removedC3 = cartridgeTest.removeCartridge("c3",
restClient);
assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s",
"c3"), removedC3, true);
@@ -242,41 +243,41 @@ public class SampleApplicationsTest extends StratosTestServerManager {
try {
boolean addedScalingPolicy = autoscalingPolicyTest.addAutoscalingPolicy("autoscaling-policy-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedScalingPolicy, true);
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", endpoint, restClient);
+ boolean addedC1 = cartridgeTest.addCartridge("c1.json", restClient);
assertEquals(addedC1, true);
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", endpoint, restClient);
+ boolean addedC2 = cartridgeTest.addCartridge("c2.json", restClient);
assertEquals(addedC2, true);
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", endpoint, restClient);
+ boolean addedC3 = cartridgeTest.addCartridge("c3.json", restClient);
assertEquals(addedC3, true);
boolean addedG1 = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedG1, true);
- CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
+ CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1",
restClient);
assertEquals(beanG1.getName(), "G1");
boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedN1, true);
boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedN2, true);
boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedDep, true);
boolean added = applicationTest.addApplication("g-sc-G123-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(added, true);
- ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1", endpoint,
+ ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1",
restClient);
assertEquals(bean.getApplicationId(), "g-sc-G123-1");
@@ -308,10 +309,10 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 2);
boolean updated = applicationTest.updateApplication("g-sc-G123-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(updated, true);
- ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1", endpoint,
+ ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1",
restClient);
assertEquals(bean.getApplicationId(), "g-sc-G123-1");
@@ -343,60 +344,60 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 3);
- boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
+ boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
restClient);
assertEquals(removedGroup, false);
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
+ boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
restClient);
assertEquals(removedAuto, false);
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
//Trying to remove the used network partition
assertEquals(removedNet, false);
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
+ boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
restClient);
assertEquals(removedDep, false);
- boolean removed = applicationTest.removeApplication("g-sc-G123-1", endpoint,
+ boolean removed = applicationTest.removeApplication("g-sc-G123-1",
restClient);
assertEquals(removed, true);
- ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1", endpoint,
+ ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1",
restClient);
assertEquals(beanRemoved, null);
- removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
+ removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
restClient);
assertEquals(removedGroup, true);
- boolean removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
+ boolean removedC1 = cartridgeTest.removeCartridge("c1",
restClient);
assertEquals(removedC1, true);
- boolean removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
+ boolean removedC2 = cartridgeTest.removeCartridge("c2",
restClient);
assertEquals(removedC2, true);
- boolean removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
+ boolean removedC3 = cartridgeTest.removeCartridge("c3",
restClient);
assertEquals(removedC3, true);
- removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
+ removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
restClient);
assertEquals(removedAuto, true);
- removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
+ removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
restClient);
assertEquals(removedDep, true);
- removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
assertEquals(removedNet, true);
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
+ boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
restClient);
assertEquals(removedN2, true);
@@ -417,55 +418,59 @@ public class SampleApplicationsTest extends StratosTestServerManager {
initializeApplicationEventReceiver();
initializeTopologyEventReceiver();
+ //Verifying whether the relevant Topologies are initialized
+ assertApplicationTopologyInitialized();
+ assertTopologyInitialized();
+
boolean addedScalingPolicy = autoscalingPolicyTest.addAutoscalingPolicy("autoscaling-policy-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedScalingPolicy, true);
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", endpoint, restClient);
+ boolean addedC1 = cartridgeTest.addCartridge("c1.json", restClient);
assertEquals(addedC1, true);
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", endpoint, restClient);
+ boolean addedC2 = cartridgeTest.addCartridge("c2.json", restClient);
assertEquals(addedC2, true);
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", endpoint, restClient);
+ boolean addedC3 = cartridgeTest.addCartridge("c3.json", restClient);
assertEquals(addedC3, true);
boolean addedG1 = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedG1, true);
- CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
+ CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1",
restClient);
assertEquals(beanG1.getName(), "G1");
boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedN1, true);
boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedN2, true);
boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedDep, true);
boolean added = applicationTest.addApplication("g-sc-G123-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(added, true);
- ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1", endpoint,
+ ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1",
restClient);
assertEquals(bean.getApplicationId(), "g-sc-G123-1");
boolean addAppPolicy = applicationPolicyTest.addApplicationPolicy(
- "application-policy-1.json", endpoint, restClient);
+ "application-policy-1.json", restClient);
assertEquals(addAppPolicy, true);
ApplicationPolicyBean policyBean = applicationPolicyTest.getApplicationPolicy(
- "application-policy-1", endpoint, restClient);
+ "application-policy-1", restClient);
//deploy the application
boolean deployed = applicationTest.deployApplication(bean.getApplicationId(),
- policyBean.getId(), endpoint, restClient);
+ policyBean.getId(), restClient);
assertEquals(deployed, true);
//Application active handling
@@ -479,91 +484,91 @@ public class SampleApplicationsTest extends StratosTestServerManager {
//Updating application
boolean updated = applicationTest.updateApplication("g-sc-G123-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(updated, true);
assertGroupInstanceCount(bean.getApplicationId(), "group3", 2);
assertClusterMinMemberCount(bean.getApplicationId(), 2);
- ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1", endpoint,
+ ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1",
restClient);
assertEquals(updatedBean.getApplicationId(), "g-sc-G123-1");
- boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
+ boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
restClient);
assertEquals(removedGroup, false);
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
+ boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
restClient);
assertEquals(removedAuto, false);
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
//Trying to remove the used network partition
assertEquals(removedNet, false);
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
+ boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
restClient);
assertEquals(removedDep, false);
//Un-deploying the application
- boolean unDeployed = applicationTest.undeployApplication("g-sc-G123-1", endpoint,
+ boolean unDeployed = applicationTest.undeployApplication("g-sc-G123-1",
restClient);
assertEquals(unDeployed, true);
assertApplicationUndeploy("g-sc-G123-1");
- boolean removed = applicationTest.removeApplication("g-sc-G123-1", endpoint,
+ boolean removed = applicationTest.removeApplication("g-sc-G123-1",
restClient);
assertEquals(removed, true);
- ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1", endpoint,
+ ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1",
restClient);
assertEquals(beanRemoved, null);
- removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
+ removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1",
restClient);
assertEquals(removedGroup, true);
- boolean removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
+ boolean removedC1 = cartridgeTest.removeCartridge("c1",
restClient);
assertEquals(removedC1, true);
- boolean removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
+ boolean removedC2 = cartridgeTest.removeCartridge("c2",
restClient);
assertEquals(removedC2, true);
- boolean removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
+ boolean removedC3 = cartridgeTest.removeCartridge("c3",
restClient);
assertEquals(removedC3, true);
- removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
+ removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1",
restClient);
assertEquals(removedAuto, true);
- removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
+ removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
restClient);
assertEquals(removedDep, true);
//Remove network partition used by application policy
- removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
assertEquals(removedNet, false);
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
+ boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
restClient);
assertEquals(removedN2, false);
- boolean removeAppPolicy = applicationPolicyTest.removeApplicationPolicy("application-policy-1", endpoint,
+ boolean removeAppPolicy = applicationPolicyTest.removeApplicationPolicy("application-policy-1",
restClient);
assertEquals(removeAppPolicy, true);
- removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
assertEquals(removedNet, true);
- removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
+ removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
restClient);
assertEquals(removedN2, true);
@@ -581,9 +586,9 @@ public class SampleApplicationsTest extends StratosTestServerManager {
log.info("Started network partition test case**************************************");
boolean added = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(added, true);
- NetworkPartitionBean bean = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
+ NetworkPartitionBean bean = networkPartitionTest.getNetworkPartition("network-partition-1",
restClient);
assertEquals(bean.getId(), "network-partition-1");
assertEquals(bean.getPartitions().size(), 1);
@@ -592,9 +597,9 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(bean.getPartitions().get(0).getProperty().get(0).getValue(), "default");
boolean updated = networkPartitionTest.updateNetworkPartition("network-partition-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(updated, true);
- NetworkPartitionBean updatedBean = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
+ NetworkPartitionBean updatedBean = networkPartitionTest.getNetworkPartition("network-partition-1",
restClient);
assertEquals(updatedBean.getId(), "network-partition-1");
assertEquals(updatedBean.getPartitions().size(), 2);
@@ -604,11 +609,11 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getName(), "zone");
assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getValue(), "z1");
- boolean removed = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ boolean removed = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
assertEquals(removed, true);
- NetworkPartitionBean beanRemoved = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
+ NetworkPartitionBean beanRemoved = networkPartitionTest.getNetworkPartition("network-partition-1",
restClient);
assertEquals(beanRemoved, null);
@@ -625,19 +630,19 @@ public class SampleApplicationsTest extends StratosTestServerManager {
log.info("Started deployment policy test case**************************************");
boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedN1, true);
boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedN2, true);
boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(addedDep, true);
DeploymentPolicyBean bean = deploymentPolicyTest.getDeploymentPolicy(
- "deployment-policy-1", endpoint, restClient);
+ "deployment-policy-1", restClient);
assertEquals(bean.getId(), "deployment-policy-1");
assertEquals(bean.getNetworkPartitions().size(), 2);
assertEquals(bean.getNetworkPartitions().get(0).getId(), "network-partition-1");
@@ -658,16 +663,16 @@ public class SampleApplicationsTest extends StratosTestServerManager {
//update network partition
boolean updated = networkPartitionTest.updateNetworkPartition("network-partition-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(updated, true);
//update deployment policy with new partition and max values
boolean updatedDep = deploymentPolicyTest.updateDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
+ restClient);
assertEquals(updatedDep, true);
DeploymentPolicyBean updatedBean = deploymentPolicyTest.getDeploymentPolicy(
- "deployment-policy-1", endpoint, restClient);
+ "deployment-policy-1", restClient);
assertEquals(updatedBean.getId(), "deployment-policy-1");
assertEquals(updatedBean.getNetworkPartitions().size(), 2);
assertEquals(updatedBean.getNetworkPartitions().get(0).getId(), "network-partition-1");
@@ -688,32 +693,32 @@ public class SampleApplicationsTest extends StratosTestServerManager {
"network-partition-2-partition-2");
assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 5);
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
//Trying to remove the used network partition
assertEquals(removedNet, false);
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
+ boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1",
restClient);
assertEquals(removedDep, true);
- DeploymentPolicyBean beanRemovedDep = deploymentPolicyTest.getDeploymentPolicy("deployment-policy-1", endpoint,
+ DeploymentPolicyBean beanRemovedDep = deploymentPolicyTest.getDeploymentPolicy("deployment-policy-1",
restClient);
assertEquals(beanRemovedDep, null);
- boolean removedN1 = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
+ boolean removedN1 = networkPartitionTest.removeNetworkPartition("network-partition-1",
restClient);
assertEquals(removedN1, true);
- NetworkPartitionBean beanRemovedN1 = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
+ NetworkPartitionBean beanRemovedN1 = networkPartitionTest.getNetworkPartition("network-partition-1",
restClient);
assertEquals(beanRemovedN1, null);
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
+ boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2",
restClient);
assertEquals(removedN2, true);
- NetworkPartitionBean beanRemovedN2 = networkPartitionTest.getNetworkPartition("network-partition-2", endpoint,
+ NetworkPartitionBean beanRemovedN2 = networkPartitionTest.getNetworkPartition("network-partition-2",
restClient);
assertEquals(beanRemovedN2, null);
@@ -730,9 +735,9 @@ public class SampleApplicationsTest extends StratosTestServerManager {
log.info("Started Cartridge test case**************************************");
try {
- boolean added = cartridgeTest.addCartridge("c0.json", endpoint, restClient);
+ boolean added = cartridgeTest.addCartridge("c0.json", restClient);
assertEquals(added, true);
- CartridgeBean bean = cartridgeTest.getCartridge("c0", endpoint, restClient);
+ CartridgeBean bean = cartridgeTest.getCartridge("c0", restClient);
assertEquals(bean.getType(), "c0");
assertEquals(bean.getCategory(), "Application");
assertEquals(bean.getHost(), "qmog.cisco.com");
@@ -762,9 +767,9 @@ public class SampleApplicationsTest extends StratosTestServerManager {
boolean updated = cartridgeTest.updateCartridge("c0.json",
- endpoint, restClient);
+ restClient);
assertEquals(updated, true);
- CartridgeBean updatedBean = cartridgeTest.getCartridge("c0", endpoint,
+ CartridgeBean updatedBean = cartridgeTest.getCartridge("c0",
restClient);
assertEquals(updatedBean.getType(), "c0");
assertEquals(updatedBean.getCategory(), "Data");
@@ -793,11 +798,11 @@ public class SampleApplicationsTest extends StratosTestServerManager {
}
}
- boolean removed = cartridgeTest.removeCartridge("c0", endpoint,
+ boolean removed = cartridgeTest.removeCartridge("c0",
restClient);
assertEquals(removed, true);
- CartridgeBean beanRemoved = cartridgeTest.getCartridge("c0", endpoint,
+ CartridgeBean beanRemoved = cartridgeTest.getCartridge("c0",
restClient);
assertEquals(beanRemoved, null);
@@ -865,6 +870,46 @@ public class SampleApplicationsTest extends StratosTestServerManager {
}
/**
+ * Assert application Topology initialization
+ *
+ */
+ private void assertApplicationTopologyInitialized() {
+ long startTime = System.currentTimeMillis();
+ boolean applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
+ while (!applicationTopologyInitialized) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
+ break;
+ }
+ }
+ assertEquals(String.format("Application Topology didn't get initialized "), applicationTopologyInitialized, true);
+ }
+
+ /**
+ * Assert Topology initialization
+ *
+ */
+ private void assertTopologyInitialized() {
+ long startTime = System.currentTimeMillis();
+ boolean topologyInitialized = TopologyManager.getTopology().isInitialized();
+ while (!topologyInitialized) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ignore) {
+ }
+ topologyInitialized = TopologyManager.getTopology().isInitialized();
+ if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
+ break;
+ }
+ }
+ assertEquals(String.format("Topology didn't get initialized "), topologyInitialized, true);
+ }
+
+ /**
* Assert application activation
*
* @param applicationName
@@ -1053,7 +1098,7 @@ public class SampleApplicationsTest extends StratosTestServerManager {
applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
log.info("Force undeployment is going to start for the [application] " + applicationName);
- applicationTest.forceUndeployApplication(applicationName, endpoint, restClient);
+ applicationTest.forceUndeployApplication(applicationName, restClient);
while (application.getInstanceContextCount() > 0 ||
applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
try {
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java
deleted file mode 100644
index 9a81972..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonParser;
-import org.apache.commons.lang.StringUtils;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-
-/**
- * Util class
- */
-public class StratosArtifactsUtils {
-
- public String getJsonStringFromFile(String filePath) throws FileNotFoundException {
- JsonParser parser = new JsonParser();
- Object object = parser.parse(new FileReader(getResourcesFolderPath() + filePath));
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- String content = gson.toJson(object);
- return content;
-
- }
-
- /**
- * Get resources folder path
- * @return
- */
- private String getResourcesFolderPath() {
- String path = getClass().getResource("/").getPath();
- return StringUtils.removeEnd(path, File.separator);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
index fb5ff51..a1b07e1 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
@@ -19,19 +19,32 @@
package org.apache.stratos.integration.tests.rest;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonParser;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.http.client.methods.*;
+import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.net.URI;
/**
* Rest client to handle rest requests
*/
public class RestClient {
-
+ private static final Log log = LogFactory.getLog(RestClient.class);
private DefaultHttpClient httpClient;
+ private String endPoint;
+ private String userName;
+ private String password;
public RestClient() {
PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
@@ -44,6 +57,13 @@ public class RestClient {
httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient);
}
+ public RestClient(String endPoint, String userName, String password) {
+ this();
+ this.endPoint = endPoint;
+ this.userName = userName;
+ this.password = password;
+ }
+
/**
* Handle http post request. Return String
*
@@ -130,4 +150,190 @@ public class RestClient {
request.releaseConnection();
}
}
+
+ public boolean addEntity(String filePath, String resourcePath, String entityName) {
+ try {
+ String content = getJsonStringFromFile(filePath);
+ URI uri = new URIBuilder(this.endPoint + resourcePath).build();
+
+ HttpResponse response = doPost(uri, content);
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return true;
+ } 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());
+ }
+ }
+ }
+ log.error("An unknown error occurred while trying to add " + entityName);
+ throw new RuntimeException("An unknown error occurred while trying to add" + entityName);
+ } catch (Exception e) {
+ String message = "Could not add " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public boolean deployEntity(String resourcePath, String entityName) {
+ try {
+ URI uri = new URIBuilder(this.endPoint + resourcePath).build();
+
+ HttpResponse response = doPost(uri, "");
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return true;
+ } 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());
+ }
+ }
+ }
+ log.error("An unknown error occurred while trying to deploy " + entityName);
+ throw new RuntimeException("An unknown error occurred while trying to deploy " + entityName);
+ } catch (Exception e) {
+ String message = "Could not deploy " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public boolean undeployEntity(String resourcePath, String entityName) {
+ try {
+ URI uri = new URIBuilder(this.endPoint + resourcePath).build();
+
+ HttpResponse response = doPost(uri, "");
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return true;
+ } 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());
+ }
+ }
+ }
+ log.error("An unknown error occurred while trying to deploy " + entityName);
+ throw new RuntimeException("An unknown error occurred while trying to deploy " + entityName);
+ } catch (Exception e) {
+ String message = "Could not deploy " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public Object getEntity(String resourcePath, String identifier, Class responseJsonClass,
+ String entityName) {
+ try {
+ URI uri = new URIBuilder(this.endPoint + resourcePath + "/" + identifier).build();
+ HttpResponse response = doGet(uri);
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ Gson gson = gsonBuilder.create();
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return gson.fromJson(response.getContent(), responseJsonClass);
+ } else if (response.getStatusCode() == 404) {
+ return null;
+ } else {
+ ErrorResponse errorResponse = gson.fromJson(response.getContent(),
+ ErrorResponse.class);
+ if (errorResponse != null) {
+ throw new RuntimeException(errorResponse.getErrorMessage());
+ }
+ }
+ }
+ String msg = "An unknown error occurred while getting the " + entityName;
+ log.error(msg);
+ throw new RuntimeException(msg);
+ } catch (Exception e) {
+ String message = "Could not get " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public boolean removeEntity(String resourcePath, String identifier, String entityName) {
+ try {
+ URI uri = new URIBuilder(this.endPoint + "/" + resourcePath + "/" + identifier).build();
+ HttpResponse response = doDelete(uri);
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return true;
+ } else if (response.getContent().contains("it is used") || response.getContent().contains("in use")) {
+ return false;
+ } 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());
+ }
+ }
+ }
+ String msg = "An unknown error occurred while removing the " + entityName;
+ log.error(msg);
+ throw new RuntimeException(msg);
+ } catch (Exception e) {
+ String message = "Could not remove " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public boolean updateEntity(String filePath, String resourcePath, String entityName) {
+ try {
+ String content = getJsonStringFromFile(filePath);
+ URI uri = new URIBuilder(this.endPoint + resourcePath).build();
+
+ HttpResponse response = doPut(uri, content);
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return true;
+ } 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());
+ }
+ }
+ }
+ log.error("An unknown error occurred while trying to update " + entityName);
+ throw new RuntimeException("An unknown error occurred while trying to update" + entityName);
+ } catch (Exception e) {
+ String message = "Could not add " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public String getJsonStringFromFile(String filePath) throws FileNotFoundException {
+ JsonParser parser = new JsonParser();
+ Object object = parser.parse(new FileReader(getResourcesFolderPath() + filePath));
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ Gson gson = gsonBuilder.create();
+ String content = gson.toJson(object);
+ return content;
+
+ }
+
+ /**
+ * Get resources folder path
+ *
+ * @return
+ */
+ private String getResourcesFolderPath() {
+ String path = getClass().getResource("/").getPath();
+ return StringUtils.removeEnd(path, File.separator);
+ }
}
[09/12] stratos git commit: Introducing stratos integration test
suite for the artifacts
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-4.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-4.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-4.json
deleted file mode 100644
index fb0cb9c..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-4.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-4",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json
new file mode 100644
index 0000000..275b536
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5-v1.json
@@ -0,0 +1,28 @@
+{
+ "id": "network-partition-5",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default1"
+ },
+ {
+ "name": "zone",
+ "value": "z1"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json
new file mode 100644
index 0000000..5464aa9
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-5.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-5",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json
new file mode 100644
index 0000000..d200b70
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-6.json
@@ -0,0 +1,24 @@
+{
+ "id": "network-partition-6",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "network-partition-6-partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "network-partition-6-partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json
new file mode 100644
index 0000000..6250504
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-7.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-7",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json
new file mode 100644
index 0000000..354b837
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/network-partition-8.json
@@ -0,0 +1,24 @@
+{
+ "id": "network-partition-8",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "network-partition-8-partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "network-partition-8-partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/mock/update/network-partition-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/update/network-partition-1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/mock/update/network-partition-1.json
deleted file mode 100644
index 054265a..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/mock/update/network-partition-1.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "id": "network-partition-1",
- "provider": "mock",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "default"
- }
- ]
- },
- {
- "id": "partition-2",
- "property": [
- {
- "name": "region",
- "value": "default1"
- },
- {
- "name": "zone",
- "value": "z1"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-1-nw-partition.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-1-nw-partition.json b/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-1-nw-partition.json
deleted file mode 100644
index 061fc73..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-1-nw-partition.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "id": "ap-southeast-1-nw-partition",
- "provider": "ec2-singapore",
- "partitions": [
- {
- "id": "ap-southeast-1a-partition",
- "property": [
- {
- "name": "region",
- "value": "ap-southeast-1"
- },
- {
- "name": "zone",
- "value": "ap-southeast-1a"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-2-nw-partition.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-2-nw-partition.json b/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-2-nw-partition.json
deleted file mode 100644
index 435d2f0..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/multi/ap-southeast-2-nw-partition.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "id": "ap-southeast-2-nw-partition",
- "provider": "ec2-sydney",
- "partitions": [
- {
- "id": "ap-southeast-2b-partition",
- "property": [
- {
- "name": "region",
- "value": "ap-southeast-2"
- },
- {
- "name": "zone",
- "value": "ap-southeast-2b"
- }
- ]
- }
- ],
- "properties": [
- {
- "name": "payload_parameter.PUPPET_IP",
- "value": "172.31.9.64"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/multi/openstack-nw-partition.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/multi/openstack-nw-partition.json b/products/stratos/modules/integration/src/test/resources/network-partitions/multi/openstack-nw-partition.json
deleted file mode 100644
index c95a987..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/multi/openstack-nw-partition.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "id": "openstack-nw-partition",
- "provider": "openstack",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "RegionOne"
- }
- ]
- }
- ],
- "properties": [
- {
- "name": "payload_parameter.PUPPET_IP",
- "value": "192.168.60.16"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-1.json b/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-1.json
deleted file mode 100644
index aa14c0f..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-1.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-1",
- "provider": "openstack",
- "partitions": [
- {
- "id": "partition-1",
- "property": [
- {
- "name": "region",
- "value": "RegionOne"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-2.json b/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-2.json
deleted file mode 100644
index c4db4a5..0000000
--- a/products/stratos/modules/integration/src/test/resources/network-partitions/openstack/network-partition-2.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "network-partition-2",
- "provider": "openstack",
- "partitions": [
- {
- "id": "partition-2",
- "property": [
- {
- "name": "region",
- "value": "RegionOne"
- }
- ]
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5b844043/products/stratos/modules/integration/src/test/resources/testng.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/testng.xml b/products/stratos/modules/integration/src/test/resources/testng.xml
new file mode 100644
index 0000000..c450bf0
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/testng.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="StratosIntegrationSuite">
+
+ <test name="CartridgeTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.CartridgeTest" />
+ </classes>
+ </test>
+ <test name="CartridgeGroupTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.CartridgeGroupTest" />
+ </classes>
+ </test>
+ <test name="NetworkPartitionTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.NetworkPartitionTest" />
+ </classes>
+ </test>
+ <test name="ApplicationPolicyTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.ApplicationPolicyTest" />
+ </classes>
+ </test>
+ <test name="DeploymentPolicyTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.DeploymentPolicyTest" />
+ </classes>
+ </test>
+ <test name="AutoscalingPolicyTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.AutoscalingPolicyTest" />
+ </classes>
+ </test>
+ <test name="SampleApplicationsTest">
+ <classes>
+ <class name="org.apache.stratos.integration.tests.SampleApplicationsTest" />
+ </classes>
+ </test>
+
+</suite>
[04/12] stratos git commit: refining the resources to have the
samples with the reference of the test case
Posted by re...@apache.org.
refining the resources to have the samples with the reference of the test case
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ce00b955
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ce00b955
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ce00b955
Branch: refs/heads/master
Commit: ce00b955b73cf45a7386f5faa6bf69ed6242d391
Parents: 5b84404
Author: reka <rt...@gmail.com>
Authored: Thu Aug 6 19:02:26 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Aug 6 19:33:43 2015 +0530
----------------------------------------------------------------------
.../tests/ApplicationBurstingTest.java | 190 ++++++++++++++++++-
.../tests/ApplicationPolicyTest.java | 2 +
.../integration/tests/ApplicationTest.java | 29 ---
.../tests/AutoscalingPolicyTest.java | 2 +
.../integration/tests/CartridgeGroupTest.java | 11 +-
.../integration/tests/CartridgeTest.java | 2 +
.../integration/tests/DeploymentPolicyTest.java | 12 +-
.../integration/tests/NetworkPartitionTest.java | 6 +-
.../integration/tests/RestConstants.java | 2 +-
.../tests/SampleApplicationsTest.java | 44 ++---
.../application-policy-3.json | 18 ++
.../app-bursting-single-cartriddge-group.json | 70 +++++++
.../autoscaling-policy-2.json | 14 ++
.../cartridges-groups/esb-php-group.json | 19 ++
.../cartridges/mock/esb.json | 50 +++++
.../cartridges/mock/php.json | 51 +++++
.../cartridges/mock/tomcat.json | 53 ++++++
.../deployment-policy-4.json | 32 ++++
.../mock/network-partition-10.json | 24 +++
.../mock/network-partition-9.json | 15 ++
.../application-policy-1.json | 18 --
.../application-policy-2.json | 18 --
.../application-policy-3.json | 18 ++
.../mock/network-partition-10.json | 24 +++
.../mock/network-partition-9.json | 15 ++
.../simple/single-cartridge-app/README.md | 25 ---
.../single-cartridge-app/g-sc-G123-1-v1.json | 86 ---------
.../single-cartridge-app/g-sc-G123-1-v2.json | 86 ---------
.../single-cartridge-app/g-sc-G123-1-v3.json | 86 ---------
.../single-cartridge-app/g-sc-G123-1.json | 86 ---------
.../autoscaling-policy-1.json | 14 --
.../autoscaling-policy-c0-v1.json | 14 --
.../autoscaling-policy-c0.json | 14 --
.../autoscaling-policy-c0-v1.json | 14 ++
.../autoscaling-policy-c0.json | 14 ++
.../cartridges-groups/g4-g5-g6-v1.json | 50 +++++
.../cartridges-groups/g4-g5-g6.json | 50 +++++
.../cartridges/mock/c4.json | 45 +++++
.../cartridges/mock/c5.json | 124 ++++++++++++
.../cartridges/mock/c6.json | 45 +++++
.../cartridge-test/cartridges/mock/c0-v1.json | 124 ++++++++++++
.../cartridge-test/cartridges/mock/c0.json | 124 ++++++++++++
.../cartridges-groups/cartrdige-nested-v1.json | 50 -----
.../cartridges-groups/cartrdige-nested.json | 50 -----
.../cartridges-groups/g4-g5-g6-v1.json | 50 -----
.../resources/cartridges-groups/g4-g5-g6.json | 50 -----
.../test/resources/cartridges/mock/c0-v1.json | 124 ------------
.../src/test/resources/cartridges/mock/c0.json | 124 ------------
.../src/test/resources/cartridges/mock/c1.json | 45 -----
.../src/test/resources/cartridges/mock/c2.json | 45 -----
.../src/test/resources/cartridges/mock/c3.json | 45 -----
.../src/test/resources/cartridges/mock/c4.json | 45 -----
.../src/test/resources/cartridges/mock/c5.json | 124 ------------
.../src/test/resources/cartridges/mock/c6.json | 45 -----
.../deployment-policy-1-v1.json | 36 ----
.../deployment-policy-1.json | 32 ----
.../deployment-policy-2-v1.json | 36 ----
.../deployment-policy-2.json | 32 ----
.../deployment-policy-3.json | 32 ----
.../deployment-policy-2-v1.json | 36 ++++
.../deployment-policy-2.json | 32 ++++
.../mock/network-partition-5-v1.json | 28 +++
.../mock/network-partition-5.json | 15 ++
.../mock/network-partition-6.json | 24 +++
.../mock/network-partition-3-v1.json | 28 +++
.../mock/network-partition-3.json | 15 ++
.../mock/network-partition-1-v1.json | 28 ---
.../mock/network-partition-1.json | 15 --
.../mock/network-partition-2.json | 24 ---
.../mock/network-partition-3-v1.json | 28 ---
.../mock/network-partition-3.json | 15 --
.../mock/network-partition-5-v1.json | 28 ---
.../mock/network-partition-5.json | 15 --
.../mock/network-partition-6.json | 24 ---
.../mock/network-partition-7.json | 15 --
.../mock/network-partition-8.json | 24 ---
.../application-policy-1.json | 18 ++
.../applications/g-sc-G123-1-v1.json | 86 +++++++++
.../applications/g-sc-G123-1-v2.json | 86 +++++++++
.../applications/g-sc-G123-1-v3.json | 86 +++++++++
.../applications/g-sc-G123-1.json | 86 +++++++++
.../autoscaling-policy-1.json | 14 ++
.../cartridges-groups/cartrdige-nested-v1.json | 50 +++++
.../cartridges-groups/cartrdige-nested.json | 50 +++++
.../cartridges/mock/c1.json | 45 +++++
.../cartridges/mock/c2.json | 45 +++++
.../cartridges/mock/c3.json | 45 +++++
.../deployment-policy-1-v1.json | 36 ++++
.../deployment-policy-1.json | 32 ++++
.../mock/network-partition-1-v1.json | 28 +++
.../mock/network-partition-1.json | 15 ++
.../mock/network-partition-2.json | 24 +++
.../integration/src/test/resources/testng.xml | 5 +
93 files changed, 2156 insertions(+), 1694 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java
index cefd786..518c7cb 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationBurstingTest.java
@@ -18,8 +18,11 @@
*/
package org.apache.stratos.integration.tests;
+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.testng.annotations.Test;
import static junit.framework.Assert.assertEquals;
@@ -29,9 +32,192 @@ import static junit.framework.Assert.assertTrue;
* This will handle the application bursting test cases
*/
public class ApplicationBurstingTest extends StratosTestServerManager {
+ private static final Log log = LogFactory.getLog(SampleApplicationsTest.class);
+ private static final String TEST_PATH = "/application-bursting-test";
+
@Test
- public void testApplication() {
- assertTrue("test passes", true);
+ public void testDeployApplication() {
+ try {
+ log.info("Started application Bursting test case**************************************");
+
+ String autoscalingPolicyId = "autoscaling-policy-2";
+
+ boolean addedScalingPolicy = restClient.addEntity(TEST_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+ + "/" + autoscalingPolicyId + ".json",
+ RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+ assertEquals(addedScalingPolicy, true);
+
+ boolean addedC1 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "esb.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC1, true);
+
+ boolean addedC2 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "php.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC2, true);
+
+ boolean addedC3 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "tomcat.json",
+ RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ assertEquals(addedC3, true);
+
+ boolean addedG1 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
+ "/" + "esb-php-group.json", RestConstants.CARTRIDGE_GROUPS,
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(addedG1, true);
+
+ CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group",
+ CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(beanG1.getName(), "esb-php-group");
+
+ boolean addedN1 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-9.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN1, true);
+
+ boolean addedN2 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ "network-partition-10.json",
+ RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(addedN2, true);
+
+ boolean addedDep = restClient.addEntity(TEST_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ "deployment-policy-4.json",
+ RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(addedDep, true);
+
+ boolean added = restClient.addEntity(TEST_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,
+ "cartridge-group-app", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(bean.getApplicationId(), "cartridge-group-app");
+
+ boolean addAppPolicy = restClient.addEntity(TEST_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ "application-policy-3.json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(addAppPolicy, true);
+
+ ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+ RestConstants.APPLICATION_POLICIES,
+ "application-policy-3", ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
+
+ //deploy the application
+ String resourcePath = RestConstants.APPLICATIONS + "/" + "cartridge-group-app" +
+ RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-3";
+ boolean deployed = restClient.deployEntity(resourcePath,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(deployed, true);
+
+ //Application active handling
+ TopologyHandler.getInstance().assertApplicationActivation(bean.getApplicationId());
+
+ //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",
+ 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-9",
+ RestConstants.NETWORK_PARTITIONS_NAME);
+ //Trying to remove the used network partition
+ assertEquals(removedNet, false);
+
+ boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+ "deployment-policy-4", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, false);
+
+ //Un-deploying the application
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "cartridge-group-app" +
+ RestConstants.APPLICATIONS_UNDEPLOY;
+
+ boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(unDeployed, true);
+
+ boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("cartridge-group-app");
+ if (!undeploy) {
+ //Need to forcefully undeploy the application
+ log.info("Force undeployment is going to start for the [application] " + "cartridge-group-app");
+
+ restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "cartridge-group-app" +
+ RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
+
+ boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("cartridge-group-app");
+ assertEquals(String.format("Forceful undeployment failed for the application %s",
+ "cartridge-group-app"), forceUndeployed, true);
+
+ }
+
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "cartridge-group-app",
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(removed, true);
+
+ ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+ "cartridge-group-app", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ assertEquals(beanRemoved, null);
+
+ removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group",
+ RestConstants.CARTRIDGE_GROUPS_NAME);
+ assertEquals(removedGroup, true);
+
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "esb",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC1, true);
+
+ boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "php",
+ RestConstants.CARTRIDGES_NAME);
+ assertEquals(removedC2, true);
+
+ boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "tomcat",
+ 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-4", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ assertEquals(removedDep, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-9", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, false);
+
+ boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-10", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedN2, false);
+
+ boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+ "application-policy-3", RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(removeAppPolicy, true);
+
+ removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-9", RestConstants.NETWORK_PARTITIONS_NAME);
+ assertEquals(removedNet, true);
+
+ removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+ "network-partition-10", 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/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
index b727e82..cc9f976 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
@@ -34,6 +34,8 @@ import static junit.framework.Assert.assertTrue;
*/
public class ApplicationPolicyTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(ApplicationPolicyTest.class);
+ private static final String TEST_PATH = "/application-policy-test";
+
@Test
public void testApplicationPolicy() {
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
deleted file mode 100644
index 8ceec4d..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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;
-
-import org.apache.stratos.messaging.message.receiver.application.ApplicationsEventReceiver;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
-
-/**
- * Super class for application test cases
- */
-public class ApplicationTest extends StratosTestServerManager {
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
index d841552..bcacfc8 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
@@ -31,6 +31,8 @@ import static junit.framework.Assert.assertTrue;
*/
public class AutoscalingPolicyTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(AutoscalingPolicyTest.class);
+ private static final String TEST_PATH = "/autoscaling-policy-test";
+
@Test
public void testAutoscalingPolicy() {
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
index 8bc3a9e..873fa5a 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
@@ -32,25 +32,26 @@ import static junit.framework.Assert.assertTrue;
*/
public class CartridgeGroupTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(CartridgeGroupTest.class);
+ private static final String TEST_PATH = "/cartridge-group-test";
@Test
public void testCartridgeGroup() {
try {
log.info("Started Cartridge group test case**************************************");
- boolean addedC1 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c4.json",
+ boolean addedC1 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c4.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c4"), addedC1, true);
- boolean addedC2 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c5.json",
+ boolean addedC2 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c5.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c5"), addedC2, true);
- boolean addedC3 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c6.json",
+ boolean addedC3 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c6.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c6"), addedC3, true);
- boolean added = restClient.addEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ boolean added = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
"/" + "g4-g5-g6.json", RestConstants.CARTRIDGE_GROUPS,
RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(String.format("Cartridge Group did not added: [cartridge-group-name] %s",
@@ -61,7 +62,7 @@ public class CartridgeGroupTest extends StratosTestServerManager {
assertEquals(String.format("Cartridge Group name did not match: [cartridge-group-name] %s",
"g4-g5-g6.json"), bean.getName(), "G4");
- boolean updated = restClient.updateEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ boolean updated = restClient.updateEntity(TEST_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
"/" + "g4-g5-g6-v1.json",
RestConstants.CARTRIDGE_GROUPS, RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(String.format("Cartridge Group did not updated: [cartridge-group-name] %s",
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
index 26eb881..638d742 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
@@ -33,6 +33,8 @@ import static junit.framework.Assert.assertTrue;
*/
public class CartridgeTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(CartridgeTest.class);
+ private static final String TEST_PATH = "/cartridge-group-test";
+
@Test
public void testCartridge() {
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
index 6c1f4e0..b384e46 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
@@ -33,6 +33,8 @@ import static junit.framework.Assert.assertTrue;
*/
public class DeploymentPolicyTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(DeploymentPolicyTest.class);
+ private static final String TEST_PATH = "/deployment-policy-test";
+
@Test
public void testDeploymentPolicy() {
@@ -40,17 +42,17 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
String deploymentPolicyId = "deployment-policy-2";
log.info("Started deployment policy test case**************************************");
- boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN1 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-5" + ".json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN1, true);
- boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN2 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-6" + ".json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN2, true);
- boolean addedDep = restClient.addEntity(RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ boolean addedDep = restClient.addEntity(TEST_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
deploymentPolicyId + ".json",
RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(addedDep, true);
@@ -77,13 +79,13 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 9);
//update network partition
- boolean updated = restClient.updateEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean updated = restClient.updateEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-5-v1.json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(updated, true);
//update deployment policy with new partition and max values
- boolean updatedDep = restClient.updateEntity(RestConstants.DEPLOYMENT_POLICIES_PATH +
+ boolean updatedDep = restClient.updateEntity(TEST_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH +
"/" + deploymentPolicyId + "-v1.json", RestConstants.DEPLOYMENT_POLICIES,
RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(updatedDep, true);
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
index a2ec9dc..741d8be 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
@@ -32,6 +32,8 @@ import static junit.framework.Assert.assertTrue;
*/
public class NetworkPartitionTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(NetworkPartitionTest.class);
+ private static final String TEST_PATH = "/network-partition-test";
+
@Test
public void testNetworkPartition() {
@@ -39,7 +41,7 @@ public class NetworkPartitionTest extends StratosTestServerManager {
String networkPartitionId = "network-partition-3";
log.info("Started network partition test case**************************************");
- boolean added = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean added = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
networkPartitionId + ".json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
@@ -54,7 +56,7 @@ public class NetworkPartitionTest extends StratosTestServerManager {
assertEquals(bean.getPartitions().get(0).getProperty().get(0).getName(), "region");
assertEquals(bean.getPartitions().get(0).getProperty().get(0).getValue(), "default");
- boolean updated = restClient.updateEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean updated = restClient.updateEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
networkPartitionId + "-v1.json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
index 181aaa5..bf7de6c 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
@@ -44,7 +44,7 @@ public class RestConstants {
public static final String NETWORK_PARTITIONS_NAME = "networkPartition";
public static final String DEPLOYMENT_POLICIES_PATH = "/deployment-policies/";
public static final String DEPLOYMENT_POLICIES_NAME = "deploymentPolicy";
- public static final String APPLICATIONS_PATH = "/applications/simple/single-cartridge-app/";
+ public static final String APPLICATIONS_PATH = "/applications/";
public static final String APPLICATIONS_NAME = "application";
public static final String APPLICATION_POLICIES_PATH = "/application-policies/";
public static final String APPLICATION_POLICIES_NAME = "applicationPolicy";
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
index 7641b18..b2960e2 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
@@ -34,7 +34,7 @@ import static junit.framework.Assert.assertTrue;
*/
public class SampleApplicationsTest extends StratosTestServerManager {
private static final Log log = LogFactory.getLog(SampleApplicationsTest.class);
-
+ private static final String TEST_PATH = "/sample-applications-test";
@Test
public void testApplication() {
@@ -42,24 +42,24 @@ public class SampleApplicationsTest extends StratosTestServerManager {
String autoscalingPolicyId = "autoscaling-policy-1";
try {
- boolean addedScalingPolicy = restClient.addEntity(RestConstants.AUTOSCALING_POLICIES_PATH
+ boolean addedScalingPolicy = restClient.addEntity(TEST_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+ "/" + autoscalingPolicyId + ".json",
RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(addedScalingPolicy, true);
- boolean addedC1 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c1.json",
+ boolean addedC1 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c1.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC1, true);
- boolean addedC2 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c2.json",
+ boolean addedC2 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c2.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC2, true);
- boolean addedC3 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c3.json",
+ boolean addedC3 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c3.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC3, true);
- boolean addedG1 = restClient.addEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ boolean addedG1 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
"/" + "cartrdige-nested.json", RestConstants.CARTRIDGE_GROUPS,
RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(addedG1, true);
@@ -69,22 +69,22 @@ public class SampleApplicationsTest extends StratosTestServerManager {
CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(beanG1.getName(), "G1");
- boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN1 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-1.json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN1, true);
- boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN2 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-2.json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN2, true);
- boolean addedDep = restClient.addEntity(RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ boolean addedDep = restClient.addEntity(TEST_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
"deployment-policy-1.json",
RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(addedDep, true);
- boolean added = restClient.addEntity(RestConstants.APPLICATIONS_PATH + "/" +
+ boolean added = restClient.addEntity(TEST_PATH + RestConstants.APPLICATIONS_PATH + "/" +
"g-sc-G123-1.json", RestConstants.APPLICATIONS,
RestConstants.APPLICATIONS_NAME);
assertEquals(added, true);
@@ -120,7 +120,7 @@ public class SampleApplicationsTest extends StratosTestServerManager {
assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 1);
assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 2);
- boolean updated = restClient.updateEntity(RestConstants.APPLICATIONS_PATH + "/g-sc-G123-1-v1.json",
+ boolean updated = restClient.updateEntity(TEST_PATH + RestConstants.APPLICATIONS_PATH + "/g-sc-G123-1-v1.json",
RestConstants.APPLICATIONS, RestConstants.APPLICATIONS_NAME);
assertEquals(updated, true);
@@ -229,24 +229,24 @@ public class SampleApplicationsTest extends StratosTestServerManager {
String autoscalingPolicyId = "autoscaling-policy-1";
- boolean addedScalingPolicy = restClient.addEntity(RestConstants.AUTOSCALING_POLICIES_PATH
+ boolean addedScalingPolicy = restClient.addEntity(TEST_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+ "/" + autoscalingPolicyId + ".json",
RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
assertEquals(addedScalingPolicy, true);
- boolean addedC1 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c1.json",
+ boolean addedC1 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c1.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC1, true);
- boolean addedC2 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c2.json",
+ boolean addedC2 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c2.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC2, true);
- boolean addedC3 = restClient.addEntity(RestConstants.CARTRIDGES_PATH + "/" + "c3.json",
+ boolean addedC3 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c3.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertEquals(addedC3, true);
- boolean addedG1 = restClient.addEntity(RestConstants.CARTRIDGE_GROUPS_PATH +
+ boolean addedG1 = restClient.addEntity(TEST_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
"/" + "cartrdige-nested.json", RestConstants.CARTRIDGE_GROUPS,
RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(addedG1, true);
@@ -256,22 +256,22 @@ public class SampleApplicationsTest extends StratosTestServerManager {
CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
assertEquals(beanG1.getName(), "G1");
- boolean addedN1 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN1 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-1.json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN1, true);
- boolean addedN2 = restClient.addEntity(RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+ boolean addedN2 = restClient.addEntity(TEST_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
"network-partition-2.json",
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertEquals(addedN2, true);
- boolean addedDep = restClient.addEntity(RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+ boolean addedDep = restClient.addEntity(TEST_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
"deployment-policy-1.json",
RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
assertEquals(addedDep, true);
- boolean added = restClient.addEntity(RestConstants.APPLICATIONS_PATH + "/" +
+ boolean added = restClient.addEntity(TEST_PATH + RestConstants.APPLICATIONS_PATH + "/" +
"g-sc-G123-1.json", RestConstants.APPLICATIONS,
RestConstants.APPLICATIONS_NAME);
assertEquals(added, true);
@@ -280,7 +280,7 @@ public class SampleApplicationsTest extends StratosTestServerManager {
"g-sc-G123-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
assertEquals(bean.getApplicationId(), "g-sc-G123-1");
- boolean addAppPolicy = restClient.addEntity(RestConstants.APPLICATION_POLICIES_PATH + "/" +
+ boolean addAppPolicy = restClient.addEntity(TEST_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
"application-policy-1.json", RestConstants.APPLICATION_POLICIES,
RestConstants.APPLICATION_POLICIES_NAME);
assertEquals(addAppPolicy, true);
@@ -307,7 +307,7 @@ public class SampleApplicationsTest extends StratosTestServerManager {
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
//Updating application
- boolean updated = restClient.updateEntity(RestConstants.APPLICATIONS_PATH + "/" +
+ boolean updated = restClient.updateEntity(TEST_PATH + RestConstants.APPLICATIONS_PATH + "/" +
"g-sc-G123-1-v1.json", RestConstants.APPLICATIONS,
RestConstants.APPLICATIONS_NAME);
assertEquals(updated, true);
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json
new file mode 100644
index 0000000..2cecc06
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-3.json
@@ -0,0 +1,18 @@
+{
+ "id": "application-policy-3",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-9",
+ "network-partition-10"
+ ],
+ "properties": [
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-9|network-partition-10"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json
new file mode 100644
index 0000000..4e00d60
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json
@@ -0,0 +1,70 @@
+{
+ "applicationId": "cartridge-group-app",
+ "alias": "my-cartridge-group-app",
+ "components": {
+ "groups": [
+ {
+ "name": "esb-php-group",
+ "alias": "my-esb-php-group",
+ "deploymentPolicy": "deployment-policy-4",
+ "groupMinInstances": 1,
+ "groupMaxInstances": 2,
+ "cartridges": [
+ {
+ "type": "esb",
+ "cartridgeMin": 1,
+ "cartridgeMax": 2,
+ "subscribableInfo": {
+ "alias": "my-esb",
+ "autoscalingPolicy": "autoscaling-policy-2",
+ "artifactRepository": {
+ "privateRepo": false,
+ "repoUrl": "https://github.com/imesh/stratos-esb-applications.git",
+ "repoUsername": "",
+ "repoPassword": ""
+ }
+ }
+ },
+ {
+ "type": "php",
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "lvsVirtualIP": "192.168.56.50|255.255.255.0",
+ "subscribableInfo": {
+ "alias": "my-php",
+ "autoscalingPolicy": "autoscaling-policy-2",
+ "artifactRepository": {
+ "privateRepo": false,
+ "repoUrl": "https://github.com/imesh/stratos-php-applications.git",
+ "repoUsername": "",
+ "repoPassword": ""
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "cartridges": [
+ {
+ "type": "tomcat",
+ "cartridgeMin": 2,
+ "cartridgeMax": 4,
+ "subscribableInfo": {
+ "alias": "my-tomcat",
+ "autoscalingPolicy": "autoscaling-policy-2",
+ "deploymentPolicy": "deployment-policy-4",
+ "artifactRepository": {
+ "privateRepo": false,
+ "repoUrl": "https://github.com/imesh/stratos-tomcat-applications.git",
+ "repoUsername": "",
+ "repoPassword": ""
+ }
+ }
+ }
+ ],
+ "dependencies": {
+ "terminationBehaviour": "terminate-none"
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-2.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-2.json
new file mode 100644
index 0000000..944aa82
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-2.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscaling-policy-2",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 35
+ },
+ "memoryConsumption": {
+ "threshold": 45
+ },
+ "loadAverage": {
+ "threshold": 25
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group.json
new file mode 100644
index 0000000..008c735
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group.json
@@ -0,0 +1,19 @@
+{
+ "name": "esb-php-group",
+ "cartridges": [
+ "esb",
+ "php"
+ ],
+ "dependencies": {
+ "startupOrders": [
+ {
+ "aliases": [
+ "cartridge.my-esb",
+ "cartridge.my-php"
+ ]
+ }
+ ],
+ "terminationBehaviour": "terminate-none"
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb.json
new file mode 100755
index 0000000..571e7e1
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb.json
@@ -0,0 +1,50 @@
+{
+ "type": "esb",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "framework",
+ "displayName": "esb",
+ "description": "esb 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/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php.json
new file mode 100755
index 0000000..5d53e3a
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php.json
@@ -0,0 +1,51 @@
+{
+ "type": "php",
+ "provider": "apache",
+ "category": "framework",
+ "host": "php.stratos.org",
+ "displayName": "php",
+ "description": "php 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/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat.json
new file mode 100755
index 0000000..395687d
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat.json
@@ -0,0 +1,53 @@
+{
+ "type": "tomcat",
+ "provider": "apache",
+ "host": "tomcat.stratos.org",
+ "category": "framework",
+ "displayName": "tomcat",
+ "description": "tomcat 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"
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-4.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-4.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-4.json
new file mode 100644
index 0000000..f9935d7
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-4.json
@@ -0,0 +1,32 @@
+{
+ "id": "deployment-policy-4",
+ "networkPartitions": [
+ {
+ "id": "network-partition-9",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "partitionMax": 4
+ }
+ ]
+ },
+ {
+ "id": "network-partition-10",
+ "partitionAlgo": "round-robin",
+ "partitions": [
+ {
+ "id": "network-partition-10-partition-1",
+ "partitionMax": 4
+ },
+ {
+ "id": "network-partition-10-partition-2",
+ "partitionMax": 4
+ }
+ ]
+ }
+ ]
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-10.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-10.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-10.json
new file mode 100644
index 0000000..1e1ec23
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-10.json
@@ -0,0 +1,24 @@
+{
+ "id": "network-partition-10",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "network-partition-10-partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "network-partition-10-partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-9.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-9.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-9.json
new file mode 100644
index 0000000..9f12343
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-9.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-9",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json b/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json
deleted file mode 100644
index 17858bb..0000000
--- a/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "id": "application-policy-1",
- "algorithm": "one-after-another",
- "networkPartitions": [
- "network-partition-1",
- "network-partition-2"
- ],
- "properties": [
- {
- "name": "networkPartitionGroups",
- "value": "network-partition-1,network-partition-2"
- },
- {
- "name": "key-2",
- "value": "value-2"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json b/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json
deleted file mode 100644
index 1137942..0000000
--- a/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-2.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "id": "application-policy-2",
- "algorithm": "one-after-another",
- "networkPartitions": [
- "network-partition-7",
- "network-partition-8"
- ],
- "properties": [
- {
- "name": "networkPartitionGroups",
- "value": "network-partition-7,network-partition-8"
- },
- {
- "name": "key-2",
- "value": "value-2"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json
new file mode 100644
index 0000000..2cecc06
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-policy-test/application-policies/application-policy-3.json
@@ -0,0 +1,18 @@
+{
+ "id": "application-policy-3",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-9",
+ "network-partition-10"
+ ],
+ "properties": [
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-9|network-partition-10"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json
new file mode 100644
index 0000000..1e1ec23
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-10.json
@@ -0,0 +1,24 @@
+{
+ "id": "network-partition-10",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "network-partition-10-partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ },
+ {
+ "id": "network-partition-10-partition-2",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json
new file mode 100644
index 0000000..9f12343
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-9.json
@@ -0,0 +1,15 @@
+{
+ "id": "network-partition-9",
+ "provider": "mock",
+ "partitions": [
+ {
+ "id": "partition-1",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md
deleted file mode 100644
index 4e092ea..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-Single Cartridge Application
-============================
-A simple application with a php cartridge.
-
-Application view
-----------------
-single-cartridge-app <br />
--- single-cartridge-app-1 <br />
--- -- my-php <br />
-
-Application folder structure
-----------------------------
--- artifacts/[iaas]/ IaaS specific artifacts <br />
--- scripts/common/ Common scripts for all iaases <br />
--- scripts/[iaas] IaaS specific scripts <br />
-
-How to run
-----------
-cd scripts/[iaas]/ <br />
-./deploy.sh <br />
-
-How to undeploy
----------------
-cd scripts/[iaas]/ <br />
-./undeploy.sh <br />
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json
deleted file mode 100644
index ff332c0..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v1.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 4,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 3,
- "groupMinInstances": 2,
- "deploymentPolicy": "static-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json
deleted file mode 100644
index 6f827c2..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v2.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 5,
- "groupMinInstances": 2,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 4,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 3,
- "groupMinInstances": 2,
- "deploymentPolicy": "static-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json
deleted file mode 100644
index a6e5fd7..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1-v3.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 4,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 4,
- "groupMinInstances": 3,
- "deploymentPolicy": "static-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json
deleted file mode 100644
index 76d72c8..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 1,
- "cartridgeMax": 2,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 1,
- "cartridgeMax": 2,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 2,
- "groupMinInstances": 1,
- "deploymentPolicy": "deployment-policy-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 1,
- "cartridgeMax": 2,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-1.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-1.json
deleted file mode 100644
index f82403b..0000000
--- a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-1.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "id": "autoscaling-policy-1",
- "loadThresholds": {
- "requestsInFlight": {
- "threshold": 35
- },
- "memoryConsumption": {
- "threshold": 45
- },
- "loadAverage": {
- "threshold": 25
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ce00b955/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json
deleted file mode 100644
index 31c2b84..0000000
--- a/products/stratos/modules/integration/src/test/resources/autoscaling-policies/autoscaling-policy-c0-v1.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "id": "autoscaling-policy-c0",
- "loadThresholds": {
- "requestsInFlight": {
- "threshold": 30
- },
- "memoryConsumption": {
- "threshold": 40
- },
- "loadAverage": {
- "threshold": 20
- }
- }
-}
[06/12] stratos git commit: Adding assertion of topology
initizlization and refactoring the test classes to use same CRUD operations
from RestClient
Posted by re...@apache.org.
Adding assertion of topology initizlization and refactoring the test classes to use same CRUD operations from RestClient
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/f995fb3b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/f995fb3b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/f995fb3b
Branch: refs/heads/master
Commit: f995fb3bbd0a2b10b610c90e43369b940b9ce5ca
Parents: d5680aa
Author: reka <rt...@gmail.com>
Authored: Wed Aug 5 14:09:34 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Aug 6 19:33:43 2015 +0530
----------------------------------------------------------------------
.../tests/ApplicationPolicyTest.java | 137 ++--------
.../integration/tests/ApplicationTest.java | 227 +++-------------
.../tests/AutoscalingPolicyTest.java | 136 ++--------
.../integration/tests/CartridgeGroupTest.java | 141 ++--------
.../integration/tests/CartridgeTest.java | 143 ++--------
.../integration/tests/DeploymentPolicyTest.java | 141 ++--------
.../integration/tests/NetworkPartitionTest.java | 137 ++--------
.../tests/SampleApplicationsTest.java | 265 +++++++++++--------
.../tests/StratosArtifactsUtils.java | 53 ----
.../integration/tests/rest/RestClient.java | 208 ++++++++++++++-
10 files changed, 516 insertions(+), 1072 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
index 05110bb..ec5bf04 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
@@ -19,138 +19,41 @@
package org.apache.stratos.integration.tests;
-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.utils.URIBuilder;
import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
import org.apache.stratos.integration.tests.rest.RestClient;
-import java.net.URI;
-
/**
* Test to handle Network partition CRUD operations
*/
-public class ApplicationPolicyTest extends StratosArtifactsUtils {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
- String applicationPolicies = "/application-policies/";
- String applicationPoliciesUpdate = "/application-policies/update/";
-
+public class ApplicationPolicyTest {
+ private static final Log log = LogFactory.getLog(ApplicationPolicyTest.class);
+ private static final String applicationPolicies = "/application-policies/";
+ private static final String applicationPoliciesUpdate = "/application-policies/update/";
+ private static final String entityName = "applicationPolicy";
- public boolean addApplicationPolicy(String networkPartitionId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(applicationPolicies + networkPartitionId);
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES).build();
- HttpResponse response = restClient.doPost(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while adding the application policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not add application policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean addApplicationPolicy(String applicationPolicyId, RestClient restClient) {
+ return restClient.addEntity(applicationPolicies + "/" + applicationPolicyId,
+ RestConstants.APPLICATION_POLICIES, entityName);
}
- public ApplicationPolicyBean getApplicationPolicy(String networkPartitionId, String endpoint,
- RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES + "/" +
- networkPartitionId).build();
- HttpResponse response = restClient.doGet(uri);
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return gson.fromJson(response.getContent(), ApplicationPolicyBean.class);
- } else if (response.getStatusCode() == 404) {
- return null;
- } else {
- ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
- if (errorResponse != null) {
- throw new RuntimeException(errorResponse.getErrorMessage());
- }
- }
- }
- String msg = "An unknown error occurred while getting the application policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not get application policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public ApplicationPolicyBean getApplicationPolicy(String applicationPolicyId, RestClient restClient) {
+
+ ApplicationPolicyBean bean = (ApplicationPolicyBean) restClient.
+ getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+ ApplicationPolicyBean.class, entityName);
+ return bean;
}
- public boolean updateApplicationPolicy(String networkPartitionId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(applicationPoliciesUpdate + networkPartitionId);
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES).build();
- HttpResponse response = restClient.doPut(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while updating the application policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not update application policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean updateApplicationPolicy(String applicationPolicyId, RestClient restClient) {
+ return restClient.updateEntity(applicationPoliciesUpdate + "/" + applicationPolicyId,
+ RestConstants.APPLICATION_POLICIES, entityName);
+
}
- public boolean removeApplicationPolicy(String networkPartitionId, String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES + "/" +
- networkPartitionId).build();
- HttpResponse response = restClient.doDelete(uri);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } else if(response.getContent().contains("it is used")) {
- return false;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while removing the application policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not remove application policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean removeApplicationPolicy(String applicationPolicyId, RestClient restClient) {
+ return restClient.removeEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId, entityName);
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
index d4f77a6..af18163 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
@@ -19,224 +19,59 @@
package org.apache.stratos.integration.tests;
-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.utils.URIBuilder;
import org.apache.stratos.common.beans.application.ApplicationBean;
-import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
import org.apache.stratos.integration.tests.rest.RestClient;
-import java.net.URI;
-
/**
- * Test to handle autoscaling policy CRUD operations
+ * Test to handle application CRUD operations, deploy and undeploy
*/
-public class ApplicationTest extends StratosArtifactsUtils {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
+public class ApplicationTest {
+ private static final Log log = LogFactory.getLog(ApplicationTest.class);
String applications = "/applications/simple/single-cartridge-app/";
String applicationsUpdate = "/applications/simple/single-cartridge-app/update/";
+ private static final String entityName = "application";
-
- public boolean addApplication(String applicationId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(applications + applicationId);
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS).build();
-
- HttpResponse response = restClient.doPost(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while adding the application";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not add application";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean addApplication(String applicationId, RestClient restClient) {
+ return restClient.addEntity(applications + "/" + applicationId,
+ RestConstants.APPLICATIONS, entityName);
}
- public boolean deployApplication(String applicationId, String applicationPolicyId,
- String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" + applicationId +
- RestConstants.APPLICATIONS_DEPLOY + "/" + applicationPolicyId).build();
-
- HttpResponse response = restClient.doPost(uri, "");
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while deploying the application";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not deploy application";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public ApplicationBean getApplication(String applicationId,
+ RestClient restClient) {
+ ApplicationBean bean = (ApplicationBean) restClient.
+ getEntity(RestConstants.APPLICATIONS, applicationId,
+ ApplicationBean.class, entityName);
+ return bean;
}
- public boolean undeployApplication(String applicationId,
- String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" + applicationId +
- RestConstants.APPLICATIONS_UNDEPLOY).build();
-
- HttpResponse response = restClient.doPost(uri, "");
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while undeploying the application";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not undeploy application";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean updateApplication(String applicationId, RestClient restClient) {
+ return restClient.updateEntity(applicationsUpdate + "/" + applicationId,
+ RestConstants.APPLICATIONS, entityName);
}
- public boolean forceUndeployApplication(String applicationId,
- String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" + applicationId +
- RestConstants.APPLICATIONS_UNDEPLOY + "?force=true").build();
+ public boolean removeApplication(String applicationId, RestClient restClient) {
+ return restClient.removeEntity(RestConstants.APPLICATIONS, applicationId, entityName);
- HttpResponse response = restClient.doPost(uri, "");
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while force undeploying the application";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not forcefully undeploy application";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
}
- public ApplicationBean getApplication(String applicationId, String endpoint,
- RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" +
- applicationId).build();
- HttpResponse response = restClient.doGet(uri);
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return gson.fromJson(response.getContent(), ApplicationBean.class);
- } else if (response.getStatusCode() == 404) {
- return null;
- } else {
- ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
- if (errorResponse != null) {
- throw new RuntimeException(errorResponse.getErrorMessage());
- }
- }
- }
- String msg = "An unknown error occurred while getting the application";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not get application";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean deployApplication(String applicationId, String applicationPolicyId,
+ RestClient restClient) {
+ return restClient.deployEntity(RestConstants.APPLICATIONS + "/" + applicationId +
+ RestConstants.APPLICATIONS_DEPLOY + "/" + applicationPolicyId, entityName);
}
- public boolean updateApplication(String applicationId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(applicationsUpdate + applicationId);
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS).build();
- HttpResponse response = restClient.doPut(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while updating the application";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not update application";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean undeployApplication(String applicationId,
+ RestClient restClient) {
+ return restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + applicationId +
+ RestConstants.APPLICATIONS_UNDEPLOY, entityName);
}
- public boolean removeApplication(String applicationId, String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" +
- applicationId).build();
- HttpResponse response = restClient.doDelete(uri);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while removing the application";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not remove application";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean forceUndeployApplication(String applicationId,
+ RestClient restClient) {
+ return restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + applicationId +
+ RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", entityName);
}
+
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
index c76c0ef..7c04d92 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
@@ -18,137 +18,41 @@
*/
package org.apache.stratos.integration.tests;
-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.utils.URIBuilder;
import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
import org.apache.stratos.integration.tests.rest.RestClient;
-import java.net.URI;
-
/**
* Test to handle autoscaling policy CRUD operations
*/
-public class AutoscalingPolicyTest extends StratosArtifactsUtils {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
- String autoscalingPolicy = "/autoscaling-policies/";
- String autoscalingPolicyUpdate = "/autoscaling-policies/update/";
-
+public class AutoscalingPolicyTest {
+ private static final Log log = LogFactory.getLog(AutoscalingPolicyTest.class);
+ private static final String autoscalingPolicy = "/autoscaling-policies/";
+ private static final String autoscalingPolicyUpdate = "/autoscaling-policies/update/";
+ private static final String entityName = "autoscalingPolicy";
- public boolean addAutoscalingPolicy(String autoscalingPolicyName, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(autoscalingPolicy + autoscalingPolicyName);
- URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES).build();
+ public boolean addAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
+ return restClient.addEntity(autoscalingPolicy + "/" + autoscalingPolicyName,
+ RestConstants.AUTOSCALING_POLICIES, entityName);
- HttpResponse response = restClient.doPost(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- log.error("An unknown error occurred while trying to add autoscaling policy....");
- throw new RuntimeException("An unknown error occurred while trying to add autoscaling policy");
- } catch (Exception e) {
- String message = "Could not add Autoscaling policy....";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
}
- public AutoscalePolicyBean getAutoscalingPolicy(String autoscalingPolicyName, String endpoint,
- RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES + "/" +
- autoscalingPolicyName).build();
- HttpResponse response = restClient.doGet(uri);
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return gson.fromJson(response.getContent(), AutoscalePolicyBean.class);
- } else if (response.getStatusCode() == 404) {
- return null;
- } else {
- ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
- if (errorResponse != null) {
- throw new RuntimeException(errorResponse.getErrorMessage());
- }
- }
- }
- String msg = "An unknown error occurred while getting the autosclaing policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not get autoscaling policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public AutoscalePolicyBean getAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
+ AutoscalePolicyBean bean = (AutoscalePolicyBean) restClient.
+ getEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyName,
+ AutoscalePolicyBean.class, entityName);
+ return bean;
}
- public boolean updateAutoscalingPolicy(String autoscalingPolicyName, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(autoscalingPolicyUpdate + autoscalingPolicyName);
- URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES).build();
- HttpResponse response = restClient.doPut(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while updating the autosclaing policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not updating autoscaling policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean updateAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
+ return restClient.updateEntity(autoscalingPolicyUpdate + "/" + autoscalingPolicyName,
+ RestConstants.AUTOSCALING_POLICIES, entityName);
+
}
- public boolean removeAutoscalingPolicy(String autoscalingPolicyName, String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES + "/" +
- autoscalingPolicyName).build();
- HttpResponse response = restClient.doDelete(uri);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } else if(response.getContent().contains("is in use")) {
- return false;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while removing the autosclaing policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not remove autoscaling policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean removeAutoscalingPolicy(String autoscalingPolicyName, RestClient restClient) {
+ return restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyName, entityName);
+
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
index 4da1185..caf2838 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
@@ -19,138 +19,39 @@
package org.apache.stratos.integration.tests;
-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.utils.URIBuilder;
import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
import org.apache.stratos.integration.tests.rest.RestClient;
-import java.net.URI;
-
/**
- * Test to handle Network partition CRUD operations
+ * Test to handle Cartridge group CRUD operations
*/
-public class CartridgeGroupTest extends StratosArtifactsUtils {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
- String cartridgeGroups = "/cartridges-groups/";
- String cartridgeGroupsUpdate = "/cartridges-groups/update/";
-
-
- public boolean addCartridgeGroup(String groupName, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(cartridgeGroups + groupName);
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS).build();
-
- HttpResponse response = restClient.doPost(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while adding the cartridge group";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not add cartridge group";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+public class CartridgeGroupTest {
+ private static final Log log = LogFactory.getLog(CartridgeGroupTest.class);
+ private static final String cartridgeGroups = "/cartridges-groups/";
+ private static final String cartridgeGroupsUpdate = "/cartridges-groups/update/";
+ private static final String entityName = "cartridgeGroup";
+
+ public boolean addCartridgeGroup(String groupName, RestClient restClient) {
+ return restClient.addEntity(cartridgeGroups + "/" + groupName,
+ RestConstants.CARTRIDGE_GROUPS, entityName);
}
- public CartridgeGroupBean getCartridgeGroup(String groupName, String endpoint,
- RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS + "/" +
- groupName).build();
- HttpResponse response = restClient.doGet(uri);
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return gson.fromJson(response.getContent(), CartridgeGroupBean.class);
- } else if (response.getStatusCode() == 404) {
- return null;
- } else {
- ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
- if (errorResponse != null) {
- throw new RuntimeException(errorResponse.getErrorMessage());
- }
- }
- }
- String msg = "An unknown error occurred while getting the cartridge group";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not get cartridge group";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public CartridgeGroupBean getCartridgeGroup(String groupName, RestClient restClient) {
+ CartridgeGroupBean bean = (CartridgeGroupBean) restClient.
+ getEntity(RestConstants.CARTRIDGE_GROUPS, groupName,
+ CartridgeGroupBean.class, entityName);
+ return bean;
}
- public boolean updateCartridgeGroup(String groupName, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(cartridgeGroupsUpdate + groupName);
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS).build();
- HttpResponse response = restClient.doPut(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while updating the cartridge group";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not update cartridge group";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean updateCartridgeGroup(String groupName, RestClient restClient) {
+ return restClient.updateEntity(cartridgeGroupsUpdate + "/" + groupName,
+ RestConstants.CARTRIDGE_GROUPS, entityName);
}
- public boolean removeCartridgeGroup(String groupName, String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS + "/" +
- groupName).build();
- HttpResponse response = restClient.doDelete(uri);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } else if(response.getContent().contains("it is used")) {
- return false;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while removing the cartridge group";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not remove cartridge group";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean removeCartridgeGroup(String groupName, RestClient restClient) {
+ return restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, groupName, entityName);
+
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
index 680d8a7..fc5cfa0 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
@@ -19,138 +19,41 @@
package org.apache.stratos.integration.tests;
-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.utils.URIBuilder;
import org.apache.stratos.common.beans.cartridge.CartridgeBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
+import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
import org.apache.stratos.integration.tests.rest.RestClient;
-import java.net.URI;
-
/**
- * Test to handle Network partition CRUD operations
+ * Test to handle Cartridge CRUD operations
*/
-public class CartridgeTest extends StratosArtifactsUtils {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
- String cartridges = "/cartridges/mock/";
- String cartridgesUpdate = "/cartridges/mock/update/";
-
-
- public boolean addCartridge(String cartridgeType, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(cartridges + cartridgeType);
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES).build();
-
- HttpResponse response = restClient.doPost(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while adding the cartridge";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not add cartridge";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+public class CartridgeTest {
+ private static final Log log = LogFactory.getLog(CartridgeTest.class);
+ private static final String cartridges = "/cartridges/mock/";
+ private static final String cartridgesUpdate = "/cartridges/mock/update/";
+ private static final String entityName = "cartridge";
+
+
+ public boolean addCartridge(String cartridgeType, RestClient restClient) {
+ return restClient.addEntity(cartridges + "/" + cartridgeType,
+ RestConstants.CARTRIDGES, entityName);
}
- public CartridgeBean getCartridge(String cartridgeType, String endpoint,
- RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES + "/" +
- cartridgeType).build();
- HttpResponse response = restClient.doGet(uri);
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return gson.fromJson(response.getContent(), CartridgeBean.class);
- } else if (response.getStatusCode() == 404) {
- return null;
- } else {
- ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
- if (errorResponse != null) {
- throw new RuntimeException(errorResponse.getErrorMessage());
- }
- }
- }
- String msg = "An unknown error occurred while getting the cartridge";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not get cartridge";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public CartridgeBean getCartridge(String cartridgeType,
+ RestClient restClient) {
+ CartridgeBean bean = (CartridgeBean) restClient.
+ getEntity(RestConstants.CARTRIDGES, cartridgeType,
+ CartridgeBean.class, entityName);
+ return bean;
}
- public boolean updateCartridge(String cartridgeType, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(cartridgesUpdate + cartridgeType);
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES).build();
- HttpResponse response = restClient.doPut(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while updating the cartridge";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not update cartridge";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean updateCartridge(String cartridgeType, RestClient restClient) {
+ return restClient.updateEntity(cartridgesUpdate + "/" + cartridgeType,
+ RestConstants.CARTRIDGES, entityName);
}
- public boolean removeCartridge(String cartridgeType, String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES + "/" +
- cartridgeType).build();
- HttpResponse response = restClient.doDelete(uri);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } else if (response.getContent().contains("it is used")) {
- return false;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while removing the cartridge";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not remove cartridge";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean removeCartridge(String cartridgeType, RestClient restClient) {
+ return restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType, entityName);
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
index d7d4dd4..707f750 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
@@ -19,140 +19,39 @@
package org.apache.stratos.integration.tests;
-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.utils.URIBuilder;
import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
import org.apache.stratos.integration.tests.rest.RestClient;
-import java.net.URI;
-
/**
- * Test to handle Network partition CRUD operations
+ * Test to handle Deployment policy CRUD operations
*/
-public class DeploymentPolicyTest extends StratosArtifactsUtils {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
- String deploymentPolicies = "/deployment-policies/";
- String deploymentPoliciesUpdate = "/deployment-policies/update/";
-
-
- public boolean addDeploymentPolicy(String deploymentPolicyId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(deploymentPolicies + deploymentPolicyId);
- URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES).build();
-
- HttpResponse response = restClient.doPost(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while adding the deployment policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not add deployment policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+public class DeploymentPolicyTest {
+ private static final Log log = LogFactory.getLog(DeploymentPolicyTest.class);
+ private static final String deploymentPolicies = "/deployment-policies/";
+ private static final String deploymentPoliciesUpdate = "/deployment-policies/update/";
+ private static final String entityName = "deploymentPolicy";
+
+ public boolean addDeploymentPolicy(String deploymentPolicyId, RestClient restClient) {
+ return restClient.addEntity(deploymentPolicies + "/" + deploymentPolicyId,
+ RestConstants.DEPLOYMENT_POLICIES, entityName);
}
- public DeploymentPolicyBean getDeploymentPolicy(String deploymentPolicyId, String endpoint,
+ public DeploymentPolicyBean getDeploymentPolicy(String deploymentPolicyId,
RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES + "/" +
- deploymentPolicyId).build();
- HttpResponse response = restClient.doGet(uri);
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return gson.fromJson(response.getContent(), DeploymentPolicyBean.class);
- } else if (response.getStatusCode() == 404) {
- return null;
- } else {
- ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
- if (errorResponse != null) {
- throw new RuntimeException(errorResponse.getErrorMessage());
- }
- }
- }
- String msg = "An unknown error occurred while getting the deployment policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not get deployment policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ DeploymentPolicyBean bean = (DeploymentPolicyBean) restClient.
+ getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+ DeploymentPolicyBean.class, entityName);
+ return bean;
}
- public boolean updateDeploymentPolicy(String deploymentPolicyId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(deploymentPoliciesUpdate + deploymentPolicyId);
- URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES).build();
- HttpResponse response = restClient.doPut(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } else if(response.getContent().contains("it is used")) {
- return false;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while updating the deployment policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not update deployment policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean updateDeploymentPolicy(String deploymentPolicyId, RestClient restClient) {
+ return restClient.updateEntity(deploymentPoliciesUpdate + "/" + deploymentPolicyId,
+ RestConstants.DEPLOYMENT_POLICIES, entityName);
}
- public boolean removeDeploymentPolicy(String deploymentPolicyId, String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES + "/" +
- deploymentPolicyId).build();
- HttpResponse response = restClient.doDelete(uri);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } else if(response.getContent().contains("is in use")) {
- return false;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while removing the deployment policy";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not remove deployment policy";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean removeDeploymentPolicy(String deploymentPolicyId, RestClient restClient) {
+ return restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, entityName);
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/f995fb3b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
index 42dff0a..ff27ea6 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
@@ -19,138 +19,39 @@
package org.apache.stratos.integration.tests;
-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.utils.URIBuilder;
import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
import org.apache.stratos.integration.tests.rest.RestClient;
-import java.net.URI;
-
/**
* Test to handle Network partition CRUD operations
*/
-public class NetworkPartitionTest extends StratosArtifactsUtils {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
- String networkPartitions = "/network-partitions/mock/";
- String networkPartitionsUpdate = "/network-partitions/mock/update/";
-
-
- public boolean addNetworkPartition(String networkPartitionId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(networkPartitions + networkPartitionId);
- URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS).build();
-
- HttpResponse response = restClient.doPost(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while adding the networkpartition";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not add networkpartition";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+public class NetworkPartitionTest {
+ private static final Log log = LogFactory.getLog(NetworkPartitionTest.class);
+ private static final String networkPartitions = "/network-partitions/mock/";
+ private static final String networkPartitionsUpdate = "/network-partitions/mock/update/";
+ private static final String entityName = "networkPartition";
+
+ public boolean addNetworkPartition(String networkPartitionId, RestClient restClient) {
+ return restClient.addEntity(networkPartitions + "/" + networkPartitionId,
+ RestConstants.NETWORK_PARTITIONS, entityName);
}
- public NetworkPartitionBean getNetworkPartition(String networkPartitionId, String endpoint,
+ public NetworkPartitionBean getNetworkPartition(String networkPartitionId,
RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS + "/" +
- networkPartitionId).build();
- HttpResponse response = restClient.doGet(uri);
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return gson.fromJson(response.getContent(), NetworkPartitionBean.class);
- } else if (response.getStatusCode() == 404) {
- return null;
- } else {
- ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
- if (errorResponse != null) {
- throw new RuntimeException(errorResponse.getErrorMessage());
- }
- }
- }
- String msg = "An unknown error occurred while getting the networkpartition";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not get networkpartition";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ NetworkPartitionBean bean = (NetworkPartitionBean) restClient.
+ getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+ NetworkPartitionBean.class, entityName);
+ return bean;
}
- public boolean updateNetworkPartition(String networkPartitionId, String endpoint, RestClient restClient) {
- try {
- String content = getJsonStringFromFile(networkPartitionsUpdate + networkPartitionId);
- URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS).build();
- HttpResponse response = restClient.doPut(uri, content);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while updating the networkpartition";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not update networkpartition";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean updateNetworkPartition(String networkPartitionId, RestClient restClient) {
+ return restClient.updateEntity(networkPartitionsUpdate + "/" + networkPartitionId,
+ RestConstants.NETWORK_PARTITIONS, entityName);
}
- public boolean removeNetworkPartition(String networkPartitionId, String endpoint, RestClient restClient) {
- try {
- URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS + "/" +
- networkPartitionId).build();
- HttpResponse response = restClient.doDelete(uri);
- if (response != null) {
- if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
- return true;
- } else if(response.getContent().contains("it is used")) {
- return false;
- } 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());
- }
- }
- }
- String msg = "An unknown error occurred while removing the networkpartition";
- log.error(msg);
- throw new RuntimeException(msg);
- } catch (Exception e) {
- String message = "Could not remove networkpartition";
- log.error(message, e);
- throw new RuntimeException(message, e);
- }
+ public boolean removeNetworkPartition(String networkPartitionId, RestClient restClient) {
+ return restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, entityName);
}
}