Repository: stratos
Updated Branches:
  refs/heads/tenant-isolation 5a28ca4aa -> c2fa84252


Adding integration tests


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

Branch: refs/heads/tenant-isolation
Commit: 199b932fb25926ce4a9a16dbbb910b21512d0358
Parents: b751ddd
Author: Dinithi <[email protected]>
Authored: Wed Jul 22 13:07:19 2015 +0530
Committer: Dinithi <[email protected]>
Committed: Wed Jul 22 13:07:19 2015 +0530

----------------------------------------------------------------------
 .../autoscaler/registry/RegistryManager.java    |  8 +++--
 .../publisher/TopologyEventPublisher.java       |  4 +--
 ...LoadBalancerCommonTopologyEventReceiver.java |  2 +-
 .../domain/application/Applications.java        | 19 ++++++-----
 .../event/topology/ServiceRemovedEvent.java     | 18 +++++++---
 .../ServiceRemovedMessageProcessor.java         |  8 ++---
 .../util/converter/ObjectConverter.java         |  3 +-
 .../tests/SampleApplicationsTest.java           | 35 ++++++++++++--------
 .../single-group-app/scripts/common/deploy.sh   | 29 ++++++++++------
 .../single-group-app/scripts/common/undeploy.sh | 25 +++++++-------
 .../single-group-app/scripts/mock/deploy.sh     |  2 +-
 .../single-group-app/scripts/mock/undeploy.sh   |  2 +-
 samples/tenants/tenant1.json                    |  9 +++++
 samples/tenants/tenant2.json                    |  9 +++++
 14 files changed, 112 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
