http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java deleted file mode 100644 index 895e5f6..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.policies; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean; -import org.apache.stratos.integration.tests.RestConstants; -import org.apache.stratos.integration.tests.StratosTestServerManager; -import org.testng.annotations.Test; - -import static junit.framework.Assert.*; - -/** - * Test to handle autoscaling policy CRUD operations - */ -public class AutoscalingPolicyTest extends StratosTestServerManager { - private static final Log log = LogFactory.getLog(AutoscalingPolicyTest.class); - private static final String RESOURCES_PATH = "/autoscaling-policy-test"; - - - @Test - public void testAutoscalingPolicy() { - log.info("-------------------------Started autoscaling policy test case-------------------------"); - String policyId = "autoscaling-policy-autoscaling-policy-test"; - try { - boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json", - RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME); - - assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), added, true); - AutoscalePolicyBean bean = (AutoscalePolicyBean) restClientTenant1. - getEntity(RestConstants.AUTOSCALING_POLICIES, policyId, - AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); - - assertEquals(String.format("[autoscaling-policy-id] %s is not correct", bean.getId()), - bean.getId(), policyId); - assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId), - bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 35.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId), - bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 45.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId), - bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0); - - bean = (AutoscalePolicyBean) restClientTenant2. - getEntity(RestConstants.AUTOSCALING_POLICIES, policyId, - AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); - assertNull("Auto scale policy exists for other tenant",bean); - - boolean addedTenant2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json", - RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME); - - assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), addedTenant2, true); - bean = (AutoscalePolicyBean) restClientTenant2. - getEntity(RestConstants.AUTOSCALING_POLICIES, policyId, - AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); - - assertEquals(String.format("[autoscaling-policy-id] %s is not correct", bean.getId()), - bean.getId(), policyId); - assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId), - bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 35.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId), - bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 45.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId), - bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0); - - boolean updated = 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) restClientTenant1.getEntity( - RestConstants.AUTOSCALING_POLICIES, policyId, - AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); - assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId), - updatedBean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId), - updatedBean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId), - updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0); - - boolean updatedTenant2 = restClientTenant2.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), updatedTenant2, true); - AutoscalePolicyBean updatedTenant2Bean = (AutoscalePolicyBean) restClientTenant2.getEntity( - RestConstants.AUTOSCALING_POLICIES, policyId, - AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); - assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId), - updatedTenant2Bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId), - updatedTenant2Bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 0.0); - assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId), - updatedTenant2Bean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0); - - - 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) restClientTenant1.getEntity( - RestConstants.AUTOSCALING_POLICIES, policyId, - AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); - assertEquals(String.format("[autoscaling-policy-id] %s didn't get removed successfully", - policyId), beanRemoved, null); - - beanRemoved = (AutoscalePolicyBean) restClientTenant2.getEntity( - RestConstants.AUTOSCALING_POLICIES, policyId, - AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME); - assertNotNull("Auto scale policy not exist in other tenant",beanRemoved); - - removed = restClientTenant2.removeEntity(RestConstants.AUTOSCALING_POLICIES, - policyId, RestConstants.AUTOSCALING_POLICIES_NAME); - assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId), - removed, true); - - log.info("-------------------------Ended autoscaling policy test case---------------------------"); - } catch (Exception e) { - log.error("An error occurred while handling [autoscaling policy] " + policyId, e); - assertTrue("An error occurred while handling [autoscaling policy] " + policyId, false); - } - } -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java deleted file mode 100644 index b784baf..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.stratos.integration.tests.policies; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.beans.partition.NetworkPartitionBean; -import org.apache.stratos.common.beans.partition.NetworkPartitionReferenceBean; -import org.apache.stratos.common.beans.partition.PartitionReferenceBean; -import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean; -import org.apache.stratos.integration.tests.RestConstants; -import org.apache.stratos.integration.tests.StratosTestServerManager; -import org.testng.annotations.Test; - -import static junit.framework.Assert.*; - -/** - * Test to handle Deployment policy CRUD operations - */ -public class DeploymentPolicyTest extends StratosTestServerManager { - private static final Log log = LogFactory.getLog(DeploymentPolicyTest.class); - private static final String RESOURCES_PATH = "/deployment-policy-test"; - - - @Test - public void testDeploymentPolicy() { - try { - String deploymentPolicyId = "deployment-policy-deployment-policy-test"; - log.info("-------------------------Started deployment policy test case-------------------------"); - - boolean addedN1 = 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 = 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 = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" + - deploymentPolicyId + ".json", - RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertEquals(addedDep, true); - - DeploymentPolicyBean bean = (DeploymentPolicyBean) restClientTenant1. - getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, - DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); - - NetworkPartitionReferenceBean nw1 = bean.getNetworkPartitions().get(0); - NetworkPartitionReferenceBean nw2 = bean.getNetworkPartitions().get(1); - PartitionReferenceBean nw1P1 = nw1.getPartitions().get(0); - PartitionReferenceBean nw2P1 = nw2.getPartitions().get(0); - PartitionReferenceBean nw2P2 = nw2.getPartitions().get(1); - - assertEquals(bean.getId(), "deployment-policy-deployment-policy-test"); - assertEquals(bean.getNetworkPartitions().size(), 2); - assertEquals(nw1.getId(), "network-partition-deployment-policy-test-1"); - assertEquals(nw1.getPartitionAlgo(), "one-after-another"); - assertEquals(nw1.getPartitions().size(), 1); - assertEquals(nw1P1.getId(), "partition-1"); - assertEquals(nw1P1.getPartitionMax(), 20); - - assertEquals(nw2.getId(), "network-partition-deployment-policy-test-2"); - assertEquals(nw2.getPartitionAlgo(), "round-robin"); - assertEquals(nw2.getPartitions().size(), 2); - assertEquals(nw2P1.getId(), - "network-partition-6-partition-1"); - assertEquals(nw2P1.getPartitionMax(), 10); - assertEquals(nw2P2.getId(), - "network-partition-6-partition-2"); - assertEquals(nw2P2.getPartitionMax(), 9); - - //update network partition - boolean updated = 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 = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + - "/" + deploymentPolicyId + "-v1.json", RestConstants.DEPLOYMENT_POLICIES, - RestConstants.DEPLOYMENT_POLICIES_NAME); - assertEquals(updatedDep, true); - - DeploymentPolicyBean updatedBean = (DeploymentPolicyBean) restClientTenant1. - getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, - DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); - - nw1 = updatedBean.getNetworkPartitions().get(0); - nw2 = updatedBean.getNetworkPartitions().get(1); - nw1P1 = nw1.getPartitions().get(0); - PartitionReferenceBean nw1P2 = nw1.getPartitions().get(1); - nw2P1 = nw2.getPartitions().get(0); - nw2P2 = nw2.getPartitions().get(1); - - assertEquals(updatedBean.getId(), "deployment-policy-deployment-policy-test"); - assertEquals(updatedBean.getNetworkPartitions().size(), 2); - assertEquals(nw1.getId(), "network-partition-deployment-policy-test-1"); - assertEquals(nw1.getPartitionAlgo(), "one-after-another"); - assertEquals(nw1.getPartitions().size(), 2); - assertEquals(nw1P1.getId(), "partition-1"); - assertEquals(nw1P1.getPartitionMax(), 25); - assertEquals(nw1P2.getId(), "partition-2"); - assertEquals(nw1P2.getPartitionMax(), 20); - - assertEquals(nw2.getId(), "network-partition-deployment-policy-test-2"); - assertEquals(nw2.getPartitionAlgo(), "round-robin"); - assertEquals(nw2.getPartitions().size(), 2); - assertEquals(nw2P1.getId(), - "network-partition-6-partition-1"); - assertEquals(nw2P1.getPartitionMax(), 15); - assertEquals(nw2P2.getId(), - "network-partition-6-partition-2"); - assertEquals(nw2P2.getPartitionMax(), 5); - - updatedBean = (DeploymentPolicyBean) restClientTenant2. - getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, - DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertNull("Deployment policy found in tenant 2",updatedBean); - - addedN1 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + - "network-partition-deployment-policy-test-1" + ".json", - RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(addedN1, true); - - addedN2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + - "network-partition-deployment-policy-test-2" + ".json", - RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(addedN2, true); - - addedDep = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" + - deploymentPolicyId + ".json", - RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertEquals(addedDep, true); - - bean = (DeploymentPolicyBean) restClientTenant2. - getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, - DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertNotNull("Deployment policy not exist in other tenant",bean); - - boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, - "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME); - //Trying to remove the used network partition - assertEquals(removedNet, false); - - boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES, - deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertEquals(removedDep, true); - - DeploymentPolicyBean beanRemovedDep = (DeploymentPolicyBean) restClientTenant1. - getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, - DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertEquals(beanRemovedDep, null); - - boolean removedN1 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, - "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(removedN1, true); - - 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 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, - "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(removedN2, true); - - NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClientTenant1. - getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2", - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(beanRemovedN2, null); - - bean = (DeploymentPolicyBean) restClientTenant2. - getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, - DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertNotNull("Deployment policy not exist in other tenant",bean); - - removedDep = restClientTenant2.removeEntity(RestConstants.DEPLOYMENT_POLICIES, - deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertEquals(removedDep, true); - - beanRemovedDep = (DeploymentPolicyBean) restClientTenant2. - getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId, - DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME); - assertEquals(beanRemovedDep, null); - - removedN1 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS, - "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(removedN1, true); - - beanRemovedN1 = (NetworkPartitionBean) restClientTenant2. - getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-1", - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(beanRemovedN1, null); - - removedN2 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS, - "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(removedN2, true); - - beanRemovedN2 = (NetworkPartitionBean) restClientTenant2. - getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2", - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(beanRemovedN2, null); - - log.info("-------------------------Ended deployment policy test case-------------------------"); - - } catch (Exception e) { - log.error("An error occurred while handling deployment policy", e); - assertTrue("An error occurred while handling deployment policy", false); - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java deleted file mode 100644 index de5c4fd..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.stratos.integration.tests.policies; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.beans.partition.NetworkPartitionBean; -import org.apache.stratos.common.beans.partition.PartitionBean; -import org.apache.stratos.integration.tests.RestConstants; -import org.apache.stratos.integration.tests.StratosTestServerManager; -import org.testng.annotations.Test; - -import static junit.framework.Assert.*; - -/** - * Test to handle Network partition CRUD operations - */ -public class NetworkPartitionTest extends StratosTestServerManager { - private static final Log log = LogFactory.getLog(NetworkPartitionTest.class); - private static final String RESOURCES_PATH = "/network-partition-test"; - - - @Test - public void testNetworkPartition() { - try { - String networkPartitionId = "network-partition-network-partition-test"; - log.info("-------------------------Started network partition test case-------------------------"); - - boolean added = restClientTenant1.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + - networkPartitionId + ".json", - RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); - - assertEquals(added, true); - NetworkPartitionBean bean = (NetworkPartitionBean) restClientTenant1. - getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - - PartitionBean p1 = bean.getPartitions().get(0); - assertEquals(bean.getId(), "network-partition-network-partition-test"); - assertEquals(bean.getPartitions().size(), 1); - assertEquals(p1.getId(), "partition-1"); - assertEquals(p1.getProperty().get(0).getName(), "region"); - assertEquals(p1.getProperty().get(0).getValue(), "default"); - - boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + - networkPartitionId + "-v1.json", - RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); - - assertEquals(updated, true); - NetworkPartitionBean updatedBean = (NetworkPartitionBean) restClientTenant1. - getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - - PartitionBean p2 = updatedBean.getPartitions().get(1); - assertEquals(updatedBean.getId(), "network-partition-network-partition-test"); - assertEquals(updatedBean.getPartitions().size(), 2); - assertEquals(p2.getId(), "partition-2"); - assertEquals(p2.getProperty().get(0).getName(), "region"); - assertEquals(p2.getProperty().get(0).getValue(), "default1"); - assertEquals(p2.getProperty().get(1).getName(), "zone"); - assertEquals(p2.getProperty().get(1).getValue(), "z1"); - - updatedBean = (NetworkPartitionBean) restClientTenant2. - getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertNull("Network partition found in tenant 2",updatedBean); - - added = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" + - networkPartitionId + ".json", - RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME); - - assertEquals(added, true); - bean = (NetworkPartitionBean) restClientTenant2. - getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertNotNull("Network partition not exist in other tenant",bean); - - boolean removed = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS, - networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(removed, true); - - NetworkPartitionBean beanRemoved = (NetworkPartitionBean) restClientTenant1. - getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(beanRemoved, null); - - bean = (NetworkPartitionBean) restClientTenant2. - getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertNotNull("Network partition not exist in other tenant",bean); - - removed = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS, - networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(removed, true); - - beanRemoved = (NetworkPartitionBean) restClientTenant2. - getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId, - NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME); - assertEquals(beanRemoved, null); - - log.info("-------------------------Ended network partition test case-------------------------"); - } catch (Exception e) { - log.error("An error occurred while handling network partitions", e); - assertTrue("An error occurred while handling network partitions", false); - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java deleted file mode 100644 index 168713e..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/ErrorResponse.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.rest; - -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; - -/** - * Error response. - */ -@XmlRootElement(name = "errorResponse") -public class ErrorResponse implements Serializable { - - private int errorCode; - private String errorMessage; - - public ErrorResponse() { - } - - public ErrorResponse(int errorCode, String errorMessage) { - this.setErrorCode(errorCode); - this.setErrorMessage(errorMessage); - } - - public int getErrorCode() { - return errorCode; - } - - public void setErrorCode(int errorCode) { - this.errorCode = errorCode; - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java deleted file mode 100644 index 8ac5619..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponse.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.rest; - -/** - * Created by reka on 7/28/15. - */ -public class HttpResponse { - - private int statusCode; - private String content; - private String reason; - - public int getStatusCode() { - return statusCode; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getReason() { - return reason; - } - - public void setReason(String reason) { - this.reason = reason; - } - - @Override - public String toString() { - return "HttpResponse [statusCode=" + statusCode + ", content=" + content - + ", reason=" + reason + "]"; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java deleted file mode 100644 index 532fc5e..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/HttpResponseHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.rest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpEntity; -import org.apache.http.StatusLine; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.ResponseHandler; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; - -/** - * Rest http response handler - */ -public class HttpResponseHandler implements ResponseHandler<HttpResponse> { - private static final Log log = LogFactory.getLog(HttpResponseHandler.class); - - @Override - public HttpResponse handleResponse(org.apache.http.HttpResponse response) throws ClientProtocolException, - IOException { - StatusLine statusLine = response.getStatusLine(); - HttpEntity entity = response.getEntity(); - if (entity == null) { - throw new ClientProtocolException("Response contains no content"); - } - - BufferedReader reader = new BufferedReader(new InputStreamReader( - (response.getEntity().getContent()))); - - String output; - String result = ""; - - while ((output = reader.readLine()) != null) { - result += output; - } - - HttpResponse httpResponse = new HttpResponse(); - httpResponse.setStatusCode(statusLine.getStatusCode()); - httpResponse.setContent(result); - httpResponse.setReason(statusLine.getReasonPhrase()); - - if (log.isDebugEnabled()) { - log.debug("Extracted Http Response: " + httpResponse.toString()); - } - - return httpResponse; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java deleted file mode 100644 index f53ca90..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/IntegrationMockClient.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.rest; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.PoolingClientConnectionManager; -import org.apache.stratos.mock.iaas.client.MockIaasApiClient; -import org.apache.stratos.mock.iaas.client.rest.HttpResponse; -import org.apache.stratos.mock.iaas.client.rest.HttpResponseHandler; - -import java.net.URI; - -/** - * Mock client - */ -public class IntegrationMockClient extends MockIaasApiClient { - private static final Log log = LogFactory.getLog(IntegrationMockClient.class); - private static final String INSTANCES_CONTEXT = "/instances/"; - private DefaultHttpClient httpClient; - private String endpoint; - - public IntegrationMockClient(String endpoint) { - super(endpoint); - this.endpoint = endpoint; - PoolingClientConnectionManager cm = new PoolingClientConnectionManager(); - // Increase max total connection to 200 - cm.setMaxTotal(200); - // Increase default max connection per route to 50 - cm.setDefaultMaxPerRoute(50); - - httpClient = new DefaultHttpClient(cm); - httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient); - } - - public boolean terminateInstance(String instanceId) { - try { - if (log.isDebugEnabled()) { - log.debug(String.format("Terminate instance: [instance-id] %s", instanceId)); - } - URI uri = new URIBuilder(endpoint + INSTANCES_CONTEXT + instanceId).build(); - org.apache.stratos.mock.iaas.client.rest.HttpResponse response = doDelete(uri); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return true; - } else { - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - throw new RuntimeException("An unknown error occurred"); - } catch (Exception e) { - String message = "Could not start mock instance"; - throw new RuntimeException(message, e); - } - } - - public HttpResponse doDelete(URI resourcePath) throws Exception { - HttpDelete httpDelete = null; - try { - httpDelete = new HttpDelete(resourcePath); - httpDelete.addHeader("Content-Type", "application/json"); - - return httpClient.execute(httpDelete, new HttpResponseHandler()); - } finally { - releaseConnection(httpDelete); - } - } - - private void releaseConnection(HttpRequestBase request) { - if (request != null) { - request.releaseConnection(); - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java deleted file mode 100644 index 66c6a73..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/RestClient.java +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.rest; - - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParser; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.client.methods.*; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.PoolingClientConnectionManager; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.lang.reflect.Type; -import java.net.URI; - -/** - * Rest client to handle rest requests - */ -public class RestClient { - private static final Log log = LogFactory.getLog(RestClient.class); - private DefaultHttpClient httpClient; - private String endPoint; - private String userName; - private String password; - - public RestClient() { - PoolingClientConnectionManager cm = new PoolingClientConnectionManager(); - // Increase max total connection to 200 - cm.setMaxTotal(200); - // Increase default max connection per route to 50 - cm.setDefaultMaxPerRoute(50); - - httpClient = new DefaultHttpClient(cm); - httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient); - } - - public RestClient(String endPoint, String userName, String password) { - this(); - this.endPoint = endPoint; - this.setUserName(userName); - this.setPassword(password); - } - - /** - * Handle http post request. Return String - * - * @param resourcePath This should be REST endpoint - * @param jsonParamString The json string which should be executed from the post request - * @return The HttpResponse - * @throws Exception if any errors occur when executing the request - */ - public HttpResponse doPost(URI resourcePath, String jsonParamString) throws Exception { - HttpPost postRequest = null; - try { - postRequest = new HttpPost(resourcePath); - StringEntity input = new StringEntity(jsonParamString); - input.setContentType("application/json"); - postRequest.setEntity(input); - - String userPass = getUsernamePassword(); - String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8")); - postRequest.addHeader("Authorization", basicAuth); - - return httpClient.execute(postRequest, new HttpResponseHandler()); - } finally { - releaseConnection(postRequest); - } - } - - /** - * Handle http get request. Return String - * - * @param resourcePath This should be REST endpoint - * @return The HttpResponse - * @throws org.apache.http.client.ClientProtocolException and IOException - * if any errors occur when executing the request - */ - public HttpResponse doGet(URI resourcePath) throws Exception { - HttpGet getRequest = null; - try { - getRequest = new HttpGet(resourcePath); - getRequest.addHeader("Content-Type", "application/json"); - String userPass = getUsernamePassword(); - String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8")); - getRequest.addHeader("Authorization", basicAuth); - - return httpClient.execute(getRequest, new HttpResponseHandler()); - } finally { - releaseConnection(getRequest); - } - } - - public HttpResponse doDelete(URI resourcePath) throws Exception { - HttpDelete httpDelete = null; - try { - httpDelete = new HttpDelete(resourcePath); - httpDelete.addHeader("Content-Type", "application/json"); - String userPass = getUsernamePassword(); - String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8")); - httpDelete.addHeader("Authorization", basicAuth); - return httpClient.execute(httpDelete, new HttpResponseHandler()); - } finally { - releaseConnection(httpDelete); - } - } - - public HttpResponse doPut(URI resourcePath, String jsonParamString) throws Exception { - - HttpPut putRequest = null; - try { - putRequest = new HttpPut(resourcePath); - - StringEntity input = new StringEntity(jsonParamString); - input.setContentType("application/json"); - putRequest.setEntity(input); - String userPass = getUsernamePassword(); - String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8")); - putRequest.addHeader("Authorization", basicAuth); - return httpClient.execute(putRequest, new HttpResponseHandler()); - } finally { - releaseConnection(putRequest); - } - } - - private void releaseConnection(HttpRequestBase request) { - if (request != null) { - request.releaseConnection(); - } - } - - public boolean addEntity(String filePath, String resourcePath, String entityName) { - try { - String content = getJsonStringFromFile(filePath); - URI uri = new URIBuilder(this.endPoint + resourcePath).build(); - - HttpResponse response = doPost(uri, content); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return true; - } else { - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - String msg = "An unknown error occurred while trying to add "; - log.error(msg + entityName); - throw new RuntimeException(msg + entityName); - } catch (Exception e) { - String message = "Could not add " + entityName; - log.error(message, e); - throw new RuntimeException(message, e); - } - } - - public boolean deployEntity(String resourcePath, String entityName) { - try { - URI uri = new URIBuilder(this.endPoint + resourcePath).build(); - - HttpResponse response = doPost(uri, ""); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return true; - } else { - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - String msg = "An unknown error occurred while trying to deploy "; - log.error(msg + entityName); - throw new RuntimeException(msg + entityName); - } catch (Exception e) { - String message = "Could not deploy " + entityName; - log.error(message, e); - throw new RuntimeException(message, e); - } - } - - public boolean undeployEntity(String resourcePath, String entityName) { - try { - URI uri = new URIBuilder(this.endPoint + resourcePath).build(); - - HttpResponse response = doPost(uri, ""); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return true; - } else { - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - String msg = "An unknown error occurred while trying to undeploy "; - log.error(msg + entityName); - throw new RuntimeException(msg + entityName); - } catch (Exception e) { - String message = "Could not deploy " + entityName; - log.error(message, e); - throw new RuntimeException(message, e); - } - } - - public Object getEntity(String resourcePath, String identifier, Class responseJsonClass, - String entityName) { - try { - URI uri = new URIBuilder(this.endPoint + resourcePath + "/" + identifier).build(); - HttpResponse response = doGet(uri); - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return gson.fromJson(response.getContent(), responseJsonClass); - } else if (response.getStatusCode() == 404) { - return null; - } else { - ErrorResponse errorResponse = gson.fromJson(response.getContent(), - ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - String msg = "An unknown error occurred while getting the " + entityName; - log.error(msg); - throw new RuntimeException(msg); - } catch (Exception e) { - String message = "Could not get " + entityName; - log.error(message, e); - throw new RuntimeException(message, e); - } - } - - public Object listEntity(String resourcePath, Type type, String entityName) { - try { - URI uri = new URIBuilder(this.endPoint + resourcePath).build(); - HttpResponse response = doGet(uri); - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return gson.fromJson(response.getContent(), type); - } else if (response.getStatusCode() == 404) { - return null; - } else { - ErrorResponse errorResponse = gson.fromJson(response.getContent(), - ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - String msg = "An unknown error occurred while getting the " + entityName; - log.error(msg); - throw new RuntimeException(msg); - } catch (Exception e) { - String message = "Could not get " + entityName; - log.error(message, e); - throw new RuntimeException(message, e); - } - } - - public boolean removeEntity(String resourcePath, String identifier, String entityName) { - try { - URI uri = new URIBuilder(this.endPoint + "/" + resourcePath + "/" + identifier).build(); - HttpResponse response = doDelete(uri); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return true; - } else if (response.getContent().contains("it is used") || response.getContent().contains("in use")) { - return false; - } else { - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - ErrorResponse errorResponse = gson.fromJson(response.getContent(), - ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - String msg = "An unknown error occurred while removing the " + entityName; - log.error(msg); - throw new RuntimeException(msg); - } catch (Exception e) { - String message = "Could not remove " + entityName; - log.error(message, e); - throw new RuntimeException(message, e); - } - } - - public boolean updateEntity(String filePath, String resourcePath, String entityName) { - try { - String content = getJsonStringFromFile(filePath); - URI uri = new URIBuilder(this.endPoint + resourcePath).build(); - - HttpResponse response = doPut(uri, content); - if (response != null) { - if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) { - return true; - } else { - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - ErrorResponse errorResponse = gson.fromJson(response.getContent(), - ErrorResponse.class); - if (errorResponse != null) { - throw new RuntimeException(errorResponse.getErrorMessage()); - } - } - } - String msg = "An unknown error occurred while trying to update "; - log.error(msg + entityName); - throw new RuntimeException(msg + entityName); - } catch (Exception e) { - String message = "Could not update " + entityName; - log.error(message, e); - throw new RuntimeException(message, e); - } - } - - /** - * Get the json string from the artifacts directory - * - * @param filePath path of the artifacts - * @return json string of the relevant artifact - * @throws FileNotFoundException - */ - public String getJsonStringFromFile(String filePath) throws FileNotFoundException { - JsonParser parser = new JsonParser(); - Object object = parser.parse(new FileReader(getResourcesFolderPath() + filePath)); - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - return gson.toJson(object); - } - - /** - * Get resources folder path - * - * @return the resource path - */ - private String getResourcesFolderPath() { - String path = getClass().getResource("/").getPath(); - return StringUtils.removeEnd(path, File.separator); - } - - /** - * Get the username and password - * - * @return username:password - */ - private String getUsernamePassword() { - return this.getUserName() + ":" + this.getPassword(); - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java deleted file mode 100644 index 848f4f2..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/rest/WebClientWrapper.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.rest; - -import org.apache.http.client.HttpClient; -import org.apache.http.conn.ClientConnectionManager; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.impl.client.DefaultHttpClient; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -public class WebClientWrapper { - public static HttpClient wrapClient(HttpClient base) { - try { - SSLContext ctx = SSLContext.getInstance("TLS"); - X509TrustManager tm = new X509TrustManager() { - public void checkClientTrusted(X509Certificate[] xcs, - String string) throws CertificateException { - } - - public void checkServerTrusted(X509Certificate[] xcs, - String string) throws CertificateException { - } - - public X509Certificate[] getAcceptedIssuers() { - return null; - } - }; - ctx.init(null, new TrustManager[]{tm}, null); - SSLSocketFactory ssf = new SSLSocketFactory(ctx); - ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); - ClientConnectionManager ccm = base.getConnectionManager(); - SchemeRegistry sr = ccm.getSchemeRegistry(); - sr.register(new Scheme("https", ssf, 443)); - return new DefaultHttpClient(ccm, base.getParams()); - } catch (Exception ex) { - return null; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java deleted file mode 100644 index a1998e1..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.stratos.integration.tests.users; - -import org.apache.stratos.integration.tests.RestConstants; -import org.apache.stratos.integration.tests.StratosTestServerManager; -import org.testng.annotations.Test; - -import static junit.framework.Assert.assertTrue; - -/** - * Handling users - */ -public class TenantTest extends StratosTestServerManager { - private static final String RESOURCES_PATH = "/user-test"; - - - @Test - public void addUser() { - String tenantId = "tenant-1"; - boolean addedUser1 = restClientAdmin.addEntity(RESOURCES_PATH + "/" + - tenantId + ".json", - RestConstants.USERS, RestConstants.USERS_NAME); - assertTrue(addedUser1); - - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java deleted file mode 100644 index 1b083df..0000000 --- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.integration.tests.users; - -import com.google.gson.reflect.TypeToken; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.beans.UserInfoBean; -import org.apache.stratos.common.beans.cartridge.CartridgeBean; -import org.apache.stratos.integration.tests.RestConstants; -import org.apache.stratos.integration.tests.StratosTestServerManager; -import org.testng.annotations.Test; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.*; - -/** - * Handling users - */ -public class UserTest extends StratosTestServerManager { - private static final Log log = LogFactory.getLog(UserTest.class); - private static final String RESOURCES_PATH = "/user-test"; - - @Test - public void addUser() { - try { - log.info("-------------------------------Started users test case-------------------------------"); - String userId = "user-1"; - boolean addedUser1 = restClientAdmin.addEntity(RESOURCES_PATH + "/" + - userId + ".json", - RestConstants.USERS, RestConstants.USERS_NAME); - assertTrue(addedUser1); - - Type listType = new TypeToken<ArrayList<UserInfoBean>>() { - }.getType(); - - List<UserInfoBean> userInfoBeanList = (List<UserInfoBean>) restClientAdmin.listEntity(RestConstants.USERS, - listType, RestConstants.USERS_NAME); - - UserInfoBean bean1 = null; - for (UserInfoBean userInfoBean : userInfoBeanList) { - if (userInfoBean.getUserName().equals(userId)) { - bean1 = userInfoBean; - } - } - assertNotNull(bean1); - /*assertEquals(bean1.getEmail(), "[email protected]"); - assertEquals(bean1.getFirstName(), "Frank"); - assertEquals(bean1.getRole(), "admin"); - assertEquals(bean1.getLastName(), "Myers"); - assertEquals(bean1.getCredential(), "kim12345");*/ - - boolean updatedUser1 = restClientAdmin.updateEntity(RESOURCES_PATH + "/" + - userId + "-v1.json", - RestConstants.USERS, RestConstants.USERS_NAME); - assertTrue(updatedUser1); - - userInfoBeanList = (List<UserInfoBean>) restClientAdmin.listEntity(RestConstants.USERS, - listType, RestConstants.USERS_NAME); - - for (UserInfoBean userInfoBean : userInfoBeanList) { - if (userInfoBean.getUserName().equals(userId)) { - bean1 = userInfoBean; - } - } - assertNotNull(bean1); - /*assertEquals(bean1.getEmail(), "[email protected]"); - assertEquals(bean1.getFirstName(), "Frankn"); - assertEquals(bean1.getRole(), "admin"); - assertEquals(bean1.getLastName(), "Myersn"); - assertEquals(bean1.getCredential(), "kim123456");*/ - - boolean removedUser1 = restClientAdmin.removeEntity(RestConstants.USERS, - userId, RestConstants.USERS_NAME); - assertTrue(removedUser1); - - userInfoBeanList = (List<UserInfoBean>) restClientAdmin.listEntity(RestConstants.USERS, - listType, RestConstants.USERS_NAME); - - bean1 = null; - for (UserInfoBean userInfoBean : userInfoBeanList) { - if (userInfoBean.getUserName().equals(userId)) { - bean1 = userInfoBean; - } - } - assertNull(bean1); - - log.info("-------------------------Ended users test case-------------------------"); - - } catch (Exception e) { - log.error("An error occurred while handling application bursting", e); - assertTrue("An error occurred while handling application bursting", false); - } - - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json deleted file mode 100644 index 4d1d35f..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id": "application-policy-application-bursting-test", - "algorithm": "one-after-another", - "networkPartitions": [ - "network-partition-application-bursting-test-1", - "network-partition-application-bursting-test-2" - ], - "properties": [ - { - "name": "networkPartitionGroups", - "value": "network-partition-application-bursting-test-1|network-partition-application-bursting-test-2" - }, - { - "name": "key-2", - "value": "value-2" - } - ] -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json deleted file mode 100644 index c091ec5..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "applicationId": "application-bursting-test", - "alias": "my-cartridge-group-app", - "components": { - "groups": [ - { - "name": "esb-php-group-application-bursting-test", - "alias": "my-esb-php-group-application-bursting-test", - "deploymentPolicy": "deployment-policy-application-bursting-test", - "groupMinInstances": 1, - "groupMaxInstances": 2, - "cartridges": [ - { - "type": "esb-application-bursting-test", - "cartridgeMin": 1, - "cartridgeMax": 2, - "subscribableInfo": { - "alias": "my-esb-application-bursting-test", - "autoscalingPolicy": "autoscaling-policy-application-bursting-test", - "artifactRepository": { - "privateRepo": false, - "repoUrl": "https://github.com/imesh/stratos-esb-applications.git", - "repoUsername": "", - "repoPassword": "" - } - } - }, - { - "type": "php-application-bursting-test", - "cartridgeMin": 2, - "cartridgeMax": 4, - "lvsVirtualIP": "192.168.56.50|255.255.255.0", - "subscribableInfo": { - "alias": "my-php-application-bursting-test", - "autoscalingPolicy": "autoscaling-policy-application-bursting-test", - "artifactRepository": { - "privateRepo": false, - "repoUrl": "https://github.com/imesh/stratos-php-applications.git", - "repoUsername": "", - "repoPassword": "" - } - } - } - ] - } - ], - "cartridges": [ - { - "type": "tomcat-application-bursting-test", - "cartridgeMin": 2, - "cartridgeMax": 4, - "subscribableInfo": { - "alias": "my-tomcat-application-bursting-test", - "autoscalingPolicy": "autoscaling-policy-application-bursting-test", - "deploymentPolicy": "deployment-policy-application-bursting-test", - "artifactRepository": { - "privateRepo": false, - "repoUrl": "https://github.com/imesh/stratos-tomcat-applications.git", - "repoUsername": "", - "repoPassword": "" - } - } - } - ], - "dependencies": { - "terminationBehaviour": "terminate-none" - } - } -} - http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json deleted file mode 100644 index 697cb70..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "autoscaling-policy-application-bursting-test", - "loadThresholds": { - "requestsInFlight": { - "threshold": 35 - }, - "memoryConsumption": { - "threshold": 45 - }, - "loadAverage": { - "threshold": 25 - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json deleted file mode 100644 index 8fbab89..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "esb-php-group-application-bursting-test", - "cartridges": [ - "esb-application-bursting-test", - "php-application-bursting-test" - ], - "dependencies": { - "startupOrders": [ - { - "aliases": [ - "cartridge.my-esb-application-bursting-test", - "cartridge.my-php-application-bursting-test" - ] - } - ], - "terminationBehaviour": "terminate-none" - } -} - http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json deleted file mode 100755 index d97f9ff..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "type": "esb-application-bursting-test", - "provider": "apache", - "host": "stratos.apache.org", - "category": "framework", - "displayName": "esb-application-bursting-test", - "description": "esb-application-bursting-test Cartridge", - "version": "7", - "multiTenant": "false", - "portMapping": [ - { - "name": "http-22", - "protocol": "http", - "port": "22", - "proxyPort": "8280" - } - ], - "deployment": { - }, - "iaasProvider": [ - { - "type": "mock", - "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e", - "networkInterfaces": [ - { - "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e" - } - ], - "property": [ - { - "name": "instanceType", - "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594" - }, - { - "name": "keyPair", - "value": "vishanth-key" - }, - { - "name": "securityGroups", - "value": "default" - } - ] - } - ], - "metadataKeys": [ - "server_ip", - "username", - "password" - ] -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json deleted file mode 100755 index 02d0d9d..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "type": "php-application-bursting-test", - "provider": "apache", - "category": "framework", - "host": "php.stratos.org", - "displayName": "php-application-bursting-test", - "description": "php-application-bursting-test Cartridge", - "version": "7", - "multiTenant": "false", - "portMapping": [ - { - "name": "http-80", - "protocol": "http", - "port": "8080", - "proxyPort": "8280" - }, - { - "name": "http-22", - "protocol": "tcp", - "port": "22", - "proxyPort": "8222" - } - ], - "deployment": { - }, - "iaasProvider": [ - { - "type": "mock", - "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e", - "networkInterfaces": [ - { - "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e" - } - ], - "property": [ - { - "name": "instanceType", - "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594" - }, - { - "name": "keyPair", - "value": "reka" - }, - { - "name": "securityGroups", - "value": "default" - } - ] - } - ] -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json deleted file mode 100755 index b63d568..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "type": "tomcat-application-bursting-test", - "provider": "apache", - "host": "tomcat.stratos.org", - "category": "framework", - "displayName": "tomcat-application-bursting-test", - "description": "tomcat-application-bursting-test Cartridge", - "version": "7", - "multiTenant": "false", - "portMapping": [ - { - "name": "http-22", - "protocol": "http", - "port": "22", - "proxyPort": "8280" - }, - { - "protocol": "http", - "port": "8080", - "proxyPort": "80" - } - ], - "deployment": { - }, - "iaasProvider": [ - { - "type": "mock", - "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e", - "networkInterfaces": [ - { - "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e" - } - ], - "property": [ - { - "name": "instanceType", - "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594" - }, - { - "name": "keyPair", - "value": "vishanth-key" - }, - { - "name": "securityGroups", - "value": "default" - } - ] - } - ], - "metadataKeys": [ - "url" - ] -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json b/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json deleted file mode 100644 index 4adc0f2..0000000 --- a/products/stratos/modules/integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "id": "deployment-policy-application-bursting-test", - "networkPartitions": [ - { - "id": "network-partition-application-bursting-test-1", - "partitionAlgo": "one-after-another", - "partitions": [ - { - "id": "partition-1", - "partitionMax": 4 - } - ] - }, - { - "id": "network-partition-application-bursting-test-2", - "partitionAlgo": "round-robin", - "partitions": [ - { - "id": "network-partition-10-partition-1", - "partitionMax": 4 - }, - { - "id": "network-partition-10-partition-2", - "partitionMax": 4 - } - ] - } - ] -} - - -
