http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTestCase.java
 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTestCase.java
index 581115a..29566f6 100644
--- 
a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTestCase.java
+++ 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTestCase.java
@@ -41,32 +41,37 @@ import static org.testng.AssertJUnit.assertTrue;
 /**
  * Sample application tests with application add, .
  */
+@Test(groups = { "application" })
 public class SampleApplicationsTestCase extends StratosIntegrationTest {
     private static final Log log = 
LogFactory.getLog(SampleApplicationsTestCase.class);
     private static final String RESOURCES_PATH = "/sample-applications-test";
+    long startTime;
 
-    @Test(timeOut = APPLICATION_TEST_TIMEOUT, groups = 
{"stratos.application.deployment"})
+    @Test(timeOut = DEFAULT_APPLICATION_TEST_TIMEOUT,
+          priority = 1)
     public void testApplication() throws Exception {
-        String autoscalingPolicyId = 
"autoscaling-policy-sample-applications-test";
+        startTime = System.currentTimeMillis();
+        log.info("Running SampleApplicationsTestCase.testApplication test 
method...");
 
-        boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + 
RestConstants.AUTOSCALING_POLICIES_PATH
-                        + "/" + autoscalingPolicyId + ".json",
+        String autoscalingPolicyId = 
"autoscaling-policy-sample-applications-test";
+        boolean addedScalingPolicy = restClient.addEntity(
+                RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" 
+ autoscalingPolicyId + ".json",
                 RestConstants.AUTOSCALING_POLICIES, 
RestConstants.AUTOSCALING_POLICIES_NAME);
         assertEquals(addedScalingPolicy, true);
 
-        boolean addedC1 = restClient.addEntity(
-                RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
"c1-sample-applications-test.json",
-                RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        boolean addedC1 = restClient
+                .addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + 
"/" + "c1-sample-applications-test.json",
+                        RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
         assertEquals(addedC1, true);
 
-        boolean addedC2 = restClient.addEntity(
-                RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
"c2-sample-applications-test.json",
-                RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        boolean addedC2 = restClient
+                .addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + 
"/" + "c2-sample-applications-test.json",
+                        RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
         assertEquals(addedC2, true);
 
-        boolean addedC3 = restClient.addEntity(
-                RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
"c3-sample-applications-test.json",
-                RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        boolean addedC3 = restClient
+                .addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + 
"/" + "c3-sample-applications-test.json",
+                        RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
         assertEquals(addedC3, true);
 
         boolean addedG1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGE_GROUPS_PATH +
@@ -75,23 +80,23 @@ public class SampleApplicationsTestCase extends 
StratosIntegrationTest {
         assertEquals(addedG1, true);
 
         CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
-                getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
-                        CartridgeGroupBean.class, 
RestConstants.CARTRIDGE_GROUPS_NAME);
+                getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test", CartridgeGroupBean.class,
+                        RestConstants.CARTRIDGE_GROUPS_NAME);
         assertEquals(beanG1.getName(), "G1-sample-applications-test");
 
         boolean addedN1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                        "network-partition-sample-applications-test-1.json",
-                RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
+                        "network-partition-sample-applications-test-1.json", 
RestConstants.NETWORK_PARTITIONS,
+                RestConstants.NETWORK_PARTITIONS_NAME);
         assertEquals(addedN1, true);
 
         boolean addedN2 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                        "network-partition-sample-applications-test-2.json",
-                RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
+                        "network-partition-sample-applications-test-2.json", 
RestConstants.NETWORK_PARTITIONS,
+                RestConstants.NETWORK_PARTITIONS_NAME);
         assertEquals(addedN2, true);
 
         boolean addedDep = restClient.addEntity(RESOURCES_PATH + 
RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
-                        "deployment-policy-sample-applications-test.json",
-                RestConstants.DEPLOYMENT_POLICIES, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
+                        "deployment-policy-sample-applications-test.json", 
RestConstants.DEPLOYMENT_POLICIES,
+                RestConstants.DEPLOYMENT_POLICIES_NAME);
         assertEquals(addedDep, true);
 
         boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
@@ -99,8 +104,9 @@ public class SampleApplicationsTestCase extends 
StratosIntegrationTest {
                 RestConstants.APPLICATIONS_NAME);
         assertEquals(added, true);
 
-        ApplicationBean bean = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
-                "g-sc-G123-1-sample-applications-test", ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
+        ApplicationBean bean = (ApplicationBean) restClient
+                .getEntity(RestConstants.APPLICATIONS, 
"g-sc-G123-1-sample-applications-test", ApplicationBean.class,
+                        RestConstants.APPLICATIONS_NAME);
         assertEquals(bean.getApplicationId(), 
"g-sc-G123-1-sample-applications-test");
 
         CartridgeGroupReferenceBean group1 = 
bean.getComponents().getGroups().get(0);
@@ -138,12 +144,13 @@ public class SampleApplicationsTestCase extends 
StratosIntegrationTest {
         assertEquals(c3.getCartridgeMax(), 2);
 
         boolean updated = restClient.updateEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH +
-                        "/g-sc-G123-1-sample-applications-test-v1.json",
-                RestConstants.APPLICATIONS, RestConstants.APPLICATIONS_NAME);
+                        "/g-sc-G123-1-sample-applications-test-v1.json", 
RestConstants.APPLICATIONS,
+                RestConstants.APPLICATIONS_NAME);
         assertEquals(updated, true);
 
-        ApplicationBean updatedBean = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
-                "g-sc-G123-1-sample-applications-test", ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
+        ApplicationBean updatedBean = (ApplicationBean) restClient
+                .getEntity(RestConstants.APPLICATIONS, 
"g-sc-G123-1-sample-applications-test", ApplicationBean.class,
+                        RestConstants.APPLICATIONS_NAME);
 
         assertEquals(bean.getApplicationId(), 
"g-sc-G123-1-sample-applications-test");
 
@@ -181,224 +188,226 @@ public class SampleApplicationsTestCase extends 
StratosIntegrationTest {
         assertEquals(c3.getCartridgeMin(), 2);
         assertEquals(c3.getCartridgeMax(), 3);
 
-
-        boolean removedGroup =
-                restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
-                        RestConstants.CARTRIDGE_GROUPS_NAME);
+        boolean removedGroup = 
restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
+                RestConstants.CARTRIDGE_GROUPS_NAME);
         assertFalse(removedGroup);
 
-        boolean removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+        boolean removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+                RestConstants.AUTOSCALING_POLICIES_NAME);
         assertFalse(removedAuto);
 
