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

[3/3] stratos git commit: Update integration test with tenants

Update integration test with tenants


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

Branch: refs/heads/tenant-isolation
Commit: aa0f22b526187beb132a8ccd85d7ad59bb8195bc
Parents: a55f20f
Author: Gayan Gunarathne <ga...@wso2.com>
Authored: Fri Aug 14 00:17:14 2015 +0530
Committer: Gayan Gunarathne <ga...@wso2.com>
Committed: Fri Aug 14 00:17:14 2015 +0530

----------------------------------------------------------------------
 .../tests/StratosTestServerManager.java         |  8 +--
 .../application/ApplicationBurstingTest.java    | 66 +++++++++---------
 .../application/ApplicationUpdateTest.java      | 70 ++++++++++----------
 .../application/GroupStartupOrderTest.java      | 66 +++++++++---------
 .../PartitionOneAfterAnotherClusterTest.java    | 44 ++++++------
 .../PartitionRoundRobinClusterTest.java         | 43 ++++++------
 .../application/SampleApplicationsTest.java     | 55 ++++++++-------
 .../application/SingleClusterScalingTest.java   | 53 +++++++--------
 .../tests/group/CartridgeGroupTest.java         | 30 ++++-----
 .../integration/tests/group/CartridgeTest.java  | 12 ++--
 .../tests/policies/ApplicationPolicyTest.java   | 22 +++---
 .../tests/policies/AutoscalingPolicyTest.java   | 12 ++--
 .../tests/policies/DeploymentPolicyTest.java    | 28 ++++----
 .../tests/policies/NetworkPartitionTest.java    | 13 ++--
 14 files changed, 259 insertions(+), 263 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
index 0645038..63f6afb 100755
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
@@ -30,9 +30,7 @@ import org.apache.stratos.integration.tests.application.SampleApplicationsTest;
 import org.apache.stratos.integration.tests.rest.IntegrationMockClient;
 import org.apache.stratos.integration.tests.rest.RestClient;
 import org.apache.stratos.messaging.domain.tenant.Tenant;
-import org.apache.stratos.mock.iaas.client.MockIaasApiClient;
 import org.testng.annotations.AfterSuite;
-import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeSuite;
 import org.wso2.carbon.integration.framework.TestServerManager;
 import org.wso2.carbon.integration.framework.utils.FrameworkSettings;
