You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2015/04/30 08:28:27 UTC

[05/10] stratos git commit: refining the application samples hierarchy

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/deploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/deploy.sh
new file mode 100755
index 0000000..dc0446c
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/deploy.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+
+artifacts_path=`cd "${script_path}/../../artifacts"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+cartridges_path=`cd "${script_path}/../../../../../cartridges/${iaas}"; pwd`
+cartridges_groups_path=`cd "${script_path}/../../../../../cartridges-groups"; pwd`
+autoscaling_policies_path=`cd "${script_path}/../../../../../autoscaling-policies"; pwd`
+network_partitions_path=`cd "${script_path}/../../../../../network-partitions/${iaas}"; pwd`
+deployment_policies_path=`cd "${script_path}/../../../../../deployment-policies"; pwd`
+application_policies_path=`cd "${script_path}/../../../../../application-policies"; pwd`
+
+set -e
+
+if [[ -z "${iaas}" ]]; then
+    echo "Usage: deploy.sh [iaas]"
+    exit
+fi
+
+echo ${autoscaling_policies_path}/autoscaling-policy-1.json
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies
+
+echo "Adding network partitions..."
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions
+
+echo "Adding deployment policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+
+echo "Adding mysql cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/mysql.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding php cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding esb cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/esb.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+sleep 1
+
+echo "Adding application policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies
+
+sleep 1
+
+echo "Adding esb-php-nested-with-esb-php-nested-with-mysql-php group..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/esb-php-nested-with-esb-php-nested-with-mysql-php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups
+
+sleep 1
+
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications
+
+sleep 1
+
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/esb-php-nested-with-esb-php-nested-with-mysql-php-app/deploy/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/undeploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/undeploy.sh
new file mode 100644
index 0000000..2658130
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/common/undeploy.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+set -e
+
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/esb-php-nested-with-esb-php-nested-with-mysql-php-app/undeploy
+
+sleep 10
+
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/esb-php-nested-with-esb-php-nested-with-mysql-php-app
+
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/esb-php-nested-with-esb-php-nested-with-mysql-php
+
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/php
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/mysql
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/esb
+
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1
+
+echo "Removing deployment policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies/deployment-policy-1
+
+echo "Removing network partitions..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-2
+
+echo "Removing application policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/deploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/deploy.sh
new file mode 100755
index 0000000..1370667
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="ec2"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/undeploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/ec2/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/deploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/deploy.sh
new file mode 100755
index 0000000..c8f11f7
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/deploy.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+iaas="kubernetes"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+kubernetes_clusters_path=`cd "${script_path}/../../../../../kubernets-clusters"; pwd`
+
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d "@${kubernetes_clusters_path}/kubernetes-cluster-1.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/undeploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/undeploy.sh
new file mode 100644
index 0000000..0054670
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/kubernetes/undeploy.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh
+
+echo "Removing kubernetes cluster..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/deploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/deploy.sh
new file mode 100755
index 0000000..93f8517
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+iaas="mock"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/undeploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/undeploy.sh
new file mode 100755
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/mock/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/deploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/deploy.sh
new file mode 100755
index 0000000..4c39959
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="openstack"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/undeploy.sh b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/esb-php-nested-with-esb-php-nested-with-mysql-php-app/scripts/openstack/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/artifacts/application.json b/samples/applications/nested/five-levels-nested-groups-app/artifacts/application.json
new file mode 100644
index 0000000..1fa30c0
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/artifacts/application.json
@@ -0,0 +1,184 @@
+{
+   "alias":"n-level-nesting-app",
+   "applicationId":"n-level-nesting",
+   "components":{
+      "groups":[
+         {
+            "name":"n-level-nesting",
+            "groupMinInstances":1,
+            "groupMaxInstances":1,
+            "alias":"n-level-nesting-group",
+            "groups":[
+               {
+                  "name":"level-one-group",
+                  "groupMinInstances":1,
+                  "groupMaxInstances":1,
+                  "alias":"level-one-group",
+                  "cartridges":[
+                     {
+                        "cartridgeMin":1,
+                        "cartridgeMax":10000000,
+                        "type":"esb",
+                        "subscribableInfo":{
+                           "alias":"level-one-group-esb",
+                           "deploymentPolicy":"deployment-policy-1",
+                           "autoscalingPolicy":"autoscaling-policy-1"
+                        }
+                     },
+                     {
+                        "cartridgeMin":1,
+                        "cartridgeMax":10000000,
+                        "type":"tomcat",
+                        "subscribableInfo":{
+                           "alias":"level-one-group-tomcat",
+                           "deploymentPolicy":"deployment-policy-1",
+                           "artifactRepository":{
+                              "privateRepo":false,
+                              "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git"
+                           },
+                           "autoscalingPolicy":"autoscaling-policy-1"
+                        }
+                     }
+                  ],
+                  "groups":[
+                     {
+                        "name":"level-two-group",
+                        "groupMinInstances":1,
+                        "groupMaxInstances":1,
+                        "alias":"level-two-group",
+                        "cartridges":[
+                           {
+                              "cartridgeMin":1,
+                              "cartridgeMax":10000000,
+                              "type":"esb",
+                              "subscribableInfo":{
+                                 "alias":"level-two-group-esb",
+                                 "deploymentPolicy":"deployment-policy-1",
+                                 "autoscalingPolicy":"autoscaling-policy-1"
+                              }
+                           },
+                           {
+                              "cartridgeMin":1,
+                              "cartridgeMax":10000000,
+                              "type":"tomcat",
+                              "subscribableInfo":{
+                                 "alias":"level-two-group-tomcat",
+                                 "deploymentPolicy":"deployment-policy-1",
+                                 "artifactRepository":{
+                                    "privateRepo":false,
+                                    "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git"
+                                 },
+                                 "autoscalingPolicy":"autoscaling-policy-1"
+                              }
+                           }
+                        ],
+                        "groups":[
+                           {
+                              "name":"level-three-group",
+                              "groupMinInstances":1,
+                              "groupMaxInstances":1,
+                              "alias":"level-three-group",
+                              "cartridges":[
+                                 {
+                                    "cartridgeMin":1,
+                                    "cartridgeMax":10000000,
+                                    "type":"esb",
+                                    "subscribableInfo":{
+                                       "alias":"level-three-group-esb",
+                                       "deploymentPolicy":"deployment-policy-1",
+                                       "autoscalingPolicy":"autoscaling-policy-1"
+                                    }
+                                 },
+                                 {
+                                    "cartridgeMin":1,
+                                    "cartridgeMax":10000000,
+                                    "type":"tomcat",
+                                    "subscribableInfo":{
+                                       "alias":"level-three-group-tomcat",
+                                       "deploymentPolicy":"deployment-policy-1",
+                                       "artifactRepository":{
+                                          "privateRepo":false,
+                                          "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git"
+                                       },
+                                       "autoscalingPolicy":"autoscaling-policy-1"
+                                    }
+                                 }
+                              ],
+                              "groups":[
+                                 {
+                                    "name":"level-four-group",
+                                    "groupMinInstances":1,
+                                    "groupMaxInstances":1,
+                                    "alias":"level-four-group",
+                                    "cartridges":[
+                                       {
+                                          "cartridgeMin":1,
+                                          "cartridgeMax":10000000,
+                                          "type":"esb",
+                                          "subscribableInfo":{
+                                             "alias":"level-four-group-esb",
+                                             "deploymentPolicy":"deployment-policy-1",
+                                             "autoscalingPolicy":"autoscaling-policy-1"
+                                          }
+                                       },
+                                       {
+                                          "cartridgeMin":1,
+                                          "cartridgeMax":10000000,
+                                          "type":"tomcat",
+                                          "subscribableInfo":{
+                                             "alias":"level-four-group-tomcat",
+                                             "deploymentPolicy":"deployment-policy-1",
+                                             "artifactRepository":{
+                                                "privateRepo":false,
+                                                "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git"
+                                             },
+                                             "autoscalingPolicy":"autoscaling-policy-1"
+                                          }
+                                       }
+                                    ],
+                                    "groups":[
+                                       {
+                                          "name":"level-five-group",
+                                          "groupMinInstances":1,
+                                          "groupMaxInstances":1,
+                                          "alias":"level-five-group",
+                                          "cartridges":[
+                                             {
+                                                "cartridgeMin":1,
+                                                "cartridgeMax":10000000,
+                                                "type":"esb",
+                                                "subscribableInfo":{
+                                                   "alias":"level-five-group-esb",
+                                                   "deploymentPolicy":"deployment-policy-1",
+                                                   "autoscalingPolicy":"autoscaling-policy-1"
+                                                }
+                                             },
+                                             {
+                                                "cartridgeMin":1,
+                                                "cartridgeMax":10000000,
+                                                "type":"tomcat",
+                                                "subscribableInfo":{
+                                                   "alias":"level-five-group-tomcat",
+                                                   "deploymentPolicy":"deployment-policy-1",
+                                                   "artifactRepository":{
+                                                      "privateRepo":false,
+                                                      "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git"
+                                                   },
+                                                   "autoscalingPolicy":"autoscaling-policy-1"
+                                                }
+                                             }
+                                          ]
+                                       }
+                                    ]
+                                 }
+                              ]
+                           }
+                        ]
+                     }
+                  ]
+               }
+            ]
+         }
+      ]
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/common/deploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/common/deploy.sh
new file mode 100755
index 0000000..3333dee
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/common/deploy.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+
+artifacts_path=`cd "${script_path}/../../artifacts"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+cartridges_path=`cd "${script_path}/../../../../../cartridges/${iaas}"; pwd`
+cartridges_groups_path=`cd "${script_path}/../../../../../cartridges-groups"; pwd`
+autoscaling_policies_path=`cd "${script_path}/../../../../../autoscaling-policies"; pwd`
+network_partitions_path=`cd "${script_path}/../../../../../network-partitions/${iaas}"; pwd`
+deployment_policies_path=`cd "${script_path}/../../../../../deployment-policies"; pwd`
+application_policies_path=`cd "${script_path}/../../../../../application-policies"; pwd`
+
+set -e
+
+if [[ -z "${iaas}" ]]; then
+    echo "Usage: deploy.sh [iaas]"
+    exit
+fi
+
+echo ${autoscaling_policies_path}/autoscaling-policy-1.json
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies
+
+echo "Adding network partitions..."
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions
+
+echo "Adding deployment policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+
+echo "Adding mysql cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/mysql.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding php cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding esb cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/esb.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+sleep 1
+
+echo "Adding application policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies
+
+sleep 1
+
+echo "n-level-nesting group..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/n-level-nesting.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups
+
+sleep 1
+
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications
+
+sleep 1
+
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/n-level-nesting/deploy/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/common/undeploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/common/undeploy.sh
new file mode 100644
index 0000000..48d20f4
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/common/undeploy.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+set -e
+
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/n-level-nesting/undeploy
+
+sleep 10
+
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/n-level-nesting
+
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/n-level-nesting
+
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/php
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/mysql
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/esb
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat
+
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1
+
+echo "Removing deployment policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies/deployment-policy-1
+
+echo "Removing network partitions..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-2
+
+echo "Removing application policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/deploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/deploy.sh
new file mode 100755
index 0000000..1370667
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="ec2"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/undeploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/ec2/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/deploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/deploy.sh
new file mode 100755
index 0000000..c8f11f7
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/deploy.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+iaas="kubernetes"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+kubernetes_clusters_path=`cd "${script_path}/../../../../../kubernets-clusters"; pwd`
+
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d "@${kubernetes_clusters_path}/kubernetes-cluster-1.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/undeploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/undeploy.sh
new file mode 100644
index 0000000..0054670
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/kubernetes/undeploy.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh
+
+echo "Removing kubernetes cluster..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/deploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/deploy.sh
new file mode 100755
index 0000000..93f8517
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+iaas="mock"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/undeploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/undeploy.sh
new file mode 100755
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/mock/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/deploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/deploy.sh
new file mode 100755
index 0000000..4c39959
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="openstack"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/undeploy.sh b/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/five-levels-nested-groups-app/scripts/openstack/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/README.md b/samples/applications/nested/single-level-nested-group-app/README.md
new file mode 100644
index 0000000..1acc75d
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/README.md
@@ -0,0 +1,14 @@
+nested-group
+============
+
+Application folder structure
+----------------------------
+-- artifacts/<iaas>/ IaaS specific artifacts
+-- scripts/common/ Common scripts for all iaases
+-- scripts/<iaas> IaaS specific scripts
+
+How to run
+----------
+cd scripts/<iaas>/
+./deploy.sh
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/artifacts/application.json b/samples/applications/nested/single-level-nested-group-app/artifacts/application.json
new file mode 100644
index 0000000..d7a6e04
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/artifacts/application.json
@@ -0,0 +1,82 @@
+{
+    "applicationId": "nested-group-app",
+    "alias": "my-nested-group-app",
+    "components": {
+        "groups": [
+            {
+                "name": "group6",
+                "alias": "my-group6",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "deploymentPolicy":"deployment-policy-2",
+                "groups": [
+                    {
+                        "name": "group7",
+                        "alias": "my-group7",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "my-tomcat1-group7",
+                                    "autoscalingPolicy": "autoscaling-policy-1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        "repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git",
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            }
+                        ]
+                    }
+                ],
+                "cartridges": [
+                    {
+                        "type": "tomcat2",
+                        "cartridgeMin": 1,
+                        "cartridgeMax": 2,
+                        "subscribableInfo": {
+                            "alias": "my-tomcat2-group6",
+                            "autoscalingPolicy": "autoscaling-policy-1",
+                            "artifactRepository":{
+                                "privateRepo":false,
+                                "repoUrl":"https://github.com/imesh/stratos-tomcat2-applications.git",
+                                "repoUsername":"",
+                                "repoPassword":""
+                            }
+                        }
+                    }
+                ]
+            }
+        ],
+        "cartridges": [
+            {
+                "type": "tomcat",
+                "cartridgeMin": 1,
+                "cartridgeMax": 2,
+                "subscribableInfo": {
+                    "alias": "my-tomcat",
+                    "autoscalingPolicy": "autoscaling-policy-1",
+                    "deploymentPolicy":"deployment-policy-2",
+                    "artifactRepository":{
+                        "privateRepo":false,
+                        "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git",
+                        "repoUsername":"",
+                        "repoPassword":""
+                    }
+                }
+            }
+        ],
+        "dependencies": {
+            "startupOrders": [
+                "group.my-group6,cartridge.my-tomcat"
+            ],
+            "terminationBehaviour": "terminate-all"
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/common/deploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/common/deploy.sh
new file mode 100755
index 0000000..4a0e0ed
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/common/deploy.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+
+artifacts_path=`cd "${script_path}/../../artifacts"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+cartridges_path=`cd "${script_path}/../../../../../cartridges/${iaas}"; pwd`
+cartridges_groups_path=`cd "${script_path}/../../../../../cartridges-groups"; pwd`
+autoscaling_policies_path=`cd "${script_path}/../../../../../autoscaling-policies"; pwd`
+network_partitions_path=`cd "${script_path}/../../../../../network-partitions/${iaas}"; pwd`
+deployment_policies_path=`cd "${script_path}/../../../../../deployment-policies"; pwd`
+application_policies_path=`cd "${script_path}/../../../../../application-policies"; pwd`
+
+set -e
+
+if [[ -z "${iaas}" ]]; then
+    echo "Usage: deploy.sh [iaas]"
+    exit
+fi
+
+echo ${autoscaling_policies_path}/autoscaling-policy-1.json
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies
+
+echo "Adding network partitions..."
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions
+
+echo "Adding deployment policies..."
+curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding group6c group..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/group6c.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups
+
+sleep 1
+
+echo "Adding application policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies
+
+sleep 1
+
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications
+
+sleep 1
+
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/nested-group-app/deploy/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/common/undeploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/common/undeploy.sh
new file mode 100644
index 0000000..038933e
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/common/undeploy.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+set -e
+
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/nested-group-app/undeploy
+
+sleep 10
+
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/nested-group-app
+
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group6
+
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat2
+
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1
+
+echo "Removing application policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/common/update-deployment-policy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/common/update-deployment-policy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/common/update-deployment-policy.sh
new file mode 100755
index 0000000..c52e117
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/common/update-deployment-policy.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+script_path=`cd "$prgdir"; pwd`
+
+deployment_policies_path=`cd "${script_path}/../../../../../deployment-policies"; pwd`
+
+curl -X PUT -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/common/update-network-partition.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/common/update-network-partition.sh b/samples/applications/nested/single-level-nested-group-app/scripts/common/update-network-partition.sh
new file mode 100755
index 0000000..4b2b275
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/common/update-network-partition.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+script_path=`cd "$prgdir"; pwd`
+
+network_partitions_path=`cd "${script_path}/../../../../../network-partitions/${iaas}"; pwd`
+
+curl -X PUT -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/ec2/deploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/ec2/deploy.sh
new file mode 100755
index 0000000..1370667
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/ec2/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="ec2"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/ec2/undeploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/ec2/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/ec2/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/deploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/deploy.sh
new file mode 100755
index 0000000..32eff3c
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/deploy.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+iaas="kubernetes"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d "@${iaas_artifacts_path}/kubernetes-cluster.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters
+
+bash ${common_folder}/deploy.sh ${iaas}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/undeploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/undeploy.sh
new file mode 100644
index 0000000..0054670
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/kubernetes/undeploy.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh
+
+echo "Removing kubernetes cluster..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/mock/deploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/mock/deploy.sh
new file mode 100755
index 0000000..93f8517
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/mock/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+iaas="mock"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/mock/undeploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/mock/undeploy.sh
new file mode 100755
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/mock/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/mock/update-network-partition.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/mock/update-network-partition.sh b/samples/applications/nested/single-level-nested-group-app/scripts/mock/update-network-partition.sh
new file mode 100755
index 0000000..329684b
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/mock/update-network-partition.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+iaas="mock"
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/update-network-partition.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/openstack/deploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/openstack/deploy.sh
new file mode 100755
index 0000000..4c39959
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/openstack/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="openstack"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/openstack/undeploy.sh b/samples/applications/nested/single-level-nested-group-app/scripts/openstack/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/openstack/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-group-app/scripts/openstack/update-network-partition.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-group-app/scripts/openstack/update-network-partition.sh b/samples/applications/nested/single-level-nested-group-app/scripts/openstack/update-network-partition.sh
new file mode 100755
index 0000000..4b2b275
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-group-app/scripts/openstack/update-network-partition.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+script_path=`cd "$prgdir"; pwd`
+
+network_partitions_path=`cd "${script_path}/../../../../../network-partitions/${iaas}"; pwd`
+
+curl -X PUT -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/README.md b/samples/applications/nested/single-level-nested-groups-app/README.md
new file mode 100644
index 0000000..47015bf
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/README.md
@@ -0,0 +1,13 @@
+Complex App
+===========
+
+Application folder structure
+----------------------------
+-- artifacts/<iaas>/ IaaS specific artifacts
+-- scripts/common/ Common scripts for all iaases
+-- scripts/<iaas> IaaS specific scripts
+
+How to run
+----------
+cd scripts/<iaas>/
+./deploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/artifacts/application.json b/samples/applications/nested/single-level-nested-groups-app/artifacts/application.json
new file mode 100644
index 0000000..7b85f93
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/artifacts/application.json
@@ -0,0 +1,131 @@
+{
+    "applicationId": "complex-app",
+    "alias": "my-complex-app",
+    "components": {
+        "groups": [
+            {
+                "name": "group6",
+                "alias": "my-group6",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "deploymentPolicy":"deployment-policy-1",
+                "groups": [
+                    {
+                        "name": "group7",
+                        "alias": "my-group7",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "my-tomcat1-group7",
+                                    "autoscalingPolicy": "autoscaling-policy-1",
+                                    "artifactRepository":{
+                                       "privateRepo":false,
+                                       "repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git",
+                                       "repoUsername":"",
+                                       "repoPassword":""
+                                    }
+                                }
+                            }
+                        ]
+                    }
+                ],
+                "cartridges": [
+                    {
+                        "type": "tomcat2",
+                        "cartridgeMin": 1,
+                        "cartridgeMax": 2,
+                        "subscribableInfo": {
+                            "alias": "my-tomcat2-group6",
+                            "autoscalingPolicy": "autoscaling-policy-1",
+                            "artifactRepository":{
+                               "privateRepo":false,
+                               "repoUrl":"https://github.com/imesh/stratos-tomcat2-applications.git",
+                               "repoUsername":"",
+                               "repoPassword":""
+                            }
+                        }
+                    }
+                ]
+            },
+            {
+                "name": "group8",
+                "alias": "my-group8",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "deploymentPolicy":"deployment-policy-1",
+                "groups": [
+                    {
+                        "name": "group9",
+                        "alias": "my-group9",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "my-tomcat1-group9",
+                                    "autoscalingPolicy": "autoscaling-policy-1",
+                                    "artifactRepository":{
+                                       "privateRepo":false,
+                                       "repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git",
+                                       "repoUsername":"",
+                                       "repoPassword":""
+                                    }
+                                }
+                            }
+                        ]
+                    }
+                ],
+                "cartridges": [
+                    {
+                        "type": "tomcat2",
+                        "cartridgeMin": 1,
+                        "cartridgeMax": 2,
+                        "subscribableInfo": {
+                            "alias": "my-tomcat2-group8",
+                            "autoscalingPolicy": "autoscaling-policy-1",
+                            "artifactRepository":{
+                               "privateRepo":false,
+                               "repoUrl":"https://github.com/imesh/stratos-tomcat2-applications.git",
+                               "repoUsername":"",
+                               "repoPassword":""
+                            }
+                        }
+                    }
+                ]
+            }
+        ],
+        "cartridges": [
+            {
+                "type": "tomcat",
+                "cartridgeMin": 1,
+                "cartridgeMax": 2,
+                "subscribableInfo": {
+                    "alias": "my-tomcat",
+                    "autoscalingPolicy": "autoscaling-policy-1",
+                    "deploymentPolicy":"deployment-policy-1",
+                    "artifactRepository":{
+                       "privateRepo":false,
+                       "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git",
+                       "repoUsername":"",
+                       "repoPassword":""
+                    }
+                }
+            }
+        ],
+        "dependencies": {
+            "startupOrders": [
+                "group.my-group8,cartridge.my-tomcat,group.my-group6"
+            ],
+            "terminationBehaviour": "terminate-all"
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/artifacts/autoscaling-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/artifacts/autoscaling-policy.json b/samples/applications/nested/single-level-nested-groups-app/artifacts/autoscaling-policy.json
new file mode 100755
index 0000000..b41726e
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/artifacts/autoscaling-policy.json
@@ -0,0 +1,14 @@
+{
+    "id": "autoscaling-policy-1",
+    "loadThresholds": {
+        "requestsInFlight": {
+            "threshold": 80
+        },
+        "memoryConsumption": {
+            "threshold": 90
+        },
+        "loadAverage": {
+            "threshold": 50
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/artifacts/deployment-policy.json b/samples/applications/nested/single-level-nested-groups-app/artifacts/deployment-policy.json
new file mode 100644
index 0000000..666c299
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/artifacts/deployment-policy.json
@@ -0,0 +1,15 @@
+{
+   "id": "deployment-policy-1",
+   "networkPartition": [
+      {
+         "id": "network-partition-1",
+         "partitionAlgo": "one-after-another",
+         "partitions": [
+            {
+               "id": "partition-1",
+               "max": 5
+            }
+         ]
+      }
+   ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/common/deploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/common/deploy.sh
new file mode 100755
index 0000000..6adbef5
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/common/deploy.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+
+artifacts_path=`cd "${script_path}/../../artifacts"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+cartridges_path=`cd "${script_path}/../../../../../cartridges/${iaas}"; pwd`
+cartridges_groups_path=`cd "${script_path}/../../../../../cartridges-groups"; pwd`
+autoscaling_policies_path=`cd "${script_path}/../../../../../autoscaling-policies"; pwd`
+network_partitions_path=`cd "${script_path}/../../../../../network-partitions/${iaas}"; pwd`
+deployment_policies_path=`cd "${script_path}/../../../../../deployment-policies"; pwd`
+application_policies_path=`cd "${script_path}/../../../../../application-policies"; pwd`
+
+set -e
+
+if [[ -z "${iaas}" ]]; then
+    echo "Usage: deploy.sh [iaas]"
+    exit
+fi
+
+echo ${autoscaling_policies_path}/autoscaling-policy-1.json
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies
+
+echo "Adding network partitions..."
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions
+
+echo "Adding deployment policies..."
+curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_path}/tomcat2.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding group6c group..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/group6c3.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups
+
+echo "Adding group8c group..."
+curl -X POST -H "Content-Type: application/json" -d "@${cartridges_groups_path}/group8c.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups
+
+sleep 1
+
+echo "Adding application policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies
+
+sleep 1
+
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications
+
+sleep 1
+
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/complex-app/deploy/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/common/undeploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/common/undeploy.sh
new file mode 100644
index 0000000..455174f
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/common/undeploy.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+set -e
+
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/complex-app/undeploy
+
+sleep 10
+
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/complex-app
+
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group8
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridgeGroups/group6
+
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat2
+
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1
+
+echo "Removing deployment policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies/deployment-policy-1
+
+echo "Removing network partitions..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-1
+
+echo "Removing application policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/deploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/deploy.sh
new file mode 100755
index 0000000..1370667
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="ec2"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/undeploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/ec2/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/deploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/deploy.sh
new file mode 100755
index 0000000..32eff3c
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/deploy.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+iaas="kubernetes"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d "@${iaas_artifacts_path}/kubernetes-cluster.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters
+
+bash ${common_folder}/deploy.sh ${iaas}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/undeploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/undeploy.sh
new file mode 100644
index 0000000..0054670
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/kubernetes/undeploy.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh
+
+echo "Removing kubernetes cluster..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/mock/deploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/mock/deploy.sh
new file mode 100755
index 0000000..93f8517
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/mock/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+iaas="mock"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/mock/undeploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/mock/undeploy.sh
new file mode 100755
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/mock/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/deploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/deploy.sh
new file mode 100755
index 0000000..4c39959
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="openstack"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/undeploy.sh b/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested/single-level-nested-groups-app/scripts/openstack/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/README.md b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/README.md
deleted file mode 100644
index 6cb7cdc..0000000
--- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-single_cartridge
-================
-i) In this artifact sample you can find we have listed them as mock and openstack.
-
-ii) In this sample artifact, it deployes simple application with a php cartridge and start it.
-
-iii) You can choose the IaaS and navigate to it and simply run the single_cartridge.sh file. It'll deploy the relevant artifacts and start the application.
-
-
-This sample can be used to test the startup order pattern. As defined, the application is using dbgroup(mysql, postgres), app-group(tomcat, php) and esb. In this case, appgroup and esb are depending on dbgroup. So, dbgroup should start first.  Other two can come up in parallel after dbgroup started. When starting of appgroup, tomcat depends on php. In that case, tomcat will have to come up first and then php. By running this sample, this particular scenario can be simulated.

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/artifacts/application.json b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/artifacts/application.json
deleted file mode 100644
index 10f8c83..0000000
--- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/artifacts/application.json
+++ /dev/null
@@ -1,121 +0,0 @@
-{
-    "alias": "mycompositeapp",
-    "applicationId": "my-compositeapp",
-    "components": {
-      "groups": [
-        {
-          "name": "app-group",
-          "alias": "my-appgroup",
-          "cartridges": [
-            {
-              "type": "tomcat",
-              "cartridgeMax": 2,
-              "cartridgeMin": 1,
-              "subscribableInfo": {
-                "alias": "my-tomcat",
-                "artifactRepository": {
-                  "alias": "my-tomcat",
-                  "privateRepo": true,
-                  "repoPassword": "password",
-                  "repoUrl": "http://xxx:10080/git/default.git",
-                  "repoUsername": "user"
-                },
-                "autoscalingPolicy": "autoscaling-policy-1",
-                "deploymentPolicy": "deployment-policy-2"
-              }
-            },
-            {
-              "type": "php",
-              "cartridgeMax": 2,
-              "cartridgeMin": 1,
-              "subscribableInfo": {
-                "alias": "my-php",
-                "artifactRepository": {
-
-                  "privateRepo": true,
-                  "repoPassword": "password",
-                  "repoUrl": "http://xxx:10080/git/default.git",
-                  "repoUsername": "user"
-                },
-                "autoscalingPolicy": "autoscaling-policy-1",
-                "deploymentPolicy": "deployment-policy-2"
-              }
-            }
-          ],
-          "groupMaxInstances": 2,
-          "groupMinInstances": 1,
-          "groupScalingEnabled": true
-        },
-        {
-          "name": "db-group",
-          "alias": "my-dbgroup",
-          "cartridges": [
-            {
-              "type": "postgres",
-              "cartridgeMax": 2,
-              "cartridgeMin": 1,
-              "subscribableInfo": {
-                "alias": "my-postgres",
-                "artifactRepository": {
-                  "alias": "my-postgres",
-                  "privateRepo": false,
-                  "repoPassword": "password",
-                  "repoUrl": "http://xxx:10080/git/default.git",
-                  "repoUsername": "user"
-                },
-                "autoscalingPolicy": "autoscaling-policy-1",
-                "deploymentPolicy": "deployment-policy-2"
-              }
-            },
-            {
-              "type": "mysql",
-              "cartridgeMax": 2,
-              "cartridgeMin": 1,
-              "subscribableInfo": {
-                "alias": "my-mysql",
-                "artifactRepository": {
-                  "alias": "my-mysql",
-                  "privateRepo": true,
-                  "repoPassword": "password",
-                  "repoUrl": "http://xxx:10080/git/default.git",
-                  "repoUsername": "user"
-                },
-                "autoscalingPolicy": "autoscaling-policy-1",
-                "deploymentPolicy": "deployment-policy-2"
-              }
-            }
-          ],
-          "groupMaxInstances": 2,
-          "groupMinInstances": 1,
-          "groupScalingEnabled": true
-        }
-      ],
-      "cartridges": [
-        {
-          "type": "esb",
-          "cartridgeMax": 2,
-          "cartridgeMin": 1,
-          "subscribableInfo": {
-            "alias": "my-esb",
-            "artifactRepository": {
-              "privateRepo": true,
-              "repoPassword": "password",
-              "repoUrl": "http://xxx:10080/git/default.git",
-              "repoUsername": "user"
-            },
-            "autoscalingPolicy": "autoscaling-policy-1",
-            "deploymentPolicy": "deployment-policy-2"
-          }
-        }
-      ],
-      "dependencies": {
-        "scalingDependants": {
-          "@xsi.nil": "true"
-        },
-       "startupOrders": [
-          "group.my-dbgroup,group.my-appgroup","group.my-dbgroup,cartridge.my-esb"
-        ],
-        "terminationBehaviour": "terminate-none"
-      }
-    }
-  }

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-domain-mappings.sh
----------------------------------------------------------------------
diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-domain-mappings.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-domain-mappings.sh
deleted file mode 100755
index 74c6ed7..0000000
--- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-domain-mappings.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-export host_ip="localhost"
-export artifacts_path="../../artifacts"
-
-pushd ${artifacts_path}
-echo "Adding domain mappings..."
-curl -X POST -H "Content-Type: application/json" -d @'domain-mappings.json' -k -u admin:admin https://${host_ip}:9443/api/applications/single-cartridge-app/domainMappings
-popd
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/aaa8a0f4/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-network-partition.sh
----------------------------------------------------------------------
diff --git a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-network-partition.sh b/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-network-partition.sh
deleted file mode 100644
index 56c7c6c..0000000
--- a/samples/applications/php-tomcat-group-postgres-mysql-group-esb/scripts/common/add-network-partition.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-export host_ip="localhost"
-export artifacts_path="../../artifacts"
-
-pushd ${artifacts_path}
-echo "Adding network partition..."
-curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/network-partition.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
-popd