-        boolean removedNet = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                "network-partition-sample-applications-test-1",
-                RestConstants.NETWORK_PARTITIONS_NAME);
+        boolean removedNet = restClient
+                .removeEntity(RestConstants.NETWORK_PARTITIONS, 
"network-partition-sample-applications-test-1",
+                        RestConstants.NETWORK_PARTITIONS_NAME);
         //Trying to remove the used network partition
         assertFalse(removedNet);
 
-        boolean removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                "deployment-policy-sample-applications-test", 
RestConstants.DEPLOYMENT_POLICIES_NAME);
+        boolean removedDep = restClient
+                .removeEntity(RestConstants.DEPLOYMENT_POLICIES, 
"deployment-policy-sample-applications-test",
+                        RestConstants.DEPLOYMENT_POLICIES_NAME);
         assertFalse(removedDep);
 
-        boolean removed =
-                restClient.removeEntity(RestConstants.APPLICATIONS, 
"g-sc-G123-1-sample-applications-test",
-                        RestConstants.APPLICATIONS_NAME);
+        boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, 
"g-sc-G123-1-sample-applications-test",
+                RestConstants.APPLICATIONS_NAME);
         assertTrue(removed);
 
-        ApplicationBean beanRemoved = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
-                "g-sc-G123-1-sample-applications-test", ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
+        ApplicationBean beanRemoved = (ApplicationBean) restClient
+                .getEntity(RestConstants.APPLICATIONS, 
"g-sc-G123-1-sample-applications-test", ApplicationBean.class,
+                        RestConstants.APPLICATIONS_NAME);
         assertNull(beanRemoved);
 
         removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
                 RestConstants.CARTRIDGE_GROUPS_NAME);
         assertEquals(removedGroup, true);
 
-        boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, 
"c1-sample-applications-test",
-                RestConstants.CARTRIDGES_NAME);
+        boolean removedC1 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c1-sample-applications-test", RestConstants.CARTRIDGES_NAME);
         assertEquals(removedC1, true);
 
-        boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, 
"c2-sample-applications-test",
-                RestConstants.CARTRIDGES_NAME);
+        boolean removedC2 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c2-sample-applications-test", RestConstants.CARTRIDGES_NAME);
         assertEquals(removedC2, true);
 
-        boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, 
"c3-sample-applications-test",
-                RestConstants.CARTRIDGES_NAME);
+        boolean removedC3 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c3-sample-applications-test", RestConstants.CARTRIDGES_NAME);
         assertEquals(removedC3, true);
 
-        removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+        removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+                RestConstants.AUTOSCALING_POLICIES_NAME);
         assertEquals(removedAuto, true);
 
-        removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                "deployment-policy-sample-applications-test", 
RestConstants.DEPLOYMENT_POLICIES_NAME);
+        removedDep = restClient
+                .removeEntity(RestConstants.DEPLOYMENT_POLICIES, 
"deployment-policy-sample-applications-test",
+                        RestConstants.DEPLOYMENT_POLICIES_NAME);
         assertEquals(removedDep, true);
 
-        removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                "network-partition-sample-applications-test-1", 
RestConstants.NETWORK_PARTITIONS_NAME);
+        removedNet = restClient
+                .removeEntity(RestConstants.NETWORK_PARTITIONS, 
"network-partition-sample-applications-test-1",
+                        RestConstants.NETWORK_PARTITIONS_NAME);
         assertEquals(removedNet, true);
 