@@ -61,7 +59,7 @@ public class StratosTestServerManager extends TestServerManager {
     private static final String JNDI_PROPERTIES_FILE = "jndi.properties";
     private static final String JMS_OUTPUT_ADAPTER_FILE = "JMSOutputAdaptor.xml";
     protected RestClient restClientAdmin;
-    protected RestClient restClient;
+    protected RestClient restClientTenant1;
     private String endpoint = "https://localhost:9443";
 
     private BrokerService broker = new BrokerService();
@@ -76,8 +74,8 @@ public class StratosTestServerManager extends TestServerManager {
         super(CARBON_ZIP, PORT_OFFSET);
         serverUtils = new ServerUtils();
         restClientAdmin=new RestClient(endpoint,"admin","admin");
-        restClient = new RestClient(endpoint, "admin", "admin");
-     //   restClient = new RestClient(endpoint, "admin", "admin");
+        restClientTenant1 = new RestClient(endpoint, "admin", "admin");
+     //   restClientTenant1 = new RestClient(endpoint, "admin", "admin");
         mockIaasApiClient = new IntegrationMockClient(endpoint + "/mock-iaas/api");
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
index 6c62056..c55ff04 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
@@ -47,63 +47,63 @@ public class ApplicationBurstingTest extends StratosTestServerManager {
 
             String autoscalingPolicyId = "autoscaling-policy-application-bursting-test";
 
-            boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+            boolean addedScalingPolicy = restClientTenant1.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 + "/" + "esb-application-bursting-test.json",
+            boolean addedC1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "esb-application-bursting-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC1, true);
 
-            boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "php-application-bursting-test.json",
+            boolean addedC2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "php-application-bursting-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC2, true);
 
-            boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "tomcat-application-bursting-test.json",
+            boolean addedC3 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "tomcat-application-bursting-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC3, true);
 
-            boolean addedG1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
+            boolean addedG1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
                             "/" + "esb-php-group-application-bursting-test.json", RestConstants.CARTRIDGE_GROUPS,
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(addedG1, true);
 
-            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClientTenant1.
                     getEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
                             CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(beanG1.getName(), "esb-php-group-application-bursting-test");
 
-            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-bursting-test-1.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN1, true);
 
-            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-bursting-test-2.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN2, true);
 
-            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
                             "deployment-policy-application-bursting-test.json",
                     RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(addedDep, true);
 
-            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
                             "app-bursting-single-cartriddge-group.json", RestConstants.APPLICATIONS,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(added, true);
 
-            ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean bean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "application-bursting-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(bean.getApplicationId(), "application-bursting-test");
 
-            boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+            boolean addAppPolicy = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
                             "application-policy-application-bursting-test.json", RestConstants.APPLICATION_POLICIES,
                     RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(addAppPolicy, true);
 
-            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClientTenant1.getEntity(
                     RestConstants.APPLICATION_POLICIES,
                     "application-policy-application-bursting-test", ApplicationPolicyBean.class,
                     RestConstants.APPLICATION_POLICIES_NAME);
@@ -111,7 +111,7 @@ public class ApplicationBurstingTest extends StratosTestServerManager {
             //deploy the application
             String resourcePath = RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
                     RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-application-bursting-test";
-            boolean deployed = restClient.deployEntity(resourcePath,
+            boolean deployed = restClientTenant1.deployEntity(resourcePath,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(deployed, true);
 
@@ -125,21 +125,21 @@ public class ApplicationBurstingTest extends StratosTestServerManager {
             //Cluster active handling
             TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
 
-            boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
+            boolean removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(removedGroup, false);
 
-            boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            boolean removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, false);
 
-            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-1",
                     RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
             assertEquals(removedNet, false);
 
-            boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-application-bursting-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, false);
 
@@ -147,7 +147,7 @@ public class ApplicationBurstingTest extends StratosTestServerManager {
             String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
                     RestConstants.APPLICATIONS_UNDEPLOY;
 
-            boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+            boolean unDeployed = restClientTenant1.undeployEntity(resourcePathUndeploy,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
@@ -156,7 +156,7 @@ public class ApplicationBurstingTest extends StratosTestServerManager {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the [application] " + "application-bursting-test");
 
-                restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
+                restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
 
                 boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
@@ -165,55 +165,55 @@ public class ApplicationBurstingTest extends StratosTestServerManager {
 
             }
 
-            boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "application-bursting-test",
+            boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "application-bursting-test",
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(removed, true);
 
-            ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "application-bursting-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(beanRemoved, null);
 
-            removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
+            removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(removedGroup, true);
 
-            boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "esb-application-bursting-test",
+            boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "esb-application-bursting-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC1, true);
 
-            boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "php-application-bursting-test",
+            boolean removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "php-application-bursting-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC2, true);
 
-            boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "tomcat-application-bursting-test",
+            boolean removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "tomcat-application-bursting-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC3, true);
 
-            removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, true);
 
-            removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-application-bursting-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, false);
 
-            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, false);
 
-            boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+            boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
                     "application-policy-application-bursting-test", RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(removeAppPolicy, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, true);
 
-            removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
index 36339a9..38692d5 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
@@ -47,63 +47,63 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
 
             String autoscalingPolicyId = "autoscaling-policy-application-update-test";
 
-            boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+            boolean addedScalingPolicy = restClientTenant1.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-application-update-test.json",
+            boolean addedC1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c1-application-update-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC1, true);
 
-            boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c2-application-update-test.json",
+            boolean addedC2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c2-application-update-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC2, true);
 
-            boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c3-application-update-test.json",
+            boolean addedC3 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c3-application-update-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC3, true);
 
-            boolean addedG1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
+            boolean addedG1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
                             "/" + "cartrdige-nested-application-update-test.json", RestConstants.CARTRIDGE_GROUPS,
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(addedG1, true);
 
-            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClientTenant1.
                     getEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
                             CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(beanG1.getName(), "G1-application-update-test");
 
-            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-update-test-1.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN1, true);
 
-            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-update-test-2.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN2, true);
 
