You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/08/10 13:03:18 UTC
[2/6] stratos git commit: Add the updated integration tests
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
deleted file mode 100644
index 747ba80..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
+++ /dev/null
@@ -1,1035 +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;
-
-import org.apache.commons.exec.CommandLine;
-import org.apache.commons.exec.DefaultExecutor;
-import org.apache.commons.exec.PumpStreamHandler;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.autoscaler.stub.pojo.ApplicationContext;
-import org.apache.stratos.common.beans.PropertyBean;
-import org.apache.stratos.common.beans.application.ApplicationBean;
-import org.apache.stratos.common.beans.cartridge.CartridgeBean;
-import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
-import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
-import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
-import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
-import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
-import org.apache.stratos.common.client.AutoscalerServiceClient;
-import org.apache.stratos.common.threading.StratosThreadPool;
-import org.apache.stratos.integration.tests.rest.RestClient;
-import org.apache.stratos.messaging.domain.application.*;
-import org.apache.stratos.messaging.domain.instance.ClusterInstance;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.messaging.domain.topology.Member;
-import org.apache.stratos.messaging.domain.topology.MemberStatus;
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationsEventReceiver;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.rmi.RemoteException;
-import java.util.Collection;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-
-import static junit.framework.Assert.*;
-
-/**
- * Sample application tests.
- */
-public class SampleApplicationsTest extends StratosTestServerManager {
-
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-
- public static final int APPLICATION_ACTIVATION_TIMEOUT = 120000;
- public static final String APPLICATION_STATUS_CREATED = "Created";
- public static final String APPLICATION_STATUS_UNDEPLOYING = "Undeploying";
- private String endpoint = "https://localhost:9443";
-
- private ApplicationsEventReceiver applicationsEventReceiver;
- private TopologyEventReceiver topologyEventReceiver;
- private RestClient restClient = new RestClient();
- private AutoscalingPolicyTest autoscalingPolicyTest;
- private NetworkPartitionTest networkPartitionTest;
- private CartridgeTest cartridgeTest;
- private DeploymentPolicyTest deploymentPolicyTest;
- private CartridgeGroupTest cartridgeGroupTest;
- private ApplicationTest applicationTest;
- private ApplicationPolicyTest applicationPolicyTest;
-
-
- @BeforeClass
- public void setUp() {
- // Set jndi.properties.dir system property for initializing event receivers
- System.setProperty("jndi.properties.dir", getResourcesFolderPath());
- System.setProperty("autoscaler.service.url", "https://localhost:9443/services/AutoscalerService");
- autoscalingPolicyTest = new AutoscalingPolicyTest();
- networkPartitionTest = new NetworkPartitionTest();
- cartridgeTest = new CartridgeTest();
- deploymentPolicyTest = new DeploymentPolicyTest();
- cartridgeGroupTest = new CartridgeGroupTest();
- applicationTest = new ApplicationTest();
- applicationPolicyTest = new ApplicationPolicyTest();
- }
-
- @Test
- public void testSingleCartridgeApplication() {
- try {
- initializeApplicationEventReceiver();
- //runApplicationTest("simple/single-cartridge-app", "single-cartridge-app");
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred", false);
- }
- }
-
- @Test
- public void testAutoscalingPolicy() {
- try {
- boolean added = autoscalingPolicyTest.addAutoscalingPolicy("autoscaling-policy-c0.json",
- endpoint, restClient, "admin", "admin");
- assertEquals(added, true);
- AutoscalePolicyBean bean = autoscalingPolicyTest.getAutoscalingPolicy("autoscaling-policy-c0", endpoint,
- restClient, "admin", "admin");
- assertEquals(bean.getId(), "autoscaling-policy-c0");
- assertEquals(bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 35.0, 0.0);
- assertEquals(bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 45.0, 0.0);
- assertEquals(bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0);
-
- boolean updated = autoscalingPolicyTest.updateAutoscalingPolicy("autoscaling-policy-c0.json",
- endpoint, restClient,"admin","admin");
- assertEquals(updated, true);
- AutoscalePolicyBean updatedBean = autoscalingPolicyTest.getAutoscalingPolicy("autoscaling-policy-c0", endpoint,
- restClient,"admin","admin");
- assertEquals(updatedBean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0);
- assertEquals(updatedBean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 0.0);
- assertEquals(updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
-
- boolean removed = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-c0", endpoint,
- restClient, "admin", "admin");
- assertEquals(removed, true);
-
- AutoscalePolicyBean beanRemoved = autoscalingPolicyTest.getAutoscalingPolicy("autoscaling-policy-c0", endpoint,
- restClient, "admin", "admin");
- assertEquals(beanRemoved, null);
-
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred while handling autoscaling policy", false);
- }
- }
-
- @Test
- public void testCartridgeGroup() {
- try {
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", endpoint, restClient);
- assertEquals(addedC1, true);
-
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", endpoint, restClient);
- assertEquals(addedC2, true);
-
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", endpoint, restClient);
- assertEquals(addedC3, true);
-
-
- boolean added = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
- assertEquals(added, true);
- CartridgeGroupBean bean = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(bean.getName(), "G1");
-
- boolean updated = cartridgeGroupTest.updateCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
- assertEquals(updated, true);
- CartridgeGroupBean updatedBean = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(updatedBean.getName(), "G1");
- /*
- boolean removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
- restClient);
- assertEquals(removedC1, false);
-
- boolean removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
- restClient);
- assertEquals(removedC2, false);
-
- boolean removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
- restClient);
- assertEquals(removedC3, false); */
-
-
- boolean removed = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(removed, true);
-
- CartridgeGroupBean beanRemoved = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(beanRemoved, null);
-
- boolean removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
- restClient);
- assertEquals(removedC1, true);
-
- boolean removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
- restClient);
- assertEquals(removedC2, true);
-
- boolean removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
- restClient);
- assertEquals(removedC3, true);
-
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred while handling autoscaling policy", false);
- }
- }
-
- @Test
- public void testApplication() {
- try {
- boolean addedScalingPolicy = autoscalingPolicyTest.addAutoscalingPolicy("autoscaling-policy-1.json",
- endpoint, restClient, "admin", "admin");
- assertEquals(addedScalingPolicy, true);
-
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", endpoint, restClient);
- assertEquals(addedC1, true);
-
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", endpoint, restClient);
- assertEquals(addedC2, true);
-
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", endpoint, restClient);
- assertEquals(addedC3, true);
-
- boolean addedG1 = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
- assertEquals(addedG1, true);
- CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(beanG1.getName(), "G1");
-
- boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
- assertEquals(addedN1, true);
-
- boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- endpoint, restClient);
- assertEquals(addedN2, true);
-
- boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
- assertEquals(addedDep, true);
-
- boolean added = applicationTest.addApplication("g-sc-G123-1.json",
- endpoint, restClient);
- assertEquals(added, true);
- ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(bean.getApplicationId(), "g-sc-G123-1");
-
- assertEquals(bean.getComponents().getGroups().get(0).getName(), "G1");
- assertEquals(bean.getComponents().getGroups().get(0).getAlias(), "group1");
- assertEquals(bean.getComponents().getGroups().get(0).getGroupMaxInstances(), 1);
- assertEquals(bean.getComponents().getGroups().get(0).getGroupMinInstances(), 1);
-
- assertEquals(bean.getComponents().getGroups().get(0).getCartridges().get(0).getType(), "c1");
- assertEquals(bean.getComponents().getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 1);
- assertEquals(bean.getComponents().getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 2);
-
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getAlias(), "group2");
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getName(), "G2");
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroupMaxInstances(), 1);
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroupMinInstances(), 1);
-
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getCartridges().get(0).getType(), "c2");
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 1);
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 2);
-
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getAlias(), "group3");
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getName(), "G3");
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getGroupMaxInstances(), 2);
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getGroupMinInstances(), 1);
-
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getType(), "c3");
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 1);
- assertEquals(bean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 2);
-
-
- boolean updated = applicationTest.updateApplication("g-sc-G123-1.json",
- endpoint, restClient);
- assertEquals(updated, true);
-
- ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1", endpoint,
- restClient);
-
- assertEquals(bean.getApplicationId(), "g-sc-G123-1");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getName(), "G1");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getAlias(), "group1");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroupMaxInstances(), 1);
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroupMinInstances(), 1);
-
- assertEquals(updatedBean.getComponents().getGroups().get(0).getCartridges().get(0).getType(), "c1");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 2);
- assertEquals(updatedBean.getComponents().getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 3);
-
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getAlias(), "group2");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getName(), "G2");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroupMaxInstances(), 1);
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroupMinInstances(), 1);
-
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getCartridges().get(0).getType(), "c2");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 2);
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 4);
-
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getAlias(), "group3");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getName(), "G3");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getGroupMaxInstances(), 3);
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getGroupMinInstances(), 2);
-
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getType(), "c3");
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMin(), 2);
- assertEquals(updatedBean.getComponents().getGroups().get(0).getGroups().get(0).getGroups().get(0).getCartridges().get(0).getCartridgeMax(), 3);
-
- /*
- boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(removedGroup, false);
-
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
- restClient, "admin", "admin");
- assertEquals(removedAuto, false);
-
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- //Trying to remove the used network partition
- assertEquals(removedNet, false);
-
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
- restClient);
- assertEquals(removedDep, false); */
-
- boolean removed = applicationTest.removeApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(removed, true);
-
- ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(beanRemoved, null);
-
- boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(removedGroup, true);
-
- boolean removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
- restClient);
- assertEquals(removedC1, true);
-
- boolean removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
- restClient);
- assertEquals(removedC2, true);
-
- boolean removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
- restClient);
- assertEquals(removedC3, true);
-
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
- restClient, "admin", "admin");
- assertEquals(removedAuto, true);
-
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
- restClient);
- assertEquals(removedDep, true);
-
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(removedNet, true);
-
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
- restClient);
- assertEquals(removedN2, true);
-
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred while handling application", false);
- }
- }
-
- @Test
- public void testDeployApplication() {
- try {
- //Initializing event Receivers
- initializeApplicationEventReceiver();
- initializeTopologyEventReceiver();
-
- boolean addedScalingPolicy = autoscalingPolicyTest.addAutoscalingPolicy("autoscaling-policy-1.json",
- endpoint, restClient, "admin", "admin");
- assertEquals(addedScalingPolicy, true);
-
- boolean addedC1 = cartridgeTest.addCartridge("c1.json", endpoint, restClient);
- assertEquals(addedC1, true);
-
- boolean addedC2 = cartridgeTest.addCartridge("c2.json", endpoint, restClient);
- assertEquals(addedC2, true);
-
- boolean addedC3 = cartridgeTest.addCartridge("c3.json", endpoint, restClient);
- assertEquals(addedC3, true);
-
-
- boolean addedG1 = cartridgeGroupTest.addCartridgeGroup("cartrdige-nested.json",
- endpoint, restClient);
- assertEquals(addedG1, true);
-
-
- CartridgeGroupBean beanG1 = cartridgeGroupTest.getCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(beanG1.getName(), "G1");
-
- boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
- assertEquals(addedN1, true);
-
- boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- endpoint, restClient);
- assertEquals(addedN2, true);
-
- boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
- assertEquals(addedDep, true);
-
-
- boolean added = applicationTest.addApplication("g-sc-G123-1.json",
- endpoint, restClient);
- assertEquals(added, true);
- ApplicationBean bean = applicationTest.getApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(bean.getApplicationId(), "g-sc-G123-1");
-
- boolean addAppPolicy = applicationPolicyTest.addApplicationPolicy(
- "application-policy-1.json", endpoint, restClient);
- assertEquals(addAppPolicy, true);
-
- ApplicationPolicyBean policyBean = applicationPolicyTest.getApplicationPolicy(
- "application-policy-1", endpoint, restClient);
-
- //deploy the application
- boolean deployed = applicationTest.deployApplication(bean.getApplicationId(),
- policyBean.getId(), endpoint, restClient);
- assertEquals(deployed, true);
-
- //Application active handling
- assertApplicationActivation("g-sc-G123-1", -1234);
-
- //Group active handling
- assertGroupActivation("g-sc-G123-1", -1234);
-
- //Cluster active handling
- assertClusterActivation("g-sc-G123-1", -1234);
-
-
- //Updating application
- boolean updated = applicationTest.updateApplication("g-sc-G123-1.json",
- endpoint, restClient);
- assertEquals(updated, true);
-
- assertGroupInstanceCount(bean.getApplicationId(), "group3", 2);
- ApplicationBean updatedBean = applicationTest.getApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(updatedBean.getApplicationId(), "g-sc-G123-1");
-
- /* boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(removedGroup, false);
-
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
- restClient,"admin","admin");
- assertEquals(removedAuto, false);
-
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- //Trying to remove the used network partition
- assertEquals(removedNet, false);
-
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
- restClient);
- assertEquals(removedDep, false); */
-
- boolean unDeployed = applicationTest.undeployApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(unDeployed, true);
-
- assertApplicationUndeploy("g-sc-G123-1", -1234);
-
- boolean removed = applicationTest.removeApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(removed, true);
-
- ApplicationBean beanRemoved = applicationTest.getApplication("g-sc-G123-1", endpoint,
- restClient);
- assertEquals(beanRemoved, null);
-
- boolean removedGroup = cartridgeGroupTest.removeCartridgeGroup("G1", endpoint,
- restClient);
- assertEquals(removedGroup, true);
-
- boolean removedC1 = cartridgeTest.removeCartridge("c1", endpoint,
- restClient);
- assertEquals(removedC1, true);
-
- boolean removedC2 = cartridgeTest.removeCartridge("c2", endpoint,
- restClient);
- assertEquals(removedC2, true);
-
- boolean removedC3 = cartridgeTest.removeCartridge("c3", endpoint,
- restClient);
- assertEquals(removedC3, true);
-
- boolean removedAuto = autoscalingPolicyTest.removeAutoscalingPolicy("autoscaling-policy-1", endpoint,
- restClient,"admin","admin");
- assertEquals(removedAuto, true);
-
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
- restClient);
- assertEquals(removedDep, true);
-
- //Remove network partition used by application policy
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(removedNet, false);
-
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
- restClient);
- assertEquals(removedN2, false);
-
- boolean removeAppPolicy = applicationPolicyTest.removeApplicationPolicy("application-policy-1", endpoint,
- restClient);
- assertEquals(removeAppPolicy, true);
-
- removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(removedNet, true);
-
- removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
- restClient);
- assertEquals(removedN2, true);
-
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred while handling autoscaling policy", false);
- }
- }
-
- @Test
- public void testNetworkPartition() {
- try {
- boolean added = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
- assertEquals(added, true);
- NetworkPartitionBean bean = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(bean.getId(), "network-partition-1");
- assertEquals(bean.getPartitions().size(), 1);
- assertEquals(bean.getPartitions().get(0).getId(), "partition-1");
- assertEquals(bean.getPartitions().get(0).getProperty().get(0).getName(), "region");
- assertEquals(bean.getPartitions().get(0).getProperty().get(0).getValue(), "default");
-
- boolean updated = networkPartitionTest.updateNetworkPartition("network-partition-1.json",
- endpoint, restClient);
- assertEquals(updated, true);
- NetworkPartitionBean updatedBean = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(updatedBean.getId(), "network-partition-1");
- assertEquals(updatedBean.getPartitions().size(), 2);
- assertEquals(updatedBean.getPartitions().get(1).getId(), "partition-2");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(0).getName(), "region");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(0).getValue(), "default1");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getName(), "zone");
- assertEquals(updatedBean.getPartitions().get(1).getProperty().get(1).getValue(), "z1");
-
- boolean removed = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(removed, true);
-
- NetworkPartitionBean beanRemoved = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(beanRemoved, null);
-
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred while handling network partitions", false);
- }
- }
-
- @Test
- public void testDeploymentPolicy() {
- try {
- boolean addedN1 = networkPartitionTest.addNetworkPartition("network-partition-1.json",
- endpoint, restClient);
- assertEquals(addedN1, true);
-
- boolean addedN2 = networkPartitionTest.addNetworkPartition("network-partition-2.json",
- endpoint, restClient);
- assertEquals(addedN2, true);
-
- boolean addedDep = deploymentPolicyTest.addDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
- assertEquals(addedDep, true);
-
- DeploymentPolicyBean bean = deploymentPolicyTest.getDeploymentPolicy(
- "deployment-policy-1", endpoint, restClient);
- assertEquals(bean.getId(), "deployment-policy-1");
- assertEquals(bean.getNetworkPartitions().size(), 2);
- assertEquals(bean.getNetworkPartitions().get(0).getId(), "network-partition-1");
- assertEquals(bean.getNetworkPartitions().get(0).getPartitionAlgo(), "one-after-another");
- assertEquals(bean.getNetworkPartitions().get(0).getPartitions().size(), 1);
- assertEquals(bean.getNetworkPartitions().get(0).getPartitions().get(0).getId(), "partition-1");
- assertEquals(bean.getNetworkPartitions().get(0).getPartitions().get(0).getPartitionMax(), 20);
-
- assertEquals(bean.getNetworkPartitions().get(1).getId(), "network-partition-2");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitionAlgo(), "round-robin");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().size(), 2);
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(0).getId(),
- "network-partition-2-partition-1");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(0).getPartitionMax(), 10);
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(1).getId(),
- "network-partition-2-partition-2");
- assertEquals(bean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 9);
-
- //update network partition
- boolean updated = networkPartitionTest.updateNetworkPartition("network-partition-1.json",
- endpoint, restClient);
- assertEquals(updated, true);
-
- //update deployment policy with new partition and max values
-
- boolean updatedDep = deploymentPolicyTest.updateDeploymentPolicy("deployment-policy-1.json",
- endpoint, restClient);
- assertEquals(updatedDep, true);
-
- DeploymentPolicyBean updatedBean = deploymentPolicyTest.getDeploymentPolicy(
- "deployment-policy-1", endpoint, restClient);
- assertEquals(updatedBean.getId(), "deployment-policy-1");
- assertEquals(updatedBean.getNetworkPartitions().size(), 2);
- assertEquals(updatedBean.getNetworkPartitions().get(0).getId(), "network-partition-1");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitionAlgo(), "one-after-another");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().size(), 2);
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(0).getId(), "partition-1");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(0).getPartitionMax(), 25);
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(1).getId(), "partition-2");
- assertEquals(updatedBean.getNetworkPartitions().get(0).getPartitions().get(1).getPartitionMax(), 20);
-
- assertEquals(updatedBean.getNetworkPartitions().get(1).getId(), "network-partition-2");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitionAlgo(), "round-robin");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().size(), 2);
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(0).getId(),
- "network-partition-2-partition-1");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(0).getPartitionMax(), 15);
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(1).getId(),
- "network-partition-2-partition-2");
- assertEquals(updatedBean.getNetworkPartitions().get(1).getPartitions().get(1).getPartitionMax(), 5);
-
- boolean removedNet = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- //Trying to remove the used network partition
- assertEquals(removedNet, false);
-
- boolean removedDep = deploymentPolicyTest.removeDeploymentPolicy("deployment-policy-1", endpoint,
- restClient);
- assertEquals(removedDep, true);
-
- DeploymentPolicyBean beanRemovedDep = deploymentPolicyTest.getDeploymentPolicy("deployment-policy-1", endpoint,
- restClient);
- assertEquals(beanRemovedDep, null);
-
- boolean removedN1 = networkPartitionTest.removeNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(removedN1, true);
-
- NetworkPartitionBean beanRemovedN1 = networkPartitionTest.getNetworkPartition("network-partition-1", endpoint,
- restClient);
- assertEquals(beanRemovedN1, null);
-
- boolean removedN2 = networkPartitionTest.removeNetworkPartition("network-partition-2", endpoint,
- restClient);
- assertEquals(removedN2, true);
-
- NetworkPartitionBean beanRemovedN2 = networkPartitionTest.getNetworkPartition("network-partition-2", endpoint,
- restClient);
- assertEquals(beanRemovedN2, null);
-
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred while handling autoscaling policy", false);
- }
- }
-
- @Test
- public void testCartridge() {
- try {
- boolean added = cartridgeTest.addCartridge("c0.json", endpoint, restClient);
- assertEquals(added, true);
- CartridgeBean bean = cartridgeTest.getCartridge("c0", endpoint, restClient);
- assertEquals(bean.getType(), "c0");
- assertEquals(bean.getCategory(), "Application");
- assertEquals(bean.getHost(), "qmog.cisco.com");
- for (PropertyBean property : bean.getProperty()) {
- if (property.getName().equals("payload_parameter.CEP_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com");
- } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com");
- } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
- assertEquals(property.getValue(), "1");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin");
- } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
- assertEquals(property.getValue(), "test");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
- assertEquals(property.getValue(), "7711");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
- assertEquals(property.getValue(), "7611");
- } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
- assertEquals(property.getValue(), "7611");
- } else if (property.getName().equals("payload_parameter.MB_PORT")) {
- assertEquals(property.getValue(), "61616");
- }
- }
-
-
- boolean updated = cartridgeTest.updateCartridge("c0.json",
- endpoint, restClient);
- assertEquals(updated, true);
- CartridgeBean updatedBean = cartridgeTest.getCartridge("c0", endpoint,
- restClient);
- assertEquals(updatedBean.getType(), "c0");
- assertEquals(updatedBean.getCategory(), "Data");
- assertEquals(updatedBean.getHost(), "qmog.cisco.com12");
- for (PropertyBean property : updatedBean.getProperty()) {
- if (property.getName().equals("payload_parameter.CEP_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com123");
- } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin123");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com123");
- } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
- assertEquals(property.getValue(), "3");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin123");
- } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
- assertEquals(property.getValue(), "test123");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
- assertEquals(property.getValue(), "7712");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
- assertEquals(property.getValue(), "7612");
- } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
- assertEquals(property.getValue(), "7612");
- } else if (property.getName().equals("payload_parameter.MB_PORT")) {
- assertEquals(property.getValue(), "61617");
- }
- }
-
- boolean removed = cartridgeTest.removeCartridge("c0", endpoint,
- restClient);
- assertEquals(removed, true);
-
- CartridgeBean beanRemoved = cartridgeTest.getCartridge("c0", endpoint,
- restClient);
- assertEquals(beanRemoved, null);
-
- } catch (Exception e) {
- log.error(e);
- assertTrue("An error occurred while handling cartridges", false);
- }
- }
-
-
- private void runApplicationTest(String applicationId) {
- runApplicationTest(applicationId, applicationId);
- }
-
- private void runApplicationTest(String applicationFolderName, String applicationId) {
- executeCommand(getApplicationsPath() + "/" + applicationFolderName + "/scripts/mock/deploy.sh");
- assertApplicationActivation(applicationId, -1234);
- executeCommand(getApplicationsPath() + "/" + applicationFolderName + "/scripts/mock/undeploy.sh");
- assertApplicationNotExists(applicationId);
- }
-
- /**
- * Initialize application event receiver
- */
- private void initializeApplicationEventReceiver() {
- if (applicationsEventReceiver == null) {
- applicationsEventReceiver = new ApplicationsEventReceiver();
- ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER", 1);
- applicationsEventReceiver.setExecutorService(executorService);
- applicationsEventReceiver.execute();
- }
- }
-
- /**
- * Initialize Topology event receiver
- */
- private void initializeTopologyEventReceiver() {
- if (topologyEventReceiver == null) {
- topologyEventReceiver = new TopologyEventReceiver();
- ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER1", 1);
- topologyEventReceiver.setExecutorService(executorService);
- topologyEventReceiver.execute();
- }
- }
-
- /**
- * Execute shell command
- *
- * @param commandText
- */
- private void executeCommand(String commandText) {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- try {
- CommandLine commandline = CommandLine.parse(commandText);
- DefaultExecutor exec = new DefaultExecutor();
- PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream);
- exec.setStreamHandler(streamHandler);
- exec.execute(commandline);
- log.info(outputStream.toString());
- } catch (Exception e) {
- log.error(outputStream.toString(), e);
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Assert application activation
- *
- * @param applicationId
- */
- private void assertApplicationActivation(String applicationId, int tenantId) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplicationByTenant(applicationId, tenantId);
- while (!((application != null) && (application.getStatus() == ApplicationStatus.Active))) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplicationByTenant(applicationId, tenantId);
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- assertNotNull(String.format("Application is not found: [application-id] %s", application.getId()), application);
- assertEquals(String.format("Application status did not change to active: [application-id] %s", application.getId()),
- ApplicationStatus.Active, application.getStatus());
- }
-
- /**
- * Assert application activation
- *
- * @param applicationId
- */
- private void assertGroupActivation(String applicationId, int tenantId) {
- Application application = ApplicationManager.getApplications().getApplicationByTenant(applicationId, tenantId);
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationId), application);
-
- Collection<Group> groups = application.getAllGroupsRecursively();
- for(Group group : groups) {
- assertEquals(group.getInstanceContextCount() >= group.getGroupMinInstances(), true);
- }
- }
-
- /**
- * Assert application activation
- *
- * @param applicationId
- */
- private void assertClusterActivation(String applicationId, int tenantId) {
- Application application = ApplicationManager.getApplications().getApplicationByTenant(applicationId, tenantId);
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationId), application);
-
- Set<ClusterDataHolder> clusterDataHolderSet = application.getClusterDataRecursively();
- for(ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
- String serviceUuid = clusterDataHolder.getServiceUuid();
- String clusterId = clusterDataHolder.getClusterId();
- Service service = TopologyManager.getTopology().getService(serviceUuid);
- assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
- applicationId, serviceUuid), service);
-
- Cluster cluster = service.getCluster(clusterId);
- assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
- applicationId, serviceUuid, clusterId), cluster);
- boolean clusterActive = false;
-
- for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
- int activeInstances = 0;
- for (Member member : cluster.getMembers()) {
- if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
- if (member.getStatus().equals(MemberStatus.Active)) {
- activeInstances++;
- }
- }
- }
- clusterActive = activeInstances >= clusterDataHolder.getMinInstances();
- log.info(String.format("Active instance count: %s, Min instance count: %s", activeInstances,
- clusterDataHolder.getMinInstances()));
-
- if (!clusterActive) {
- break;
- }
- }
- assertEquals(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId),
- clusterActive, true);
- }
-
- }
-
-
- /**
- * Assert application activation
- *
- * @param applicationId
- */
- private void assertApplicationUndeploy(String applicationId, int tenantId) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplicationByTenant(applicationId, tenantId);
- ApplicationContext applicationContext = null;
- try {
- applicationContext = AutoscalerServiceClient.getInstance().getApplicationByTenant(applicationId, tenantId);
- } catch (RemoteException e) {
- log.error("Error while getting the application context for [application] " + applicationId);
- }
- while (((application != null) && application.getInstanceContextCount() > 0) ||
- (applicationContext == null || applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING))) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplicationByTenant(applicationId, tenantId);
- try {
- applicationContext = AutoscalerServiceClient.getInstance().getApplicationByTenant(applicationId, tenantId);
- } catch (RemoteException e) {
- log.error("Error while getting the application context for [application] " + applicationId);
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
-
- assertNotNull(String.format("Application is not found: [application-id] %s", applicationId), application);
- assertNotNull(String.format("Application Context is not found: [application-id] %s", applicationId),
- applicationContext);
-
- //Force undeployment after the graceful deployment
- if (application.getInstanceContextCount() > 0 ||
- applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
- log.info("Force undeployment is going to start for the [application] " + applicationId);
-
- applicationTest.forceUndeployApplication(applicationId, endpoint, restClient);
- while (application.getInstanceContextCount() > 0 ||
- applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplicationByTenant(applicationId, tenantId);
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- }
- assertEquals(String.format("Application status did not change to Created: [application-id] %s", applicationId),
- APPLICATION_STATUS_CREATED, applicationContext.getStatus());
-
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- private void assertGroupInstanceCount(String applicationName, String groupAlias, int count) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
- if (application != null) {
- Group group = application.getGroupRecursively(groupAlias);
- while (group.getInstanceContextCount() != count) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- for (GroupInstance instance : group.getInstanceIdToInstanceContextMap().values()) {
- while (!instance.getStatus().equals(GroupStatus.Active)) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ignore) {
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- }
- assertEquals(String.format("Application status did not change to active: [application-id] %s", applicationName),
- group.getInstanceContextCount(), count);
- }
- assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
-
- }
-
- private void assertApplicationNotExists(String applicationName) {
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNull(String.format("Application is found in the topology : [application-id] %s", applicationName), application);
- }
-
- /**
- * Get applications folder path
- *
- * @return
- */
- private String getApplicationsPath() {
- return getResourcesFolderPath() + "/../../../../../../samples/applications";
- }
-
- /**
- * Get resources folder path
- *
- * @return
- */
- private String getResourcesFolderPath() {
- String path = getClass().getResource("/").getPath();
- return StringUtils.removeEnd(path, File.separator);
- }
-
- private String getArtifactsPath() {
- return getResourcesFolderPath() + "/../../src/test/resources";
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java
deleted file mode 100644
index 9a81972..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosArtifactsUtils.java
+++ /dev/null
@@ -1,53 +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;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonParser;
-import org.apache.commons.lang.StringUtils;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-
-/**
- * Util class
- */
-public class StratosArtifactsUtils {
-
- 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();
- String content = gson.toJson(object);
- return content;
-
- }
-
- /**
- * Get resources folder path
- * @return
- */
- private String getResourcesFolderPath() {
- String path = getClass().getResource("/").getPath();
- return StringUtils.removeEnd(path, File.separator);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
index 4e7f404..f5648d6 100755
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
@@ -26,6 +26,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.stratos.common.test.TestLogAppender;
+import org.apache.stratos.integration.tests.application.SampleApplicationsTest;
+import org.apache.stratos.integration.tests.rest.RestClient;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.wso2.carbon.integration.framework.TestServerManager;
@@ -53,20 +55,23 @@ public class StratosTestServerManager extends TestServerManager {
private static final String MOCK_IAAS_XML_FILE = "mock-iaas.xml";
private static final String JNDI_PROPERTIES_FILE = "jndi.properties";
private static final String JMS_OUTPUT_ADAPTER_FILE = "JMSOutputAdaptor.xml";
+ protected RestClient restClient;
+ private String endpoint = "https://localhost:9443";
+ private BrokerService broker = new BrokerService();
+ private TestLogAppender testLogAppender = new TestLogAppender();
private ServerUtils serverUtils;
private String carbonHome;
public StratosTestServerManager() {
super(CARBON_ZIP, PORT_OFFSET);
serverUtils = new ServerUtils();
+ restClient = new RestClient(endpoint, "admin", "admin");
}
@Override
@BeforeSuite(timeOut = 600000)
public String startServer() throws IOException {
-
- TestLogAppender testLogAppender = new TestLogAppender();
Logger.getRootLogger().addAppender(testLogAppender);
Logger.getRootLogger().setLevel(Level.INFO);
@@ -74,13 +79,15 @@ public class StratosTestServerManager extends TestServerManager {
// Start ActiveMQ
long time1 = System.currentTimeMillis();
log.info("Starting ActiveMQ...");
- BrokerService broker = new BrokerService();
+ broker.setDataDirectory(StratosTestServerManager.class.getResource("/").getPath() +
+ File.separator + ".." + File.separator + "activemq-data");
broker.setBrokerName("testBroker");
broker.addConnector(ACTIVEMQ_BIND_ADDRESS);
broker.start();
long time2 = System.currentTimeMillis();
- log.info(String.format("ActiveMQ started in %d sec", (time2 - time1)/1000));
- } catch (Exception e) {
+ log.info(String.format("ActiveMQ started in %d sec", (time2 - time1) / 1000));
+ }
+ catch (Exception e) {
throw new RuntimeException("Could not start ActiveMQ", e);
}
@@ -104,24 +111,48 @@ public class StratosTestServerManager extends TestServerManager {
this.serverUtils.startServerUsingCarbonHome(carbonHome, carbonHome, "stratos", PORT_OFFSET, null);
FrameworkSettings.init();
- while (!serverStarted(testLogAppender)) {
+ while (!serverStarted()) {
log.info("Waiting for topology to be initialized...");
Thread.sleep(5000);
}
+ while (!mockServiceStarted()) {
+ log.info("Waiting for mock service to be initialized...");
+ Thread.sleep(1000);
+ }
+
long time4 = System.currentTimeMillis();
- log.info(String.format("Stratos server started in %d sec", (time4 - time3)/1000));
+ log.info(String.format("Stratos server started in %d sec", (time4 - time3) / 1000));
return carbonHome;
}
- } catch (Exception e) {
+ }
+ catch (Exception e) {
throw new RuntimeException("Could not start Stratos server", e);
}
}
+ private boolean mockServiceStarted() {
+ for (String message : testLogAppender.getMessages()) {
+ if (message.contains("Mock IaaS service component activated")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
@AfterSuite(timeOut = 600000)
public void stopServer() throws Exception {
super.stopServer();
+ /*
+ while (!serverStopped()) {
+ log.info("Waiting for server to be shutdown...");
+ Thread.sleep(1000);
+ }
+ log.info("Stopped Apache Stratos server.");
+ */
+ broker.stop();
+ log.info("Stopped ActiveMQ server.");
}
protected void copyArtifacts(String carbonHome) throws IOException {
@@ -144,9 +175,19 @@ public class StratosTestServerManager extends TestServerManager {
log.info(sourceFilePath + " file copied");
}
- private boolean serverStarted(TestLogAppender testLogAppender) {
- for(String message : testLogAppender.getMessages()) {
- if(message.contains("Topology initialized")) {
+ private boolean serverStopped() {
+ for (String message : testLogAppender.getMessages()) {
+ if (message.contains("Halting JVM")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ private boolean serverStarted() {
+ for (String message : testLogAppender.getMessages()) {
+ if (message.contains("Topology initialized")) {
return true;
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/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
index 208f960..34a9d75 100644
--- 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
@@ -19,19 +19,32 @@
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.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();
@@ -44,17 +57,22 @@ public class RestClient {
httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient);
}
+ public RestClient(String endPoint, String userName, String password) {
+ this();
+ this.endPoint = endPoint;
+ this.userName = userName;
+ this.password = password;
+ }
+
/**
* Handle http post request. Return String
*
* @param resourcePath This should be REST endpoint
* @param jsonParamString The json string which should be executed from the post request
- * @param userName
- * @param password
* @return The HttpResponse
* @throws Exception if any errors occur when executing the request
*/
- public HttpResponse doPost(URI resourcePath, String jsonParamString, String userName, String password) throws Exception {
+ public HttpResponse doPost(URI resourcePath, String jsonParamString) throws Exception {
HttpPost postRequest = null;
try {
postRequest = new HttpPost(resourcePath);
@@ -62,7 +80,7 @@ public class RestClient {
input.setContentType("application/json");
postRequest.setEntity(input);
- String userPass = userName + ":" + password;
+ String userPass = getUsernamePassword();
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
postRequest.addHeader("Authorization", basicAuth);
@@ -76,18 +94,16 @@ public class RestClient {
* Handle http get request. Return String
*
* @param resourcePath This should be REST endpoint
- * @param userName
- * @param password
* @return The HttpResponse
* @throws org.apache.http.client.ClientProtocolException and IOException
* if any errors occur when executing the request
*/
- public HttpResponse doGet(URI resourcePath, String userName, String password) throws Exception {
+ public HttpResponse doGet(URI resourcePath) throws Exception {
HttpGet getRequest = null;
try {
getRequest = new HttpGet(resourcePath);
getRequest.addHeader("Content-Type", "application/json");
- String userPass = userName + ":" + password;
+ String userPass = getUsernamePassword();
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
getRequest.addHeader("Authorization", basicAuth);
@@ -97,12 +113,12 @@ public class RestClient {
}
}
- public HttpResponse doDelete(URI resourcePath, String userName, String password) throws Exception {
+ public HttpResponse doDelete(URI resourcePath) throws Exception {
HttpDelete httpDelete = null;
try {
httpDelete = new HttpDelete(resourcePath);
httpDelete.addHeader("Content-Type", "application/json");
- String userPass = userName + ":" + password;
+ 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());
@@ -111,7 +127,7 @@ public class RestClient {
}
}
- public HttpResponse doPut(URI resourcePath, String jsonParamString, String userName, String password) throws Exception {
+ public HttpResponse doPut(URI resourcePath, String jsonParamString) throws Exception {
HttpPut putRequest = null;
try {
@@ -120,7 +136,7 @@ public class RestClient {
StringEntity input = new StringEntity(jsonParamString);
input.setContentType("application/json");
putRequest.setEntity(input);
- String userPass = userName + ":" + password;
+ 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());
@@ -134,4 +150,208 @@ public class RestClient {
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 boolean removeEntity(String resourcePath, String identifier, String entityName) {
+ try {
+ URI uri = new URIBuilder(this.endPoint + "/" + resourcePath + "/" + identifier).build();
+ HttpResponse response = doDelete(uri);
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return true;
+ } else if (response.getContent().contains("it is used") || response.getContent().contains("in use")) {
+ return false;
+ } else {
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ Gson gson = gsonBuilder.create();
+ ErrorResponse errorResponse = gson.fromJson(response.getContent(),
+ ErrorResponse.class);
+ if (errorResponse != null) {
+ throw new RuntimeException(errorResponse.getErrorMessage());
+ }
+ }
+ }
+ String msg = "An unknown error occurred while removing the " + entityName;
+ log.error(msg);
+ throw new RuntimeException(msg);
+ } catch (Exception e) {
+ String message = "Could not remove " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ public boolean updateEntity(String filePath, String resourcePath, String entityName) {
+ try {
+ String content = getJsonStringFromFile(filePath);
+ URI uri = new URIBuilder(this.endPoint + resourcePath).build();
+
+ HttpResponse response = doPut(uri, content);
+ if (response != null) {
+ if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
+ return true;
+ } else {
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ Gson gson = gsonBuilder.create();
+ ErrorResponse errorResponse = gson.fromJson(response.getContent(),
+ ErrorResponse.class);
+ if (errorResponse != null) {
+ throw new RuntimeException(errorResponse.getErrorMessage());
+ }
+ }
+ }
+ String msg = "An unknown error occurred while trying to update ";
+ log.error(msg + entityName);
+ throw new RuntimeException(msg + entityName);
+ } catch (Exception e) {
+ String message = "Could not update " + entityName;
+ log.error(message, e);
+ throw new RuntimeException(message, e);
+ }
+ }
+
+ /**
+ * Get the json string from the artifacts directory
+ *
+ * @param filePath path of the artifacts
+ * @return json string of the relevant artifact
+ * @throws FileNotFoundException
+ */
+ public String getJsonStringFromFile(String filePath) throws FileNotFoundException {
+ JsonParser parser = new JsonParser();
+ Object object = parser.parse(new FileReader(getResourcesFolderPath() + filePath));
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ Gson gson = gsonBuilder.create();
+ return gson.toJson(object);
+ }
+
+ /**
+ * Get resources folder path
+ *
+ * @return the resource path
+ */
+ private String getResourcesFolderPath() {
+ String path = getClass().getResource("/").getPath();
+ return StringUtils.removeEnd(path, File.separator);
+ }
+
+ /**
+ * Get the username and password
+ *
+ * @return username:password
+ */
+ private String getUsernamePassword() {
+ return this.userName + ":" + this.password;
+ }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json b/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json
deleted file mode 100644
index 12b9bd4..0000000
--- a/products/stratos/modules/integration/src/test/resources/application-policies/application-policy-1.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "id": "application-policy-1",
- "algorithm": "one-after-another",
- "networkPartitions": [
- "network-partition-1",
- "network-partition-2"
- ],
- "properties": [
- {
- "name": "key-1",
- "value": "network-partition-1,network-partition-2"
- },
- {
- "name": "key-2",
- "value": "value-2"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md
deleted file mode 100644
index 4e092ea..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-Single Cartridge Application
-============================
-A simple application with a php cartridge.
-
-Application view
-----------------
-single-cartridge-app <br />
--- single-cartridge-app-1 <br />
--- -- my-php <br />
-
-Application folder structure
-----------------------------
--- artifacts/[iaas]/ IaaS specific artifacts <br />
--- scripts/common/ Common scripts for all iaases <br />
--- scripts/[iaas] IaaS specific scripts <br />
-
-How to run
-----------
-cd scripts/[iaas]/ <br />
-./deploy.sh <br />
-
-How to undeploy
----------------
-cd scripts/[iaas]/ <br />
-./undeploy.sh <br />
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json
deleted file mode 100644
index 76d72c8..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/g-sc-G123-1.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 1,
- "cartridgeMax": 2,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 1,
- "cartridgeMax": 2,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 2,
- "groupMinInstances": 1,
- "deploymentPolicy": "deployment-policy-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 1,
- "cartridgeMax": 2,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json b/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json
deleted file mode 100644
index a91c4e0..0000000
--- a/products/stratos/modules/integration/src/test/resources/applications/simple/single-cartridge-app/update/g-sc-G123-1.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "alias": "g-sc-G123-1",
- "applicationId": "g-sc-G123-1",
- "components": {
- "cartridges": [],
- "groups": [
- {
- "name": "G1",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group1",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c1",
- "subscribableInfo": {
- "alias": "c1-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G2",
- "groupMaxInstances": 1,
- "groupMinInstances": 1,
- "alias": "group2",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 4,
- "type": "c2",
- "subscribableInfo": {
- "alias": "c2-1x0",
- "deploymentPolicy": "deployment-policy-1",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": [
- {
- "name": "G3",
- "groupMaxInstances": 3,
- "groupMinInstances": 2,
- "deploymentPolicy": "deployment-policy-1",
- "alias": "group3",
- "cartridges": [
- {
- "cartridgeMin": 2,
- "cartridgeMax": 3,
- "type": "c3",
- "subscribableInfo": {
- "alias": "c3-1x0",
- "artifactRepository": {
- "repoUsername": "user",
- "repoUrl": "http://stratos.apache.org:10080/git/default.git",
- "privateRepo": true,
- "repoPassword": "c-policy"
- },
- "autoscalingPolicy": "autoscaling-policy-1"
- }
- }
- ],
- "groups": []
- }
- ]
- }
- ]
- }
- ]
- }
-}