You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/11/02 16:31:03 UTC

[22/50] [abbrv] stratos git commit: Revert "Merge with tenant-isolation branch"

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
index afbdc1a..571b261 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.stratos.integration.tests.group;
 
+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;
@@ -27,6 +28,10 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
 import static junit.framework.Assert.*;
 
 /**
@@ -43,15 +48,15 @@ public class CartridgeTest extends StratosTestServerManager {
 
         try {
             String cartridgeType = "c0-cartridge-test";
-            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
+            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
                             cartridgeType + ".json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(added, true);
-            CartridgeBean bean = (CartridgeBean) restClientTenant1.
+            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");
@@ -75,15 +80,13 @@ public class CartridgeTest extends StratosTestServerManager {
                     assertEquals(property.getValue(), "61616");
                 }
             }
-            bean = (CartridgeBean) restClientTenant2.
-                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
-                            CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
-            assertNull("Cartridge exists in other tenant", bean);
-            boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
+
+
+            boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
                             cartridgeType + "-v1.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(updated, true);
-            CartridgeBean updatedBean = (CartridgeBean) restClientTenant1.
+            assertTrue(updated);
+            CartridgeBean updatedBean = (CartridgeBean) restClient.
                     getEntity(RestConstants.CARTRIDGES, cartridgeType,
                             CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
             assertEquals(updatedBean.getType(), "c0-cartridge-test");
@@ -113,79 +116,84 @@ public class CartridgeTest extends StratosTestServerManager {
                 }
             }
 
-            bean = (CartridgeBean) restClientTenant2.
+            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("Cartridge exists in other tenant", bean);
+            assertNull(beanRemoved);
 
-            added = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
-                            cartridgeType + ".json",
+            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);
+        }
+    }
+
+    @Test
+    public void testCartridgeList() {
+        log.info("--------------------Started Cartridge list test case-----------------------------");
+
+        try {
+            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);
-            assertEquals(added, true);
+            assertTrue(added1);
 
-            updated = restClientTenant2.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
-                            cartridgeType + "-v1.json",
+            boolean added2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
+                            cartridgeType2 + ".json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(updated, true);
+            assertTrue(added2);
 
-            updatedBean = (CartridgeBean) restClientTenant2.
-                    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");
+            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;
                 }
             }
-            boolean removed = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, cartridgeType,
-                    RestConstants.CARTRIDGES_NAME);
-            assertEquals(removed, true);
-
-            bean = (CartridgeBean) restClientTenant2.
-                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
-                            CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
-            assertNotNull("Cartridge not exists in other tenant", bean);
+            assertNotNull(bean1);
 
-            CartridgeBean beanRemoved = (CartridgeBean) restClientTenant1.
-                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
-                            CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
-            assertEquals(beanRemoved, null);
+            CartridgeBean bean2 = null;
+            for (CartridgeBean cartridgeBean : cartridgeList) {
+                if (cartridgeBean.getType().equals(cartridgeType1)) {
+                    bean2 = cartridgeBean;
+                }
+            }
+            assertNotNull(bean2);
 
-            removed = restClientTenant2.removeEntity(RestConstants.CARTRIDGES, cartridgeType,
+            boolean removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType1,
                     RestConstants.CARTRIDGES_NAME);
-            assertEquals(removed, true);
+            assertTrue(removed);
 
-            beanRemoved = (CartridgeBean) restClientTenant2.
-                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
+            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);
 
-            log.info("---------------------------Ended Cartridge test case-------------------------");
+            log.info("---------------------------Ended Cartridge list 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);
+            log.error("An error occurred while handling Cartridges list", e);
+            assertTrue("An error occurred while handling Cartridges list", false);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
index 6800200..656abc5 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.stratos.integration.tests.policies;
 
+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;
@@ -28,6 +29,10 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
 import static junit.framework.Assert.*;
 
 /**
@@ -44,22 +49,22 @@ public class ApplicationPolicyTest extends StratosTestServerManager {
             String applicationPolicyId = "application-policy-application-policy-test";
             log.info("-------------------------Started Application policy test case-------------------------");
 
-            boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-policy-test-1" + ".json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN1, true);
+            assertTrue(addedN1);
 
-            boolean addedN2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-policy-test-2" + ".json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN2, true);
+            assertTrue(addedN2);
 
-            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
                             applicationPolicyId + ".json",
                     RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(addedDep, true);
+            assertTrue(addedDep);
 
-            ApplicationPolicyBean bean = (ApplicationPolicyBean) restClientTenant1.
+            ApplicationPolicyBean bean = (ApplicationPolicyBean) restClient.
                     getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
                             ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(bean.getId(), applicationPolicyId);
@@ -86,99 +91,141 @@ public class ApplicationPolicyTest extends StratosTestServerManager {
                 }
             }
             if (!algoFound) {
-                assertTrue(String.format("The networkPartitionGroups property is not found in %s",
-                        applicationPolicyId), false);
+                assertNull(String.format("The networkPartitionGroups property is not found in %s",
+                        applicationPolicyId));
             }
 
-            bean = (ApplicationPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
-                            ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
-            assertNull("Application policy bean found in tenant 2",bean);
-
-            addedN1 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            "network-partition-application-policy-test-1" + ".json",
-                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN1, true);
-
-            addedN2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            "network-partition-application-policy-test-2" + ".json",
-                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN2, true);
-
-            boolean addedTenant2Dep = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
-                            applicationPolicyId + ".json",
-                    RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(addedTenant2Dep, true);
-
-            ApplicationPolicyBean tenant2bean = (ApplicationPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
-                            ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
-            assertNotNull("Application is not exist in tenant 2", tenant2bean);
-
-
-            boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
-            assertEquals(removedNet, false);
+            assertFalse(removedNet);
 
-            boolean removedDep = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
+            boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
                     applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(removedDep, true);
+            assertTrue(removedDep);
 
-            ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClientTenant1.
+            ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClient.
                     getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
                             ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(beanRemovedDep, null);
+            assertNull(beanRemovedDep);
 
-            boolean removedN1 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN1, true);
+            assertTrue(removedN1);
 
-            NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClientTenant1.
+            NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN1, null);
+            assertNull(beanRemovedN1);
 
-            boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, true);
+            assertTrue(removedN2);
 
-            NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClientTenant1.
+            NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2",
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN2, null);
+            assertNull(beanRemovedN2);
 
-            tenant2bean = (ApplicationPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+            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 testApplicationPolicyList() {
+        try {
+            String applicationPolicyId1 = "application-policy-application-policy-test-1";
+            String applicationPolicyId2 = "application-policy-application-policy-test-2";
+            log.info("-------------------------Started Application policy list test case-------------------------");
+
+            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-application-policy-test-1" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(addedN1);
+
+            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-application-policy-test-2" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(addedN2);
+
+            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+                            applicationPolicyId1 + ".json",
+                    RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
+            assertTrue(addedDep);
+
+            addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+                            applicationPolicyId2 + ".json",
+                    RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
+            assertTrue(addedDep);
+
+            Type listType = new TypeToken<ArrayList<ApplicationPolicyBean>>() {
+            }.getType();
+
+            List<ApplicationPolicyBean> applicationPolicyList = (List<ApplicationPolicyBean>) restClient.
+                    listEntity(RestConstants.APPLICATION_POLICIES,
+                            listType, RestConstants.APPLICATION_POLICIES_NAME);
+            assertTrue(applicationPolicyList.size() >= 2);
+
+            ApplicationPolicyBean bean1 = null;
+            for (ApplicationPolicyBean applicationPolicyBean : applicationPolicyList) {
+                if (applicationPolicyBean.getId().equals(applicationPolicyId1)) {
+                    bean1 = applicationPolicyBean;
+                }
+            }
+            assertNotNull(bean1);
+
+            ApplicationPolicyBean bean2 = null;
+            for (ApplicationPolicyBean applicationPolicyBean : applicationPolicyList) {
+                if (applicationPolicyBean.getId().equals(applicationPolicyId2)) {
+                    bean2 = applicationPolicyBean;
+                }
+            }
+            assertNotNull(bean2);
+
+            boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+                    applicationPolicyId1, RestConstants.APPLICATION_POLICIES_NAME);
+            assertTrue(removedDep);
+
+            ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClient.
+                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId1,
                             ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
-            assertNotNull("Application is not exist in tenant 2", tenant2bean);
+            assertNull(beanRemovedDep);
 
-            removedDep = restClientTenant2.removeEntity(RestConstants.APPLICATION_POLICIES,
-                    applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(removedDep, true);
+            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+            //Trying to remove the used network partition
+            assertFalse(removedNet);
 
-            beanRemovedDep = (ApplicationPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+            removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+                    applicationPolicyId2, RestConstants.APPLICATION_POLICIES_NAME);
+            assertTrue(removedDep);
+
+            beanRemovedDep = (ApplicationPolicyBean) restClient.
+                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId2,
                             ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(beanRemovedDep, null);
+            assertNull(beanRemovedDep);
 
-            removedN1 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN1, true);
+            assertTrue(removedN1);
 
-            beanRemovedN1 = (NetworkPartitionBean) restClientTenant2.
+            NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN1, null);
+            assertNull(beanRemovedN1);
 
-            removedN2 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, true);
+            assertTrue(removedN2);
 
-            beanRemovedN2 = (NetworkPartitionBean) restClientTenant2.
+            NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2",
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN2, null);
+            assertNull(beanRemovedN2);
 
             log.info("-------------------------Ended deployment policy test case-------------------------");
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
index 895e5f6..a615d98 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.stratos.integration.tests.policies;
 
+import com.google.gson.reflect.TypeToken;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
@@ -25,6 +26,10 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
 import static junit.framework.Assert.*;
 
 /**
@@ -40,33 +45,11 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
         log.info("-------------------------Started autoscaling policy test case-------------------------");
         String policyId = "autoscaling-policy-autoscaling-policy-test";
         try {
-            boolean added = restClientTenant1.addEntity(RESOURCES_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);
-            AutoscalePolicyBean bean = (AutoscalePolicyBean) restClientTenant1.
-                    getEntity(RestConstants.AUTOSCALING_POLICIES, policyId,
-                            AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
-
-            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);
-
-            bean = (AutoscalePolicyBean) restClientTenant2.
-                    getEntity(RestConstants.AUTOSCALING_POLICIES, policyId,
-                            AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertNull("Auto scale policy exists for other tenant",bean);
-
-            boolean addedTenant2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json",
+            boolean added = restClient.addEntity(RESOURCES_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), addedTenant2, true);
-            bean = (AutoscalePolicyBean) restClientTenant2.
+            assertTrue(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), added);
+            AutoscalePolicyBean bean = (AutoscalePolicyBean) restClient.
                     getEntity(RestConstants.AUTOSCALING_POLICIES, policyId,
                             AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
 
@@ -79,11 +62,11 @@ 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 = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
+            boolean updated = restClient.updateEntity(RESOURCES_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);
-            AutoscalePolicyBean updatedBean = (AutoscalePolicyBean) restClientTenant1.getEntity(
+            assertTrue(String.format("[autoscaling-policy-id] %s update failed", policyId), updated);
+            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),
@@ -93,46 +76,95 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
             assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
                     updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
 
-            boolean updatedTenant2 = restClientTenant2.updateEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
-                    RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+            boolean removed = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                    policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertTrue(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
+                    removed);
 
-            assertEquals(String.format("[autoscaling-policy-id] %s update failed", policyId), updatedTenant2, true);
-            AutoscalePolicyBean updatedTenant2Bean = (AutoscalePolicyBean) restClientTenant2.getEntity(
+            AutoscalePolicyBean beanRemoved = (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),
-                    updatedTenant2Bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0);
-            assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
-                    updatedTenant2Bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 0.0);
-            assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
-                    updatedTenant2Bean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
+            assertNull(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
+                    policyId), beanRemoved);
+            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 testAutoscalingPolicyList() {
+        log.info("-------------------------Started autoscaling policy list test case-------------------------");
+        String policyId1 = "autoscaling-policy-autoscaling-policy-test-1";
+        String policyId2 = "autoscaling-policy-autoscaling-policy-test-2";
+        try {
+            boolean added = restClient.addEntity(RESOURCES_PATH +
+                            RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId1 + ".json",
+                    RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
 
-            boolean removed = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                    policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
-                    removed, true);
+            assertTrue(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s",
+                    policyId1), added);
 
-            AutoscalePolicyBean beanRemoved = (AutoscalePolicyBean) restClientTenant1.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);
+            added = restClient.addEntity(RESOURCES_PATH +
+                            RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId2 + ".json",
+                    RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
 
-            beanRemoved = (AutoscalePolicyBean) restClientTenant2.getEntity(
-                    RestConstants.AUTOSCALING_POLICIES, policyId,
+            assertTrue(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s",
+                    policyId2), added);
+
+
+            Type listType = new TypeToken<ArrayList<AutoscalePolicyBean>>() {
+            }.getType();
+
+            List<AutoscalePolicyBean> autoscalingPolicyList = (List<AutoscalePolicyBean>) restClient.
+                    listEntity(RestConstants.AUTOSCALING_POLICIES,
+                            listType, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertTrue(autoscalingPolicyList.size() >= 2);
+
+            AutoscalePolicyBean bean1 = null;
+            for (AutoscalePolicyBean autoscalePolicyBean : autoscalingPolicyList) {
+                if (autoscalePolicyBean.getId().equals(policyId1)) {
+                    bean1 = autoscalePolicyBean;
+                }
+            }
+            assertNotNull(bean1);
+
+            AutoscalePolicyBean bean2 = null;
+            for (AutoscalePolicyBean autoscalePolicyBean : autoscalingPolicyList) {
+                if (autoscalePolicyBean.getId().equals(policyId2)) {
+                    bean2 = autoscalePolicyBean;
+                }
+            }
+            assertNotNull(bean2);
+
+
+            boolean removed = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                    policyId1, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertTrue(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId1),
+                    removed);
+
+            AutoscalePolicyBean beanRemoved = (AutoscalePolicyBean) restClient.getEntity(
+                    RestConstants.AUTOSCALING_POLICIES, policyId1,
                     AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertNotNull("Auto scale policy not exist in other tenant",beanRemoved);
+            assertNull(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
+                    policyId1), beanRemoved);
 
-            removed = restClientTenant2.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                    policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
-                    removed, true);
+            removed = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                    policyId2, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertTrue(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId2),
+                    removed);
 
-            log.info("-------------------------Ended autoscaling policy test case---------------------------");
+            beanRemoved = (AutoscalePolicyBean) restClient.getEntity(
+                    RestConstants.AUTOSCALING_POLICIES, policyId2,
+                    AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertNull(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
+                    policyId2), beanRemoved);
+
+            log.info("-------------------------Ended autoscaling policy list 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);
+            log.error("An error occurred while handling [autoscaling policy] list", e);
+            assertTrue("An error occurred while handling [autoscaling policy] list", false);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
index b784baf..34e398b 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
@@ -19,9 +19,9 @@
 
 package org.apache.stratos.integration.tests.policies;
 
+import com.google.gson.reflect.TypeToken;
 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.partition.NetworkPartitionReferenceBean;
 import org.apache.stratos.common.beans.partition.PartitionReferenceBean;
 import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
@@ -29,6 +29,10 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
 import static junit.framework.Assert.*;
 
 /**
@@ -45,22 +49,22 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
             String deploymentPolicyId = "deployment-policy-deployment-policy-test";
             log.info("-------------------------Started deployment policy test case-------------------------");
 
-            boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-deployment-policy-test-1" + ".json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN1, true);
+            assertTrue(addedN1);
 
-            boolean addedN2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-deployment-policy-test-2" + ".json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN2, true);
+            assertTrue(addedN2);
 
-            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
                             deploymentPolicyId + ".json",
                     RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(addedDep, true);
+            assertTrue(addedDep);
 
-            DeploymentPolicyBean bean = (DeploymentPolicyBean) restClientTenant1.
+            DeploymentPolicyBean bean = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
                             DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
 
@@ -89,18 +93,18 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
             assertEquals(nw2P2.getPartitionMax(), 9);
 
             //update network partition
-            boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-deployment-policy-test-1-v1.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(updated, true);
+            assertTrue(updated);
 
             //update deployment policy with new partition and max values
-            boolean updatedDep = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH +
+            boolean updatedDep = restClient.updateEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH +
                             "/" + deploymentPolicyId + "-v1.json", RestConstants.DEPLOYMENT_POLICIES,
                     RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(updatedDep, true);
+            assertTrue(updatedDep);
 
-            DeploymentPolicyBean updatedBean = (DeploymentPolicyBean) restClientTenant1.
+            DeploymentPolicyBean updatedBean = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
                             DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
 
@@ -131,96 +135,143 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
                     "network-partition-6-partition-2");
             assertEquals(nw2P2.getPartitionMax(), 5);
 
-            updatedBean = (DeploymentPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
-                            DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertNull("Deployment policy found in tenant 2",updatedBean);
-
-            addedN1 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            "network-partition-deployment-policy-test-1" + ".json",
-                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN1, true);
-
-            addedN2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            "network-partition-deployment-policy-test-2" + ".json",
-                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(addedN2, true);
-
-            addedDep = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
-                            deploymentPolicyId + ".json",
-                    RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(addedDep, true);
-
-            bean = (DeploymentPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
-                            DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertNotNull("Deployment policy not exist in other tenant",bean);
-
-            boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
-            assertEquals(removedNet, false);
+            assertFalse(removedNet);
 
-            boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(removedDep, true);
+            assertTrue(removedDep);
 
-            DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClientTenant1.
+            DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
                             DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(beanRemovedDep, null);
+            assertNull(beanRemovedDep);
 
-            boolean removedN1 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN1, true);
+            assertTrue(removedN1);
 
-            NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClientTenant1.
+            DeploymentPolicyBean beanRemovedN1 = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-1",
-                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN1, null);
+                            DeploymentPolicyBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN1);
 
-            boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, true);
+            assertTrue(removedN2);
 
-            NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClientTenant1.
+            DeploymentPolicyBean beanRemovedN2 = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2",
-                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN2, null);
+                            DeploymentPolicyBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN2);
 
-            bean = (DeploymentPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+            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 testDeploymentPolicyList() {
+        try {
+            String deploymentPolicyId1 = "deployment-policy-deployment-policy-test-1";
+            String deploymentPolicyId2 = "deployment-policy-deployment-policy-test-2";
+
+            log.info("-------------------------Started deployment policy list test case-------------------------");
+
+            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-deployment-policy-test-1" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(addedN1);
+
+            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-deployment-policy-test-2" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(addedN2);
+
+            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+                            deploymentPolicyId1 + ".json",
+                    RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertTrue(addedDep);
+
+
+            addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+                            deploymentPolicyId2 + ".json",
+                    RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertTrue(addedDep);
+
+
+            Type listType = new TypeToken<ArrayList<DeploymentPolicyBean>>() {
+            }.getType();
+
+            List<DeploymentPolicyBean> cartridgeList = (List<DeploymentPolicyBean>) restClient.
+                    listEntity(RestConstants.DEPLOYMENT_POLICIES,
+                            listType, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertTrue(cartridgeList.size() >= 2);
+
+            DeploymentPolicyBean bean1 = null;
+            for (DeploymentPolicyBean deploymentPolicyBean : cartridgeList) {
+                if (deploymentPolicyBean.getId().equals(deploymentPolicyId1)) {
+                    bean1 = deploymentPolicyBean;
+                }
+            }
+            assertNotNull(bean1);
+
+            DeploymentPolicyBean bean2 = null;
+            for (DeploymentPolicyBean deploymentPolicyBean : cartridgeList) {
+                if (deploymentPolicyBean.getId().equals(deploymentPolicyId2)) {
+                    bean2 = deploymentPolicyBean;
+                }
+            }
+            assertNotNull(bean2);
+
+            boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+                    deploymentPolicyId1, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertTrue(removedDep);
+
+            DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClient.
+                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId1,
                             DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertNotNull("Deployment policy not exist in other tenant",bean);
+            assertNull(beanRemovedDep);
 
-            removedDep = restClientTenant2.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                    deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(removedDep, true);
+            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+            //Trying to remove the used network partition
+            assertFalse(removedNet);
 
-            beanRemovedDep = (DeploymentPolicyBean) restClientTenant2.
-                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+            removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+                    deploymentPolicyId2, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertTrue(removedDep);
+
+            beanRemovedDep = (DeploymentPolicyBean) restClient.
+                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId2,
                             DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(beanRemovedDep, null);
+            assertNull(beanRemovedDep);
 
-            removedN1 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN1, true);
+            assertTrue(removedN1);
 
-            beanRemovedN1 = (NetworkPartitionBean) restClientTenant2.
+            DeploymentPolicyBean beanRemovedN1 = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-1",
-                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN1, null);
+                            DeploymentPolicyBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN1);
 
-            removedN2 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, true);
+            assertTrue(removedN2);
 
-            beanRemovedN2 = (NetworkPartitionBean) restClientTenant2.
+            DeploymentPolicyBean beanRemovedN2 = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2",
-                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN2, null);
+                            DeploymentPolicyBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN2);
 
-            log.info("-------------------------Ended deployment policy test case-------------------------");
+            log.info("-------------------------Ended deployment policy list test case-------------------------");
 
         } catch (Exception e) {
             log.error("An error occurred while handling deployment policy", e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
index de5c4fd..6f0f928 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.stratos.integration.tests.policies;
 
+import com.google.gson.reflect.TypeToken;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
@@ -27,6 +28,10 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
 import static junit.framework.Assert.*;
 
 /**
@@ -43,12 +48,12 @@ public class NetworkPartitionTest extends StratosTestServerManager {
             String networkPartitionId = "network-partition-network-partition-test";
             log.info("-------------------------Started network partition test case-------------------------");
 
-            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             networkPartitionId + ".json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
 
-            assertEquals(added, true);
-            NetworkPartitionBean bean = (NetworkPartitionBean) restClientTenant1.
+            assertTrue(added);
+            NetworkPartitionBean bean = (NetworkPartitionBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
 
@@ -59,12 +64,12 @@ public class NetworkPartitionTest extends StratosTestServerManager {
             assertEquals(p1.getProperty().get(0).getName(), "region");
             assertEquals(p1.getProperty().get(0).getValue(), "default");
 
-            boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             networkPartitionId + "-v1.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
 
-            assertEquals(updated, true);
-            NetworkPartitionBean updatedBean = (NetworkPartitionBean) restClientTenant1.
+            assertTrue(updated);
+            NetworkPartitionBean updatedBean = (NetworkPartitionBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
 
@@ -77,43 +82,82 @@ public class NetworkPartitionTest extends StratosTestServerManager {
             assertEquals(p2.getProperty().get(1).getName(), "zone");
             assertEquals(p2.getProperty().get(1).getValue(), "z1");
 
-            updatedBean = (NetworkPartitionBean) restClientTenant2.
+            boolean removed = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(removed);
+
+            NetworkPartitionBean beanRemoved = (NetworkPartitionBean) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertNull("Network partition found in tenant 2",updatedBean);
+            assertNull(beanRemoved);
 
-            added = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            networkPartitionId + ".json",
-                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            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);
+        }
+    }
 
-            assertEquals(added, true);
-            bean = (NetworkPartitionBean) restClientTenant2.
-                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
-                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertNotNull("Network partition not exist in other tenant",bean);
+    @Test
+    public void testNetworkPartitionList() {
+        try {
+            String networkPartitionId1 = "network-partition-network-partition-test-1";
+            String networkPartitionId2 = "network-partition-network-partition-test-2";
 
-            boolean removed = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removed, true);
+            log.info("-------------------------Started network partition list test case-------------------------");
 
-            NetworkPartitionBean beanRemoved = (NetworkPartitionBean) restClientTenant1.
-                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
-                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemoved, null);
+            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            networkPartitionId1 + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(added);
 
-            bean = (NetworkPartitionBean) restClientTenant2.
-                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+            added = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            networkPartitionId2 + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(added);
+
+            Type listType = new TypeToken<ArrayList<NetworkPartitionBean>>() {
+            }.getType();
+
+            List<NetworkPartitionBean> cartridgeList = (List<NetworkPartitionBean>) restClient.
+                    listEntity(RestConstants.NETWORK_PARTITIONS,
+                            listType, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(cartridgeList.size() >= 2);
+
+            NetworkPartitionBean bean1 = null;
+            for (NetworkPartitionBean networkPartitionBean : cartridgeList) {
+                if (networkPartitionBean.getId().equals(networkPartitionId1)) {
+                    bean1 = networkPartitionBean;
+                }
+            }
+            assertNotNull(bean1);
+
+            NetworkPartitionBean bean2 = null;
+            for (NetworkPartitionBean networkPartitionBean : cartridgeList) {
+                if (networkPartitionBean.getId().equals(networkPartitionId2)) {
+                    bean2 = networkPartitionBean;
+                }
+            }
+            assertNotNull(bean2);
+
+
+            boolean removed = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    networkPartitionId1, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(removed);
+
+            NetworkPartitionBean beanRemoved = (NetworkPartitionBean) restClient.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId1,
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertNotNull("Network partition not exist in other tenant",bean);
+            assertNull(beanRemoved);
 
-            removed = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removed, true);
+            removed = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    networkPartitionId2, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(removed);
 
-            beanRemoved = (NetworkPartitionBean) restClientTenant2.
-                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+            beanRemoved = (NetworkPartitionBean) restClient.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId2,
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemoved, null);
+            assertNull(beanRemoved);
 
             log.info("-------------------------Ended network partition test case-------------------------");
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
index f53ca90..0378509 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
@@ -68,7 +68,7 @@ public class IntegrationMockClient extends MockIaasApiClient {
                 } else {
                     GsonBuilder gsonBuilder = new GsonBuilder();
                     Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
+                    org.apache.stratos.mock.iaas.domain.ErrorResponse errorResponse = gson.fromJson(response.getContent(), org.apache.stratos.mock.iaas.domain.ErrorResponse.class);
                     if (errorResponse != null) {
                         throw new RuntimeException(errorResponse.getErrorMessage());
                     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/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 66c6a73..9702a31 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
@@ -61,8 +61,8 @@ public class RestClient {
     public RestClient(String endPoint, String userName, String password) {
         this();
         this.endPoint = endPoint;
-        this.setUserName(userName);
-        this.setPassword(password);
+        this.userName = userName;
+        this.password = password;
     }
 
     /**
@@ -382,22 +382,6 @@ public class RestClient {
      * @return username:password
      */
     private String getUsernamePassword() {
-        return this.getUserName() + ":" + this.getPassword();
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
+        return this.userName + ":" + this.password;
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java
index a1998e1..437b162 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java
@@ -35,7 +35,7 @@ public class TenantTest extends StratosTestServerManager {
     @Test
     public void addUser() {
         String tenantId = "tenant-1";
-        boolean addedUser1 = restClientAdmin.addEntity(RESOURCES_PATH + "/" +
+        boolean addedUser1 = restClient.addEntity(RESOURCES_PATH + "/" +
                         tenantId + ".json",
                 RestConstants.USERS, RestConstants.USERS_NAME);
         assertTrue(addedUser1);

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java
index 1b083df..c15250f 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java
@@ -45,7 +45,7 @@ public class UserTest extends StratosTestServerManager {
         try {
             log.info("-------------------------------Started users test case-------------------------------");
             String userId = "user-1";
-            boolean addedUser1 = restClientAdmin.addEntity(RESOURCES_PATH + "/" +
+            boolean addedUser1 = restClient.addEntity(RESOURCES_PATH + "/" +
                             userId + ".json",
                     RestConstants.USERS, RestConstants.USERS_NAME);
             assertTrue(addedUser1);
@@ -53,7 +53,7 @@ public class UserTest extends StratosTestServerManager {
             Type listType = new TypeToken<ArrayList<UserInfoBean>>() {
             }.getType();
 
-            List<UserInfoBean> userInfoBeanList = (List<UserInfoBean>) restClientAdmin.listEntity(RestConstants.USERS,
+            List<UserInfoBean> userInfoBeanList = (List<UserInfoBean>) restClient.listEntity(RestConstants.USERS,
                     listType, RestConstants.USERS_NAME);
 
             UserInfoBean bean1 = null;
@@ -69,12 +69,12 @@ public class UserTest extends StratosTestServerManager {
             assertEquals(bean1.getLastName(), "Myers");
             assertEquals(bean1.getCredential(), "kim12345");*/
 
-            boolean updatedUser1 = restClientAdmin.updateEntity(RESOURCES_PATH + "/" +
+            boolean updatedUser1 = restClient.updateEntity(RESOURCES_PATH + "/" +
                             userId + "-v1.json",
                     RestConstants.USERS, RestConstants.USERS_NAME);
             assertTrue(updatedUser1);
 
-            userInfoBeanList = (List<UserInfoBean>) restClientAdmin.listEntity(RestConstants.USERS,
+            userInfoBeanList = (List<UserInfoBean>) restClient.listEntity(RestConstants.USERS,
                     listType, RestConstants.USERS_NAME);
 
             for (UserInfoBean userInfoBean : userInfoBeanList) {
@@ -89,11 +89,11 @@ public class UserTest extends StratosTestServerManager {
             assertEquals(bean1.getLastName(), "Myersn");
             assertEquals(bean1.getCredential(), "kim123456");*/
 
-            boolean removedUser1 = restClientAdmin.removeEntity(RestConstants.USERS,
+            boolean removedUser1 = restClient.removeEntity(RestConstants.USERS,
                             userId, RestConstants.USERS_NAME);
             assertTrue(removedUser1);
 
-            userInfoBeanList = (List<UserInfoBean>) restClientAdmin.listEntity(RestConstants.USERS,
+            userInfoBeanList = (List<UserInfoBean>) restClient.listEntity(RestConstants.USERS,
                     listType, RestConstants.USERS_NAME);
 
             bean1 = null;

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/resources/common/mock-iaas.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/common/mock-iaas.xml b/products/stratos/modules/integration/src/test/resources/common/mock-iaas.xml
index 0f6b206..ab0b0bf 100644
--- a/products/stratos/modules/integration/src/test/resources/common/mock-iaas.xml
+++ b/products/stratos/modules/integration/src/test/resources/common/mock-iaas.xml
@@ -48,13 +48,13 @@
                  stop: stop publishing statistics -->
             <pattern factor="memory-consumption" mode="continue">
                 <!-- Sample values -->
-                <sampleValues>60,70,80,90,90,90,40,60,50,60</sampleValues>
+                <sampleValues>60,60,10,10,10,10,10,10</sampleValues>
                 <!-- Duration of each sample value in seconds -->
                 <sampleDuration>60</sampleDuration>
             </pattern>
             <pattern factor="load-average" mode="continue">
                 <!-- Sample values -->
-                <sampleValues>70,70,70</sampleValues>
+                <sampleValues>60,60,10,10,10,10,10,10</sampleValues>
                 <!-- Duration of each sample value in seconds -->
                 <sampleDuration>60</sampleDuration>
             </pattern>
@@ -79,26 +79,26 @@
                 <sampleDuration>30</sampleDuration>
             </pattern>
         </cartridge>
-        <cartridge type="c3-group-termination-behavior-test">
-            <!-- factor:memory-consumption|load-average|requests-in-flight-->
-            <!-- mode:loop|continue|stop -->
-            <!-- Mode defines the action needs to be taken after the last sample value:
+        <!--<cartridge type="c3-group-termination-behavior-test">
+            &lt;!&ndash; factor:memory-consumption|load-average|requests-in-flight&ndash;&gt;
+            &lt;!&ndash; mode:loop|continue|stop &ndash;&gt;
+            &lt;!&ndash; Mode defines the action needs to be taken after the last sample value:
                  loop: start from beginning
                  continue: continue the last sample value
-                 stop: stop publishing statistics -->
+                 stop: stop publishing statistics &ndash;&gt;
             <pattern factor="memory-consumption" mode="stop">
-                <!-- Sample values -->
-                <sampleValues>20,20,20</sampleValues>
-                <!-- Duration of each sample value in seconds -->
+                &lt;!&ndash; Sample values &ndash;&gt;
+                <sampleValues>20,20,20,</sampleValues>
+                &lt;!&ndash; Duration of each sample value in seconds &ndash;&gt;
                 <sampleDuration>60</sampleDuration>
             </pattern>
             <pattern factor="load-average" mode="stop">
-                <!-- Sample values -->
+                &lt;!&ndash; Sample values &ndash;&gt;
                 <sampleValues>20,20,20</sampleValues>
-                <!-- Duration of each sample value in seconds -->
+                &lt;!&ndash; Duration of each sample value in seconds &ndash;&gt;
                 <sampleDuration>60</sampleDuration>
             </pattern>
-        </cartridge>
+        </cartridge>-->
         <cartridge type="php">
             <!-- factor:memory-consumption|load-average|requests-in-flight-->
             <!-- mode:loop|continue|stop -->
@@ -120,4 +120,4 @@
             </pattern>
         </cartridge>
     </health-statistics>
-</mock-iaas>
\ No newline at end of file
+</mock-iaas>

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/resources/group-startup-order-test/application-policies/application-policy-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/application-policies/application-policy-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/group-startup-order-test/application-policies/application-policy-application-bursting-test.json
deleted file mode 100644
index 7bc9c2d..0000000
--- a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/application-policies/application-policy-application-bursting-test.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-    "id": "application-policy-group-startup-order-test",
-    "algorithm": "one-after-another",
-    "networkPartitions": [
-        "network-partition-group-startup-order-test-1",
-        "network-partition-group-startup-order-test-2"
-    ],
-    "properties": [
-        {
-            "name": "networkPartitionGroups",
-            "value": "network-partition-group-startup-order-test-1|network-partition-group-startup-order-test-2"
-        },
-        {
-            "name": "key-2",
-            "value": "value-2"
-        }
-    ]
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/resources/group-startup-order-test/applications/app-bursting-single-cartriddge-group.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/applications/app-bursting-single-cartriddge-group.json b/products/stratos/modules/integration/src/test/resources/group-startup-order-test/applications/app-bursting-single-cartriddge-group.json
deleted file mode 100644
index db04c61..0000000
--- a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/applications/app-bursting-single-cartriddge-group.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-    "applicationId": "group-startup-order-test",
-    "alias": "my-cartridge-group-app",
-    "components": {
-        "groups": [
-            {
-                "name": "esb-php-group-group-startup-order-test",
-                "alias": "my-esb-php-group-group-startup-order-test",
-                "deploymentPolicy": "deployment-policy-group-startup-order-test",
-                "groupMinInstances": 1,
-                "groupMaxInstances": 2,
-                "cartridges": [
-                    {
-                        "type": "esb-group-startup-order-test",
-                        "cartridgeMin": 1,
-                        "cartridgeMax": 2,
-                        "subscribableInfo": {
-                            "alias": "my-esb-group-startup-order-test",
-                            "autoscalingPolicy": "autoscaling-policy-group-startup-order-test",
-                            "artifactRepository": {
-                                "privateRepo": false,
-                                "repoUrl": "https://github.com/imesh/stratos-esb-applications.git",
-                                "repoUsername": "",
-                                "repoPassword": ""
-                            }
-                        }
-                    },
-                    {
-                        "type": "php-group-startup-order-test",
-                        "cartridgeMin": 2,
-                        "cartridgeMax": 4,
-                        "lvsVirtualIP": "192.168.56.50|255.255.255.0",
-                        "subscribableInfo": {
-                            "alias": "my-php-group-startup-order-test",
-                            "autoscalingPolicy": "autoscaling-policy-group-startup-order-test",
-                            "artifactRepository": {
-                                "privateRepo": false,
-                                "repoUrl": "https://github.com/imesh/stratos-php-applications.git",
-                                "repoUsername": "",
-                                "repoPassword": ""
-                            }
-                        }
-                    }
-                ]
-            }
-        ],
-        "cartridges": [
-            {
-                "type": "tomcat-group-startup-order-test",
-                "cartridgeMin": 2,
-                "cartridgeMax": 4,
-                "subscribableInfo": {
-                    "alias": "my-tomcat-group-startup-order-test",
-                    "autoscalingPolicy": "autoscaling-policy-group-startup-order-test",
-                    "deploymentPolicy": "deployment-policy-group-startup-order-test",
-                    "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/4b864473/products/stratos/modules/integration/src/test/resources/group-startup-order-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/group-startup-order-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json
deleted file mode 100644
index 0c6ec97..0000000
--- a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-    "id": "autoscaling-policy-group-startup-order-test",
-    "loadThresholds": {
-        "requestsInFlight": {
-            "threshold": 35
-        },
-        "memoryConsumption": {
-            "threshold": 45
-        },
-        "loadAverage": {
-            "threshold": 25
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges-groups/esb-php-group-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges-groups/esb-php-group-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges-groups/esb-php-group-application-bursting-test.json
deleted file mode 100644
index 9c7d997..0000000
--- a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges-groups/esb-php-group-application-bursting-test.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-    "name": "esb-php-group-group-startup-order-test",
-    "cartridges": [
-        "esb-group-startup-order-test",
-        "php-group-startup-order-test"
-    ],
-    "dependencies": {
-        "startupOrders": [
-            {
-                "aliases": [
-                    "cartridge.my-esb-group-startup-order-test",
-                    "cartridge.my-php-group-startup-order-test"
-                ]
-            }
-        ],
-        "terminationBehaviour": "terminate-none"
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges/mock/esb-application-bursting-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges/mock/esb-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges/mock/esb-application-bursting-test.json
deleted file mode 100755
index b6f428e..0000000
--- a/products/stratos/modules/integration/src/test/resources/group-startup-order-test/cartridges/mock/esb-application-bursting-test.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
-    "type": "esb-group-startup-order-test",
-    "provider": "apache",
-    "host": "stratos.apache.org",
-    "category": "framework",
-    "displayName": "esb-group-startup-order-test",
-    "description": "esb-group-startup-order-test Cartridge",
-    "version": "7",
-    "multiTenant": "false",
-    "portMapping": [
-        {
-            "name": "http-22",
-            "protocol": "http",
-            "port": "22",
-            "proxyPort": "8280"
-        }
-    ],
-    "deployment": {
-    },
-    "iaasProvider": [
-        {
-            "type": "mock",
-            "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e",
-            "networkInterfaces": [
-                {
-                    "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e"
-                }
-            ],
-            "property": [
-                {
-                    "name": "instanceType",
-                    "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594"
-                },
-                {
-                    "name": "keyPair",
-                    "value": "vishanth-key"
-                },
-                {
-                    "name": "securityGroups",
-                    "value": "default"
-                }
-            ]
-        }
-    ],
-    "metadataKeys": [
-        "server_ip",
-        "username",
-        "password"
-    ]
-}