You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2015/08/14 12:59:20 UTC

[2/4] stratos git commit: adding list operation to application, cartridge, and all other policies

adding list operation to application, cartridge, and all other policies


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/121f118f
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/121f118f
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/121f118f

Branch: refs/heads/master
Commit: 121f118f4dfd9b5da4d3b770c882355488a18763
Parents: 512280a
Author: reka <rt...@gmail.com>
Authored: Fri Aug 14 15:34:21 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Fri Aug 14 15:38:08 2015 +0530

----------------------------------------------------------------------
 .../application/SampleApplicationsTest.java     | 174 ++++++++++++++++++-
 .../integration/tests/group/CartridgeTest.java  |  18 +-
 .../tests/policies/ApplicationPolicyTest.java   | 132 ++++++++++++--
 .../tests/policies/AutoscalingPolicyTest.java   |  95 +++++++++-
 .../tests/policies/DeploymentPolicyTest.java    | 145 ++++++++++++++--
 ...cation-policy-application-policy-test-1.json |  18 ++
 ...cation-policy-application-policy-test-2.json |  18 ++
 ...caling-policy-autoscaling-policy-test-1.json |  14 ++
 ...caling-policy-autoscaling-policy-test-2.json |  14 ++
 ...loyment-policy-deployment-policy-test-1.json |  32 ++++
 ...loyment-policy-deployment-policy-test-2.json |  32 ++++
 .../sample-applications-test-1.json             |  86 +++++++++
 .../sample-applications-test-2.json             |  86 +++++++++
 .../src/test/resources/stratos-testing.xml      |  12 +-
 14 files changed, 814 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTest.java
index 4ca3632..0de17e1 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationsTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.stratos.integration.tests.application;
 
+import com.google.gson.reflect.TypeToken;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.common.beans.application.ApplicationBean;
@@ -27,12 +28,13 @@ import org.apache.stratos.common.beans.cartridge.CartridgeGroupReferenceBean;
 import org.apache.stratos.common.beans.cartridge.CartridgeReferenceBean;
 import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