-            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
                             "deployment-policy-application-update-test.json",
                     RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(addedDep, true);
 
-            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
                             "g-sc-G123-1-application-update-test.json", RestConstants.APPLICATIONS,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(added, true);
 
-            ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean bean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(bean.getApplicationId(), "g-sc-G123-1-application-update-test");
 
-            boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+            boolean addAppPolicy = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
                             "application-policy-application-update-test.json", RestConstants.APPLICATION_POLICIES,
                     RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(addAppPolicy, true);
 
-            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClientTenant1.getEntity(
                     RestConstants.APPLICATION_POLICIES,
                     "application-policy-application-update-test", ApplicationPolicyBean.class,
                     RestConstants.APPLICATION_POLICIES_NAME);
@@ -111,7 +111,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
             //deploy the application
             String resourcePath = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
                     RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-application-update-test";
-            boolean deployed = restClient.deployEntity(resourcePath,
+            boolean deployed = restClientTenant1.deployEntity(resourcePath,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(deployed, true);
 
@@ -126,7 +126,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
             TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
 
             //Updating application
-            boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+            boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
                             "g-sc-G123-1-application-update-test-v1.json", RestConstants.APPLICATIONS,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(updated, true);
@@ -135,25 +135,25 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
 
             TopologyHandler.getInstance().assertClusterMinMemberCount(bean.getApplicationId(), 1);
 
-            ApplicationBean updatedBean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean updatedBean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(updatedBean.getApplicationId(), "g-sc-G123-1-application-update-test");
 
-            boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
+            boolean removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(removedGroup, false);
 
-            boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            boolean removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, false);
 
-            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-update-test-1",
                     RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
             assertEquals(removedNet, false);
 
-            boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, false);
 
@@ -161,7 +161,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
             String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
                     RestConstants.APPLICATIONS_UNDEPLOY;
 
-            boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+            boolean unDeployed = restClientTenant1.undeployEntity(resourcePathUndeploy,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
@@ -170,7 +170,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the [application] " + "g-sc-G123-1-application-update-test");
 
-                restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
+                restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
 
                 boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test");
@@ -179,55 +179,55 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
 
             }
 
-            boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
+            boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(removed, true);
 
-            ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(beanRemoved, null);
 
-            removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
+            removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(removedGroup, true);
 
-            boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c1-application-update-test",
+            boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c1-application-update-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC1, true);
 
-            boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c2-application-update-test",
+            boolean removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c2-application-update-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC2, true);
 
-            boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c3-application-update-test",
+            boolean removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c3-application-update-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC3, true);
 
-            removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, true);
 
-            removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, false);
 
-            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, false);
 
-            boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+            boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
                     "application-policy-application-update-test", RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(removeAppPolicy, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, true);
 
-            removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
index 1f3aa56..81743da 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
@@ -46,63 +46,63 @@ public class GroupStartupOrderTest extends StratosTestServerManager {
 
             String autoscalingPolicyId = "autoscaling-policy-application-bursting-test";
 
-            boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+            boolean addedScalingPolicy = restClientTenant1.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 + "/" + "esb-application-bursting-test.json",
+            boolean addedC1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "esb-application-bursting-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC1, true);
 
-            boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "php-application-bursting-test.json",
+            boolean addedC2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "php-application-bursting-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC2, true);
 
-            boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "tomcat-application-bursting-test.json",
+            boolean addedC3 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "tomcat-application-bursting-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC3, true);
 
-            boolean addedG1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
+            boolean addedG1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
                             "/" + "esb-php-group-application-bursting-test.json", RestConstants.CARTRIDGE_GROUPS,
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(addedG1, true);
 
-            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClient.
+            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClientTenant1.
                     getEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
                             CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(beanG1.getName(), "esb-php-group-application-bursting-test");
 
-            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-bursting-test-1.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN1, true);
 
-            boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-application-bursting-test-2.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN2, true);
 
-            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
                             "deployment-policy-application-bursting-test.json",
                     RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(addedDep, true);
 
-            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
                             "app-bursting-single-cartriddge-group.json", RestConstants.APPLICATIONS,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(added, true);
 