-        boolean removedN2 = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                "network-partition-sample-applications-test-2", 
RestConstants.NETWORK_PARTITIONS_NAME);
-        assertEquals(removedN2, true, String.format(
-                "[Network partition] 
network-partition-sample-applications-test-2 could not be removed for " +
-                        "[application] g-sc-G123-1-sample-applications-test"));
+        boolean removedN2 = restClient
+                .removeEntity(RestConstants.NETWORK_PARTITIONS, 
"network-partition-sample-applications-test-2",
+                        RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(removedN2, true,
+                "[Network partition] 
network-partition-sample-applications-test-2 could not be removed for "
+                        + "[application] 
g-sc-G123-1-sample-applications-test");
     }
 
-    @Test(timeOut = APPLICATION_TEST_TIMEOUT, groups = 
{"stratos.application.deployment"})
+    @Test(timeOut = DEFAULT_APPLICATION_TEST_TIMEOUT,
+          priority = 2)
     public void testApplicationList() throws Exception {
-            String autoscalingPolicyId = 
"autoscaling-policy-sample-applications-test";
-
-            boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + 
RestConstants.AUTOSCALING_POLICIES_PATH
-                            + "/" + autoscalingPolicyId + ".json",
-                    RestConstants.AUTOSCALING_POLICIES, 
RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertEquals(addedScalingPolicy, true);
-
-            boolean addedC1 = restClient.addEntity(
-                    RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
"c1-sample-applications-test.json",
-                    RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(addedC1, true);
-
-            boolean addedC2 = restClient.addEntity(
-                    RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
"c2-sample-applications-test.json",
-                    RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(addedC2, true);
-
-            boolean addedC3 = restClient.addEntity(
-                    RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
"c3-sample-applications-test.json",
-                    RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(addedC3, true);
-
-            boolean addedG1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGE_GROUPS_PATH +
-                            "/" + 
"cartridge-nested-sample-applications-test.json", 
RestConstants.CARTRIDGE_GROUPS,
-                    RestConstants.CARTRIDGE_GROUPS_NAME);
-            assertEquals(addedG1, true);
-
-            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
-                    getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
-                            CartridgeGroupBean.class, 
RestConstants.CARTRIDGE_GROUPS_NAME);
-            assertEquals(beanG1.getName(), "G1-sample-applications-test");
-
-            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            
"network-partition-sample-applications-test-1.json",
-                    RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN1, true);
-
-            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            
"network-partition-sample-applications-test-2.json",
-                    RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN2, true);
-
-            boolean addedDep = restClient.addEntity(RESOURCES_PATH + 
RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
-                            "deployment-policy-sample-applications-test.json",
-                    RestConstants.DEPLOYMENT_POLICIES, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(addedDep, true);
-
-            String app1 = "sample-applications-test-1";
-            String app2 = "sample-applications-test-2";
-            boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
-                            app1 + ".json", RestConstants.APPLICATIONS,
-                    RestConstants.APPLICATIONS_NAME);
-            assertEquals(added, true);
-
-            added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
-                            app2 + ".json", RestConstants.APPLICATIONS,
-                    RestConstants.APPLICATIONS_NAME);
-            assertEquals(added, true);
-
-            Type listType = new TypeToken<ArrayList<ApplicationBean>>() {
-            }.getType();
-
-            List<ApplicationBean> applicationList = (List<ApplicationBean>) 
restClient.
-                    listEntity(RestConstants.APPLICATIONS,
-                            listType, RestConstants.APPLICATIONS_NAME);
-            assertTrue(applicationList.size() >= 2);
-
-
-            ApplicationBean bean1 = null;
-            for (ApplicationBean applicationBean : applicationList) {
-                if (applicationBean.getApplicationId().equals(app1)) {
-                    bean1 = applicationBean;
-                }
-            }
-            assertNotNull(bean1);
+        log.info("Running SampleApplicationsTestCase.testApplicationList test 
method...");
 
-            ApplicationBean bean2 = null;
-            for (ApplicationBean applicationBean : applicationList) {
-                if (applicationBean.getApplicationId().equals(app2)) {
-                    bean2 = applicationBean;
-                }
+        String autoscalingPolicyId = 
"autoscaling-policy-sample-applications-test";
+        boolean addedScalingPolicy = restClient.addEntity(
+                RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" 
+ autoscalingPolicyId + ".json",
+                RestConstants.AUTOSCALING_POLICIES, 
RestConstants.AUTOSCALING_POLICIES_NAME);
+        assertEquals(addedScalingPolicy, true);
+
+        boolean addedC1 = restClient
+                .addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + 
"/" + "c1-sample-applications-test.json",
+                        RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
+        assertEquals(addedC1, true);
+
+        boolean addedC2 = restClient
+                .addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + 
"/" + "c2-sample-applications-test.json",
+                        RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
+        assertEquals(addedC2, true);
+
+        boolean addedC3 = restClient
+                .addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + 
"/" + "c3-sample-applications-test.json",
+                        RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
+        assertEquals(addedC3, true);
+
+        boolean addedG1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGE_GROUPS_PATH +
+                        "/" + 
"cartridge-nested-sample-applications-test.json", 
RestConstants.CARTRIDGE_GROUPS,
+                RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertEquals(addedG1, true);
+
+        CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+                getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test", CartridgeGroupBean.class,
+                        RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertEquals(beanG1.getName(), "G1-sample-applications-test");
+
+        boolean addedN1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                        "network-partition-sample-applications-test-1.json", 
RestConstants.NETWORK_PARTITIONS,
+                RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(addedN1, true);
+
+        boolean addedN2 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                        "network-partition-sample-applications-test-2.json", 
RestConstants.NETWORK_PARTITIONS,
+                RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(addedN2, true);
+
+        boolean addedDep = restClient.addEntity(RESOURCES_PATH + 
RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+                        "deployment-policy-sample-applications-test.json", 
RestConstants.DEPLOYMENT_POLICIES,
+                RestConstants.DEPLOYMENT_POLICIES_NAME);
+        assertEquals(addedDep, true);
+
+        String app1 = "sample-applications-test-1";
+        String app2 = "sample-applications-test-2";
+        boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
+                app1 + ".json", RestConstants.APPLICATIONS, 
RestConstants.APPLICATIONS_NAME);
+        assertEquals(added, true);
+
+        added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
+                app2 + ".json", RestConstants.APPLICATIONS, 
RestConstants.APPLICATIONS_NAME);
+        assertEquals(added, true);
+
+        Type listType = new TypeToken<ArrayList<ApplicationBean>>() {
+        }.getType();
+
+        List<ApplicationBean> applicationList = (List<ApplicationBean>) 
restClient.
+                listEntity(RestConstants.APPLICATIONS, listType, 
RestConstants.APPLICATIONS_NAME);
+        assertTrue(applicationList.size() >= 2);
+
+        ApplicationBean bean1 = null;
+        for (ApplicationBean applicationBean : applicationList) {
+            if (applicationBean.getApplicationId().equals(app1)) {
+                bean1 = applicationBean;
             }
-            assertNotNull(bean2);
+        }
+        assertNotNull(bean1);
 
+        ApplicationBean bean2 = null;
+        for (ApplicationBean applicationBean : applicationList) {
+            if (applicationBean.getApplicationId().equals(app2)) {
+                bean2 = applicationBean;
+            }
+        }
+        assertNotNull(bean2);
 
-            boolean removed = 
restClient.removeEntity(RestConstants.APPLICATIONS, app1,
-                    RestConstants.APPLICATIONS_NAME);
-            assertTrue(removed);
+        boolean removedGroup = 
restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
+                RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertFalse(removedGroup);
 
-            ApplicationBean beanRemoved = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
-                    app1, ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
-            assertNull(beanRemoved);
+        boolean removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+                RestConstants.AUTOSCALING_POLICIES_NAME);
+        assertFalse(removedAuto);
 
-            boolean removedGroup =
-                    restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
-                            RestConstants.CARTRIDGE_GROUPS_NAME);
-            assertFalse(removedGroup);
+        boolean removedNet = restClient
+                .removeEntity(RestConstants.NETWORK_PARTITIONS, 
"network-partition-sample-applications-test-1",
+                        RestConstants.NETWORK_PARTITIONS_NAME);
+        //Trying to remove the used network partition
+        assertFalse(removedNet);
 
-            boolean removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                    autoscalingPolicyId, 
RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertFalse(removedAuto);
+        boolean removedDep = restClient
+                .removeEntity(RestConstants.DEPLOYMENT_POLICIES, 
"deployment-policy-sample-applications-test",
+                        RestConstants.DEPLOYMENT_POLICIES_NAME);
+        assertFalse(removedDep);
 
