http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/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
deleted file mode 100644
index 656abc5..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.integration.tests.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;
-import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
-import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
-import org.apache.stratos.integration.tests.RestConstants;
-import org.apache.stratos.integration.tests.StratosTestServerManager;
-import org.testng.annotations.Test;
-
-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
- */
-public class ApplicationPolicyTest extends StratosTestServerManager {
-    private static final Log log = 
LogFactory.getLog(ApplicationPolicyTest.class);
-    private static final String RESOURCES_PATH = "/application-policy-test";
-
-
-    @Test
-    public void testApplicationPolicy() {
-        try {
-            String applicationPolicyId = 
"application-policy-application-policy-test";
-            log.info("-------------------------Started Application policy 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 + "/" +
-                            applicationPolicyId + ".json",
-                    RestConstants.APPLICATION_POLICIES, 
RestConstants.APPLICATION_POLICIES_NAME);
-            assertTrue(addedDep);
-
-            ApplicationPolicyBean bean = (ApplicationPolicyBean) restClient.
-                    getEntity(RestConstants.APPLICATION_POLICIES, 
applicationPolicyId,
-                            ApplicationPolicyBean.class, 
RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(bean.getId(), applicationPolicyId);
-            assertEquals(String.format("The expected algorithm %s is not found 
in %s",
-                    "one-after-another", applicationPolicyId), 
bean.getAlgorithm(), "one-after-another");
-            assertEquals(String.format("The expected id %s is not found",
-                    applicationPolicyId), bean.getId(), applicationPolicyId);
-            assertEquals(String.format("The expected networkpartitions size %s 
is not found in %s",
-                    2, applicationPolicyId), 
bean.getNetworkPartitions().length, 2);
-            assertEquals(String.format("The first network partition is not %s 
in %s",
-                            "network-partition-application-policy-test-1", 
applicationPolicyId), bean.getNetworkPartitions()[0],
-                    "network-partition-application-policy-test-1");
-            assertEquals(String.format("The Second network partition is not %s 
in %s",
-                            "network-partition-application-policy-test-2", 
applicationPolicyId), bean.getNetworkPartitions()[1],
-                    "network-partition-application-policy-test-2");
-            boolean algoFound = false;
-            for (PropertyBean propertyBean : bean.getProperties()) {
-                if (propertyBean.getName().equals("networkPartitionGroups")) {
-                    assertEquals(String.format("The networkPartitionGroups 
algorithm %s is not found in %s",
-                                    
"network-partition-application-policy-test-1,network-partition-application-policy-test-2",
 applicationPolicyId),
-                            propertyBean.getValue(), 
"network-partition-application-policy-test-1,network-partition-application-policy-test-2");
-                    algoFound = true;
-
-                }
-            }
-            if (!algoFound) {
-                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
-            assertFalse(removedNet);
-
-            boolean removedDep = 
restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
-                    applicationPolicyId, 
RestConstants.APPLICATION_POLICIES_NAME);
-            assertTrue(removedDep);
-
-            ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) 
restClient.
-                    getEntity(RestConstants.APPLICATION_POLICIES, 
applicationPolicyId,
-                            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);
-            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);
-            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);
-            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);
-            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);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/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
deleted file mode 100644
index a615d98..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests.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;
-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.*;
-
-/**
- * Test to handle autoscaling policy CRUD operations
- */
-public class AutoscalingPolicyTest extends StratosTestServerManager {
-    private static final Log log = 
LogFactory.getLog(AutoscalingPolicyTest.class);
-    private static final String RESOURCES_PATH = "/autoscaling-policy-test";
-
-
-    @Test
-    public void testAutoscalingPolicy() {
-        log.info("-------------------------Started autoscaling policy test 
case-------------------------");
-        String policyId = "autoscaling-policy-autoscaling-policy-test";
-        try {
-            boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json",
-                    RestConstants.AUTOSCALING_POLICIES, 
RestConstants.AUTOSCALING_POLICIES_NAME);
-
-            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);
-
-            assertEquals(String.format("[autoscaling-policy-id] %s is not 
correct", bean.getId()),
-                    bean.getId(), policyId);
-            assertEquals(String.format("[autoscaling-policy-id] %s RIF is not 
correct", policyId),
-                    
bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 35.0, 0.0);
-            assertEquals(String.format("[autoscaling-policy-id] %s Memory is 
not correct", policyId),
-                    
bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 45.0, 0.0);
-            assertEquals(String.format("[autoscaling-policy-id] %s Load is not 
correct", policyId),
-                    bean.getLoadThresholds().getLoadAverage().getThreshold(), 
25.0, 0.0);
-
-            boolean updated = restClient.updateEntity(RESOURCES_PATH + 
RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
-                    RestConstants.AUTOSCALING_POLICIES, 
RestConstants.AUTOSCALING_POLICIES_NAME);
-
-            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),
-                    
updatedBean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 
0.0);
-            assertEquals(String.format("[autoscaling-policy-id] %s Load is not 
correct", policyId),
-                    
updatedBean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 
0.0);
-            assertEquals(String.format("[autoscaling-policy-id] %s Memory is 
not correct", policyId),
-                    
updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
-
-            boolean removed = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                    policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
-            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);
-            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);
-            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);
-            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/395be450/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
deleted file mode 100644
index 34e398b..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.integration.tests.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.NetworkPartitionReferenceBean;
-import org.apache.stratos.common.beans.partition.PartitionReferenceBean;
-import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
-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.*;
-
-/**
- * Test to handle Deployment policy CRUD operations
- */
-public class DeploymentPolicyTest extends StratosTestServerManager {
-    private static final Log log = 
LogFactory.getLog(DeploymentPolicyTest.class);
-    private static final String RESOURCES_PATH = "/deployment-policy-test";
-
-
-    @Test
-    public void testDeploymentPolicy() {
-        try {
-            String deploymentPolicyId = 
"deployment-policy-deployment-policy-test";
-            log.info("-------------------------Started deployment policy 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 + "/" +
-                            deploymentPolicyId + ".json",
-                    RestConstants.DEPLOYMENT_POLICIES, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertTrue(addedDep);
-
-            DeploymentPolicyBean bean = (DeploymentPolicyBean) restClient.
-                    getEntity(RestConstants.DEPLOYMENT_POLICIES, 
deploymentPolicyId,
-                            DeploymentPolicyBean.class, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
-
-            NetworkPartitionReferenceBean nw1 = 
bean.getNetworkPartitions().get(0);
-            NetworkPartitionReferenceBean nw2 = 
bean.getNetworkPartitions().get(1);
-            PartitionReferenceBean nw1P1 = nw1.getPartitions().get(0);
-            PartitionReferenceBean nw2P1 = nw2.getPartitions().get(0);
-            PartitionReferenceBean nw2P2 = nw2.getPartitions().get(1);
-
-            assertEquals(bean.getId(), 
"deployment-policy-deployment-policy-test");
-            assertEquals(bean.getNetworkPartitions().size(), 2);
-            assertEquals(nw1.getId(), 
"network-partition-deployment-policy-test-1");
-            assertEquals(nw1.getPartitionAlgo(), "one-after-another");
-            assertEquals(nw1.getPartitions().size(), 1);
-            assertEquals(nw1P1.getId(), "partition-1");
-            assertEquals(nw1P1.getPartitionMax(), 20);
-
-            assertEquals(nw2.getId(), 
"network-partition-deployment-policy-test-2");
-            assertEquals(nw2.getPartitionAlgo(), "round-robin");
-            assertEquals(nw2.getPartitions().size(), 2);
-            assertEquals(nw2P1.getId(),
-                    "network-partition-6-partition-1");
-            assertEquals(nw2P1.getPartitionMax(), 10);
-            assertEquals(nw2P2.getId(),
-                    "network-partition-6-partition-2");
-            assertEquals(nw2P2.getPartitionMax(), 9);
-
-            //update network partition
-            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);
-            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);
-            assertTrue(updatedDep);
-
-            DeploymentPolicyBean updatedBean = (DeploymentPolicyBean) 
restClient.
-                    getEntity(RestConstants.DEPLOYMENT_POLICIES, 
deploymentPolicyId,
-                            DeploymentPolicyBean.class, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
-
-            nw1 = updatedBean.getNetworkPartitions().get(0);
-            nw2 = updatedBean.getNetworkPartitions().get(1);
-            nw1P1 = nw1.getPartitions().get(0);
-            PartitionReferenceBean nw1P2 = nw1.getPartitions().get(1);
-            nw2P1 = nw2.getPartitions().get(0);
-            nw2P2 = nw2.getPartitions().get(1);
-
-            assertEquals(updatedBean.getId(), 
"deployment-policy-deployment-policy-test");
-            assertEquals(updatedBean.getNetworkPartitions().size(), 2);
-            assertEquals(nw1.getId(), 
"network-partition-deployment-policy-test-1");
-            assertEquals(nw1.getPartitionAlgo(), "one-after-another");
-            assertEquals(nw1.getPartitions().size(), 2);
-            assertEquals(nw1P1.getId(), "partition-1");
-            assertEquals(nw1P1.getPartitionMax(), 25);
-            assertEquals(nw1P2.getId(), "partition-2");
-            assertEquals(nw1P2.getPartitionMax(), 20);
-
-            assertEquals(nw2.getId(), 
"network-partition-deployment-policy-test-2");
-            assertEquals(nw2.getPartitionAlgo(), "round-robin");
-            assertEquals(nw2.getPartitions().size(), 2);
-            assertEquals(nw2P1.getId(),
-                    "network-partition-6-partition-1");
-            assertEquals(nw2P1.getPartitionMax(), 15);
-            assertEquals(nw2P2.getId(),
-                    "network-partition-6-partition-2");
-            assertEquals(nw2P2.getPartitionMax(), 5);
-
-            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);
-
-            boolean removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                    deploymentPolicyId, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertTrue(removedDep);
-
-            DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) 
restClient.
-                    getEntity(RestConstants.DEPLOYMENT_POLICIES, 
deploymentPolicyId,
-                            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 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);
-            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/395be450/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
deleted file mode 100644
index 6f0f928..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.integration.tests.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.PartitionBean;
-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.*;
-
-/**
- * Test to handle Network partition CRUD operations
- */
-public class NetworkPartitionTest extends StratosTestServerManager {
-    private static final Log log = 
LogFactory.getLog(NetworkPartitionTest.class);
-    private static final String RESOURCES_PATH = "/network-partition-test";
-
-
-    @Test
-    public void testNetworkPartition() {
-        try {
-            String networkPartitionId = 
"network-partition-network-partition-test";
-            log.info("-------------------------Started network partition test 
case-------------------------");
-
-            boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            networkPartitionId + ".json",
-                    RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
-
-            assertTrue(added);
-            NetworkPartitionBean bean = (NetworkPartitionBean) restClient.
-                    getEntity(RestConstants.NETWORK_PARTITIONS, 
networkPartitionId,
-                            NetworkPartitionBean.class, 
RestConstants.NETWORK_PARTITIONS_NAME);
-
-            PartitionBean p1 = bean.getPartitions().get(0);
-            assertEquals(bean.getId(), 
"network-partition-network-partition-test");
-            assertEquals(bean.getPartitions().size(), 1);
-            assertEquals(p1.getId(), "partition-1");
-            assertEquals(p1.getProperty().get(0).getName(), "region");
-            assertEquals(p1.getProperty().get(0).getValue(), "default");
-
-            boolean updated = restClient.updateEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            networkPartitionId + "-v1.json",
-                    RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
-
-            assertTrue(updated);
-            NetworkPartitionBean updatedBean = (NetworkPartitionBean) 
restClient.
-                    getEntity(RestConstants.NETWORK_PARTITIONS, 
networkPartitionId,
-                            NetworkPartitionBean.class, 
RestConstants.NETWORK_PARTITIONS_NAME);
-
-            PartitionBean p2 = updatedBean.getPartitions().get(1);
-            assertEquals(updatedBean.getId(), 
"network-partition-network-partition-test");
-            assertEquals(updatedBean.getPartitions().size(), 2);
-            assertEquals(p2.getId(), "partition-2");
-            assertEquals(p2.getProperty().get(0).getName(), "region");
-            assertEquals(p2.getProperty().get(0).getValue(), "default1");
-            assertEquals(p2.getProperty().get(1).getName(), "zone");
-            assertEquals(p2.getProperty().get(1).getValue(), "z1");
-
-            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(beanRemoved);
-
-            log.info("-------------------------Ended network partition test 
case-------------------------");
-        } catch (Exception e) {
-            log.error("An error occurred while handling network partitions", 
e);
-            assertTrue("An error occurred while handling network partitions", 
false);
-        }
-    }
-
-    @Test
-    public void testNetworkPartitionList() {
-        try {
-            String networkPartitionId1 = 
"network-partition-network-partition-test-1";
-            String networkPartitionId2 = 
"network-partition-network-partition-test-2";
-
-            log.info("-------------------------Started network partition list 
test case-------------------------");
-
-            boolean added = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
-                            networkPartitionId1 + ".json",
-                    RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
-            assertTrue(added);
-
-            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);
-            assertNull(beanRemoved);
-
-            removed = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    networkPartitionId2, 
RestConstants.NETWORK_PARTITIONS_NAME);
-            assertTrue(removed);
-
-            beanRemoved = (NetworkPartitionBean) restClient.
-                    getEntity(RestConstants.NETWORK_PARTITIONS, 
networkPartitionId2,
-                            NetworkPartitionBean.class, 
RestConstants.NETWORK_PARTITIONS_NAME);
-            assertNull(beanRemoved);
-
-            log.info("-------------------------Ended network partition test 
case-------------------------");
-        } catch (Exception e) {
-            log.error("An error occurred while handling network partitions", 
e);
-            assertTrue("An error occurred while handling network partitions", 
false);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java
deleted file mode 100644
index 168713e..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests.rest;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * Error response.
- */
-@XmlRootElement(name = "errorResponse")
-public class ErrorResponse implements Serializable {
-
-    private int errorCode;
-    private String errorMessage;
-
-    public ErrorResponse() {
-    }
-
-    public ErrorResponse(int errorCode, String errorMessage) {
-        this.setErrorCode(errorCode);
-        this.setErrorMessage(errorMessage);
-    }
-
-    public int getErrorCode() {
-        return errorCode;
-    }
-
-    public void setErrorCode(int errorCode) {
-        this.errorCode = errorCode;
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;
-    }
-
-    public void setErrorMessage(String errorMessage) {
-        this.errorMessage = errorMessage;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java
deleted file mode 100644
index 8ac5619..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests.rest;
-
-/**
- * Created by reka on 7/28/15.
- */
-public class HttpResponse {
-
-    private int statusCode;
-    private String content;
-    private String reason;
-
-    public int getStatusCode() {
-        return statusCode;
-    }
-
-    public void setStatusCode(int statusCode) {
-        this.statusCode = statusCode;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    public String getReason() {
-        return reason;
-    }
-
-    public void setReason(String reason) {
-        this.reason = reason;
-    }
-
-    @Override
-    public String toString() {
-        return "HttpResponse [statusCode=" + statusCode + ", content=" + 
content
-                + ", reason=" + reason + "]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java
deleted file mode 100644
index 532fc5e..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests.rest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.HttpEntity;
-import org.apache.http.StatusLine;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.ResponseHandler;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-/**
- * Rest http response handler
- */
-public class HttpResponseHandler implements ResponseHandler<HttpResponse> {
-    private static final Log log = 
LogFactory.getLog(HttpResponseHandler.class);
-
-    @Override
-    public HttpResponse handleResponse(org.apache.http.HttpResponse response) 
throws ClientProtocolException,
-            IOException {
-        StatusLine statusLine = response.getStatusLine();
-        HttpEntity entity = response.getEntity();
-        if (entity == null) {
-            throw new ClientProtocolException("Response contains no content");
-        }
-
-        BufferedReader reader = new BufferedReader(new InputStreamReader(
-                (response.getEntity().getContent())));
-
-        String output;
-        String result = "";
-
-        while ((output = reader.readLine()) != null) {
-            result += output;
-        }
-
-        HttpResponse httpResponse = new HttpResponse();
-        httpResponse.setStatusCode(statusLine.getStatusCode());
-        httpResponse.setContent(result);
-        httpResponse.setReason(statusLine.getReasonPhrase());
-
-        if (log.isDebugEnabled()) {
-            log.debug("Extracted Http Response: " + httpResponse.toString());
-        }
-
-        return httpResponse;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/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
deleted file mode 100644
index 0378509..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests.rest;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpRequestBase;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.PoolingClientConnectionManager;
-import org.apache.stratos.mock.iaas.client.MockIaasApiClient;
-import org.apache.stratos.mock.iaas.client.rest.HttpResponse;
-import org.apache.stratos.mock.iaas.client.rest.HttpResponseHandler;
-
-import java.net.URI;
-
-/**
- * Mock client
- */
-public class IntegrationMockClient extends MockIaasApiClient {
-    private static final Log log = 
LogFactory.getLog(IntegrationMockClient.class);
-    private static final String INSTANCES_CONTEXT = "/instances/";
-    private DefaultHttpClient httpClient;
-    private String endpoint;
-
-    public IntegrationMockClient(String endpoint) {
-        super(endpoint);
-        this.endpoint = endpoint;
-        PoolingClientConnectionManager cm = new 
PoolingClientConnectionManager();
-        // Increase max total connection to 200
-        cm.setMaxTotal(200);
-        // Increase default max connection per route to 50
-        cm.setDefaultMaxPerRoute(50);
-
-        httpClient = new DefaultHttpClient(cm);
-        httpClient = (DefaultHttpClient) 
WebClientWrapper.wrapClient(httpClient);
-    }
-
-    public boolean terminateInstance(String instanceId) {
-        try {
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Terminate instance: [instance-id] 
%s", instanceId));
-            }
-            URI uri = new URIBuilder(endpoint + INSTANCES_CONTEXT + 
instanceId).build();
-            org.apache.stratos.mock.iaas.client.rest.HttpResponse response = 
doDelete(uri);
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    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());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public HttpResponse doDelete(URI resourcePath) throws Exception {
-        HttpDelete httpDelete = null;
-        try {
-            httpDelete = new HttpDelete(resourcePath);
-            httpDelete.addHeader("Content-Type", "application/json");
-
-            return httpClient.execute(httpDelete, new HttpResponseHandler());
-        } finally {
-            releaseConnection(httpDelete);
-        }
-    }
-
-    private void releaseConnection(HttpRequestBase request) {
-        if (request != null) {
-            request.releaseConnection();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/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
deleted file mode 100644
index 9702a31..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests.rest;
-
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonParser;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.methods.*;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.PoolingClientConnectionManager;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.lang.reflect.Type;
-import java.net.URI;
-
-/**
- * Rest client to handle rest requests
- */
-public class RestClient {
-    private static final Log log = LogFactory.getLog(RestClient.class);
-    private DefaultHttpClient httpClient;
-    private String endPoint;
-    private String userName;
-    private String password;
-
-    public RestClient() {
-        PoolingClientConnectionManager cm = new 
PoolingClientConnectionManager();
-        // Increase max total connection to 200
-        cm.setMaxTotal(200);
-        // Increase default max connection per route to 50
-        cm.setDefaultMaxPerRoute(50);
-
-        httpClient = new DefaultHttpClient(cm);
-        httpClient = (DefaultHttpClient) 
WebClientWrapper.wrapClient(httpClient);
-    }
-
-    public RestClient(String endPoint, String userName, String password) {
-        this();
-        this.endPoint = endPoint;
-        this.userName = userName;
-        this.password = password;
-    }
-
-    /**
-     * Handle http post request. Return String
-     *
-     * @param resourcePath    This should be REST endpoint
-     * @param jsonParamString The json string which should be executed from 
the post request
-     * @return The HttpResponse
-     * @throws Exception if any errors occur when executing the request
-     */
-    public HttpResponse doPost(URI resourcePath, String jsonParamString) 
throws Exception {
-        HttpPost postRequest = null;
-        try {
-            postRequest = new HttpPost(resourcePath);
-            StringEntity input = new StringEntity(jsonParamString);
-            input.setContentType("application/json");
-            postRequest.setEntity(input);
-
-            String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
-            postRequest.addHeader("Authorization", basicAuth);
-
-            return httpClient.execute(postRequest, new HttpResponseHandler());
-        } finally {
-            releaseConnection(postRequest);
-        }
-    }
-
-    /**
-     * Handle http get request. Return String
-     *
-     * @param resourcePath This should be REST endpoint
-     * @return The HttpResponse
-     * @throws org.apache.http.client.ClientProtocolException and IOException
-     *                                                        if any errors 
occur when executing the request
-     */
-    public HttpResponse doGet(URI resourcePath) throws Exception {
-        HttpGet getRequest = null;
-        try {
-            getRequest = new HttpGet(resourcePath);
-            getRequest.addHeader("Content-Type", "application/json");
-            String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
-            getRequest.addHeader("Authorization", basicAuth);
-
-            return httpClient.execute(getRequest, new HttpResponseHandler());
-        } finally {
-            releaseConnection(getRequest);
-        }
-    }
-
-    public HttpResponse doDelete(URI resourcePath) throws Exception {
-        HttpDelete httpDelete = null;
-        try {
-            httpDelete = new HttpDelete(resourcePath);
-            httpDelete.addHeader("Content-Type", "application/json");
-            String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
-            httpDelete.addHeader("Authorization", basicAuth);
-            return httpClient.execute(httpDelete, new HttpResponseHandler());
-        } finally {
-            releaseConnection(httpDelete);
-        }
-    }
-
-    public HttpResponse doPut(URI resourcePath, String jsonParamString) throws 
Exception {
-
-        HttpPut putRequest = null;
-        try {
-            putRequest = new HttpPut(resourcePath);
-
-            StringEntity input = new StringEntity(jsonParamString);
-            input.setContentType("application/json");
-            putRequest.setEntity(input);
-            String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
-            putRequest.addHeader("Authorization", basicAuth);
-            return httpClient.execute(putRequest, new HttpResponseHandler());
-        } finally {
-            releaseConnection(putRequest);
-        }
-    }
-
-    private void releaseConnection(HttpRequestBase request) {
-        if (request != null) {
-            request.releaseConnection();
-        }
-    }
-
-    public boolean addEntity(String filePath, String resourcePath, String 
entityName) {
-        try {
-            String content = getJsonStringFromFile(filePath);
-            URI uri = new URIBuilder(this.endPoint + resourcePath).build();
-
-            HttpResponse response = doPost(uri, content);
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = 
gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new 
RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            String msg = "An unknown error occurred while trying to add ";
-            log.error(msg + entityName);
-            throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
-            String message = "Could not add " + entityName;
-            log.error(message, e);
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean deployEntity(String resourcePath, String entityName) {
-        try {
-            URI uri = new URIBuilder(this.endPoint + resourcePath).build();
-
-            HttpResponse response = doPost(uri, "");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = 
gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new 
RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            String msg = "An unknown error occurred while trying to deploy ";
-            log.error(msg + entityName);
-            throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
-            String message = "Could not deploy  " + entityName;
-            log.error(message, e);
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean undeployEntity(String resourcePath, String entityName) {
-        try {
-            URI uri = new URIBuilder(this.endPoint + resourcePath).build();
-
-            HttpResponse response = doPost(uri, "");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = 
gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new 
RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            String msg = "An unknown error occurred while trying to undeploy ";
-            log.error(msg + entityName);
-            throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
-            String message = "Could not deploy  " + entityName;
-            log.error(message, e);
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public Object getEntity(String resourcePath, String identifier, Class 
responseJsonClass,
-                            String entityName) {
-        try {
-            URI uri = new URIBuilder(this.endPoint + resourcePath + "/" + 
identifier).build();
-            HttpResponse response = doGet(uri);
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), 
responseJsonClass);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = 
gson.fromJson(response.getContent(),
-                            ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new 
RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            String msg = "An unknown error occurred while getting the " + 
entityName;
-            log.error(msg);
-            throw new RuntimeException(msg);
-        } catch (Exception e) {
-            String message = "Could not get " + entityName;
-            log.error(message, e);
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public Object listEntity(String resourcePath, Type type, String 
entityName) {
-        try {
-            URI uri = new URIBuilder(this.endPoint + resourcePath).build();
-            HttpResponse response = doGet(uri);
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), type);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = 
gson.fromJson(response.getContent(),
-                            ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new 
RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            String msg = "An unknown error occurred while getting the " + 
entityName;
-            log.error(msg);
-            throw new RuntimeException(msg);
-        } catch (Exception e) {
-            String message = "Could not get " + entityName;
-            log.error(message, e);
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeEntity(String resourcePath, String identifier, String 
entityName) {
-        try {
-            URI uri = new URIBuilder(this.endPoint + "/" + resourcePath + "/" 
+ identifier).build();
-            HttpResponse response = doDelete(uri);
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return true;
-                } else if (response.getContent().contains("it is used") || 
response.getContent().contains("in use")) {
-                    return false;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = 
gson.fromJson(response.getContent(),
-                            ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new 
RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            String msg = "An unknown error occurred while removing the " + 
entityName;
-            log.error(msg);
-            throw new RuntimeException(msg);
-        } catch (Exception e) {
-            String message = "Could not remove  " + entityName;
-            log.error(message, e);
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateEntity(String filePath, String resourcePath, String 
entityName) {
-        try {
-            String content = getJsonStringFromFile(filePath);
-            URI uri = new URIBuilder(this.endPoint + resourcePath).build();
-
-            HttpResponse response = doPut(uri, content);
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && 
(response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = 
gson.fromJson(response.getContent(),
-                            ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new 
RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            String msg = "An unknown error occurred while trying to update ";
-            log.error(msg + entityName);
-            throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
-            String message = "Could not update " + entityName;
-            log.error(message, e);
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    /**
-     * Get the json string from the artifacts directory
-     *
-     * @param filePath path of the artifacts
-     * @return json string of the relevant artifact
-     * @throws FileNotFoundException
-     */
-    public String getJsonStringFromFile(String filePath) throws 
FileNotFoundException {
-        JsonParser parser = new JsonParser();
-        Object object = parser.parse(new FileReader(getResourcesFolderPath() + 
filePath));
-        GsonBuilder gsonBuilder = new GsonBuilder();
-        Gson gson = gsonBuilder.create();
-        return gson.toJson(object);
-    }
-
-    /**
-     * Get resources folder path
-     *
-     * @return the resource path
-     */
-    private String getResourcesFolderPath() {
-        String path = getClass().getResource("/").getPath();
-        return StringUtils.removeEnd(path, File.separator);
-    }
-
-    /**
-     * Get the username and password
-     *
-     * @return username:password
-     */
-    private String getUsernamePassword() {
-        return this.userName + ":" + this.password;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java
deleted file mode 100644
index 848f4f2..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests.rest;
-
-import org.apache.http.client.HttpClient;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.client.DefaultHttpClient;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-
-public class WebClientWrapper {
-    public static HttpClient wrapClient(HttpClient base) {
-        try {
-            SSLContext ctx = SSLContext.getInstance("TLS");
-            X509TrustManager tm = new X509TrustManager() {
-                public void checkClientTrusted(X509Certificate[] xcs,
-                                               String string) throws 
CertificateException {
-                }
-
-                public void checkServerTrusted(X509Certificate[] xcs,
-                                               String string) throws 
CertificateException {
-                }
-
-                public X509Certificate[] getAcceptedIssuers() {
-                    return null;
-                }
-            };
-            ctx.init(null, new TrustManager[]{tm}, null);
-            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
-            
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
-            ClientConnectionManager ccm = base.getConnectionManager();
-            SchemeRegistry sr = ccm.getSchemeRegistry();
-            sr.register(new Scheme("https", ssf, 443));
-            return new DefaultHttpClient(ccm, base.getParams());
-        } catch (Exception ex) {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/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
deleted file mode 100644
index 437b162..0000000
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.integration.tests.users;
-
-import org.apache.stratos.integration.tests.RestConstants;
-import org.apache.stratos.integration.tests.StratosTestServerManager;
-import org.testng.annotations.Test;
-
-import static junit.framework.Assert.assertTrue;
-
-/**
- * Handling users
- */
-public class TenantTest extends StratosTestServerManager {
-    private static final String RESOURCES_PATH = "/user-test";
-
-
-    @Test
-    public void addUser() {
-        String tenantId = "tenant-1";
-        boolean addedUser1 = restClient.addEntity(RESOURCES_PATH + "/" +
-                        tenantId + ".json",
-                RestConstants.USERS, RestConstants.USERS_NAME);
-        assertTrue(addedUser1);
-
-    }
-}

Reply via email to