-            ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean bean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "application-bursting-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(bean.getApplicationId(), "application-bursting-test");
 
-            boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+            boolean addAppPolicy = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
                             "application-policy-application-bursting-test.json", RestConstants.APPLICATION_POLICIES,
                     RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(addAppPolicy, true);
 
-            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClientTenant1.getEntity(
                     RestConstants.APPLICATION_POLICIES,
                     "application-policy-application-bursting-test", ApplicationPolicyBean.class,
                     RestConstants.APPLICATION_POLICIES_NAME);
@@ -110,7 +110,7 @@ public class GroupStartupOrderTest extends StratosTestServerManager {
             //deploy the application
             String resourcePath = RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
                     RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-application-bursting-test";
-            boolean deployed = restClient.deployEntity(resourcePath,
+            boolean deployed = restClientTenant1.deployEntity(resourcePath,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(deployed, true);
 
@@ -124,21 +124,21 @@ public class GroupStartupOrderTest extends StratosTestServerManager {
             //Cluster active handling
             TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
 
-            boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
+            boolean removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(removedGroup, false);
 
-            boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            boolean removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, false);
 
-            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-1",
                     RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
             assertEquals(removedNet, false);
 
-            boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-application-bursting-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, false);
 
@@ -146,7 +146,7 @@ public class GroupStartupOrderTest extends StratosTestServerManager {
             String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
                     RestConstants.APPLICATIONS_UNDEPLOY;
 
-            boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+            boolean unDeployed = restClientTenant1.undeployEntity(resourcePathUndeploy,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
@@ -155,7 +155,7 @@ public class GroupStartupOrderTest extends StratosTestServerManager {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the [application] " + "application-bursting-test");
 
-                restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
+                restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + "/" + "application-bursting-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
 
                 boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
@@ -164,55 +164,55 @@ public class GroupStartupOrderTest extends StratosTestServerManager {
 
             }
 
-            boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "application-bursting-test",
+            boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "application-bursting-test",
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(removed, true);
 
-            ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "application-bursting-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(beanRemoved, null);
 
-            removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
+            removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "esb-php-group-application-bursting-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(removedGroup, true);
 
-            boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "esb-application-bursting-test",
+            boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "esb-application-bursting-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC1, true);
 
-            boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "php-application-bursting-test",
+            boolean removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "php-application-bursting-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC2, true);
 
-            boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "tomcat-application-bursting-test",
+            boolean removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "tomcat-application-bursting-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC3, true);
 
-            removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, true);
 
-            removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-application-bursting-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, false);
 
-            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, false);
 
-            boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+            boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
                     "application-policy-application-bursting-test", RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(removeAppPolicy, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, true);
 
-            removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-bursting-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
index d8f6965..ea57b3a 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
@@ -55,40 +55,40 @@ public class PartitionOneAfterAnotherClusterTest extends StratosTestServerManage
 
             String autoscalingPolicyId = "autoscaling-policy-3";
 
-            boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+            boolean addedScalingPolicy = restClientTenant1.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 + "/" + "c7.json",
+            boolean addedC1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c7.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC1, true);
 
-            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-11.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN1, true);
 
-            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
                             "deployment-policy-5.json",
                     RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(addedDep, true);
 
-            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
                             "single-cluster-scaling-test.json", RestConstants.APPLICATIONS,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(added, true);
 
-            ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean bean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "single-cluster-scaling-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(bean.getApplicationId(), "single-cluster-scaling-test");
 
-            boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+            boolean addAppPolicy = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
                             "application-policy-4.json", RestConstants.APPLICATION_POLICIES,
                     RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(addAppPolicy, true);
 
-            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
+            ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClientTenant1.getEntity(
                     RestConstants.APPLICATION_POLICIES,
                     "application-policy-4", ApplicationPolicyBean.class,
                     RestConstants.APPLICATION_POLICIES_NAME);
@@ -96,7 +96,7 @@ public class PartitionOneAfterAnotherClusterTest extends StratosTestServerManage
             //deploy the application
             String resourcePath = RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" +
                     RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-4";
