http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java new file mode 100644 index 0000000..de9e2d7 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java @@ -0,0 +1,144 @@ +/* + * 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.common.RestConstants; +import org.apache.stratos.integration.tests.StratosIntegrationTest; +import org.testng.annotations.Test; + +import static org.testng.AssertJUnit.*; + +/** + * Test to handle autoscaling policy CRUD operations + */ +public class AutoscalingPolicyTest extends StratosIntegrationTest { + private static final Log log = LogFactory.getLog(AutoscalingPolicyTest.class); + private static final String RESOURCES_PATH = "/autoscaling-policy-test"; + + @Test(timeOut = GLOBAL_TEST_TIMEOUT) + 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/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java new file mode 100644 index 0000000..89ee78a --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java @@ -0,0 +1,234 @@ +/* + * 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.common.RestConstants; +import org.apache.stratos.integration.tests.StratosIntegrationTest; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; +import static org.testng.AssertJUnit.*; + +/** + * Test to handle Deployment policy CRUD operations + */ +public class DeploymentPolicyTest extends StratosIntegrationTest { + private static final Log log = LogFactory.getLog(DeploymentPolicyTest.class); + private static final String RESOURCES_PATH = "/deployment-policy-test"; + + @Test(timeOut = GLOBAL_TEST_TIMEOUT) + 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); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java new file mode 100644 index 0000000..c50c61d --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java @@ -0,0 +1,126 @@ +/* + * 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.common.RestConstants; +import org.apache.stratos.integration.tests.StratosIntegrationTest; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; +import static org.testng.AssertJUnit.*; + +/** + * Test to handle Network partition CRUD operations + */ +public class NetworkPartitionTest extends StratosIntegrationTest { + private static final Log log = LogFactory.getLog(NetworkPartitionTest.class); + private static final String RESOURCES_PATH = "/network-partition-test"; + + @Test(timeOut = GLOBAL_TEST_TIMEOUT) + 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); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java new file mode 100644 index 0000000..494e3fc --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTest.java @@ -0,0 +1,42 @@ +/* + * 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.common.RestConstants; +import org.apache.stratos.integration.tests.StratosIntegrationTest; +import org.testng.annotations.Test; + +import static junit.framework.Assert.assertTrue; + +/** + * Handling users + */ +public class TenantTest extends StratosIntegrationTest { + private static final String RESOURCES_PATH = "/user-test"; + + @Test(timeOut = GLOBAL_TEST_TIMEOUT) + public void addUser() { + String tenantId = "tenant-1"; + boolean addedUser1 = restClientAdmin.addEntity(RESOURCES_PATH + "/" + + tenantId + ".json", + RestConstants.USERS, RestConstants.USERS_NAME); + assertTrue(addedUser1); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java new file mode 100644 index 0000000..d073699 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTest.java @@ -0,0 +1,114 @@ +/* + * 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.integration.common.RestConstants; +import org.apache.stratos.integration.tests.StratosIntegrationTest; +import org.testng.annotations.Test; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +import static org.testng.Assert.assertNull; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertTrue; + +/** + * Handling users + */ +public class UserTest extends StratosIntegrationTest { + private static final Log log = LogFactory.getLog(UserTest.class); + private static final String RESOURCES_PATH = "/user-test"; + + @Test(timeOut = GLOBAL_TEST_TIMEOUT) + 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); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json new file mode 100644 index 0000000..4d1d35f --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/application-policies/application-policy-application-bursting-test.json @@ -0,0 +1,18 @@ +{ + "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/test-integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json new file mode 100644 index 0000000..c091ec5 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/applications/app-bursting-single-cartriddge-group.json @@ -0,0 +1,70 @@ +{ + "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/test-integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json new file mode 100644 index 0000000..697cb70 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/autoscaling-policies/autoscaling-policy-application-bursting-test.json @@ -0,0 +1,14 @@ +{ + "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/test-integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json new file mode 100644 index 0000000..8fbab89 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges-groups/esb-php-group-application-bursting-test.json @@ -0,0 +1,19 @@ +{ + "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/test-integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json new file mode 100755 index 0000000..d97f9ff --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/esb-application-bursting-test.json @@ -0,0 +1,50 @@ +{ + "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/test-integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json new file mode 100755 index 0000000..02d0d9d --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/php-application-bursting-test.json @@ -0,0 +1,51 @@ +{ + "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/test-integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json new file mode 100755 index 0000000..b63d568 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/cartridges/mock/tomcat-application-bursting-test.json @@ -0,0 +1,53 @@ +{ + "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/test-integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json new file mode 100644 index 0000000..4adc0f2 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/deployment-policies/deployment-policy-application-bursting-test.json @@ -0,0 +1,32 @@ +{ + "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 + } + ] + } + ] +} + + + http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-1.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-1.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-1.json new file mode 100644 index 0000000..78f7d01 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-1.json @@ -0,0 +1,15 @@ +{ + "id": "network-partition-application-bursting-test-1", + "provider": "mock", + "partitions": [ + { + "id": "partition-1", + "property": [ + { + "name": "region", + "value": "default" + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-2.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-2.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-2.json new file mode 100644 index 0000000..588bfff --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-bursting-test/network-partitions/mock/network-partition-application-bursting-test-2.json @@ -0,0 +1,24 @@ +{ + "id": "network-partition-application-bursting-test-2", + "provider": "mock", + "partitions": [ + { + "id": "network-partition-10-partition-1", + "property": [ + { + "name": "region", + "value": "default" + } + ] + }, + { + "id": "network-partition-10-partition-2", + "property": [ + { + "name": "region", + "value": "default" + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-1.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-1.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-1.json new file mode 100644 index 0000000..da3e8ef --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-1.json @@ -0,0 +1,18 @@ +{ + "id": "application-policy-application-policy-test-1", + "algorithm": "one-after-another", + "networkPartitions": [ + "network-partition-application-policy-test-1", + "network-partition-application-policy-test-2" + ], + "properties": [ + { + "name": "networkPartitionGroups", + "value": "network-partition-application-policy-test-1,network-partition-application-policy-test-2" + }, + { + "name": "key-2", + "value": "value-2" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-2.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-2.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-2.json new file mode 100644 index 0000000..ec3715c --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test-2.json @@ -0,0 +1,18 @@ +{ + "id": "application-policy-application-policy-test-2", + "algorithm": "one-after-another", + "networkPartitions": [ + "network-partition-application-policy-test-1", + "network-partition-application-policy-test-2" + ], + "properties": [ + { + "name": "networkPartitionGroups", + "value": "network-partition-application-policy-test-1,network-partition-application-policy-test-2" + }, + { + "name": "key-2", + "value": "value-2" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test.json new file mode 100644 index 0000000..cf1aace --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/application-policies/application-policy-application-policy-test.json @@ -0,0 +1,18 @@ +{ + "id": "application-policy-application-policy-test", + "algorithm": "one-after-another", + "networkPartitions": [ + "network-partition-application-policy-test-1", + "network-partition-application-policy-test-2" + ], + "properties": [ + { + "name": "networkPartitionGroups", + "value": "network-partition-application-policy-test-1,network-partition-application-policy-test-2" + }, + { + "name": "key-2", + "value": "value-2" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-1.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-1.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-1.json new file mode 100644 index 0000000..79a9024 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-1.json @@ -0,0 +1,24 @@ +{ + "id": "network-partition-application-policy-test-1", + "provider": "mock", + "partitions": [ + { + "id": "network-partition-8-partition-1", + "property": [ + { + "name": "region", + "value": "default" + } + ] + }, + { + "id": "network-partition-8-partition-2", + "property": [ + { + "name": "region", + "value": "default" + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-2.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-2.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-2.json new file mode 100644 index 0000000..a802378 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-policy-test/network-partitions/mock/network-partition-application-policy-test-2.json @@ -0,0 +1,15 @@ +{ + "id": "network-partition-application-policy-test-2", + "provider": "mock", + "partitions": [ + { + "id": "partition-1", + "property": [ + { + "name": "region", + "value": "default" + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/application-policies/application-policy-application-update-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/application-policies/application-policy-application-update-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/application-policies/application-policy-application-update-test.json new file mode 100644 index 0000000..1b29165 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/application-policies/application-policy-application-update-test.json @@ -0,0 +1,18 @@ +{ + "id": "application-policy-application-update-test", + "algorithm": "one-after-another", + "networkPartitions": [ + "network-partition-application-update-test-1", + "network-partition-application-update-test-2" + ], + "properties": [ + { + "name": "networkPartitionGroups", + "value": "network-partition-application-update-test-1,network-partition-application-update-test-2" + }, + { + "name": "key-2", + "value": "value-2" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test-v1.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test-v1.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test-v1.json new file mode 100644 index 0000000..2509ab1 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test-v1.json @@ -0,0 +1,86 @@ +{ + "alias": "g-sc-G123-1-application-update-test", + "applicationId": "g-sc-G123-1-application-update-test", + "components": { + "cartridges": [], + "groups": [ + { + "name": "G1-application-update-test", + "groupMaxInstances": 1, + "groupMinInstances": 1, + "alias": "group1-application-update-test", + "cartridges": [ + { + "cartridgeMin": 2, + "cartridgeMax": 3, + "type": "c1-application-update-test", + "subscribableInfo": { + "alias": "c1-1x0-application-update-test", + "deploymentPolicy": "deployment-policy-application-update-test", + "artifactRepository": { + "repoUsername": "user", + "repoUrl": "http://stratos.apache.org:10080/git/default.git", + "privateRepo": true, + "repoPassword": "c-policy" + }, + "autoscalingPolicy": "autoscaling-policy-application-update-test" + } + } + ], + "groups": [ + { + "name": "G2-application-update-test", + "groupMaxInstances": 1, + "groupMinInstances": 1, + "alias": "group2-application-update-test", + "cartridges": [ + { + "cartridgeMin": 2, + "cartridgeMax": 4, + "type": "c2-application-update-test", + "subscribableInfo": { + "alias": "c2-1x0-application-update-test", + "deploymentPolicy": "deployment-policy-application-update-test", + "artifactRepository": { + "repoUsername": "user", + "repoUrl": "http://stratos.apache.org:10080/git/default.git", + "privateRepo": true, + "repoPassword": "c-policy" + }, + "autoscalingPolicy": "autoscaling-policy-application-update-test" + } + } + ], + "groups": [ + { + "name": "G3-application-update-test", + "groupMaxInstances": 3, + "groupMinInstances": 2, + "deploymentPolicy": "deployment-policy-application-update-test", + "alias": "group3-application-update-test", + "cartridges": [ + { + "cartridgeMin": 2, + "cartridgeMax": 3, + "type": "c3-application-update-test", + "subscribableInfo": { + "alias": "c3-1x0-application-update-test", + "artifactRepository": { + "repoUsername": "user", + "repoUrl": "http://stratos.apache.org:10080/git/default.git", + "privateRepo": true, + "repoPassword": "c-policy" + }, + "autoscalingPolicy": "autoscaling-policy-application-update-test" + } + } + ], + "groups": [] + } + ] + } + ] + } + ] + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test.json new file mode 100644 index 0000000..548e66c --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/applications/g-sc-G123-1-application-update-test.json @@ -0,0 +1,86 @@ +{ + "alias": "g-sc-G123-1-application-update-test", + "applicationId": "g-sc-G123-1-application-update-test", + "components": { + "cartridges": [], + "groups": [ + { + "name": "G1-application-update-test", + "groupMaxInstances": 1, + "groupMinInstances": 1, + "alias": "group1-application-update-test", + "cartridges": [ + { + "cartridgeMin": 1, + "cartridgeMax": 2, + "type": "c1-application-update-test", + "subscribableInfo": { + "alias": "c1-1x0-application-update-test", + "deploymentPolicy": "deployment-policy-application-update-test", + "artifactRepository": { + "repoUsername": "user", + "repoUrl": "http://stratos.apache.org:10080/git/default.git", + "privateRepo": true, + "repoPassword": "c-policy" + }, + "autoscalingPolicy": "autoscaling-policy-application-update-test" + } + } + ], + "groups": [ + { + "name": "G2-application-update-test", + "groupMaxInstances": 1, + "groupMinInstances": 1, + "alias": "group2-application-update-test", + "cartridges": [ + { + "cartridgeMin": 1, + "cartridgeMax": 2, + "type": "c2-application-update-test", + "subscribableInfo": { + "alias": "c2-1x0-application-update-test", + "deploymentPolicy": "deployment-policy-application-update-test", + "artifactRepository": { + "repoUsername": "user", + "repoUrl": "http://stratos.apache.org:10080/git/default.git", + "privateRepo": true, + "repoPassword": "c-policy" + }, + "autoscalingPolicy": "autoscaling-policy-application-update-test" + } + } + ], + "groups": [ + { + "name": "G3-application-update-test", + "groupMaxInstances": 2, + "groupMinInstances": 1, + "deploymentPolicy": "deployment-policy-application-update-test", + "alias": "group3-application-update-test", + "cartridges": [ + { + "cartridgeMin": 1, + "cartridgeMax": 2, + "type": "c3-application-update-test", + "subscribableInfo": { + "alias": "c3-1x0-application-update-test", + "artifactRepository": { + "repoUsername": "user", + "repoUrl": "http://stratos.apache.org:10080/git/default.git", + "privateRepo": true, + "repoPassword": "c-policy" + }, + "autoscalingPolicy": "autoscaling-policy-application-update-test" + } + } + ], + "groups": [] + } + ] + } + ] + } + ] + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/autoscaling-policies/autoscaling-policy-application-update-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/autoscaling-policies/autoscaling-policy-application-update-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/autoscaling-policies/autoscaling-policy-application-update-test.json new file mode 100644 index 0000000..8d9b766 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/autoscaling-policies/autoscaling-policy-application-update-test.json @@ -0,0 +1,14 @@ +{ + "id": "autoscaling-policy-application-update-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/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test-v1.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test-v1.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test-v1.json new file mode 100644 index 0000000..884ea0c --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test-v1.json @@ -0,0 +1,50 @@ +{ + "name": "G1-application-update-test", + "dependencies": { + "terminationBehaviour": "terminate-none", + "startupOrders": [ + { + "aliases": [ + "group.group2-application-update-test", + "cartridge.c1-1x0-application-update-test" + ] + } + ] + }, + "cartridges": [ + "c1-application-update-test" + ], + "groups": [ + { + "name": "G2-application-update-test", + "dependencies": { + "terminationBehaviour": "terminate-dependents", + "startupOrders": [ + { + "aliases": [ + "group.group3-application-update-test", + "cartridge.c2-1x0-application-update-test" + ] + } + ] + }, + "cartridges": [ + "c2-application-update-test" + ], + "groups": [ + { + "name": "G3-application-update-test", + "dependencies": { + "terminationBehaviour": "terminate-all", + "startupOrders": [] + }, + "cartridges": [ + "c3-application-update-test" + ], + "groups": [] + } + ] + } + ] +} + http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test.json new file mode 100644 index 0000000..884ea0c --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges-groups/cartrdige-nested-application-update-test.json @@ -0,0 +1,50 @@ +{ + "name": "G1-application-update-test", + "dependencies": { + "terminationBehaviour": "terminate-none", + "startupOrders": [ + { + "aliases": [ + "group.group2-application-update-test", + "cartridge.c1-1x0-application-update-test" + ] + } + ] + }, + "cartridges": [ + "c1-application-update-test" + ], + "groups": [ + { + "name": "G2-application-update-test", + "dependencies": { + "terminationBehaviour": "terminate-dependents", + "startupOrders": [ + { + "aliases": [ + "group.group3-application-update-test", + "cartridge.c2-1x0-application-update-test" + ] + } + ] + }, + "cartridges": [ + "c2-application-update-test" + ], + "groups": [ + { + "name": "G3-application-update-test", + "dependencies": { + "terminationBehaviour": "terminate-all", + "startupOrders": [] + }, + "cartridges": [ + "c3-application-update-test" + ], + "groups": [] + } + ] + } + ] +} + http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c1-application-update-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c1-application-update-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c1-application-update-test.json new file mode 100755 index 0000000..fcfa6f2 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c1-application-update-test.json @@ -0,0 +1,45 @@ +{ + "type": "c1-application-update-test", + "provider": "apache", + "host": "stratos.apache.org", + "category": "data", + "displayName": "c1-application-update-test", + "description": "c1-application-update-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" + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c0664270/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c2-application-update-test.json ---------------------------------------------------------------------- diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c2-application-update-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c2-application-update-test.json new file mode 100755 index 0000000..a1c1a97 --- /dev/null +++ b/products/stratos/modules/integration/test-integration/src/test/resources/application-update-test/cartridges/mock/c2-application-update-test.json @@ -0,0 +1,45 @@ +{ + "type": "c2-application-update-test", + "provider": "apache", + "host": "stratos.apache.org", + "category": "data", + "displayName": "c2-application-update-test", + "description": "c2-application-update-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" + } + ] + } + ] +}