-            boolean removedNet = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    "network-partition-sample-applications-test-1",
-                    RestConstants.NETWORK_PARTITIONS_NAME);
-            //Trying to remove the used network partition
-            assertFalse(removedNet);
+        boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, 
app1, RestConstants.APPLICATIONS_NAME);
+        assertTrue(removed);
 
-            boolean removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                    "deployment-policy-sample-applications-test", 
RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertFalse(removedDep);
+        ApplicationBean beanRemoved = (ApplicationBean) restClient
+                .getEntity(RestConstants.APPLICATIONS, app1, 
ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+        assertNull(beanRemoved);
 
-            removed = restClient.removeEntity(RestConstants.APPLICATIONS, app2,
-                    RestConstants.APPLICATIONS_NAME);
-            assertTrue(removed);
+        removed = restClient.removeEntity(RestConstants.APPLICATIONS, app2, 
RestConstants.APPLICATIONS_NAME);
+        assertTrue(removed);
 
-            beanRemoved = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
-                    app2, ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
-            assertNull(beanRemoved);
+        beanRemoved = (ApplicationBean) restClient
+                .getEntity(RestConstants.APPLICATIONS, app2, 
ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+        assertNull(beanRemoved);
 
-            removedGroup = 
restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
-                    RestConstants.CARTRIDGE_GROUPS_NAME);
-            assertEquals(removedGroup, true);
+        removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G1-sample-applications-test",
+                RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertEquals(removedGroup, true);
 
-            boolean removedC1 = 
restClient.removeEntity(RestConstants.CARTRIDGES, "c1-sample-applications-test",
-                    RestConstants.CARTRIDGES_NAME);
-            assertEquals(removedC1, true);
+        boolean removedC1 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c1-sample-applications-test", RestConstants.CARTRIDGES_NAME);
+        assertEquals(removedC1, true);
 
-            boolean removedC2 = 
restClient.removeEntity(RestConstants.CARTRIDGES, "c2-sample-applications-test",
-                    RestConstants.CARTRIDGES_NAME);
-            assertEquals(removedC2, true);
+        boolean removedC2 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c2-sample-applications-test", RestConstants.CARTRIDGES_NAME);
+        assertEquals(removedC2, true);
 
-            boolean removedC3 = 
restClient.removeEntity(RestConstants.CARTRIDGES, "c3-sample-applications-test",
-                    RestConstants.CARTRIDGES_NAME);
-            assertEquals(removedC3, true);
+        boolean removedC3 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c3-sample-applications-test", RestConstants.CARTRIDGES_NAME);
+        assertEquals(removedC3, true);
 
-            removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                    autoscalingPolicyId, 
RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertEquals(removedAuto, true);
+        removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+                RestConstants.AUTOSCALING_POLICIES_NAME);
+        assertEquals(removedAuto, true);
 
-            removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                    "deployment-policy-sample-applications-test", 
RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(removedDep, true);
+        removedDep = restClient
+                .removeEntity(RestConstants.DEPLOYMENT_POLICIES, 
"deployment-policy-sample-applications-test",
+                        RestConstants.DEPLOYMENT_POLICIES_NAME);
+        assertEquals(removedDep, true);
 