-            boolean deployed = restClient.deployEntity(resourcePath,
+            boolean deployed = restClientTenant1.deployEntity(resourcePath,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(deployed, true);
 
@@ -113,17 +113,17 @@ public class PartitionOneAfterAnotherClusterTest extends StratosTestServerManage
             //Removing one member from cluster and check for auto healing
 
 
-            boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            boolean removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, false);
 
-            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-11",
                     RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
             assertEquals(removedNet, false);
 
-            boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-5", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, false);
 
@@ -131,7 +131,7 @@ public class PartitionOneAfterAnotherClusterTest extends StratosTestServerManage
             String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" +
                     RestConstants.APPLICATIONS_UNDEPLOY;
 
-            boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+            boolean unDeployed = restClientTenant1.undeployEntity(resourcePathUndeploy,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
@@ -140,7 +140,7 @@ public class PartitionOneAfterAnotherClusterTest extends StratosTestServerManage
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the [application] " + "single-cluster-scaling-test");
 
-                restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" +
+                restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
 
                 boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test");
@@ -149,37 +149,37 @@ public class PartitionOneAfterAnotherClusterTest extends StratosTestServerManage
 
             }
 
-            boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "single-cluster-scaling-test",
+            boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "single-cluster-scaling-test",
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(removed, true);
 
-            ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "single-cluster-scaling-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(beanRemoved, null);
 
-            boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c7",
+            boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c7",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC1, true);
 
 
-            removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, true);
 
