http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/artifacts/composite_application.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/group-scaling/artifacts/composite_application.json 
b/samples/applications/group-scaling/artifacts/composite_application.json
new file mode 100644
index 0000000..d2124b3
--- /dev/null
+++ b/samples/applications/group-scaling/artifacts/composite_application.json
@@ -0,0 +1,95 @@
+{
+    "applicationId": "appscaling",
+    "alias": "appscaling",
+    "components": {
+        "groups": [
+            {
+                "name": "group1",
+                "alias": "mygroup1",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "groups": [
+                    {
+                        "name": "group2",
+                        "alias": "mygroup2",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 2,
+                        "cartridges": [
+                            {
+                                "type": "c2",
+                                "cartridgeMin": 2,
+                                "cartridgeMax": 4,
+                                "subscribableInfo": {
+                                    "alias": "group2c2",
+                                    "autoscalingPolicy": "autoscale_policy_c2",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-c2-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            },
+                            {
+                                "type": "c3",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "group2c3",
+                                    "autoscalingPolicy": "autoscale_policy_c3",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-c3-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            }
+                        ]
+                    }
+                ],
+                "cartridges": [
+                    {
+                        "type": "c1",
+                        "cartridgeMin": 2,
+                        "cartridgeMax": 4,
+                        "subscribableInfo": {
+                            "alias": "group1c1",
+                            "autoscalingPolicy": "autoscale_policy_c1",
+                            "artifactRepository":{
+                                "privateRepo":false,
+                                
"repoUrl":"https://github.com/imesh/stratos-c1-applications.git";,
+                                "repoUsername":"",
+                                "repoPassword":""
+                            }
+                        }
+                    }
+                ]
+            }
+        ],
+        "cartridges": [
+            {
+                "type": "c4",
+                "cartridgeMin": 1,
+                "cartridgeMax": 2,
+                "subscribableInfo": {
+                    "alias": "myc4",
+                    "autoscalingPolicy": "autoscale_policy_c4",
+                    "artifactRepository":{
+                        "privateRepo":false,
+                        
"repoUrl":"https://github.com/imesh/stratos-c4-applications.git";,
+                        "repoUsername":"",
+                        "repoPassword":""
+                    }
+                }
+            }
+        ],
+        "dependencies": {
+            "startupOrders": [
+                "group.group1,cartridge.c4"
+            ],
+            "terminationBehaviour": "terminate-dependents"
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/ec2/artifacts/app_deployment_policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/group-scaling/iaases/ec2/artifacts/app_deployment_policy.json
 
b/samples/applications/group-scaling/iaases/ec2/artifacts/app_deployment_policy.json
new file mode 100644
index 0000000..ae2f4ca
--- /dev/null
+++ 
b/samples/applications/group-scaling/iaases/ec2/artifacts/app_deployment_policy.json
@@ -0,0 +1,71 @@
+{
+    "applicationId": "appscaling",
+    "applicationPolicy": {
+        "networkPartition": [
+            {
+                "id": "EC2-P1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "ec2",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "ap-southeast-1"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "myc4",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "group1c1",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 4
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup2",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/ec2/deploy.sh 
b/samples/applications/group-scaling/iaases/ec2/deploy.sh
new file mode 100755
index 0000000..6169cbf
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/ec2/deploy.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+export iaas="ec2"                                              #[openstack, 
ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+    # Adding c1 autoscale policy
+echo "Adding c1 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c1.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c2 autoscale policy
+echo "Adding c2 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c2.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c3 autoscale policy
+echo "Adding c3 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c3.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c4 autoscale policy
+echo "Adding c4 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c4.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding c3 cartridge
+echo "Adding c3 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c4 cartridge
+echo "Adding c4 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c4.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c1 cartridge
+echo "Adding c1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c2 cartridge
+echo "Adding c2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group1
+echo "Adding group1 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 3
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'composite_application.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/app_deployment_policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/deploy

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/ec2/undeploy.sh 
b/samples/applications/group-scaling/iaases/ec2/undeploy.sh
new file mode 100644
index 0000000..0b14665
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/ec2/undeploy.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/undeploy
+
+sleep 30
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group1
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c4
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c4
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/kubernetes/artifacts/app_deployment_policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/group-scaling/iaases/kubernetes/artifacts/app_deployment_policy.json
 
b/samples/applications/group-scaling/iaases/kubernetes/artifacts/app_deployment_policy.json
new file mode 100644
index 0000000..cf28ad7
--- /dev/null
+++ 
b/samples/applications/group-scaling/iaases/kubernetes/artifacts/app_deployment_policy.json
@@ -0,0 +1,72 @@
+{
+    "applicationId": "appscaling",
+    "applicationPolicy": {
+        "networkPartition": [
+            {
+                "id":"network-p1",
+                "kubernetesClusterId":"kubernetes-cluster-1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "kubernetes",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "default"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "myc4",
+            "networkPartition": [
+                {
+                    "id": "network-p1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "group1c1",
+            "networkPartition": [
+                {
+                    "id": "network-p1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 4
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup2",
+            "networkPartition": [
+                {
+                    "id": "network-p1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/kubernetes/artifacts/kubernetes-cluster.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/group-scaling/iaases/kubernetes/artifacts/kubernetes-cluster.json
 
b/samples/applications/group-scaling/iaases/kubernetes/artifacts/kubernetes-cluster.json
new file mode 100644
index 0000000..228eeb3
--- /dev/null
+++ 
b/samples/applications/group-scaling/iaases/kubernetes/artifacts/kubernetes-cluster.json
@@ -0,0 +1,55 @@
+{
+      "clusterId": "kubernetes-cluster-1",
+      "description": "Kubernetes CoreOS cluster",
+      "kubernetesMaster": {
+                  "hostId" : "KubHostMaster1",
+                  "hostname" : "master.dev.kubernetes.example.org",
+                  "hostIpAddress" : "172.17.8.100",
+                  "property" : [
+                  ]
+        },
+
+        "portRange" : {
+           "upper": "5000",
+           "lower": "4500"
+        },
+
+        "kubernetesHosts": [
+              {
+                     "hostId" : "KubHostSlave1",
+                     "hostname" : "slave1.dev.kubernetes.example.org",
+                     "hostIpAddress" : "172.17.8.101",
+                     "property" : [
+                     ]
+                },
+                {
+                     "hostId" : "KubHostSlave2",
+                     "hostname" : "slave2.dev.kubernetes.example.org",
+                     "hostIpAddress" : "172.17.8.102",
+                     "property" : [
+                     ]
+                }
+    ],
+    "property":[
+       {
+          "name":"payload_parameter.MB_IP",
+          "value":"172.17.8.1"
+       },
+       {
+          "name":"payload_parameter.MB_PORT",
+          "value":"1883"
+       },
+       {
+          "name":"payload_parameter.CEP_IP",
+          "value":"172.17.8.1"
+       },
+       {
+          "name":"payload_parameter.CEP_PORT",
+          "value":"7711"
+       },
+       {
+          "name":"payload_parameter.LOG_LEVEL",
+          "value":"DEBUG"
+       }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/kubernetes/deploy.sh 
b/samples/applications/group-scaling/iaases/kubernetes/deploy.sh
new file mode 100755
index 0000000..94a3fb0
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/kubernetes/deploy.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+export iaas="kubernetes"                                               
#[openstack, ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+    # Adding c1 autoscale policy
+echo "Adding c1 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c1.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c2 autoscale policy
+echo "Adding c2 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c2.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c3 autoscale policy
+echo "Adding c3 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c3.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c4 autoscale policy
+echo "Adding c4 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c4.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding c3 cartridge
+echo "Adding c3 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c4 cartridge
+echo "Adding c4 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c4.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c1 cartridge
+echo "Adding c1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c2 cartridge
+echo "Adding c2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+sleep 3
+
+# Adding kubernetes cluster
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d 
@'artifacts/kubernetes-cluster.json' -k -u admin:admin 
https://${host_ip}:9443/api/kubernetesClusters
+
+sleep 2
+
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group1
+echo "Adding group1 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 3
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'composite_application.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/app_deployment_policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/deploy

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/kubernetes/undeploy.sh 
b/samples/applications/group-scaling/iaases/kubernetes/undeploy.sh
new file mode 100644
index 0000000..9bf3383
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/kubernetes/undeploy.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/undeploy
+
+sleep 5
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group1
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c4
+
+# Removing kubernetes
+echo "Removing kubernetes cluster..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/kubernetesClusters/kubernetes-cluster-1
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c4
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/mock/artifacts/app_deployment_policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/group-scaling/iaases/mock/artifacts/app_deployment_policy.json
 
b/samples/applications/group-scaling/iaases/mock/artifacts/app_deployment_policy.json
new file mode 100644
index 0000000..e0b7b99
--- /dev/null
+++ 
b/samples/applications/group-scaling/iaases/mock/artifacts/app_deployment_policy.json
@@ -0,0 +1,71 @@
+{
+    "applicationId": "appscaling",
+    "applicationPolicy": {
+        "networkPartition": [
+            {
+                "id": "openstack_R1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "mock",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "RegionOne"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "myc4",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "group1c1",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 4
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup2",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/mock/deploy.sh 
b/samples/applications/group-scaling/iaases/mock/deploy.sh
new file mode 100755
index 0000000..cbaa6e7
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/mock/deploy.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+export iaas="mock"                                             #[openstack, 
ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+    # Adding c1 autoscale policy
+echo "Adding c1 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c1.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c2 autoscale policy
+echo "Adding c2 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c2.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c3 autoscale policy
+echo "Adding c3 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c3.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c4 autoscale policy
+echo "Adding c4 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c4.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding c3 cartridge
+echo "Adding c3 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c4 cartridge
+echo "Adding c4 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c4.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c1 cartridge
+echo "Adding c1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c2 cartridge
+echo "Adding c2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group1
+echo "Adding group1 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 3
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'composite_application.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/app_deployment_policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/deploy

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/mock/undeploy.sh 
b/samples/applications/group-scaling/iaases/mock/undeploy.sh
new file mode 100644
index 0000000..e1e9d9c
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/mock/undeploy.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/undeploy
+
+sleep 5
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group1
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c4
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c4
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/openstack/artifacts/app_deployment_policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/group-scaling/iaases/openstack/artifacts/app_deployment_policy.json
 
b/samples/applications/group-scaling/iaases/openstack/artifacts/app_deployment_policy.json
new file mode 100644
index 0000000..aa873aa
--- /dev/null
+++ 
b/samples/applications/group-scaling/iaases/openstack/artifacts/app_deployment_policy.json
@@ -0,0 +1,71 @@
+{
+    "applicationId": "appscaling",
+    "applicationPolicy": {
+        "networkPartition": [
+            {
+                "id": "openstack_R1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "openstack",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "RegionOne"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "myc4",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "group1c1",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 4
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup2",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/openstack/deploy.sh 
b/samples/applications/group-scaling/iaases/openstack/deploy.sh
new file mode 100755
index 0000000..0460b6c
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/openstack/deploy.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+export iaas="openstack"                                                
#[openstack, ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+    # Adding c1 autoscale policy
+echo "Adding c1 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c1.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c2 autoscale policy
+echo "Adding c2 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c2.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c3 autoscale policy
+echo "Adding c3 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c3.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+
+    # Adding c4 autoscale policy
+echo "Adding c4 autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d 
@'autoscale-policy-c4.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding c3 cartridge
+echo "Adding c3 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c4 cartridge
+echo "Adding c4 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c4.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c1 cartridge
+echo "Adding c1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding c2 cartridge
+echo "Adding c2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'c2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group1
+echo "Adding group1 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 3
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'composite_application.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/app_deployment_policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/deploy

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/group-scaling/iaases/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/group-scaling/iaases/openstack/undeploy.sh 
b/samples/applications/group-scaling/iaases/openstack/undeploy.sh
new file mode 100644
index 0000000..0b14665
--- /dev/null
+++ b/samples/applications/group-scaling/iaases/openstack/undeploy.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling/undeploy
+
+sleep 30
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/appscaling
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group1
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/c4
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c2
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c3
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_c4
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/README.md 
b/samples/applications/more-complex-app/README.md
new file mode 100644
index 0000000..cda8e5f
--- /dev/null
+++ b/samples/applications/more-complex-app/README.md
@@ -0,0 +1,11 @@
+more-complex-app
+================
+
+i) Using these artifacts you can deploy the more complex application.
+
+ii) In this deployment scenario, it deployed two groups which are nested.
+
+iii) In the groups we have added more that one startup orders.
+
+iv) You can simply run the deploy.sh and deploy this complex application.
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/artifacts/application_definition.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/artifacts/application_definition.json 
b/samples/applications/more-complex-app/artifacts/application_definition.json
new file mode 100644
index 0000000..7d9ea16
--- /dev/null
+++ 
b/samples/applications/more-complex-app/artifacts/application_definition.json
@@ -0,0 +1,196 @@
+{
+    "applicationId": "app_boo",
+    "alias": "app_boo_r2",
+    "components": {
+        "groups": [
+            {
+                "name": "group6",
+                "alias": "mygroup6",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "groups": [
+                    {
+                        "name": "group7",
+                        "alias": "mygroup7",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "group7tom1",
+                                    "autoscalingPolicy": "autoscale_policy_1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+
+                            },
+                            {
+                                "type": "tomcat2",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "group7tom2",
+                                    "autoscalingPolicy": "autoscale_policy_1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-tomcat2-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            }
+                        ]
+                    },
+                    {
+                        "name": "group8",
+                        "alias": "mygroup8",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "group8tom",
+                                    "autoscalingPolicy": "autoscale_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": "group6tom",
+                            "autoscalingPolicy": "autoscale_policy_1",
+                            "artifactRepository":{
+                                "privateRepo":false,
+                                
"repoUrl":"https://github.com/imesh/stratos-tomcat2-applications.git";,
+                                "repoUsername":"",
+                                "repoPassword":""
+                            }
+                        }
+                    }
+                ]
+            },
+            {
+                "name": "group8",
+                "alias": "mygroup8",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "groups": [
+                    {
+                        "name": "group9",
+                        "alias": "mygroup9",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "group9tom",
+                                    "autoscalingPolicy": "autoscale_policy_1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            }
+                        ]
+                    }
+                ],
+                "cartridges": [
+                    {
+                        "type": "tomcat1",
+                        "cartridgeMin": 1,
+                        "cartridgeMax": 2,
+                        "subscribableInfo": {
+                            "alias": "group8tom1",
+                            "autoscalingPolicy": "autoscale_policy_1",
+                            "artifactRepository":{
+                                "privateRepo":false,
+                                
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                                "repoUsername":"",
+                                "repoPassword":""
+                            }
+                        }
+                    },
+                    {
+                        "type": "tomcat2",
+                        "cartridgeMin": 1,
+                        "cartridgeMax": 2,
+                        "subscribableInfo": {
+                            "alias": "group8tom2",
+                            "autoscalingPolicy": "autoscale_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": "mytomcat1",
+                    "autoscalingPolicy": "autoscale_policy_1",
+                    "artifactRepository":{
+                        "privateRepo":false,
+                        
"repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git";,
+                        "repoUsername":"",
+                        "repoPassword":""
+                    }
+                }
+            },
+            {
+                "type": "tomcat1",
+                "cartridgeMin": 1,
+                "cartridgeMax": 2,
+                "subscribableInfo": {
+                    "alias": "mytomcat2",
+                    "autoscalingPolicy": "autoscale_policy_1",
+                    "artifactRepository":{
+                        "privateRepo":false,
+                        
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                        "repoUsername":"",
+                        "repoPassword":""
+                    }
+                }
+            }
+        ],
+        "dependencies": {
+            "startupOrders": [
+                "group.group6,cartridge.tomcat,group.group8"
+            ],
+            "terminationBehaviour": "terminate-all"
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/artifacts/autoscale-policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/artifacts/autoscale-policy.json 
b/samples/applications/more-complex-app/artifacts/autoscale-policy.json
new file mode 100755
index 0000000..9e9ad99
--- /dev/null
+++ b/samples/applications/more-complex-app/artifacts/autoscale-policy.json
@@ -0,0 +1,14 @@
+{
+    "id": "autoscale_policy_1",
+    "loadThresholds": {
+        "requestsInFlight": {
+            "threshold": 80
+        },
+        "memoryConsumption": {
+            "threshold": 90
+        },
+        "loadAverage": {
+            "threshold": 50
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/ec2/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/iaases/ec2/artifacts/deployment-policy.json
 
b/samples/applications/more-complex-app/iaases/ec2/artifacts/deployment-policy.json
new file mode 100644
index 0000000..9592a35
--- /dev/null
+++ 
b/samples/applications/more-complex-app/iaases/ec2/artifacts/deployment-policy.json
@@ -0,0 +1,87 @@
+{
+    "applicationId": "app_boo",
+    "applicationPolicy": {
+        "applicationId": "app_boo_r4",
+        "networkPartition": [
+            {
+                "id": "EC2-P1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "ec2",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "ap-southeast-1"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "mytomcat2",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mytomcat1",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup6",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup88",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/iaases/ec2/deploy.sh 
b/samples/applications/more-complex-app/iaases/ec2/deploy.sh
new file mode 100755
index 0000000..8d0c3c5
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/ec2/deploy.sh
@@ -0,0 +1,57 @@
+#!/bin/sh 
+
+export iaas="ec2"                                              #[openstack, 
ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d @'1utoscale-policy.json' 
-k -v -u admin:admin https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding tomcat cartridge
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat1 cartridge
+echo "Adding tomcat1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat2 cartridge
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group6c3
+echo "Adding group6c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group6c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+
+       # Adding group8c3
+echo "Adding group8c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group8c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 5
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'application-definition.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/deployment-policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/deploy
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/iaases/ec2/undeploy.sh 
b/samples/applications/more-complex-app/iaases/ec2/undeploy.sh
new file mode 100644
index 0000000..fa0c49d
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/ec2/undeploy.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/undeploy
+
+sleep 40
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group8
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group6
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat2
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/kubernetes/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/iaases/kubernetes/artifacts/deployment-policy.json
 
b/samples/applications/more-complex-app/iaases/kubernetes/artifacts/deployment-policy.json
new file mode 100644
index 0000000..9bb1027
--- /dev/null
+++ 
b/samples/applications/more-complex-app/iaases/kubernetes/artifacts/deployment-policy.json
@@ -0,0 +1,88 @@
+{
+    "applicationId": "app_boo",
+    "applicationPolicy": {
+        "applicationId": "app_boo_r4",
+        "networkPartition": [
+            {
+                "id":"network-p1",
+                "kubernetesClusterId":"kubernetes-cluster-1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "kubernetes",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "default"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "mytomcat2",
+            "networkPartition": [
+                {
+                    "id": "network-p1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mytomcat1",
+            "networkPartition": [
+                {
+                    "id": "network-p1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup6",
+            "networkPartition": [
+                {
+                    "id": "network-p1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup8",
+            "networkPartition": [
+                {
+                    "id": "network-p1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/kubernetes/artifacts/kubernetes-cluster.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/iaases/kubernetes/artifacts/kubernetes-cluster.json
 
b/samples/applications/more-complex-app/iaases/kubernetes/artifacts/kubernetes-cluster.json
new file mode 100644
index 0000000..228eeb3
--- /dev/null
+++ 
b/samples/applications/more-complex-app/iaases/kubernetes/artifacts/kubernetes-cluster.json
@@ -0,0 +1,55 @@
+{
+      "clusterId": "kubernetes-cluster-1",
+      "description": "Kubernetes CoreOS cluster",
+      "kubernetesMaster": {
+                  "hostId" : "KubHostMaster1",
+                  "hostname" : "master.dev.kubernetes.example.org",
+                  "hostIpAddress" : "172.17.8.100",
+                  "property" : [
+                  ]
+        },
+
+        "portRange" : {
+           "upper": "5000",
+           "lower": "4500"
+        },
+
+        "kubernetesHosts": [
+              {
+                     "hostId" : "KubHostSlave1",
+                     "hostname" : "slave1.dev.kubernetes.example.org",
+                     "hostIpAddress" : "172.17.8.101",
+                     "property" : [
+                     ]
+                },
+                {
+                     "hostId" : "KubHostSlave2",
+                     "hostname" : "slave2.dev.kubernetes.example.org",
+                     "hostIpAddress" : "172.17.8.102",
+                     "property" : [
+                     ]
+                }
+    ],
+    "property":[
+       {
+          "name":"payload_parameter.MB_IP",
+          "value":"172.17.8.1"
+       },
+       {
+          "name":"payload_parameter.MB_PORT",
+          "value":"1883"
+       },
+       {
+          "name":"payload_parameter.CEP_IP",
+          "value":"172.17.8.1"
+       },
+       {
+          "name":"payload_parameter.CEP_PORT",
+          "value":"7711"
+       },
+       {
+          "name":"payload_parameter.LOG_LEVEL",
+          "value":"DEBUG"
+       }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/iaases/kubernetes/deploy.sh 
b/samples/applications/more-complex-app/iaases/kubernetes/deploy.sh
new file mode 100755
index 0000000..e17d2fb
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/kubernetes/deploy.sh
@@ -0,0 +1,66 @@
+#!/bin/sh 
+
+export iaas="kubernetes"                                               
#[openstack, ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d @'autoscale-policy.json' 
-k -v -u admin:admin https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding tomcat cartridge
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat1 cartridge
+echo "Adding tomcat1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat2 cartridge
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+sleep 3
+
+# Adding kubernetes cluster
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d 
@'artifacts/kubernetes-cluster.json' -k -u admin:admin 
https://${host_ip}:9443/api/kubernetesClusters
+
+sleep 2
+
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group6c3
+echo "Adding group6c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group6c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+
+       # Adding group8c3
+echo "Adding group8c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group8c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 5
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'application-definition.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/deployment-policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/deploy
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/iaases/kubernetes/undeploy.sh 
b/samples/applications/more-complex-app/iaases/kubernetes/undeploy.sh
new file mode 100644
index 0000000..8b2c07b
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/kubernetes/undeploy.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/undeploy
+
+sleep 5
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group8
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group6
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat2
+
+# Removing kubernetes
+echo "Removing kubernetes cluster..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/kubernetesClusters/kubernetes-cluster-1
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/mock/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/iaases/mock/artifacts/deployment-policy.json
 
b/samples/applications/more-complex-app/iaases/mock/artifacts/deployment-policy.json
new file mode 100644
index 0000000..38bc5a6
--- /dev/null
+++ 
b/samples/applications/more-complex-app/iaases/mock/artifacts/deployment-policy.json
@@ -0,0 +1,87 @@
+{
+    "applicationId": "app_boo",
+    "applicationPolicy": {
+        "applicationId": "app_boo_r4",
+        "networkPartition": [
+            {
+                "id": "openstack_R1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "mock",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "RegionOne"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "mytomcat2",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mytomcat1",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup6",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup8",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/iaases/mock/deploy.sh 
b/samples/applications/more-complex-app/iaases/mock/deploy.sh
new file mode 100755
index 0000000..87d55b8
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/mock/deploy.sh
@@ -0,0 +1,57 @@
+#!/bin/sh 
+
+export iaas="mock"                                             #[openstack, 
ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d @'autoscale-policy.json' 
-k -v -u admin:admin https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding tomcat cartridge
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat1 cartridge
+echo "Adding tomcat1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat2 cartridge
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group6c3
+echo "Adding group6c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group6c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+
+       # Adding group8c3
+echo "Adding group8c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group8c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 5
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'application-definition.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/deployment-policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/deploy
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/iaases/mock/undeploy.sh 
b/samples/applications/more-complex-app/iaases/mock/undeploy.sh
new file mode 100644
index 0000000..3fe27b3
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/mock/undeploy.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/undeploy
+
+sleep 5
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group8
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group6
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat2
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/openstack/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/more-complex-app/iaases/openstack/artifacts/deployment-policy.json
 
b/samples/applications/more-complex-app/iaases/openstack/artifacts/deployment-policy.json
new file mode 100644
index 0000000..d4d3936
--- /dev/null
+++ 
b/samples/applications/more-complex-app/iaases/openstack/artifacts/deployment-policy.json
@@ -0,0 +1,87 @@
+{
+    "applicationId": "app_boo",
+    "applicationPolicy": {
+        "applicationId": "app_boo_r4",
+        "networkPartition": [
+            {
+                "id": "openstack_R1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "openstack",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "RegionOne"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "mytomcat2",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mytomcat1",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup6",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup8",
+            "networkPartition": [
+                {
+                    "id": "openstack_R1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/iaases/openstack/deploy.sh 
b/samples/applications/more-complex-app/iaases/openstack/deploy.sh
new file mode 100755
index 0000000..04ca6b4
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/openstack/deploy.sh
@@ -0,0 +1,57 @@
+#!/bin/sh 
+
+export iaas="openstack"                                                
#[openstack, ec2, mock, kubernetes]
+export host_ip="localhost"
+
+export artifacts_path="../../artifacts"
+export cartridges_path="../../../../cartridges/${iaas}"
+export cartridges_groups_path="../../../../cartridges-groups"
+
+set -e
+
+# Adding autoscale policy
+pushd ${artifacts_path}
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d @'autoscale-policy.json' 
-k -v -u admin:admin https://${host_ip}:9443/api/autoscalingPolicies
+popd
+
+# Adding cartridges
+pushd ${cartridges_path}
+       # Adding tomcat cartridge
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat1 cartridge
+echo "Adding tomcat1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat1.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+
+       # Adding tomcat2 cartridge
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'tomcat2.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridges
+popd
+
+# Adding groups
+pushd ${cartridges_groups_path}
+       # Adding group6c3
+echo "Adding group6c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group6c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+
+       # Adding group8c3
+echo "Adding group8c3 group..."
+curl -X POST -H "Content-Type: application/json" -d @'group8c3.json' -k -v -u 
admin:admin https://${host_ip}:9443/api/cartridgeGroups
+popd
+
+sleep 5
+
+# Creating application
+pushd ${artifacts_path}
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d 
@'application-definition.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications
+popd
+
+sleep 3
+
+# Deploy application
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" 
-d@'artifacts/deployment-policy.json' -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/deploy
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/more-complex-app/iaases/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/more-complex-app/iaases/openstack/undeploy.sh 
b/samples/applications/more-complex-app/iaases/openstack/undeploy.sh
new file mode 100644
index 0000000..fa0c49d
--- /dev/null
+++ b/samples/applications/more-complex-app/iaases/openstack/undeploy.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+export host_ip="localhost"
+
+set -e
+
+# Undeploying application
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo/undeploy
+
+sleep 40
+
+# Deleting application
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/applications/app_boo
+
+# Removing groups
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group8
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridgeGroups/group6
+
+# Removing cartridges
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/cartridges/tomcat2
+
+# Removing autoscale policies
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:9443/api/autoscalingPolicies/autoscale_policy_1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/nested-group/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group/README.md 
b/samples/applications/nested-group/README.md
new file mode 100644
index 0000000..03c5e4e
--- /dev/null
+++ b/samples/applications/nested-group/README.md
@@ -0,0 +1,8 @@
+nested-group
+============
+
+i) This artifact supports for the nested group deployment.
+
+ii) Once you browse the group6c.json file you can see that the group7 is 
nested inside the group6.
+
+iii) You can simply run the test.sh script file and deploy the necessary 
nested group artifacts.

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/nested-group/artifacts/application-definition.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/nested-group/artifacts/application-definition.json 
b/samples/applications/nested-group/artifacts/application-definition.json
new file mode 100644
index 0000000..371bcae
--- /dev/null
+++ b/samples/applications/nested-group/artifacts/application-definition.json
@@ -0,0 +1,80 @@
+{
+    "applicationId": "myapp1265",
+    "alias": "mytestapp1",
+    "components": {
+        "groups": [
+            {
+                "name": "group6",
+                "alias": "mygroup6",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "groups": [
+                    {
+                        "name": "group7",
+                        "alias": "mygroup7",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "group7tom",
+                                    "autoscalingPolicy": "autoscale_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": "group6tom",
+                            "autoscalingPolicy": "autoscale_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": "mytomcat",
+                    "autoscalingPolicy": "autoscale_policy_1",
+                    "artifactRepository":{
+                        "privateRepo":false,
+                        
"repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git";,
+                        "repoUsername":"",
+                        "repoPassword":""
+                    }
+                }
+            }
+        ],
+        "dependencies": {
+            "startupOrders": [
+                "group.group6,cartridge.tomcat"
+            ],
+            "terminationBehaviour": "terminate-all"
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/nested-group/artifacts/autoscale-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group/artifacts/autoscale-policy.json 
b/samples/applications/nested-group/artifacts/autoscale-policy.json
new file mode 100755
index 0000000..920c1fe
--- /dev/null
+++ b/samples/applications/nested-group/artifacts/autoscale-policy.json
@@ -0,0 +1,14 @@
+{
+    "id": "autoscale_policy_1",
+    "loadThresholds": {
+        "requestsInFlight": {
+            "threshold": 50
+        },
+        "memoryConsumption": {
+            "threshold": 700
+        },
+        "loadAverage": {
+            "threshold": 1000
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c966cbc/samples/applications/nested-group/iaases/ec2/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git 
a/samples/applications/nested-group/iaases/ec2/artifacts/deployment-policy.json 
b/samples/applications/nested-group/iaases/ec2/artifacts/deployment-policy.json
new file mode 100644
index 0000000..9bdfaa3
--- /dev/null
+++ 
b/samples/applications/nested-group/iaases/ec2/artifacts/deployment-policy.json
@@ -0,0 +1,55 @@
+{
+    "applicationId": "myapp1265",
+    "applicationPolicy": {
+        "networkPartition": [
+            {
+                "id": "EC2-P1",
+                "activeByDefault": "true",
+                "partitions": [
+                    {
+                        "id": "P1",
+                        "provider": "ec2",
+                        "property": [
+                            {
+                                "name": "region",
+                                "value": "ap-southeast-1"
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    },
+    "childPolicies": [
+        {
+            "alias": "mytomcat",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "alias": "mygroup6",
+            "networkPartition": [
+                {
+                    "id": "EC2-P1",
+                    "partitionAlgo": "one-after-another",
+                    "partitions": [
+                        {
+                            "id": "P1",
+                            "max": 5
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}

Reply via email to