index bd9efa4..4ccdb05 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
@@ -563,9 +563,11 @@ public class RegistryManager {
 
     public ServiceGroup getServiceGroup(String name, int tenantId) throws 
Exception {
         ServiceGroup[] serviceGroups = getServiceGroups();
-        for (ServiceGroup serviceGroup : serviceGroups) {
-            if (serviceGroup.getName().equals(name) && 
(serviceGroup.getTenantId() == tenantId)) {
-                return serviceGroup;
+        if (serviceGroups != null) {
+            for (ServiceGroup serviceGroup : serviceGroups) {
+                if (serviceGroup.getName().equals(name) && 
(serviceGroup.getTenantId() == tenantId)) {
+                    return serviceGroup;
+                }
             }
         }
         return null;

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
index 3f7b0d7..af5cb3c 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
@@ -78,11 +78,11 @@ public class TopologyEventPublisher {
     public static void sendServiceRemovedEvent(List<Cartridge> cartridgeList) {
         ServiceRemovedEvent serviceRemovedEvent;
         for (Cartridge cartridge : cartridgeList) {
-            serviceRemovedEvent = new ServiceRemovedEvent(cartridge.getType());
+            serviceRemovedEvent = new ServiceRemovedEvent(cartridge.getUuid());
             if (log.isInfoEnabled()) {
                 log.info(String.format(
                         "Publishing service removed event: [service-name] %s",
-                        serviceRemovedEvent.getServiceName()));
+                        serviceRemovedEvent.getServiceUuid()));
             }
             publishEvent(serviceRemovedEvent);
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
 
b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
index ba38967..c42bfc6 100644
--- 
a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
+++ 
b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
@@ -242,7 +242,7 @@ public class LoadBalancerCommonTopologyEventReceiver 
extends TopologyEventReceiv
             protected void onEvent(Event event) {
 
                 ServiceRemovedEvent serviceRemovedEvent = 
(ServiceRemovedEvent) event;
-                String serviceName = serviceRemovedEvent.getServiceName();
+                String serviceName = serviceRemovedEvent.getServiceUuid();
 
                 try {
                     TopologyManager.acquireReadLockForService(serviceName);

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/Applications.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/Applications.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/Applications.java
index b4b8ab5..809fccb 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/Applications.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/Applications.java
@@ -47,14 +47,17 @@ public class Applications implements Serializable {
         return this.getApplications().get(applicationUuid);
     }
 
-       public Application getApplicationByTenent(String applicationid) {
-               for(Application application:this.getApplications().values()){
-                       if(application.getId().equals(applicationid)){
-                               return application;
-                       }
-               }
-               return null;
-       }
+    public Application getApplicationByTenant(String applicationId, int 
tenantId) {
+        if(getApplications() != null) {
+            for (Application application : this.getApplications().values()) {
+                if (application.getId().equals(applicationId) && 
application.getTenantId() == tenantId) {
+                    return application;
+                }
+            }
+        }
+
+        return null;
+    }
 
     public boolean isInitialized() {
         return initialized;

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEvent.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEvent.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEvent.java
index d39fef1..8d22900 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEvent.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEvent.java
@@ -27,13 +27,23 @@ import java.io.Serializable;
 public class ServiceRemovedEvent extends TopologyEvent implements Serializable 
{
     private static final long serialVersionUID = -4835613174531768139L;
 
-    private final String serviceName;
+    private final String serviceUuid;
 
-    public ServiceRemovedEvent(String serviceName) {
-        this.serviceName = serviceName;
-    }
+    private String serviceName;
 
     public String getServiceName() {
         return serviceName;
     }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public ServiceRemovedEvent(String serviceUuid) {
+        this.serviceUuid = serviceUuid;
+    }
+
+    public String getServiceUuid() {
+        return serviceUuid;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceRemovedMessageProcessor.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceRemovedMessageProcessor.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceRemovedMessageProcessor.java
index 8fc3376..f9878d6 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceRemovedMessageProcessor.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ServiceRemovedMessageProcessor.java
@@ -70,7 +70,7 @@ public class ServiceRemovedMessageProcessor extends 
MessageProcessor {
 
     private boolean doProcess(ServiceRemovedEvent event, Topology topology) {
 
-        String serviceName = event.getServiceName();
+        String serviceName = event.getServiceUuid();
 
         // Apply service filter
         if (TopologyServiceFilter.apply(serviceName)) {
@@ -81,11 +81,11 @@ public class ServiceRemovedMessageProcessor extends 
MessageProcessor {
         notifyEventListeners(event);
 
         // Validate event against the existing topology
-        Service service = topology.getService(event.getServiceName());
+        Service service = topology.getService(event.getServiceUuid());
         if (service == null) {
             if (log.isDebugEnabled()) {
                 log.debug(String.format("Service does not exist: [service] %s",
-                        event.getServiceName()));
+                        event.getServiceUuid()));
             }
         } else {
 
@@ -93,7 +93,7 @@ public class ServiceRemovedMessageProcessor extends 
MessageProcessor {
             topology.removeService(service);
 
             if (log.isInfoEnabled()) {
-                log.info(String.format("Service removed: [service] %s", 
event.getServiceName()));
+                log.info(String.format("Service removed: [service] %s", 
event.getServiceUuid()));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
 
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
index ee368e0..62702bb 100644
--- 
a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
+++ 
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
@@ -1918,7 +1918,8 @@ public class ObjectConverter {
         }
 
         CartridgeGroupBean serviceGroupDefinition = new CartridgeGroupBean();
-        serviceGroupDefinition.setUuid(serviceGroup.getName());
+        serviceGroupDefinition.setUuid(serviceGroup.getUuid());
+        serviceGroupDefinition.setName(serviceGroup.getName());
         String[] cartridges = serviceGroup.getCartridges();
         ServiceGroup[] groups = serviceGroup.getGroups();
         org.apache.stratos.autoscaler.stub.pojo.Dependencies dependencies = 
serviceGroup.getDependencies();

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
index 613a1de..50a8347 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/SampleApplicationsTest.java
@@ -56,10 +56,10 @@ public class SampleApplicationsTest extends 
StratosTestServerManager {
     }
 
     @Test
-    public void testSingleCartridgeApplication() {
+    public void testApplications() {
         try {
             initializeApplicationEventReceiver();
-            runApplicationTest("simple/single-cartridge-app", 
"single-cartridge-app");
+            runApplicationTest("simple/single-group-app", 
"cartridge-group-app");
         } catch (Exception e) {
             log.error(e);
             assertTrue("An error occurred", false);
@@ -71,11 +71,18 @@ public class SampleApplicationsTest extends 
StratosTestServerManager {
     }
 
     private void runApplicationTest(String applicationFolderName, String 
applicationId) {
-        executeCommand(getApplicationsPath() + "/" + applicationFolderName + 
"/scripts/mock/deploy.sh");
-           assertApplicationActivation(applicationId);
-        executeCommand(getApplicationsPath() + "/" + applicationFolderName + 
"/scripts/mock/undeploy.sh");
-        assertApplicationNotExists(applicationId);
-
+        executeCommand(getApplicationsPath() + "/" + applicationFolderName + 
"/scripts/mock/deploy.sh 1");
+        assertApplicationActivation(applicationId, 1);
+        executeCommand(getApplicationsPath() + "/" + applicationFolderName + 
"/scripts/mock/deploy.sh 2");
+        assertApplicationActivation(applicationId, 2);
+
+        executeCommand(getApplicationsPath() + "/" + applicationFolderName + 
"/scripts/mock/undeploy.sh 1");
+        assertApplicationNotExists(applicationId, 1);
+        log.info("Done tenant 1: " + applicationId);
+        executeCommand(getApplicationsPath() + "/" + applicationFolderName + 
"/scripts/mock/undeploy.sh 2");
+        log.info("Assert tenant 2: " + applicationId);
+        assertApplicationNotExists(applicationId, 2);
+        log.info("Done tenant 2: " + applicationId);
     }
 
     /**
@@ -113,27 +120,29 @@ public class SampleApplicationsTest extends 
StratosTestServerManager {
      * Assert application activation
      * @param applicationName
      */
-    private void assertApplicationActivation(String applicationName) {
+    private void assertApplicationActivation(String applicationName, int 
tenantId) {
            long startTime = System.currentTimeMillis();
-           Application application = 
ApplicationManager.getApplications().getApplicationByTenent(applicationName);
+           Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,
+                tenantId);
            while (!((application != null) && (application.getStatus() == 
ApplicationStatus.Active))) {
                    try {
                            Thread.sleep(1000);
                    } catch (InterruptedException ignore) {
                    }
-                   application = 
ApplicationManager.getApplications().getApplicationByTenent(applicationName);
+                   application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
                    if ((System.currentTimeMillis() - startTime) > 
APPLICATION_ACTIVATION_TIMEOUT) {
                            break;
                    }
            }
-
            assertNotNull(String.format("Application is not found: 
[application-id] %s", applicationName), application);
            assertEquals(String.format("Application status did not change to 
active: [application-id] %s", applicationName),
                         ApplicationStatus.Active, application.getStatus());
     }
 
-    private void assertApplicationNotExists(String applicationName) {
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenent(applicationName);
+    private void assertApplicationNotExists(String applicationName, int 
tenantId) {
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,
+                tenantId);
+        log.info("Application not exist [application-name]: " + 
applicationName + " [tenant-id]: " + tenantId);
         assertNull(String.format("Application is found in the topology : 
[application-id] %s", applicationName), application);
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/samples/applications/simple/single-group-app/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git 
a/samples/applications/simple/single-group-app/scripts/common/deploy.sh 
b/samples/applications/simple/single-group-app/scripts/common/deploy.sh
index b377f84..cf55bce 100755
--- a/samples/applications/simple/single-group-app/scripts/common/deploy.sh
+++ b/samples/applications/simple/single-group-app/scripts/common/deploy.sh
@@ -23,6 +23,8 @@
 iaas=$1
 host_ip="localhost"
 host_port=9443
+username="admin@test$2.com"
+password="admin123"
 
 prgdir=`dirname "$0"`
 script_path=`cd "$prgdir"; pwd`
@@ -35,6 +37,7 @@ autoscaling_policies_path=`cd 
"${script_path}/../../../../../autoscaling-policie
 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`
+tenants_path=`cd "${script_path}/../../../../../tenants"; pwd`
 
 set -e
 
@@ -43,40 +46,44 @@ if [[ -z "${iaas}" ]]; then
     exit
 fi
 
+echo ${tenants_path}/tenant1.json
+echo "Adding a tenant..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${tenants_path}/tenant$2.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/tenants
+
 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
+curl -X POST -H "Content-Type: application/json" -d 
"@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u 
${username}:${password} 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
+curl -X POST -H "Content-Type: application/json" -d 
"@${network_partitions_path}/network-partition-1.json" -k -v -u 
${username}:${password} 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 
${username}:${password} 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
+curl -X POST -H "Content-Type: application/json" -d 
"@${deployment_policies_path}/deployment-policy-1.json" -k -v -u 
${username}:${password} 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
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_path}/tomcat.json" -k -v -u ${username}:${password} 
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
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_path}/esb.json" -k -v -u ${username}:${password} 
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
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_path}/php.json" -k -v -u ${username}:${password} 
https://${host_ip}:${host_port}/api/cartridges
 
 echo "Adding esb-php-group group..."
-curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_groups_path}/esb-php-group.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridgeGroups
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_groups_path}/esb-php-group.json" -k -v -u 
${username}:${password} 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
+curl -X POST -H "Content-Type: application/json" -d 
"@${application_policies_path}/application-policy-1.json" -k -v -u 
${username}:${password} 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
+curl -X POST -H "Content-Type: application/json" -d 
"@${artifacts_path}/application.json" -k -v -u ${username}:${password} 
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/cartridge-group-app/deploy/application-policy-1
+curl -X POST -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/applications/cartridge-group-app/deploy/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/samples/applications/simple/single-group-app/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git 
a/samples/applications/simple/single-group-app/scripts/common/undeploy.sh 
b/samples/applications/simple/single-group-app/scripts/common/undeploy.sh
index e294fd1..78f4a99 100644
--- a/samples/applications/simple/single-group-app/scripts/common/undeploy.sh
+++ b/samples/applications/simple/single-group-app/scripts/common/undeploy.sh
@@ -22,35 +22,36 @@
 #
 host_ip="localhost"
 host_port=9443
+username="admin@test$1.com"
+password="admin123"
 
 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/cartridge-group-app/undeploy
+curl -X POST -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/applications/cartridge-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/cartridge-group-app
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/applications/cartridge-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/esb-php-group
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/cartridgeGroups/esb-php-group
 
 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/esb
-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 
${username}:${password} https://${host_ip}:${host_port}/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} https://${host_ip}:${host_port}/api/cartridges/esb
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} https://${host_ip}:${host_port}/api/cartridges/php
 
 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
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
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
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/deploymentPolicies/deployment-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
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/applicationPolicies/application-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
-
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/networkPartitions/network-partition-1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u 
${username}:${password} 
https://${host_ip}:${host_port}/api/networkPartitions/network-partition-2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/samples/applications/simple/single-group-app/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git 
a/samples/applications/simple/single-group-app/scripts/mock/deploy.sh 
b/samples/applications/simple/single-group-app/scripts/mock/deploy.sh
index d2dbc4c..e5f2e36 100755
--- a/samples/applications/simple/single-group-app/scripts/mock/deploy.sh
+++ b/samples/applications/simple/single-group-app/scripts/mock/deploy.sh
@@ -26,4 +26,4 @@ prgdir=`dirname "$0"`
 script_path=`cd "$prgdir"; pwd`
 common_folder=`cd "${script_path}/../common"; pwd`
 
-bash ${common_folder}/deploy.sh ${iaas}
+bash ${common_folder}/deploy.sh ${iaas} $1

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/samples/applications/simple/single-group-app/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git 
a/samples/applications/simple/single-group-app/scripts/mock/undeploy.sh 
b/samples/applications/simple/single-group-app/scripts/mock/undeploy.sh
index aa246e6..86149e2 100755
--- a/samples/applications/simple/single-group-app/scripts/mock/undeploy.sh
+++ b/samples/applications/simple/single-group-app/scripts/mock/undeploy.sh
@@ -24,4 +24,4 @@ prgdir=`dirname "$0"`
 script_path=`cd "$prgdir"; pwd`
 common_folder=`cd "${script_path}/../common"; pwd`
 
-bash ${common_folder}/undeploy.sh
+bash ${common_folder}/undeploy.sh $1

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/samples/tenants/tenant1.json
----------------------------------------------------------------------
diff --git a/samples/tenants/tenant1.json b/samples/tenants/tenant1.json
new file mode 100644
index 0000000..f575b1b
--- /dev/null
+++ b/samples/tenants/tenant1.json
@@ -0,0 +1,9 @@
+{
+  "admin": "admin",
+  "firstName": "Frank",
+  "lastName": "Myers",
+  "adminPassword": "admin123",
+  "tenantDomain": "test1.com",
+  "email": "[email protected]",
+  "active": "true"
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/199b932f/samples/tenants/tenant2.json
----------------------------------------------------------------------
diff --git a/samples/tenants/tenant2.json b/samples/tenants/tenant2.json
new file mode 100644
index 0000000..3d2baf2
--- /dev/null
+++ b/samples/tenants/tenant2.json
@@ -0,0 +1,9 @@
+{
+  "admin": "admin",
+  "firstName": "Frank",
+  "lastName": "Myers",
+  "adminPassword": "admin123",
+  "tenantDomain": "test2.com",
+  "email": "[email protected]",
+  "active": "true"
+}

Reply via email to