-import org.apache.stratos.messaging.domain.application.Group;
 import org.testng.annotations.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.Assert.*;
 
 /**
  * Sample application tests with application add, .
@@ -201,7 +203,167 @@ public class SampleApplicationsTest extends StratosTestServerManager {
 
             ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-sample-applications-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
-            assertEquals(beanRemoved, null);
+            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);
+            assertEquals(removedC1, 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);
+
+            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);
+
+            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(String.format("[Network partition] network-partition-sample-applications-test-2 " +
+                    "could not be removed for [application] g-sc-G123-1-sample-applications-test"), removedN2, true);
+
+            log.info("-------------------------------Ended application test case-------------------------------");
+
+        } catch (Exception e) {
+            log.error("An error occurred while handling application test case", e);
+            assertTrue("An error occurred while handling application test case", false);
+        }
+    }
+
+    @Test
+    public void testApplicationList() {
+        log.info("-------------------------------Started application listtest case-------------------------------");
+        try {
+            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 +
+                            "/" + "cartrdige-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);
+            assertEquals(applicationList.size(), 2);
+
+            ApplicationBean bean1 = null;
+            for (ApplicationBean applicationBean : applicationList) {
+                if (applicationBean.getApplicationId().equals(app1)) {
+                    bean1 = applicationBean;
+                }
+            }
+            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);
+
+            ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+                    app1, ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+            assertNull(beanRemoved);
+
+            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);
+            assertFalse(removedAuto);
+
+            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);
+            assertFalse(removedDep);
+
+            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);
 
             removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-sample-applications-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
@@ -234,7 +396,7 @@ public class SampleApplicationsTest extends StratosTestServerManager {
             boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-sample-applications-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(String.format("[Network partition] network-partition-sample-applications-test-2 " +
-                    "could not be removed for [application] g-sc-G123-1-sample-applications-test"),removedN2, true);
+                    "could not be removed for [application] g-sc-G123-1-sample-applications-test"), removedN2, true);
 
             log.info("-------------------------------Ended application test case-------------------------------");
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/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 7b413c1..891b3f2 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
@@ -51,7 +51,7 @@ public class CartridgeTest extends StratosTestServerManager {
             boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
                             cartridgeType + ".json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(added, true);
+            assertTrue(added);
             CartridgeBean bean = (CartridgeBean) restClient.
                     getEntity(RestConstants.CARTRIDGES, cartridgeType,
                             CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
@@ -85,7 +85,7 @@ public class CartridgeTest extends StratosTestServerManager {
             boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
                             cartridgeType + "-v1.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(updated, true);
+            assertTrue(updated);
             CartridgeBean updatedBean = (CartridgeBean) restClient.
                     getEntity(RestConstants.CARTRIDGES, cartridgeType,
                             CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
@@ -118,12 +118,12 @@ public class CartridgeTest extends StratosTestServerManager {
 
             boolean removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType,
                     RestConstants.CARTRIDGES_NAME);
-            assertEquals(removed, true);
+            assertTrue(removed);
 
             CartridgeBean beanRemoved = (CartridgeBean) restClient.
                     getEntity(RestConstants.CARTRIDGES, cartridgeType,
                             CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
-            assertEquals(beanRemoved, null);
+            assertNull(beanRemoved);
 
             log.info("---------------------------Ended Cartridge test case-------------------------");
         } catch (Exception e) {
@@ -142,12 +142,12 @@ public class CartridgeTest extends StratosTestServerManager {
             boolean added1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
                             cartridgeType1 + ".json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(added1, true);
+            assertTrue(added1);
 
             boolean added2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
                             cartridgeType2 + ".json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
-            assertEquals(added2, true);
+            assertTrue(added2);
 
             Type listType = new TypeToken<ArrayList<CartridgeBean>>() {
             }.getType();
@@ -174,7 +174,7 @@ public class CartridgeTest extends StratosTestServerManager {
 
             boolean removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType1,
                     RestConstants.CARTRIDGES_NAME);
-            assertEquals(removed, true);
+            assertTrue(removed);
 
             CartridgeBean beanRemoved = (CartridgeBean) restClient.
                     getEntity(RestConstants.CARTRIDGES, cartridgeType1,
@@ -183,12 +183,12 @@ public class CartridgeTest extends StratosTestServerManager {
 
             removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType2,
                     RestConstants.CARTRIDGES_NAME);
-            assertEquals(removed, true);
+            assertTrue(removed);
 
             beanRemoved = (CartridgeBean) restClient.
                     getEntity(RestConstants.CARTRIDGES, cartridgeType2,
                             CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
-            assertEquals(beanRemoved, null);
+            assertNull(beanRemoved);
 
             log.info("---------------------------Ended Cartridge list test case-------------------------");
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/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 bced0ff..98ffae1 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,8 +29,11 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle Network partition CRUD operations
@@ -48,17 +52,17 @@ public class ApplicationPolicyTest extends StratosTestServerManager {
             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 = 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 = 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) restClient.
                     getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
@@ -87,41 +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));
             }
 
             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 = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
                     applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(removedDep, true);
+            assertTrue(removedDep);
 
             ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClient.
                     getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
                             ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(beanRemovedDep, null);
+            assertNull(beanRemovedDep);
+
+            boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(removedN1);
+
+            NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN1);
+
+            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-application-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(removedN2);
+
+            NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2",
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN2);
+
+            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);
+            assertEquals(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);
+            assertNull(beanRemovedDep);
+
+            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);
+
+            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);
+            assertNull(beanRemovedDep);
 
             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) restClient.
                     getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(beanRemovedN1, null);
+            assertNull(beanRemovedN1);
 
             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) 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/121f118f/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 9a164c5..ddded1c 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,8 +26,11 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle autoscaling policy CRUD operations
@@ -44,7 +48,7 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
             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), added, true);
+            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);
@@ -61,7 +65,7 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
             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);
+            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);
@@ -74,18 +78,93 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
 
             boolean removed = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
-                    removed, true);
+            assertTrue(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
+                    removed);
 
             AutoscalePolicyBean beanRemoved = (AutoscalePolicyBean) restClient.getEntity(
                     RestConstants.AUTOSCALING_POLICIES, policyId,
                     AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertEquals(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
-                    policyId), beanRemoved, null);
+            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);
+
+            assertTrue(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s",
+                    policyId1), added);
+
+            added = restClient.addEntity(RESOURCES_PATH +
+                            RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId2 + ".json",
+                    RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+
+            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);
+            assertEquals(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);
+            assertNull(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
+                    policyId1), beanRemoved);
+
+            removed = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                    policyId2, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertTrue(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId2),
+                    removed);
+
+            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] list", e);
+            assertTrue("An error occurred while handling [autoscaling policy] list", false);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/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 4401443..6cc0101 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,8 +29,11 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle Deployment policy CRUD operations
@@ -49,17 +52,17 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
             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 = 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 = 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) restClient.
                     getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
@@ -93,13 +96,13 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
             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 = 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) restClient.
                     getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
@@ -135,34 +138,34 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
             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 = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(removedDep, true);
+            assertTrue(removedDep);
 
             DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClient.
                     getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
                             DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(beanRemovedDep, null);
+            assertNull(beanRemovedDep);
 
             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) restClient.
+            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 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, true);
+            assertTrue(removedN2);
 
-            NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
+            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-------------------------");
 
@@ -171,4 +174,108 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
             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);
+            assertEquals(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);
+            assertNull(beanRemovedDep);
+
+            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);
+
+            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);
+            assertNull(beanRemovedDep);
+
+            boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(removedN1);
+
+            DeploymentPolicyBean beanRemovedN1 = (DeploymentPolicyBean) restClient.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-1",
+                            DeploymentPolicyBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN1);
+
+            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertTrue(removedN2);
+
+            DeploymentPolicyBean beanRemovedN2 = (DeploymentPolicyBean) restClient.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2",
+                            DeploymentPolicyBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNull(beanRemovedN2);
+
+            log.info("-------------------------Ended deployment policy list test case-------------------------");
+
+        } catch (Exception e) {
+            log.error("An error occurred while handling deployment policy", e);
+            assertTrue("An error occurred while handling deployment policy", false);
+        }
+    }
 }

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

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

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-1.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-1.json
new file mode 100644
index 0000000..d7765b9
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-1.json
@@ -0,0 +1,14 @@
+{
+    "id": "autoscaling-policy-autoscaling-policy-test-1",
+    "loadThresholds": {
+        "requestsInFlight": {
+            "threshold": 35
+        },
+        "memoryConsumption": {
+            "threshold": 45
+        },
+        "loadAverage": {
+            "threshold": 25
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-2.json b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-2.json
new file mode 100644
index 0000000..03f3a01
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/autoscaling-policy-test/autoscaling-policies/autoscaling-policy-autoscaling-policy-test-2.json
@@ -0,0 +1,14 @@
+{
+    "id": "autoscaling-policy-autoscaling-policy-test-2",
+    "loadThresholds": {
+        "requestsInFlight": {
+            "threshold": 35
+        },
+        "memoryConsumption": {
+            "threshold": 45
+        },
+        "loadAverage": {
+            "threshold": 25
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-1.json b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-1.json
new file mode 100644
index 0000000..edab5bd
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-1.json
@@ -0,0 +1,32 @@
+{
+    "id": "deployment-policy-deployment-policy-test-1",
+    "networkPartitions": [
+        {
+            "id": "network-partition-deployment-policy-test-1",
+            "partitionAlgo": "one-after-another",
+            "partitions": [
+                {
+                    "id": "partition-1",
+                    "partitionMax": 20
+                }
+            ]
+        },
+        {
+            "id": "network-partition-deployment-policy-test-2",
+            "partitionAlgo": "round-robin",
+            "partitions": [
+                {
+                    "id": "network-partition-6-partition-1",
+                    "partitionMax": 10
+                },
+                {
+                    "id": "network-partition-6-partition-2",
+                    "partitionMax": 9
+                }
+            ]
+        }
+    ]
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-2.json b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-2.json
new file mode 100644
index 0000000..18cb31c
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/deployment-policy-test/deployment-policies/deployment-policy-deployment-policy-test-2.json
@@ -0,0 +1,32 @@
+{
+    "id": "deployment-policy-deployment-policy-test-2",
+    "networkPartitions": [
+        {
+            "id": "network-partition-deployment-policy-test-1",
+            "partitionAlgo": "one-after-another",
+            "partitions": [
+                {
+                    "id": "partition-1",
+                    "partitionMax": 20
+                }
+            ]
+        },
+        {
+            "id": "network-partition-deployment-policy-test-2",
+            "partitionAlgo": "round-robin",
+            "partitions": [
+                {
+                    "id": "network-partition-6-partition-1",
+                    "partitionMax": 10
+                },
+                {
+                    "id": "network-partition-6-partition-2",
+                    "partitionMax": 9
+                }
+            ]
+        }
+    ]
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-1.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-1.json
new file mode 100644
index 0000000..532bee6
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-1.json
@@ -0,0 +1,86 @@
+{
+    "alias": "sample-applications-test-1",
+    "applicationId": "sample-applications-test-1",
+    "components": {
+        "cartridges": [],
+        "groups": [
+            {
+                "name": "G1-sample-applications-test",
+                "groupMaxInstances": 1,
+                "groupMinInstances": 1,
+                "alias": "group1-sample-applications-test",
+                "cartridges": [
+                    {
+                        "cartridgeMin": 1,
+                        "cartridgeMax": 2,
+                        "type": "c1-sample-applications-test",
+                        "subscribableInfo": {
+                            "alias": "c1-1x0-sample-applications-test",
+                            "deploymentPolicy": "deployment-policy-sample-applications-test",
+                            "artifactRepository": {
+                                "repoUsername": "user",
+                                "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+                                "privateRepo": true,
+                                "repoPassword": "c-policy"
+                            },
+                            "autoscalingPolicy": "autoscaling-policy-sample-applications-test"
+                        }
+                    }
+                ],
+                "groups": [
+                    {
+                        "name": "G2-sample-applications-test",
+                        "groupMaxInstances": 1,
+                        "groupMinInstances": 1,
+                        "alias": "group2-sample-applications-test",
+                        "cartridges": [
+                            {
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "type": "c2-sample-applications-test",
+                                "subscribableInfo": {
+                                    "alias": "c2-1x0-sample-applications-test",
+                                    "deploymentPolicy": "deployment-policy-sample-applications-test",
+                                    "artifactRepository": {
+                                        "repoUsername": "user",
+                                        "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+                                        "privateRepo": true,
+                                        "repoPassword": "c-policy"
+                                    },
+                                    "autoscalingPolicy": "autoscaling-policy-sample-applications-test"
+                                }
+                            }
+                        ],
+                        "groups": [
+                            {
+                                "name": "G3-sample-applications-test",
+                                "groupMaxInstances": 2,
+                                "groupMinInstances": 1,
+                                "deploymentPolicy": "deployment-policy-sample-applications-test",
+                                "alias": "group3-sample-applications-test",
+                                "cartridges": [
+                                    {
+                                        "cartridgeMin": 1,
+                                        "cartridgeMax": 2,
+                                        "type": "c3-sample-applications-test",
+                                        "subscribableInfo": {
+                                            "alias": "c3-1x0-sample-applications-test",
+                                            "artifactRepository": {
+                                                "repoUsername": "user",
+                                                "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+                                                "privateRepo": true,
+                                                "repoPassword": "c-policy"
+                                            },
+                                            "autoscalingPolicy": "autoscaling-policy-sample-applications-test"
+                                        }
+                                    }
+                                ],
+                                "groups": []
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-2.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-2.json b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-2.json
new file mode 100644
index 0000000..6427d7e
--- /dev/null
+++ b/products/stratos/modules/integration/src/test/resources/sample-applications-test/applications/sample-applications-test-2.json
@@ -0,0 +1,86 @@
+{
+    "alias": "sample-applications-test-2",
+    "applicationId": "sample-applications-test-2",
+    "components": {
+        "cartridges": [],
+        "groups": [
+            {
+                "name": "G1-sample-applications-test",
+                "groupMaxInstances": 1,
+                "groupMinInstances": 1,
+                "alias": "group1-sample-applications-test",
+                "cartridges": [
+                    {
+                        "cartridgeMin": 1,
+                        "cartridgeMax": 2,
+                        "type": "c1-sample-applications-test",
+                        "subscribableInfo": {
+                            "alias": "c1-1x0-sample-applications-test",
+                            "deploymentPolicy": "deployment-policy-sample-applications-test",
+                            "artifactRepository": {
+                                "repoUsername": "user",
+                                "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+                                "privateRepo": true,
+                                "repoPassword": "c-policy"
+                            },
+                            "autoscalingPolicy": "autoscaling-policy-sample-applications-test"
+                        }
+                    }
+                ],
+                "groups": [
+                    {
+                        "name": "G2-sample-applications-test",
+                        "groupMaxInstances": 1,
+                        "groupMinInstances": 1,
+                        "alias": "group2-sample-applications-test",
+                        "cartridges": [
+                            {
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "type": "c2-sample-applications-test",
+                                "subscribableInfo": {
+                                    "alias": "c2-1x0-sample-applications-test",
+                                    "deploymentPolicy": "deployment-policy-sample-applications-test",
+                                    "artifactRepository": {
+                                        "repoUsername": "user",
+                                        "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+                                        "privateRepo": true,
+                                        "repoPassword": "c-policy"
+                                    },
+                                    "autoscalingPolicy": "autoscaling-policy-sample-applications-test"
+                                }
+                            }
+                        ],
+                        "groups": [
+                            {
+                                "name": "G3-sample-applications-test",
+                                "groupMaxInstances": 2,
+                                "groupMinInstances": 1,
+                                "deploymentPolicy": "deployment-policy-sample-applications-test",
+                                "alias": "group3-sample-applications-test",
+                                "cartridges": [
+                                    {
+                                        "cartridgeMin": 1,
+                                        "cartridgeMax": 2,
+                                        "type": "c3-sample-applications-test",
+                                        "subscribableInfo": {
+                                            "alias": "c3-1x0-sample-applications-test",
+                                            "artifactRepository": {
+                                                "repoUsername": "user",
+                                                "repoUrl": "http://stratos.apache.org:10080/git/default.git",
+                                                "privateRepo": true,
+                                                "repoPassword": "c-policy"
+                                            },
+                                            "autoscalingPolicy": "autoscaling-policy-sample-applications-test"
+                                        }
+                                    }
+                                ],
+                                "groups": []
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/121f118f/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
index da48aa8..3f66b6b 100644
--- a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
+++ b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
@@ -21,22 +21,22 @@
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
 
 <suite name="StratosIntegrationSuite">
-   <!-- <test name="CartridgeTest">
+    <test name="CartridgeTest">
         <classes>
             <class name="org.apache.stratos.integration.tests.group.CartridgeTest" />
         </classes>
-    </test>-->
-    <!--<test name="CartridgeGroupTest" >
+    </test>
+    <test name="CartridgeGroupTest" >
         <classes>
             <class name="org.apache.stratos.integration.tests.group.CartridgeGroupTest" />
         </classes>
-    </test>-->
+    </test>
     <test name="NetworkPartitionTest">
         <classes>
             <class name="org.apache.stratos.integration.tests.policies.NetworkPartitionTest" />
         </classes>
     </test>
-    <!--<test name="ApplicationPolicyTest">
+    <test name="ApplicationPolicyTest">
         <classes>
             <class name="org.apache.stratos.integration.tests.policies.ApplicationPolicyTest" />
         </classes>
@@ -80,5 +80,5 @@
         <classes>
             <class name="org.apache.stratos.integration.tests.application.GroupTerminationBehaviorTest" />
         </classes>
-    </test>-->
+    </test>
 </suite>