-            removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-5", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-11", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, false);
 
 
-            boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+            boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
                     "application-policy-4", RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(removeAppPolicy, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-11", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
index 026944e..c2c531b 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
@@ -21,7 +21,6 @@ package org.apache.stratos.integration.tests.application;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.common.beans.application.ApplicationBean;
-import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
 import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.apache.stratos.integration.tests.TopologyHandler;
@@ -55,35 +54,35 @@ public class PartitionRoundRobinClusterTest extends StratosTestServerManager {
 
             String autoscalingPolicyId = "autoscaling-policy-partition-round-robin-test";
 
-            boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+            boolean addedScalingPolicy = restClientTenant1.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 + "/" + "c7-partition-round-robin-test.json",
+            boolean addedC1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c7-partition-round-robin-test.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
             assertEquals(addedC1, true);
 
-            boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+            boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
                             "network-partition-partition-round-robin-test.json",
                     RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(addedN1, true);
 
-            boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
                             "deployment-policy-partition-round-robin-test.json",
                     RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(addedDep, true);
 
-            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
                             "partition-round-robin-test.json", RestConstants.APPLICATIONS,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(added, true);
 
-            ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean bean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "partition-round-robin-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(bean.getApplicationId(), "partition-round-robin-test");
 
-            boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+            boolean addAppPolicy = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
                             "application-policy-partition-round-robin-test.json", RestConstants.APPLICATION_POLICIES,
                     RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(addAppPolicy, true);
@@ -91,7 +90,7 @@ public class PartitionRoundRobinClusterTest extends StratosTestServerManager {
             //deploy the application
             String resourcePath = RestConstants.APPLICATIONS + "/" + "partition-round-robin-test" +
                     RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-partition-round-robin-test";
-            boolean deployed = restClient.deployEntity(resourcePath,
+            boolean deployed = restClientTenant1.deployEntity(resourcePath,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(deployed, true);
 
@@ -119,17 +118,17 @@ public class PartitionRoundRobinClusterTest extends StratosTestServerManager {
             //Cluster active handling
             TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());   */
 
-            boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            boolean removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, false);
 
-            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-partition-round-robin-test",
                     RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
             assertEquals(removedNet, false);
 
-            boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-partition-round-robin-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, false);
 
@@ -137,7 +136,7 @@ public class PartitionRoundRobinClusterTest extends StratosTestServerManager {
             String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "partition-round-robin-test" +
                     RestConstants.APPLICATIONS_UNDEPLOY;
 
-            boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+            boolean unDeployed = restClientTenant1.undeployEntity(resourcePathUndeploy,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
@@ -146,7 +145,7 @@ public class PartitionRoundRobinClusterTest extends StratosTestServerManager {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the [application] " + "partition-round-robin-test");
 
-                restClient.undeployEntity(RestConstants.APPLICATIONS + "/" + "partition-round-robin-test" +
+                restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + "/" + "partition-round-robin-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
 
                 boolean forceUndeployed = TopologyHandler.getInstance().assertApplicationUndeploy("partition-round-robin-test");
@@ -155,37 +154,37 @@ public class PartitionRoundRobinClusterTest extends StratosTestServerManager {
 
             }
 
-            boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "partition-round-robin-test",
+            boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "partition-round-robin-test",
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(removed, true);
 
-            ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "partition-round-robin-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(beanRemoved, null);
 
-            boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c7-partition-round-robin-test",
+            boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c7-partition-round-robin-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC1, true);
 
 
-            removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, true);
 
-            removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-partition-round-robin-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-partition-round-robin-test", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, false);
 
 
-            boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+            boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
                     "application-policy-partition-round-robin-test", RestConstants.APPLICATION_POLICIES_NAME);
             assertEquals(removeAppPolicy, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-partition-round-robin-test", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/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..95b296e 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
@@ -27,7 +27,6 @@ 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;
@@ -47,54 +46,54 @@ public class SampleApplicationsTest extends StratosTestServerManager {
         try {
             String autoscalingPolicyId = "autoscaling-policy-sample-applications-test";
 
-            boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
+            boolean addedScalingPolicy = restClientTenant1.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",
+            boolean addedC1 = restClientTenant1.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",
+            boolean addedC2 = restClientTenant1.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",
+            boolean addedC3 = restClientTenant1.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 +
+            boolean addedG1 = restClientTenant1.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.
+            CartridgeGroupBean beanG1 = (CartridgeGroupBean) restClientTenant1.
                     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 + "/" +
+            boolean addedN1 = restClientTenant1.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 + "/" +
+            boolean addedN2 = restClientTenant1.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 + "/" +
+            boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
                             "deployment-policy-sample-applications-test.json",
                     RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(addedDep, true);
 
-            boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
+            boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
                             "g-sc-G123-1-sample-applications-test.json", RestConstants.APPLICATIONS,
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(added, true);
 
-            ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean bean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-sample-applications-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(bean.getApplicationId(), "g-sc-G123-1-sample-applications-test");
 
@@ -132,12 +131,12 @@ public class SampleApplicationsTest extends StratosTestServerManager {
             assertEquals(c3.getCartridgeMin(), 1);
             assertEquals(c3.getCartridgeMax(), 2);
 
-            boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH +
+            boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH +
                             "/g-sc-G123-1-sample-applications-test-v1.json",
                     RestConstants.APPLICATIONS, RestConstants.APPLICATIONS_NAME);
             assertEquals(updated, true);
 
-            ApplicationBean updatedBean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean updatedBean = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-sample-applications-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
 
             assertEquals(bean.getApplicationId(), "g-sc-G123-1-sample-applications-test");
@@ -177,61 +176,61 @@ public class SampleApplicationsTest extends StratosTestServerManager {
             assertEquals(c3.getCartridgeMax(), 3);
 
 
-            boolean removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-sample-applications-test",
+            boolean removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-sample-applications-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertFalse(removedGroup);
 
-            boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            boolean removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertFalse(removedAuto);
 
-            boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedNet = restClientTenant1.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,
+            boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-sample-applications-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertFalse(removedDep);
 
-            boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-sample-applications-test",
+            boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-sample-applications-test",
                     RestConstants.APPLICATIONS_NAME);
             assertTrue(removed);
 
-            ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
+            ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-sample-applications-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
             assertEquals(beanRemoved, null);
 
-            removedGroup = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-sample-applications-test",
+            removedGroup = restClientTenant1.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",
+            boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c1-sample-applications-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC1, true);
 
-            boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c2-sample-applications-test",
+            boolean removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c2-sample-applications-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC2, true);
 
-            boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c3-sample-applications-test",
+            boolean removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c3-sample-applications-test",
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removedC3, true);
 
-            removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+            removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(removedAuto, true);
 
-            removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+            removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-sample-applications-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, true);
 
-            removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-sample-applications-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedNet, true);
 
-            boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+            boolean removedN2 = restClientTenant1.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);