Adding smoke test suite, adding SampleApplicationStartupTestCase to cover basic 
functionality


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

Branch: refs/heads/stratos-4.1.x
Commit: 973c05b5738b2c4d3f41d9bdbe23f43972a5401f
Parents: 644803f
Author: Akila Perera <[email protected]>
Authored: Mon Sep 14 01:33:30 2015 +0530
Committer: Akila Perera <[email protected]>
Committed: Mon Sep 14 01:33:30 2015 +0530

----------------------------------------------------------------------
 .../org.apache.stratos.rest.endpoint/pom.xml    |   1 +
 .../integration/common/rest/RestClient.java     |  77 +++++---
 .../test-integration/run-smoke-test.sh          |  24 +++
 .../SampleApplicationStartupTestCase.java       | 196 +++++++++++++++++++
 ...ication-policy-sample-applications-test.json |  17 ++
 .../sample-applications-test-1.json             |  24 +++
 ...scaling-policy-sample-applications-test.json |  14 ++
 .../mock/c1-sample-applications-test.json       |  45 +++++
 ...loyment-policy-sample-applications-test.json |  18 ++
 ...rk-partition-sample-applications-test-1.json |  15 ++
 10 files changed, 401 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/components/org.apache.stratos.rest.endpoint/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/pom.xml 
b/components/org.apache.stratos.rest.endpoint/pom.xml
index c671254..016a95c 100644
--- a/components/org.apache.stratos.rest.endpoint/pom.xml
+++ b/components/org.apache.stratos.rest.endpoint/pom.xml
@@ -69,6 +69,7 @@
                         </resource>
                     </webResources>
                     <warName>api</warName>
+                    <attachClasses>true</attachClasses>
                 </configuration>
             </plugin>
         </plugins>

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-common/src/main/java/org/apache/stratos/integration/common/rest/RestClient.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-common/src/main/java/org/apache/stratos/integration/common/rest/RestClient.java
 
b/products/stratos/modules/integration/test-common/src/main/java/org/apache/stratos/integration/common/rest/RestClient.java
index 50783fa..f1beec7 100644
--- 
a/products/stratos/modules/integration/test-common/src/main/java/org/apache/stratos/integration/common/rest/RestClient.java
+++ 
b/products/stratos/modules/integration/test-common/src/main/java/org/apache/stratos/integration/common/rest/RestClient.java
@@ -80,11 +80,13 @@ public class RestClient {
             postRequest.setEntity(input);
 
             String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
+            String basicAuth =
+                    "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
             postRequest.addHeader("Authorization", basicAuth);
 
             return httpClient.execute(postRequest, new HttpResponseHandler());
-        } finally {
+        }
+        finally {
             releaseConnection(postRequest);
         }
     }
@@ -103,11 +105,13 @@ public class RestClient {
             getRequest = new HttpGet(resourcePath);
             getRequest.addHeader("Content-Type", "application/json");
             String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
+            String basicAuth =
+                    "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
             getRequest.addHeader("Authorization", basicAuth);
 
             return httpClient.execute(getRequest, new HttpResponseHandler());
-        } finally {
+        }
+        finally {
             releaseConnection(getRequest);
         }
     }
@@ -118,10 +122,12 @@ public class RestClient {
             httpDelete = new HttpDelete(resourcePath);
             httpDelete.addHeader("Content-Type", "application/json");
             String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
+            String basicAuth =
+                    "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
             httpDelete.addHeader("Authorization", basicAuth);
             return httpClient.execute(httpDelete, new HttpResponseHandler());
-        } finally {
+        }
+        finally {
             releaseConnection(httpDelete);
         }
     }
@@ -136,10 +142,12 @@ public class RestClient {
             input.setContentType("application/json");
             putRequest.setEntity(input);
             String userPass = getUsernamePassword();
-            String basicAuth = "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
+            String basicAuth =
+                    "Basic " + 
javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
             putRequest.addHeader("Authorization", basicAuth);
             return httpClient.execute(putRequest, new HttpResponseHandler());
-        } finally {
+        }
+        finally {
             releaseConnection(putRequest);
         }
     }