-            removedNet = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    "network-partition-sample-applications-test-1", 
RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedNet, true);
+        removedNet = restClient
+                .removeEntity(RestConstants.NETWORK_PARTITIONS, 
"network-partition-sample-applications-test-1",
+                        RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(removedNet, true);
 
-            boolean removedN2 = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    "network-partition-sample-applications-test-2", 
RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, true, String.format(
-                    "[Network partition] 
network-partition-sample-applications-test-2 could not be removed for " +
-                            "[application] 
g-sc-G123-1-sample-applications-test"));
+        boolean removedN2 = restClient
+                .removeEntity(RestConstants.NETWORK_PARTITIONS, 
"network-partition-sample-applications-test-2",
+                        RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(removedN2, true,
+                "[Network partition] 
network-partition-sample-applications-test-2 could not be removed for "
+                        + "[application] 
g-sc-G123-1-sample-applications-test");
+        long duration = System.currentTimeMillis() - startTime;
+        log.info(String.format("SampleApplicationsTestCase completed in 
[duration] %s ms", duration));
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTestCase.java
 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTestCase.java
index 3ea53e7..7e0ac78 100644
--- 
a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTestCase.java
+++ 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTestCase.java
@@ -21,12 +21,10 @@ package org.apache.stratos.integration.tests.application;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.common.beans.application.ApplicationBean;
-import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
 import org.apache.stratos.integration.common.RestConstants;
 import org.apache.stratos.integration.common.TopologyHandler;
 import org.apache.stratos.integration.tests.StratosIntegrationTest;
 import org.apache.stratos.messaging.domain.application.Application;
-import org.apache.stratos.messaging.domain.application.ApplicationStatus;
 import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
 import org.apache.stratos.messaging.domain.instance.ClusterInstance;
 import org.apache.stratos.messaging.domain.topology.Cluster;
@@ -40,15 +38,14 @@ import org.testng.annotations.Test;
 
 import java.util.Set;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
+import static org.testng.Assert.*;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertTrue;
 
 /**
  * This will handle the scale-up and scale-down of a particular cluster 
bursting test cases
  */
+@Test(groups = { "application", "scale" })
 public class SingleClusterScalingTestCase extends StratosIntegrationTest {
     private static final Log log = 
LogFactory.getLog(SingleClusterScalingTestCase.class);
     private static final String RESOURCES_PATH = 
"/single-cluster-scaling-test";
@@ -61,38 +58,39 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
     private static final int CLUSTER_SCALE_UP_TIMEOUT = 180000;
     private static final int CLUSTER_SCALE_DOWN_TIMEOUT = 360000;
     private int activeInstancesAfterScaleup = 0;
+    private TopologyHandler topologyHandler = TopologyHandler.getInstance();
 
-    @Test(timeOut = APPLICATION_TEST_TIMEOUT, groups = 
{"stratos.application.deployment"})
+    @Test(timeOut = DEFAULT_APPLICATION_TEST_TIMEOUT)
     public void testDeployApplication() throws Exception {
-        TopologyHandler topologyHandler = TopologyHandler.getInstance();
+        log.info("Running SingleClusterScalingTestCase.testDeployApplication 
test method...");
+        long startTime = System.currentTimeMillis();
 
-        boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + 
RestConstants.AUTOSCALING_POLICIES_PATH
-                        + "/" + autoscalingPolicyId + ".json",
+        boolean addedScalingPolicy = restClient.addEntity(
+                RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" 
+ autoscalingPolicyId + ".json",
                 RestConstants.AUTOSCALING_POLICIES, 
RestConstants.AUTOSCALING_POLICIES_NAME);
         Assert.assertTrue(addedScalingPolicy);
 
-        boolean addedC1 = restClient.addEntity(
-                RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
cartridgeId + ".json",
-                RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        boolean addedC1 = restClient
+                .addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + 
"/" + cartridgeId + ".json",
+                        RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
         Assert.assertTrue(addedC1);
 
         boolean addedN1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                        networkPartitionId + ".json",
-                RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
+                networkPartitionId + ".json", 
RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
         Assert.assertTrue(addedN1);
 
         boolean addedDep = restClient.addEntity(RESOURCES_PATH + 
RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
-                        deploymentPolicyId + ".json",
-                RestConstants.DEPLOYMENT_POLICIES, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
+                        deploymentPolicyId + ".json", 
RestConstants.DEPLOYMENT_POLICIES,
+                RestConstants.DEPLOYMENT_POLICIES_NAME);
         Assert.assertTrue(addedDep);
 
         boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
-                        applicationId + ".json", RestConstants.APPLICATIONS,
-                RestConstants.APPLICATIONS_NAME);
+                applicationId + ".json", RestConstants.APPLICATIONS, 
RestConstants.APPLICATIONS_NAME);
         Assert.assertTrue(added);
 
-        ApplicationBean bean = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
-                applicationId, ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
+        ApplicationBean bean = (ApplicationBean) restClient
+                .getEntity(RestConstants.APPLICATIONS, applicationId, 
ApplicationBean.class,
+                        RestConstants.APPLICATIONS_NAME);
         assertEquals(bean.getApplicationId(), applicationId);
 
         boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATION_POLICIES_PATH + "/" +
@@ -103,13 +101,11 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
         //deploy the application
         String resourcePath = RestConstants.APPLICATIONS + "/" + applicationId 
+
                 RestConstants.APPLICATIONS_DEPLOY + "/" + applicationPolicyId;
-        boolean deployed = restClient.deployEntity(resourcePath,
-                RestConstants.APPLICATIONS_NAME);
+        boolean deployed = restClient.deployEntity(resourcePath, 
RestConstants.APPLICATIONS_NAME);
         Assert.assertTrue(deployed);
 
         //Application active handling
-        topologyHandler.assertApplicationStatus(bean.getApplicationId()
-                , ApplicationStatus.Active);
+        
TopologyHandler.getInstance().assertApplicationActiveStatus(bean.getApplicationId());
 
         //Cluster active handling
         topologyHandler.assertClusterActivation(bean.getApplicationId());
@@ -123,26 +119,24 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
         //Check whether cluster could scale-down upto the minimum
         assertClusterScaleDownToMinimumCount(bean.getApplicationId());
 
-        boolean removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+        boolean removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+                RestConstants.AUTOSCALING_POLICIES_NAME);
         assertFalse(removedAuto);
 
-        boolean removedNet = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                networkPartitionId,
+        boolean removedNet = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
                 RestConstants.NETWORK_PARTITIONS_NAME);
         //Trying to remove the used network partition
         assertFalse(removedNet);
 
-        boolean removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME);
+        boolean removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+                RestConstants.DEPLOYMENT_POLICIES_NAME);
         assertFalse(removedDep);
 
         //Un-deploying the application
         String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + 
applicationId +
                 RestConstants.APPLICATIONS_UNDEPLOY;
 
-        boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
-                RestConstants.APPLICATIONS_NAME);
+        boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy, 
RestConstants.APPLICATIONS_NAME);
         Assert.assertTrue(unDeployed);
 
         boolean undeploy = 
topologyHandler.assertApplicationUndeploy(applicationId);
@@ -150,45 +144,48 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
             //Need to forcefully undeploy the application
             log.info(String.format("Force undeployment is going to start for 
the [application] %s", applicationId));
 
-            restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + 
applicationId+
+            restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + 
applicationId +
                     RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
 
             boolean forceUndeployed = 
topologyHandler.assertApplicationUndeploy(applicationId);
-            assertTrue(String.format("Forceful undeployment failed for the 
application %s",
-                    applicationId), forceUndeployed);
+            assertTrue(String.format("Forceful undeployment failed for the 
application %s", applicationId),
+                    forceUndeployed);
         }
 
-        boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, 
applicationId,
-                RestConstants.APPLICATIONS_NAME);
+        boolean removed = restClient
+                .removeEntity(RestConstants.APPLICATIONS, applicationId, 
RestConstants.APPLICATIONS_NAME);
         Assert.assertTrue(removed);
 
-        ApplicationBean beanRemoved = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
-                applicationId, ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
+        ApplicationBean beanRemoved = (ApplicationBean) restClient
+                .getEntity(RestConstants.APPLICATIONS, applicationId, 
ApplicationBean.class,
+                        RestConstants.APPLICATIONS_NAME);
         assertNull(beanRemoved);
 
-        boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, 
cartridgeId,
-                RestConstants.CARTRIDGES_NAME);
+        boolean removedC1 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, cartridgeId, 
RestConstants.CARTRIDGES_NAME);
         Assert.assertTrue(removedC1);
 
-        removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+        removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+                RestConstants.AUTOSCALING_POLICIES_NAME);
         Assert.assertTrue(removedAuto);
 
-        removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME);
+        removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+                RestConstants.DEPLOYMENT_POLICIES_NAME);
         Assert.assertTrue(removedDep);
 
