http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java index 58e91e3..5d08063 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java @@ -57,40 +57,40 @@ public class SingleClusterScalingTest extends StratosTestServerManager { String autoscalingPolicyId = "autoscaling-policy-single-cluster-scaling-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-single-cluster-scaling-test.json", + boolean addedC1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c7-single-cluster-scaling-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-single-cluster-scaling-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-single-cluster-scaling-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 + "/" + "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-single-cluster-scaling-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-single-cluster-scaling-test", ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME); @@ -98,7 +98,7 @@ public class SingleClusterScalingTest extends StratosTestServerManager { //deploy the application String resourcePath = RestConstants.APPLICATIONS + "/" + "single-cluster-scaling-test" + RestConstants.APPLICATIONS_DEPLOY + "/" + "application-policy-single-cluster-scaling-test"; - boolean deployed = restClient.deployEntity(resourcePath, + boolean deployed = restClientTenant1.deployEntity(resourcePath, RestConstants.APPLICATIONS_NAME); assertEquals(deployed, true); @@ -110,19 +110,19 @@ public class SingleClusterScalingTest extends StratosTestServerManager { TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId()); //Verifying whether members got created using round robin algorithm - assertClusterWithScalingup(bean.getApplicationId()); + assertClusterWithScalingup(bean.getApplicationId(), -1234); - 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-single-cluster-scaling-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-single-cluster-scaling-test", RestConstants.DEPLOYMENT_POLICIES_NAME); assertEquals(removedDep, false); @@ -130,7 +130,7 @@ public class SingleClusterScalingTest extends StratosTestServerManager { 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); @@ -139,7 +139,7 @@ public class SingleClusterScalingTest extends StratosTestServerManager { //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"); @@ -148,37 +148,37 @@ public class SingleClusterScalingTest extends StratosTestServerManager { } - 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-single-cluster-scaling-test", + boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c7-single-cluster-scaling-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-single-cluster-scaling-test", RestConstants.DEPLOYMENT_POLICIES_NAME); assertEquals(removedDep, true); - removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-single-cluster-scaling-test", RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(removedNet, false); - boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES, + boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES, "application-policy-single-cluster-scaling-test", RestConstants.APPLICATION_POLICIES_NAME); assertEquals(removeAppPolicy, true); - removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-single-cluster-scaling-test", RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(removedNet, true); @@ -194,9 +194,10 @@ public class SingleClusterScalingTest extends StratosTestServerManager { * Assert application activation * * @param applicationName + * @param tenantId */ - private void assertClusterWithScalingup(String applicationName) { - Application application = ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234); + private void assertClusterWithScalingup(String applicationName, int tenantId) { + Application application = ApplicationManager.getApplications().getApplicationByTenant(applicationName, tenantId); assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application); boolean clusterScaleup = false; @@ -232,7 +233,7 @@ public class SingleClusterScalingTest extends StratosTestServerManager { break; } } - application = ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234); + application = ApplicationManager.getApplications().getApplicationByTenant(applicationName, tenantId); if ((System.currentTimeMillis() - startTime) > CLUSTER_SCALE_UP_TIMEOUT) { break; }
http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java index ccaeaf6..6732530 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java @@ -41,88 +41,88 @@ public class CartridgeGroupTest extends StratosTestServerManager { try { log.info("-------------------------Started Cartridge group test case-------------------------"); - boolean addedC1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + + boolean addedC1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c4-cartridge-group-test.json", RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME); assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c4-cartridge-group-test"), addedC1, true); - boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + + boolean addedC2 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c5-cartridge-group-test.json", RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME); assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c5-cartridge-group-test"), addedC2, true); - boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + + boolean addedC3 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c6-cartridge-group-test.json", RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME); assertEquals(String.format("Cartridge did not added: [cartridge-name] %s", "c6-cartridge-group-test"), addedC3, true); - boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH + + boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH + "/" + "g4-g5-g6-cartridge-group-test.json", RestConstants.CARTRIDGE_GROUPS, RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge Group did not added: [cartridge-group-name] %s", "g4-g5-g6-cartridge-group-test"), added, true); - CartridgeGroupBean bean = (CartridgeGroupBean) restClient. + CartridgeGroupBean bean = (CartridgeGroupBean) restClientTenant1. getEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test", CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge Group name did not match: [cartridge-group-name] %s", "g4-g5-g6-cartridge-group-test.json"), bean.getName(), "G4-cartridge-group-test"); - boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH + + boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH + "/" + "g4-g5-g6-cartridge-group-test-v1.json", RestConstants.CARTRIDGE_GROUPS, RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge Group did not updated: [cartridge-group-name] %s", "g4-g5-g6-cartridge-group-test"), updated, true); - CartridgeGroupBean updatedBean = (CartridgeGroupBean) restClient. + CartridgeGroupBean updatedBean = (CartridgeGroupBean) restClientTenant1. getEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test", CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Updated Cartridge Group didn't match: [cartridge-group-name] %s", "g4-g5-g6-cartridge-group-test"), updatedBean.getName(), "G4-cartridge-group-test"); - boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test", + boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge can be removed while it is used in " + "cartridge group: [cartridge-name] %s", "c4-cartridge-group-test"), removedC1, false); - boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test", + boolean removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge can be removed while it is used in " + "cartridge group: [cartridge-name] %s", "c5-cartridge-group-test"), removedC2, false); - boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test", + boolean removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge can be removed while it is used in " + "cartridge group: [cartridge-name] %s", "c6-cartridge-group-test"), removedC3, false); - boolean removed = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test", + boolean removed = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge Group did not removed: [cartridge-group-name] %s", "g4-g5-g6-cartridge-group-test"), removed, true); - CartridgeGroupBean beanRemoved = (CartridgeGroupBean) restClient. + CartridgeGroupBean beanRemoved = (CartridgeGroupBean) restClientTenant1. getEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test", CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge Group did not removed completely: " + "[cartridge-group-name] %s", "g4-g5-g6-cartridge-group-test"), beanRemoved, null); - removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test", + removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s", "c4-cartridge-group-test"), removedC1, true); - removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test", + removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s", "c5-cartridge-group-test"), removedC2, true); - removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test", + removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test", RestConstants.CARTRIDGE_GROUPS_NAME); assertEquals(String.format("Cartridge can not be removed : [cartridge-name] %s", "c6-cartridge-group-test"), removedC3, true); http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java index ac39161..d460fd9 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java @@ -44,11 +44,11 @@ public class CartridgeTest extends StratosTestServerManager { try { String cartridgeType = "c0-cartridge-test"; - boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + + boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + cartridgeType + ".json", RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME); assertEquals(added, true); - CartridgeBean bean = (CartridgeBean) restClient. + CartridgeBean bean = (CartridgeBean) restClientTenant1. getEntity(RestConstants.CARTRIDGES, cartridgeType, CartridgeBean.class, RestConstants.CARTRIDGES_NAME); assertEquals(bean.getCategory(), "Application"); @@ -78,11 +78,11 @@ public class CartridgeTest extends StratosTestServerManager { } - boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + + boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + cartridgeType + "-v1.json", RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME); assertEquals(updated, true); - CartridgeBean updatedBean = (CartridgeBean) restClient. + CartridgeBean updatedBean = (CartridgeBean) restClientTenant1. getEntity(RestConstants.CARTRIDGES, cartridgeType, CartridgeBean.class, RestConstants.CARTRIDGES_NAME); assertEquals(updatedBean.getType(), "c0-cartridge-test"); @@ -112,11 +112,11 @@ public class CartridgeTest extends StratosTestServerManager { } } - boolean removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType, + boolean removed = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, cartridgeType, RestConstants.CARTRIDGES_NAME); assertEquals(removed, true); - CartridgeBean beanRemoved = (CartridgeBean) restClient. + CartridgeBean beanRemoved = (CartridgeBean) restClientTenant1. getEntity(RestConstants.CARTRIDGES, cartridgeType, CartridgeBean.class, RestConstants.CARTRIDGES_NAME); assertEquals(beanRemoved, null); http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java index bced0ff..49952aa 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java @@ -45,22 +45,22 @@ public class ApplicationPolicyTest extends StratosTestServerManager { String applicationPolicyId = "application-policy-application-policy-test"; log.info("-------------------------Started Application policy test case-------------------------"); - boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + + boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + "network-partition-application-policy-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-policy-test-2" + ".json", RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(addedN2, true); - boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" + + boolean addedDep = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" + applicationPolicyId + ".json", RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME); assertEquals(addedDep, true); - ApplicationPolicyBean bean = (ApplicationPolicyBean) restClient. + ApplicationPolicyBean bean = (ApplicationPolicyBean) restClientTenant1. getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId, ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME); assertEquals(bean.getId(), applicationPolicyId); @@ -91,34 +91,34 @@ public class ApplicationPolicyTest extends StratosTestServerManager { applicationPolicyId), false); } - boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME); //Trying to remove the used network partition assertEquals(removedNet, false); - boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES, + boolean removedDep = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME); assertEquals(removedDep, true); - ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClient. + ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClientTenant1. getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId, ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME); assertEquals(beanRemovedDep, null); - boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + boolean removedN1 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(removedN1, true); - NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient. + NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClientTenant1. getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1", NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(beanRemovedN1, null); - boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(removedN2, true); - NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient. + NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClientTenant1. getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2", NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(beanRemovedN2, null); http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java index 9a164c5..c1755c4 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java @@ -41,11 +41,11 @@ public class AutoscalingPolicyTest extends StratosTestServerManager { 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", + boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json", RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME); assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), added, true); - AutoscalePolicyBean bean = (AutoscalePolicyBean) restClient. + AutoscalePolicyBean bean = (AutoscalePolicyBean) restClientTenant1. getEntity(RestConstants.AUTOSCALING_POLICIES, policyId, AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); @@ -58,11 +58,11 @@ public class AutoscalingPolicyTest extends StratosTestServerManager { assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId), bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0); - boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json", + boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json", RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME); assertEquals(String.format("[autoscaling-policy-id] %s update failed", policyId), updated, true); - AutoscalePolicyBean updatedBean = (AutoscalePolicyBean) restClient.getEntity( + AutoscalePolicyBean updatedBean = (AutoscalePolicyBean) restClientTenant1.getEntity( RestConstants.AUTOSCALING_POLICIES, policyId, AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId), @@ -72,12 +72,12 @@ public class AutoscalingPolicyTest extends StratosTestServerManager { assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId), updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0); - boolean removed = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, + boolean removed = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES, policyId, RestConstants.AUTOSCALING_POLICIES_NAME); assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId), removed, true); - AutoscalePolicyBean beanRemoved = (AutoscalePolicyBean) restClient.getEntity( + AutoscalePolicyBean beanRemoved = (AutoscalePolicyBean) restClientTenant1.getEntity( RestConstants.AUTOSCALING_POLICIES, policyId, AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); assertEquals(String.format("[autoscaling-policy-id] %s didn't get removed successfully", http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java index 4401443..3a47e75 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java @@ -46,22 +46,22 @@ public class DeploymentPolicyTest extends StratosTestServerManager { String deploymentPolicyId = "deployment-policy-deployment-policy-test"; log.info("-------------------------Started deployment policy test case-------------------------"); - boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + + boolean addedN1 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + "network-partition-deployment-policy-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-deployment-policy-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 + "/" + deploymentPolicyId + ".json", RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME); assertEquals(addedDep, true); - DeploymentPolicyBean bean = (DeploymentPolicyBean) restClient. + DeploymentPolicyBean bean = (DeploymentPolicyBean) restClientTenant1. getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); @@ -90,18 +90,18 @@ public class DeploymentPolicyTest extends StratosTestServerManager { assertEquals(nw2P2.getPartitionMax(), 9); //update network partition - boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + + boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + "network-partition-deployment-policy-test-1-v1.json", RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(updated, true); //update deployment policy with new partition and max values - boolean updatedDep = restClient.updateEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + + boolean updatedDep = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" + deploymentPolicyId + "-v1.json", RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME); assertEquals(updatedDep, true); - DeploymentPolicyBean updatedBean = (DeploymentPolicyBean) restClient. + DeploymentPolicyBean updatedBean = (DeploymentPolicyBean) restClientTenant1. getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); @@ -132,34 +132,34 @@ public class DeploymentPolicyTest extends StratosTestServerManager { "network-partition-6-partition-2"); assertEquals(nw2P2.getPartitionMax(), 5); - boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-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, deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME); assertEquals(removedDep, true); - DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClient. + DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClientTenant1. getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); assertEquals(beanRemovedDep, null); - boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + boolean removedN1 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(removedN1, true); - NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient. + NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClientTenant1. getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-1", NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(beanRemovedN1, null); - boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(removedN2, true); - NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient. + NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClientTenant1. getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2", NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(beanRemovedN2, null); http://git-wip-us.apache.org/repos/asf/stratos/blob/aa0f22b5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java index 684dc03..2f6b2e5 100644 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java +++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java @@ -22,7 +22,6 @@ package org.apache.stratos.integration.tests.policies; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.common.beans.partition.NetworkPartitionBean; -import org.apache.stratos.common.beans.partition.NetworkPartitionReferenceBean; import org.apache.stratos.common.beans.partition.PartitionBean; import org.apache.stratos.integration.tests.RestConstants; import org.apache.stratos.integration.tests.StratosTestServerManager; @@ -45,12 +44,12 @@ public class NetworkPartitionTest extends StratosTestServerManager { String networkPartitionId = "network-partition-network-partition-test"; log.info("-------------------------Started network partition test case-------------------------"); - boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + + boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + networkPartitionId + ".json", RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(added, true); - NetworkPartitionBean bean = (NetworkPartitionBean) restClient. + NetworkPartitionBean bean = (NetworkPartitionBean) restClientTenant1. getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); @@ -61,12 +60,12 @@ public class NetworkPartitionTest extends StratosTestServerManager { assertEquals(p1.getProperty().get(0).getName(), "region"); assertEquals(p1.getProperty().get(0).getValue(), "default"); - boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + + boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + networkPartitionId + "-v1.json", RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(updated, true); - NetworkPartitionBean updatedBean = (NetworkPartitionBean) restClient. + NetworkPartitionBean updatedBean = (NetworkPartitionBean) restClientTenant1. getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); @@ -79,11 +78,11 @@ public class NetworkPartitionTest extends StratosTestServerManager { assertEquals(p2.getProperty().get(1).getName(), "zone"); assertEquals(p2.getProperty().get(1).getValue(), "z1"); - boolean removed = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS, + boolean removed = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(removed, true); - NetworkPartitionBean beanRemoved = (NetworkPartitionBean) restClient. + NetworkPartitionBean beanRemoved = (NetworkPartitionBean) restClientTenant1. getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); assertEquals(beanRemoved, null);