@@ -171,7 +179,8 @@ public class RestClient {
             String msg = "An unknown error occurred while trying to add ";
             log.error(msg + entityName);
             throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             String message = "Could not add " + entityName;
             log.error(message, e);
             throw new RuntimeException(message, e);
@@ -198,7 +207,8 @@ public class RestClient {
             String msg = "An unknown error occurred while trying to deploy ";
             log.error(msg + entityName);
             throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             String message = "Could not deploy  " + entityName;
             log.error(message, e);
             throw new RuntimeException(message, e);
@@ -225,7 +235,8 @@ public class RestClient {
             String msg = "An unknown error occurred while trying to undeploy ";
             log.error(msg + entityName);
             throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             String message = "Could not deploy  " + entityName;
             log.error(message, e);
             throw new RuntimeException(message, e);
@@ -255,7 +266,8 @@ public class RestClient {
             String msg = "An unknown error occurred while getting the " + 
entityName;
             log.error(msg);
             throw new RuntimeException(msg);
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             String message = "Could not get " + entityName;
             log.error(message, e);
             throw new RuntimeException(message, e);
@@ -284,21 +296,30 @@ public class RestClient {
             String msg = "An unknown error occurred while getting the " + 
entityName;
             log.error(msg);
             throw new RuntimeException(msg);
-        } catch (Exception e) {
+        }
+        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")) {
+    public boolean removeEntity(String resourcePath, String identifier, String 
entityName) throws Exception {
+
+        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 {
+                GsonBuilder gsonBuilder = new GsonBuilder();
+                Gson gson = gsonBuilder.create();
+                ErrorResponse errorResponse = 
gson.fromJson(response.getContent(),
+                        ErrorResponse.class);
+                log.error("Error response while removing entity [identifier] " 
+ identifier + ", [entity name] " +
+                        entityName + ", [error] " + 
errorResponse.getErrorMessage() + ", [error code] " + errorResponse
+                        .getErrorCode());
+                /*else if (response.getContent().contains("it is used") || 
response.getContent().contains("in use")) {
                     return false;
                 } else {
                     GsonBuilder gsonBuilder = new GsonBuilder();
@@ -308,16 +329,11 @@ public class RestClient {
                     if (errorResponse != null) {
                         throw new 
RuntimeException(errorResponse.getErrorMessage());
                     }
-                }
+                }*/
+                return false;
             }
-            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);
         }
+        throw new Exception("No response received from back-end.");
     }
 
     public boolean updateEntity(String filePath, String resourcePath, String 
entityName) {
@@ -342,7 +358,8 @@ public class RestClient {
             String msg = "An unknown error occurred while trying to update ";
             log.error(msg + entityName);
             throw new RuntimeException(msg + entityName);
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             String message = "Could not update " + entityName;
             log.error(message, e);
             throw new RuntimeException(message, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/run-smoke-test.sh
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/run-smoke-test.sh 
b/products/stratos/modules/integration/test-integration/run-smoke-test.sh
new file mode 100755
index 0000000..b56e956
--- /dev/null
+++ b/products/stratos/modules/integration/test-integration/run-smoke-test.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+#
+set -e
+mvn clean install -DsuiteFile=src/test/resources/test-suite-smoke.xml

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
new file mode 100644
index 0000000..29405a2
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
@@ -0,0 +1,196 @@
+package org.apache.stratos.integration.tests.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.beans.application.ApplicationBean;
+import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
+import org.apache.stratos.integration.common.RestConstants;
+import org.apache.stratos.integration.common.TopologyHandler;
+import org.apache.stratos.integration.tests.StratosIntegrationTest;
+import org.apache.stratos.messaging.domain.application.ApplicationStatus;
+import org.apache.stratos.messaging.domain.topology.Member;
+import org.testng.annotations.Test;
+
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
+
+/**
+ * Deploy a sample application on mock IaaS and assert whether application 
instance, cluster instance, member instances
+ * are getting activated. Kill the mock instance and check whether
+ */
+public class SampleApplicationStartupTestCase extends StratosIntegrationTest {
+    private static final Log log = 
LogFactory.getLog(SampleApplicationsTest.class);
+    private static final String RESOURCES_PATH = 
"/sample-application-startup-test";
+
+    @Test(timeOut = APPLICATION_TEST_TIMEOUT, description = "Application 
startup, activation and faulty member " +
+            "detection", groups = {"stratos.application.startup", "smoke"})
+    public void testApplication() throws Exception {
+        String autoscalingPolicyId = 
"autoscaling-policy-sample-applications-test";
+        TopologyHandler topologyHandler = TopologyHandler.getInstance();
+
+        log.info("Adding autoscaling policy [autoscale policy id] " + 
autoscalingPolicyId);
+        boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + 
RestConstants.AUTOSCALING_POLICIES_PATH
+                        + "/" + autoscalingPolicyId + ".json",
+                RestConstants.AUTOSCALING_POLICIES, 
RestConstants.AUTOSCALING_POLICIES_NAME);
+        assertTrue(addedScalingPolicy);
+
+        log.info("Adding cartridge [cartridge type] 
c1-sample-applications-test");
+        boolean addedC1 = restClient.addEntity(
+                RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + 
"c1-sample-applications-test.json",
+                RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+        assertTrue(addedC1);
+
+        log.info("Adding network partition [network partition id] 
network-partition-sample-applications-test-1");
+        boolean addedN1 = restClient.addEntity(RESOURCES_PATH + 
RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                        "network-partition-sample-applications-test-1.json",
+                RestConstants.NETWORK_PARTITIONS, 
RestConstants.NETWORK_PARTITIONS_NAME);
+        assertTrue(addedN1);
+
+        log.info("Adding deployment policy [deployment policy id] 
deployment-policy-sample-applications-test");
+        boolean addedDep = restClient.addEntity(RESOURCES_PATH + 
RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+                        "deployment-policy-sample-applications-test.json",
+                RestConstants.DEPLOYMENT_POLICIES, 
RestConstants.DEPLOYMENT_POLICIES_NAME);
+        assertTrue(addedDep);
+
+        log.info("Adding application [application id] 
sample-applications-test-1");
+        boolean addedApp = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
+                        "sample-applications-test-1.json", 
RestConstants.APPLICATIONS,
+                RestConstants.APPLICATIONS_NAME);
+        assertEquals(addedApp, true);
+
+        ApplicationBean bean = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
+                "sample-applications-test-1", ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
+        assertEquals(bean.getApplicationId(), "sample-applications-test-1");
+
+        log.info("Adding application policy [application policy id] 
application-policy-sample-applications-test");
+        boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + 
RestConstants.APPLICATION_POLICIES_PATH + "/" +
+                        "application-policy-sample-applications-test.json", 
RestConstants.APPLICATION_POLICIES,
+                RestConstants.APPLICATION_POLICIES_NAME);
+        assertTrue(addAppPolicy);
+
+        ApplicationPolicyBean policyBean = (ApplicationPolicyBean) 
restClient.getEntity(
+                RestConstants.APPLICATION_POLICIES, 
"application-policy-sample-applications-test",
+                ApplicationPolicyBean.class, 
RestConstants.APPLICATION_POLICIES_NAME);
+        assertEquals(policyBean.getId(), 
"application-policy-sample-applications-test");
+
+        // Used policies/cartridges should not removed...asserting validations 
when removing policies
+        log.info("Trying to remove the used autoscaling policy...");
+        boolean removedUsedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+        assertFalse(removedUsedAuto);
+
+        log.info("Trying to remove the used network partition...");
+        boolean removedUsedNet = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                "network-partition-sample-applications-test-1",
+                RestConstants.NETWORK_PARTITIONS_NAME);
+        assertFalse(removedUsedNet);
+
+        log.info("Trying to remove the used deployment policy...");
+        boolean removedUsedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+                "deployment-policy-sample-applications-test", 
RestConstants.DEPLOYMENT_POLICIES_NAME);
+        assertFalse(removedUsedDep);
+
+        log.info("Deploying application [application id] 
sample-applications-test-1 using [application policy id] " +
+                "application-policy-sample-applications-test");
+        String resourcePath = RestConstants.APPLICATIONS + 
"/sample-applications-test-1" +
+                RestConstants.APPLICATIONS_DEPLOY + 
"/application-policy-sample-applications-test";
+        boolean deployed = restClient.deployEntity(resourcePath,
+                RestConstants.APPLICATIONS_NAME);
+        assertTrue(deployed);
+
+        log.info("Trying to remove the used application policy");
+        boolean removedUsedAppPolicy = 
restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+                "application-policy-sample-applications-test", 
RestConstants.APPLICATION_POLICIES_NAME);
+        assertFalse(removedUsedAppPolicy);
+
+        log.info("Trying to remove the deployed application without 
undeploying first");
+        boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, 
"sample-applications-test-1",
+                RestConstants.APPLICATIONS_NAME);
+        assertFalse(removed);
+
+        log.info("Waiting for application status to become ACTIVE...");
+        topologyHandler.assertApplicationStatus(bean.getApplicationId(), 
ApplicationStatus.Active);
+
+        log.info("Waiting for cluster status to become ACTIVE...");
+        topologyHandler.assertClusterActivation(bean.getApplicationId());
+
+        log.info("Terminating members in [cluster id] 
c1-sample-applications-test in mock IaaS directly to simulate " +
+                "faulty members...");
+        Map<String, Member> memberMap = 
TopologyHandler.getInstance().getMembersForCluster
+                ("c1-sample-applications-test", bean.getApplicationId());
+        for (Map.Entry<String, Member> entry : memberMap.entrySet()) {
+            String memberId = entry.getValue().getMemberId();
+            TopologyHandler.getInstance().terminateMemberInMockIaas(memberId, 
mockIaasApiClient);
+            TopologyHandler.getInstance().assertMemberTermination(memberId);
+        }
+        // application status should be marked as inactive since some members 
are faulty
+        log.info("Waiting for application status to become INACTIVE");
+        topologyHandler.assertApplicationStatus(bean.getApplicationId(), 
ApplicationStatus.Inactive);
+
+        // application should recover itself and become active after spinning 
more instances
+        log.info("Waiting for application status to become ACTIVE...");
+        topologyHandler.assertApplicationStatus(bean.getApplicationId(), 
ApplicationStatus.Active);
+
+        log.info("Waiting for cluster status to become ACTIVE...");
+        topologyHandler.assertClusterActivation(bean.getApplicationId());
+
+        log.info("Un-deploying the application [application id] 
sample-applications-test-1");
+        String resourcePathUndeploy = RestConstants.APPLICATIONS + 
"/sample-applications-test-1" +
+                RestConstants.APPLICATIONS_UNDEPLOY;
+
+        boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
+                RestConstants.APPLICATIONS_NAME);
+        assertTrue(unDeployed);
+
+        boolean undeploy = 
topologyHandler.assertApplicationUndeploy("sample-applications-test-1");
+        if (!undeploy) {
+            //Need to forcefully undeploy the application
+            log.info("Force undeployment is going to start for the 
[application] sample-applications-test-1");
+
+            restClient.undeployEntity(RestConstants.APPLICATIONS + 
"/sample-applications-test-1" +
+                    RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
+
+            boolean forceUndeployed = 
topologyHandler.assertApplicationUndeploy("sample-applications-test-1");
+            assertTrue(String.format("Forceful undeployment failed for the 
application %s",
+                    "sample-applications-test-1"), forceUndeployed);
+        }
+
+        log.info("Removing the application [application id] 
sample-applications-test-1");
+        boolean removedApp = 
restClient.removeEntity(RestConstants.APPLICATIONS, 
"sample-applications-test-1",
+                RestConstants.APPLICATIONS_NAME);
+        assertTrue(removedApp);
+
+        ApplicationBean beanRemoved = (ApplicationBean) 
restClient.getEntity(RestConstants.APPLICATIONS,
+                "sample-applications-test-1", ApplicationBean.class, 
RestConstants.APPLICATIONS_NAME);
+        assertNull(beanRemoved);
+
+        log.info("Removing the application policy [application policy id] 
application-policy-sample-applications-test");
+        boolean removeAppPolicy = 
restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
+                "application-policy-sample-applications-test", 
RestConstants.APPLICATION_POLICIES_NAME);
+        assertTrue(removeAppPolicy);
+
+        log.info("Removing the cartridge [cartridge type] 
c1-sample-applications-test");
+        boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, 
"c1-sample-applications-test",
+                RestConstants.CARTRIDGES_NAME);
+        assertTrue(removedC1);
+
+        log.info("Removing the autoscaling policy [autoscaling policy id] " + 
autoscalingPolicyId);
+        boolean removedAuto = 
restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+        assertTrue(removedAuto);
+
+        log.info("Removing the deployment policy [deployment policy id] 
deployment-policy-sample-applications-test");
+        boolean removedDep = 
restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+                "deployment-policy-sample-applications-test", 
RestConstants.DEPLOYMENT_POLICIES_NAME);
+        assertTrue(removedDep);
+
+        log.info("Removing the network partition [network partition id] 
network-partition-sample-applications-test-1");
+        boolean removedNet = 
restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                "network-partition-sample-applications-test-1", 
RestConstants.NETWORK_PARTITIONS_NAME);
+        assertTrue(removedNet);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json
 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json
new file mode 100644
index 0000000..df1ffb9
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json
@@ -0,0 +1,17 @@
+{
+    "id": "application-policy-sample-applications-test",
+    "algorithm": "one-after-another",
+    "networkPartitions": [
+        "network-partition-sample-applications-test-1"
+    ],
+    "properties": [
+        {
+            "name": "networkPartitionGroups",
+            "value": "network-partition-sample-applications-test-1"
+        },
+        {
+            "name": "key-2",
+            "value": "value-2"
+        }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json
 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json
new file mode 100644
index 0000000..ce02f6c
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json
@@ -0,0 +1,24 @@
+{
+    "alias": "sample-applications-test-1",
+    "applicationId": "sample-applications-test-1",
+    "components": {
+      "cartridges": [
+        {
+          "type": "c1-sample-applications-test",
+          "cartridgeMin": 3,
+          "cartridgeMax": 5,
+          "subscribableInfo": {
+            "alias": "c1-1x0-sample-applications-test",
+            "autoscalingPolicy": "autoscaling-policy-sample-applications-test",
+            "deploymentPolicy": "deployment-policy-sample-applications-test",
+            "artifactRepository": {
+              "privateRepo": false,
+              "repoUrl": "https://github.com/lakwarus/single-cartridge.git";,
+              "repoUsername": "",
+              "repoPassword": ""
+            }
+          }
+        }
+      ]
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json
 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json
new file mode 100644
index 0000000..5bd90ab
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json
@@ -0,0 +1,14 @@
+{
+    "id": "autoscaling-policy-sample-applications-test",
+    "loadThresholds": {
+        "requestsInFlight": {
+            "threshold": 35
+        },
+        "memoryConsumption": {
+            "threshold": 45
+        },
+        "loadAverage": {
+            "threshold": 25
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-applications-test.json
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-applications-test.json
 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-applications-test.json
new file mode 100755
index 0000000..b54d22b
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-applications-test.json
@@ -0,0 +1,45 @@
+{
+    "type": "c1-sample-applications-test",
+    "provider": "apache",
+    "host": "stratos.apache.org",
+    "category": "data",
+    "displayName": "c1-sample-applications-test",
+    "description": "c1-sample-applications-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": "mock-key"
+                },
+                {
+                    "name": "securityGroups",
+                    "value": "default"
+                }
+            ]
+        }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/deployment-policies/deployment-policy-sample-applications-test.json
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/deployment-policies/deployment-policy-sample-applications-test.json
 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/deployment-policies/deployment-policy-sample-applications-test.json
new file mode 100644
index 0000000..66d755a
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/deployment-policies/deployment-policy-sample-applications-test.json
@@ -0,0 +1,18 @@
+{
+    "id": "deployment-policy-sample-applications-test",
+    "networkPartitions": [
+        {
+            "id": "network-partition-sample-applications-test-1",
+            "partitionAlgo": "one-after-another",
+            "partitions": [
+                {
+                    "id": "partition-1",
+                    "partitionMax": 20
+                }
+            ]
+        }
+    ]
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/973c05b5/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/network-partitions/mock/network-partition-sample-applications-test-1.json
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/network-partitions/mock/network-partition-sample-applications-test-1.json
 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/network-partitions/mock/network-partition-sample-applications-test-1.json
new file mode 100644
index 0000000..8d7aed5
--- /dev/null
+++ 
b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/network-partitions/mock/network-partition-sample-applications-test-1.json
@@ -0,0 +1,15 @@
+{
+    "id": "network-partition-sample-applications-test-1",
+    "provider": "mock",
+    "partitions": [
+        {
+            "id": "partition-1",
+            "property": [
+                {
+                    "name": "region",
+                    "value": "default"
+                }
+            ]
+        }
+    ]
+}

Reply via email to