-        removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
+        removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, 
networkPartitionId,
+                RestConstants.NETWORK_PARTITIONS_NAME);
         assertFalse(removedNet);
 
-        boolean removeAppPolicy = 
restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
-                applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME);
+        boolean removeAppPolicy = 
restClient.removeEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+                RestConstants.APPLICATION_POLICIES_NAME);
         Assert.assertTrue(removeAppPolicy);
 
-        removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
+        removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, 
networkPartitionId,
+                RestConstants.NETWORK_PARTITIONS_NAME);
         Assert.assertTrue(removedNet);
+        long duration = System.currentTimeMillis() - startTime;
+        log.info(String.format("SingleClusterScalingTestCase completed in 
[duration] %s ms", duration));
     }
 
     /**
@@ -198,24 +195,22 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
      */
     private void assertClusterWithScalingup(String applicationName) {
         Application application = 
ApplicationManager.getApplications().getApplication(applicationName);
-        assertNotNull(String.format("Application is not found: 
[application-id] %s",
-                applicationName), application);
+        assertNotNull(String.format("Application is not found: 
[application-id] %s", applicationName), application);
         boolean clusterScaleup = false;
         String clusterId = null;
         long startTime = System.currentTimeMillis();
         while (!clusterScaleup) {
             try {
                 Thread.sleep(1000);
-            }
-            catch (InterruptedException ignore) {
+            } catch (InterruptedException ignore) {
             }
             Set<ClusterDataHolder> clusterDataHolderSet = 
application.getClusterDataRecursively();
             for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
                 String serviceName = clusterDataHolder.getServiceType();
                 clusterId = clusterDataHolder.getClusterId();
                 Service service = 
TopologyManager.getTopology().getService(serviceName);
-                assertNotNull(String.format("Service is not found: 
[application-id] %s [service] %s",
-                        applicationName, serviceName), service);
+                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",
@@ -252,24 +247,22 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
      */
     private void assertClusterWithScaleDown(String applicationName) {
         Application application = 
ApplicationManager.getApplications().getApplication(applicationName);
-        assertNotNull(String.format("Application is not found: 
[application-id] %s",
-                applicationName), application);
+        assertNotNull(String.format("Application is not found: 
[application-id] %s", applicationName), application);
         boolean clusterScaleDown = false;
         String clusterId = null;
         long startTime = System.currentTimeMillis();
         while (!clusterScaleDown) {
             try {
                 Thread.sleep(1000);
-            }
-            catch (InterruptedException ignore) {
+            } catch (InterruptedException ignore) {
             }
             Set<ClusterDataHolder> clusterDataHolderSet = 
application.getClusterDataRecursively();
             for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
                 String serviceName = clusterDataHolder.getServiceType();
                 clusterId = clusterDataHolder.getClusterId();
                 Service service = 
TopologyManager.getTopology().getService(serviceName);
-                assertNotNull(String.format("Service is not found: 
[application-id] %s [service] %s",
-                        applicationName, serviceName), service);
+                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",
@@ -312,24 +305,22 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
      */
     private void assertClusterScaleDownToMinimumCount(String applicationName) {
         Application application = 
ApplicationManager.getApplications().getApplication(applicationName);
-        assertNotNull(String.format("Application is not found: 
[application-id] %s",
-                applicationName), application);
+        assertNotNull(String.format("Application is not found: 
[application-id] %s", applicationName), application);
         boolean clusterScaleDown = false;
         String clusterId = null;
         long startTime = System.currentTimeMillis();
         while (!clusterScaleDown) {
             try {
                 Thread.sleep(1000);
-            }
-            catch (InterruptedException ignore) {
+            } catch (InterruptedException ignore) {
             }
             Set<ClusterDataHolder> clusterDataHolderSet = 
application.getClusterDataRecursively();
             for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
                 String serviceName = clusterDataHolder.getServiceType();
                 clusterId = clusterDataHolder.getClusterId();
                 Service service = 
TopologyManager.getTopology().getService(serviceName);
-                assertNotNull(String.format("Service is not found: 
[application-id] %s [service] %s",
-                        applicationName, serviceName), service);
+                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",
@@ -357,4 +348,4 @@ public class SingleClusterScalingTestCase extends 
StratosIntegrationTest {
         assertEquals(clusterScaleDown, true,
                 String.format("Cluster did not get scaled up: [cluster-id] 
%s", clusterId));
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeGroupTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeGroupTestCase.java
 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeGroupTestCase.java
new file mode 100644
index 0000000..7cbf603
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeGroupTestCase.java
@@ -0,0 +1,241 @@
+/*
+ * 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.cartridge;
+
+import com.google.gson.reflect.TypeToken;
+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.common.RestConstants;
+import org.apache.stratos.integration.tests.StratosIntegrationTest;
+import org.testng.annotations.Test;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.AssertJUnit.*;
+
+/**
+ * Test to handle Cartridge group CRUD operations
+ */
+@Test(groups = { "cartridge" })
+public class CartridgeGroupTestCase extends StratosIntegrationTest {
+    private static final Log log = 
LogFactory.getLog(CartridgeGroupTestCase.class);
+    private static final String RESOURCES_PATH = "/cartridge-group-test";
+    private long startTime;
+
+    @Test(timeOut = DEFAULT_TEST_TIMEOUT,
+          priority = 1)
+    public void testCartridgeGroup() throws Exception {
+        log.info("Running CartridgeGroupTestCase.testCartridgeGroup test 
method...");
+        startTime = System.currentTimeMillis();
+
+        boolean addedC1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH +
+                "/" + "c4-cartridge-group-test.json", 
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        assertTrue(String.format("Cartridge did not added: [cartridge-name] 
%s", "c4-cartridge-group-test"), addedC1);
+
+        boolean addedC2 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH +
+                "/" + "c5-cartridge-group-test.json", 
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        assertTrue(String.format("Cartridge did not added: [cartridge-name] 
%s", "c5-cartridge-group-test"), addedC2);
+
+        boolean addedC3 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH +
+                "/" + "c6-cartridge-group-test.json", 
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        assertTrue(String.format("Cartridge did not added: [cartridge-name] 
%s", "c6-cartridge-group-test"), addedC3);
+
+        boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGE_GROUPS_PATH +
+                        "/" + "g4-g5-g6-cartridge-group-test.json", 
RestConstants.CARTRIDGE_GROUPS,
+                RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge Group did not added: 
[cartridge-group-name] %s",
+                "g4-g5-g6-cartridge-group-test"), added);
+
+        CartridgeGroupBean bean = (CartridgeGroupBean) restClient.
+                getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G4-cartridge-group-test", CartridgeGroupBean.class,
+                        RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertEquals(bean.getName(), "G4-cartridge-group-test",
+                String.format("Cartridge Group name did not match: 
[cartridge-group-name] %s",
+                        "g4-g5-g6-cartridge-group-test.json"));
+
+        boolean updated = restClient.updateEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGE_GROUPS_PATH +
+                        "/" + "g4-g5-g6-cartridge-group-test-v1.json", 
RestConstants.CARTRIDGE_GROUPS,
+                RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge Group did not updated: 
[cartridge-group-name] %s",
+                "g4-g5-g6-cartridge-group-test"), updated);
+
+        CartridgeGroupBean updatedBean = (CartridgeGroupBean) restClient.
+                getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G4-cartridge-group-test", CartridgeGroupBean.class,
+                        RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertEquals(updatedBean.getName(), "G4-cartridge-group-test",
+                String.format("Updated Cartridge Group didn't match: 
[cartridge-group-name] %s",
+                        "g4-g5-g6-cartridge-group-test"));
+
+        boolean removedC1 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c4-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertFalse(
+                String.format("Cartridge can be removed while it is used in " 
+ "cartridge group: [cartridge-name] %s",
+                        "c4-cartridge-group-test"), removedC1);
+
+        boolean removedC2 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c5-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertFalse(
+                String.format("Cartridge can be removed while it is used in " 
+ "cartridge group: [cartridge-name] %s",
+                        "c5-cartridge-group-test"), removedC2);
+
+        boolean removedC3 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c6-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertFalse(
+                String.format("Cartridge can be removed while it is used in " 
+ "cartridge group: [cartridge-name] %s",
+                        "c6-cartridge-group-test"), removedC3);
+
+        boolean removed = 
restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"G4-cartridge-group-test",
+                RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge Group did not removed: 
[cartridge-group-name] %s",
+                "g4-g5-g6-cartridge-group-test"), removed);
+
+        CartridgeGroupBean beanRemoved = (CartridgeGroupBean) restClient.
+                getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G4-cartridge-group-test", CartridgeGroupBean.class,
+                        RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertEquals(beanRemoved, null,
+                String.format("Cartridge Group did not removed completely: 
[cartridge-group-name] %s",
+                        "g4-g5-g6-cartridge-group-test"));
+
+        removedC1 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c4-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge can not be removed : 
[cartridge-name] %s", "c4-cartridge-group-test"),
+                removedC1);
+
+        removedC2 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c5-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge can not be removed : 
[cartridge-name] %s", "c5-cartridge-group-test"),
+                removedC2);
+
+        removedC3 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c6-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge can not be removed : 
[cartridge-name] %s", "c6-cartridge-group-test"),
+                removedC3);
+    }
+
+    @Test(timeOut = DEFAULT_TEST_TIMEOUT,
+          priority = 2)
+    public void testCartridgeGroupList() throws Exception {
+        log.info("Running CartridgeGroupTestCase.testCartridgeGroupList test 
method...");
+        boolean addedC1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH +
+                "/" + "c4-cartridge-group-test.json", 
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        assertTrue(String.format("Cartridge did not added: [cartridge-name] 
%s", "c4-cartridge-group-test"), addedC1);
+
+        boolean addedC2 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH +
+                "/" + "c5-cartridge-group-test.json", 
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        assertTrue(String.format("Cartridge did not added: [cartridge-name] 
%s", "c5-cartridge-group-test"), addedC2);
+
+        boolean addedC3 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH +
+                "/" + "c6-cartridge-group-test.json", 
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        assertTrue(String.format("Cartridge did not added: [cartridge-name] 
%s", "c6-cartridge-group-test"), addedC3);
+
+        String group1 = "group-1-cartridge-group-test";
+        String group2 = "group-2-cartridge-group-test";
+
+        boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGE_GROUPS_PATH +
+                "/" + group1 + ".json", RestConstants.CARTRIDGE_GROUPS, 
RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge Group did not added: 
[cartridge-group-name] %s", group1), added);
+
+        added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGE_GROUPS_PATH +
+                "/" + group2 + ".json", RestConstants.CARTRIDGE_GROUPS, 
RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge Group did not added: 
[cartridge-group-name] %s", group1), added);
+
+        Type listType = new TypeToken<ArrayList<CartridgeGroupBean>>() {
+        }.getType();
+
+        List<CartridgeGroupBean> cartridgeGroupList = 
(List<CartridgeGroupBean>) restClient.
+                listEntity(RestConstants.CARTRIDGE_GROUPS, listType, 
RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(cartridgeGroupList.size() >= 2);
+
+        CartridgeGroupBean bean1 = null;
+        for (CartridgeGroupBean cartridgeGroupBean : cartridgeGroupList) {
+            if (cartridgeGroupBean.getName().equals(group1)) {
+                bean1 = cartridgeGroupBean;
+            }
+        }
+        assertNotNull(bean1);
+
+        CartridgeGroupBean bean2 = null;
+        for (CartridgeGroupBean cartridgeGroupBean : cartridgeGroupList) {
+            if (cartridgeGroupBean.getName().equals(group2)) {
+                bean2 = cartridgeGroupBean;
+            }
+        }
+        assertNotNull(bean2);
+
+        boolean removed = restClient
+                .removeEntity(RestConstants.CARTRIDGE_GROUPS, group1, 
RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge Group did not removed: 
[cartridge-group-name] %s", group1), removed);
+
+        CartridgeGroupBean beanRemoved = (CartridgeGroupBean) restClient.
+                getEntity(RestConstants.CARTRIDGE_GROUPS, group1, 
CartridgeGroupBean.class,
+                        RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertNull(String.format("Cartridge Group did not removed completely: 
" + "[cartridge-group-name] %s", group1),
+                beanRemoved);
+
+        boolean removedC1 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c4-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertFalse(
+                String.format("Cartridge can be removed while it is used in " 
+ "cartridge group: [cartridge-name] %s",
+                        "c4-cartridge-group-test"), removedC1);
+
+        boolean removedC2 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c5-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertFalse(
+                String.format("Cartridge can be removed while it is used in " 
+ "cartridge group: [cartridge-name] %s",
+                        "c5-cartridge-group-test"), removedC2);
+
+        boolean removedC3 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c6-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertFalse(
+                String.format("Cartridge can be removed while it is used in " 
+ "cartridge group: [cartridge-name] %s",
+                        "c6-cartridge-group-test"), removedC3);
+
+        removed = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
group2, RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge Group did not removed: 
[cartridge-group-name] %s", group2), removed);
+
+        beanRemoved = (CartridgeGroupBean) restClient.
+                getEntity(RestConstants.CARTRIDGE_GROUPS, group2, 
CartridgeGroupBean.class,
+                        RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertNull(String.format("Cartridge Group did not removed completely: 
" + "[cartridge-group-name] %s", group2),
+                beanRemoved);
+
+        removedC1 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c4-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge can not be removed : 
[cartridge-name] %s", "c4-cartridge-group-test"),
+                removedC1);
+
+        removedC2 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c5-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge can not be removed : 
[cartridge-name] %s", "c5-cartridge-group-test"),
+                removedC2);
+
+        removedC3 = restClient
+                .removeEntity(RestConstants.CARTRIDGES, 
"c6-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertTrue(String.format("Cartridge can not be removed : 
[cartridge-name] %s", "c6-cartridge-group-test"),
+                removedC3);
+        long duration = System.currentTimeMillis() - startTime;
+        log.info(String.format("ApplicationBurstingTestCase completed in 
[duration] %s ms", duration));
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeTestCase.java
 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeTestCase.java
new file mode 100644
index 0000000..3672373
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/cartridge/CartridgeTestCase.java
@@ -0,0 +1,183 @@
+/*
+ * 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.cartridge;
+
+import com.google.gson.reflect.TypeToken;
+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.integration.common.RestConstants;
+import org.apache.stratos.integration.tests.StratosIntegrationTest;
+import org.testng.annotations.Test;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+/**
+ * Test to handle Cartridge CRUD operations
+ */
+@Test(groups = { "cartridge" })
+public class CartridgeTestCase extends StratosIntegrationTest {
+    private static final Log log = LogFactory.getLog(CartridgeTestCase.class);
+    private static final String RESOURCES_PATH = "/cartridge-test";
+    private long startTime;
+
+    @Test(timeOut = DEFAULT_TEST_TIMEOUT,
+          priority = 1)
+    public void testCartridge() throws Exception {
+        log.info("Running CartridgeTestCase.testCartridge test method...");
+        startTime = System.currentTimeMillis();
+
+        String cartridgeType = "c0-cartridge-test";
+        boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH + "/" +
+                cartridgeType + ".json", RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
+        assertTrue(added);
+        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(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH + "/" +
+                cartridgeType + "-v1.json", RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
+        assertTrue(updated);
+        CartridgeBean updatedBean = (CartridgeBean) restClient.
+                getEntity(RestConstants.CARTRIDGES, cartridgeType, 
CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+        assertEquals(updatedBean.getType(), "c0-cartridge-test");
+        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);
+        assertTrue(removed);
+
+        CartridgeBean beanRemoved = (CartridgeBean) restClient.
+                getEntity(RestConstants.CARTRIDGES, cartridgeType, 
CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+        assertNull(beanRemoved);
+    }
+
+    @Test(timeOut = DEFAULT_TEST_TIMEOUT,
+          priority = 2)
+    public void testCartridgeList() throws Exception {
+        log.info("Running CartridgeTestCase.testCartridgeList test method...");
+
+        String cartridgeType1 = "c1-cartridge-test";
+        String cartridgeType2 = "c2-cartridge-test";
+        boolean added1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH + "/" +
+                cartridgeType1 + ".json", RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
+        assertTrue(added1);
+
+        boolean added2 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH + "/" +
+                cartridgeType2 + ".json", RestConstants.CARTRIDGES, 
RestConstants.CARTRIDGES_NAME);
+        assertTrue(added2);
+
+        Type listType = new TypeToken<ArrayList<CartridgeBean>>() {
+        }.getType();
+
+        List<CartridgeBean> cartridgeList = (List<CartridgeBean>) restClient
+                .listEntity(RestConstants.CARTRIDGES, listType, 
RestConstants.CARTRIDGES_NAME);
+        assertTrue(cartridgeList.size() >= 2);
+
+        CartridgeBean bean1 = null;
+        for (CartridgeBean cartridgeBean : cartridgeList) {
+            if (cartridgeBean.getType().equals(cartridgeType1)) {
+                bean1 = cartridgeBean;
+            }
+        }
+        assertNotNull(bean1);
+
+        CartridgeBean bean2 = null;
+        for (CartridgeBean cartridgeBean : cartridgeList) {
+            if (cartridgeBean.getType().equals(cartridgeType1)) {
+                bean2 = cartridgeBean;
+            }
+        }
+        assertNotNull(bean2);
+
+        boolean removed = restClient
+                .removeEntity(RestConstants.CARTRIDGES, cartridgeType1, 
RestConstants.CARTRIDGES_NAME);
+        assertTrue(removed);
+
+        CartridgeBean beanRemoved = (CartridgeBean) restClient.
+                getEntity(RestConstants.CARTRIDGES, cartridgeType1, 
CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+        assertEquals(beanRemoved, null);
+
+        removed = restClient.removeEntity(RestConstants.CARTRIDGES, 
cartridgeType2, RestConstants.CARTRIDGES_NAME);
+        assertTrue(removed);
+
+        beanRemoved = (CartridgeBean) restClient.
+                getEntity(RestConstants.CARTRIDGES, cartridgeType2, 
CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+        assertNull(beanRemoved);
+        long duration = System.currentTimeMillis() - startTime;
+        log.info(String.format("CartridgeTestCase completed in [duration] %s 
ms", duration));
+    }
+}

Reply via email to