Repository: stratos
Updated Branches:
  refs/heads/tenant-isolation 9a32d57d9 -> 61a73fda5


Update integration test with tenants


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

Branch: refs/heads/tenant-isolation
Commit: 61a73fda54cef19598caa388d71cac886027bd3c
Parents: 9a32d57
Author: Gayan Gunarathne <[email protected]>
Authored: Fri Aug 14 15:28:42 2015 +0530
Committer: Gayan Gunarathne <[email protected]>
Committed: Fri Aug 14 15:28:42 2015 +0530

----------------------------------------------------------------------
 .../tests/StratosTestServerManager.java         |  2 +-
 .../integration/tests/TopologyHandler.java      | 43 +++++++-------
 .../application/ApplicationBurstingTest.java    | 10 ++--
 .../application/ApplicationUpdateTest.java      | 14 ++---
 .../application/GroupStartupOrderTest.java      | 10 ++--
 .../PartitionOneAfterAnotherClusterTest.java    |  8 +--
 .../PartitionRoundRobinClusterTest.java         |  8 +--
 .../application/SingleClusterScalingTest.java   |  8 +--
 .../tests/group/CartridgeGroupTest.java         |  7 +++
 .../integration/tests/group/CartridgeTest.java  | 60 ++++++++++++++++++--
 .../src/test/resources/stratos-testing.xml      |  1 +
 11 files changed, 117 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
index 422cccc..6e279cf 100755
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
@@ -76,7 +76,7 @@ public class StratosTestServerManager extends 
TestServerManager {
         serverUtils = new ServerUtils();
         restClientAdmin=new RestClient(endpoint,"admin","admin");
         restClientTenant1 = new RestClient(endpoint, "admin", "admin");
-        restClientTenant2 = new RestClient(endpoint, "admin", "admin");
+        restClientTenant2 = new RestClient(endpoint, "[email protected]", 
"admin123");
         mockIaasApiClient = new IntegrationMockClient(endpoint + 
"/mock-iaas/api");
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
index fb0718d..e6764dc 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
@@ -35,7 +35,6 @@ import org.apache.stratos.messaging.domain.topology.Service;
 import org.apache.stratos.messaging.event.Event;
 import 
org.apache.stratos.messaging.event.application.GroupInstanceCreatedEvent;
 import org.apache.stratos.messaging.event.topology.ClusterInstanceCreatedEvent;
-import org.apache.stratos.messaging.event.topology.MemberCreatedEvent;
 import org.apache.stratos.messaging.event.topology.MemberTerminatedEvent;
 import org.apache.stratos.messaging.listener.application.*;
 import org.apache.stratos.messaging.listener.topology.*;
@@ -161,17 +160,18 @@ public class TopologyHandler {
     /**
      * Assert application activation
      *
+     * @param tenantId
      * @param applicationName
      */
-    public void assertApplicationStatus(String applicationName, 
ApplicationStatus status) {
+    public void assertApplicationStatus(String applicationName, 
ApplicationStatus status, int tenantId) {
         long startTime = System.currentTimeMillis();
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
         while (!((application != null) && (application.getStatus() == 
status))) {
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException ignore) {
             }
-            application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+            application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,tenantId);
             if ((System.currentTimeMillis() - startTime) > 
APPLICATION_ACTIVATION_TIMEOUT) {
                 break;
             }
@@ -186,9 +186,10 @@ public class TopologyHandler {
      * Assert application activation
      *
      * @param applicationName
+     * @param tenantId
      */
-    public void assertGroupActivation(String applicationName) {
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+    public void assertGroupActivation(String applicationName, int tenantId) {
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
         assertNotNull(String.format("Application is not found: 
[application-id] %s",
                 applicationName), application);
 
@@ -202,9 +203,10 @@ public class TopologyHandler {
      * Assert application activation
      *
      * @param applicationName
+     * @param tenantId
      */
-    public void assertClusterActivation(String applicationName) {
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+    public void assertClusterActivation(String applicationName, int tenantId) {
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
         assertNotNull(String.format("Application is not found: 
[application-id] %s",
                 applicationName), application);
 
@@ -245,10 +247,11 @@ public class TopologyHandler {
     /**
      * Assert application activation
      *
+     * @param tenantId
      * @param applicationName
      */
-    public void terminateMemberFromCluster(String cartridgeName, String 
applicationName, IntegrationMockClient mockIaasApiClient) {
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+    public void terminateMemberFromCluster(String cartridgeName, String 
applicationName, IntegrationMockClient mockIaasApiClient, int tenantId) {
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
         assertNotNull(String.format("Application is not found: 
[application-id] %s",
                 applicationName), application);
 
@@ -289,10 +292,10 @@ public class TopologyHandler {
 
     }
 
-    public void assertClusterMinMemberCount(String applicationName, int 
minMembers) {
+    public void assertClusterMinMemberCount(String applicationName, int 
minMembers, int tenantId) {
         long startTime = System.currentTimeMillis();
 
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
         assertNotNull(String.format("Application is not found: 
[application-id] %s",
                 applicationName), application);
 
@@ -358,13 +361,14 @@ public class TopologyHandler {
      * Assert application activation
      *
      * @param applicationName
+     * @param tenantId
      */
-    public boolean assertApplicationUndeploy(String applicationName) {
+    public boolean assertApplicationUndeploy(String applicationName, int 
tenantId) {
         long startTime = System.currentTimeMillis();
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
-1234);
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
         ApplicationContext applicationContext = null;
         try {
-            applicationContext = 
AutoscalerServiceClient.getInstance().getApplicationByTenant(applicationName,-1234);
+            applicationContext = 
AutoscalerServiceClient.getInstance().getApplicationByTenant(applicationName,tenantId);
         } catch (RemoteException e) {
             log.error("Error while getting the application context for 
[application] " + applicationName);
         }
@@ -374,9 +378,9 @@ public class TopologyHandler {
                 Thread.sleep(1000);
             } catch (InterruptedException ignore) {
             }
-            application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+            application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,tenantId);
             try {
-                applicationContext = 
AutoscalerServiceClient.getInstance().getApplicationByTenant(applicationName,-1234);
+                applicationContext = 
AutoscalerServiceClient.getInstance().getApplicationByTenant(applicationName,tenantId);
             } catch (RemoteException e) {
                 log.error("Error while getting the application context for 
[application] " + applicationName);
             }
@@ -403,11 +407,12 @@ public class TopologyHandler {
     /**
      * Assert application activation
      *
+     * @param tenantId
      * @param applicationName
      */
-    public void assertGroupInstanceCount(String applicationName, String 
groupAlias, int count) {
+    public void assertGroupInstanceCount(String applicationName, String 
groupAlias, int count, int tenantId) {
         long startTime = System.currentTimeMillis();
-        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName,-1234);
+        Application application = 
ApplicationManager.getApplications().getApplicationByTenant(applicationName, 
tenantId);
         if (application != null) {
             Group group = application.getGroupRecursively(groupAlias);
             while (group.getInstanceContextCount() != count) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
index c55ff04..d1758f1 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationBurstingTest.java
@@ -117,13 +117,13 @@ public class ApplicationBurstingTest extends 
StratosTestServerManager {
 
             //Application active handling
             
TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
-                    ApplicationStatus.Active);
+                    ApplicationStatus.Active, -1234);
 
             //Group active handling
-            
TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId(), 
-1234);
 
             //Cluster active handling
-            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId(), 
-1234);
 
             boolean removedGroup = 
restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"esb-php-group-application-bursting-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
@@ -151,7 +151,7 @@ public class ApplicationBurstingTest extends 
StratosTestServerManager {
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
-            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
+            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test",
 -1234);
             if (!undeploy) {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the 
[application] " + "application-bursting-test");
@@ -159,7 +159,7 @@ public class ApplicationBurstingTest extends 
StratosTestServerManager {
                 restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + 
"/" + "application-bursting-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
 
-                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
+                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test",
 -1234);
                 assertEquals(String.format("Forceful undeployment failed for 
the application %s",
                         "application-bursting-test"), forceUndeployed, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
index 38692d5..d75b78c 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/ApplicationUpdateTest.java
@@ -117,13 +117,13 @@ public class ApplicationUpdateTest extends 
StratosTestServerManager {
 
             //Application active handling
             
TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
-                    ApplicationStatus.Active);
+                    ApplicationStatus.Active, -1234);
 
             //Group active handling
-            
TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId(), 
-1234);
 
             //Cluster active handling
-            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId(), 
-1234);
 
             //Updating application
             boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + 
RestConstants.APPLICATIONS_PATH + "/" +
@@ -131,9 +131,9 @@ public class ApplicationUpdateTest extends 
StratosTestServerManager {
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(updated, true);
 
-            
TopologyHandler.getInstance().assertGroupInstanceCount(bean.getApplicationId(), 
"group3-application-update-test", 2);
+            
TopologyHandler.getInstance().assertGroupInstanceCount(bean.getApplicationId(), 
"group3-application-update-test", 2, -1234);
 
-            
TopologyHandler.getInstance().assertClusterMinMemberCount(bean.getApplicationId(),
 1);
+            
TopologyHandler.getInstance().assertClusterMinMemberCount(bean.getApplicationId(),
 1, -1234);
 
             ApplicationBean updatedBean = (ApplicationBean) 
restClientTenant1.getEntity(RestConstants.APPLICATIONS,
                     "g-sc-G123-1-application-update-test", 
ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
@@ -165,7 +165,7 @@ public class ApplicationUpdateTest extends 
StratosTestServerManager {
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
-            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test");
+            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test",
 -1234);
             if (!undeploy) {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the 
[application] " + "g-sc-G123-1-application-update-test");
@@ -173,7 +173,7 @@ public class ApplicationUpdateTest extends 
StratosTestServerManager {
                 restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + 
"/" + "g-sc-G123-1-application-update-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
 
-                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test");
+                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test",
 -1234);
                 assertEquals(String.format("Forceful undeployment failed for 
the application %s",
                         "g-sc-G123-1-application-update-test"), 
forceUndeployed, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
index 81743da..8ab96c3 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/GroupStartupOrderTest.java
@@ -116,13 +116,13 @@ public class GroupStartupOrderTest extends 
StratosTestServerManager {
 
             //Application active handling
             
TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
-                    ApplicationStatus.Active);
+                    ApplicationStatus.Active, -1234);
 
             //Group active handling
-            
TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertGroupActivation(bean.getApplicationId(), 
-1234);
 
             //Cluster active handling
-            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId(), 
-1234);
 
             boolean removedGroup = 
restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, 
"esb-php-group-application-bursting-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
@@ -150,7 +150,7 @@ public class GroupStartupOrderTest extends 
StratosTestServerManager {
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
-            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
+            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test",
 -1234);
             if (!undeploy) {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the 
[application] " + "application-bursting-test");
@@ -158,7 +158,7 @@ public class GroupStartupOrderTest extends 
StratosTestServerManager {
                 restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + 
"/" + "application-bursting-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
 
-                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test");
+                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("application-bursting-test",
 -1234);
                 assertEquals(String.format("Forceful undeployment failed for 
the application %s",
                         "application-bursting-test"), forceUndeployed, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
index ea57b3a..225a300 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionOneAfterAnotherClusterTest.java
@@ -102,10 +102,10 @@ public class PartitionOneAfterAnotherClusterTest extends 
StratosTestServerManage
 
             //Application active handling
             
TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
-                    ApplicationStatus.Active);
+                    ApplicationStatus.Active, -1234);
 
             //Cluster active handling
-            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId(), 
-1234);
 
             //Verifying whether members got created using round robin algorithm
             assertClusterWithRoundRobinAlgorithm(bean.getApplicationId());
@@ -135,7 +135,7 @@ public class PartitionOneAfterAnotherClusterTest extends 
StratosTestServerManage
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
-            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test");
+            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test",
 -1234);
             if (!undeploy) {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the 
[application] " + "single-cluster-scaling-test");
@@ -143,7 +143,7 @@ public class PartitionOneAfterAnotherClusterTest extends 
StratosTestServerManage
                 restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + 
"/" + "single-cluster-scaling-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
 
-                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test");
+                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test",
 -1234);
                 assertEquals(String.format("Forceful undeployment failed for 
the application %s",
                         "single-cluster-scaling-test"), forceUndeployed, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
index c2c531b..1df0027 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/PartitionRoundRobinClusterTest.java
@@ -97,10 +97,10 @@ public class PartitionRoundRobinClusterTest extends 
StratosTestServerManager {
 
             //Application active handling
             
TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId(),
-                    ApplicationStatus.Active);
+                    ApplicationStatus.Active, -1234);
 
             //Cluster active handling
-            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId(), 
-1234);
 
             //Verifying whether members got created using round robin algorithm
          /*   assertClusterWithRoundRobinAlgorithm(bean.getApplicationId());
@@ -140,7 +140,7 @@ public class PartitionRoundRobinClusterTest extends 
StratosTestServerManager {
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
-            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("partition-round-robin-test");
+            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("partition-round-robin-test",
 -1234);
             if (!undeploy) {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the 
[application] " + "partition-round-robin-test");
@@ -148,7 +148,7 @@ public class PartitionRoundRobinClusterTest extends 
StratosTestServerManager {
                 restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + 
"/" + "partition-round-robin-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
 
-                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("partition-round-robin-test");
+                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("partition-round-robin-test",
 -1234);
                 assertEquals(String.format("Forceful undeployment failed for 
the application %s",
                         "partition-round-robin-test"), forceUndeployed, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java
index 5d08063..3bcb628 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/application/SingleClusterScalingTest.java
@@ -104,10 +104,10 @@ public class SingleClusterScalingTest extends 
StratosTestServerManager {
 
             //Application active handling
             
TopologyHandler.getInstance().assertApplicationStatus(bean.getApplicationId()
-                    , ApplicationStatus.Active);
+                    , ApplicationStatus.Active, -1234);
 
             //Cluster active handling
-            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId());
+            
TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId(), 
-1234);
 
             //Verifying whether members got created using round robin algorithm
             assertClusterWithScalingup(bean.getApplicationId(), -1234);
@@ -134,7 +134,7 @@ public class SingleClusterScalingTest extends 
StratosTestServerManager {
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(unDeployed, true);
 
-            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test");
+            boolean undeploy = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test",
 -1234);
             if (!undeploy) {
                 //Need to forcefully undeploy the application
                 log.info("Force undeployment is going to start for the 
[application] " + "single-cluster-scaling-test");
@@ -142,7 +142,7 @@ public class SingleClusterScalingTest extends 
StratosTestServerManager {
                 restClientTenant1.undeployEntity(RestConstants.APPLICATIONS + 
"/" + "single-cluster-scaling-test" +
                         RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", 
RestConstants.APPLICATIONS);
 
-                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test");
+                boolean forceUndeployed = 
TopologyHandler.getInstance().assertApplicationUndeploy("single-cluster-scaling-test",
 -1234);
                 assertEquals(String.format("Forceful undeployment failed for 
the application %s",
                         "single-cluster-scaling-test"), forceUndeployed, true);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java
index 6732530..f2705b9 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTest.java
@@ -27,6 +27,7 @@ import 
org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
 
 /**
@@ -83,6 +84,12 @@ public class CartridgeGroupTest extends 
StratosTestServerManager {
             assertEquals(String.format("Updated Cartridge Group didn't match: 
[cartridge-group-name] %s",
                     "g4-g5-g6-cartridge-group-test"), updatedBean.getName(), 
"G4-cartridge-group-test");
 
+            updatedBean = (CartridgeGroupBean) restClientTenant2.
+                    getEntity(RestConstants.CARTRIDGE_GROUPS, 
"G4-cartridge-group-test",
+                            CartridgeGroupBean.class, 
RestConstants.CARTRIDGE_GROUPS_NAME);
+            assertNull(String.format("Updated Cartridge Group found in other 
tenant: [cartridge-group-name] %s",
+                    "g4-g5-g6-cartridge-group-test"), updatedBean);
+
             boolean removedC1 = 
restClientTenant1.removeEntity(RestConstants.CARTRIDGES, 
"c4-cartridge-group-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(String.format("Cartridge can be removed while it is 
used in " +

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
index d460fd9..20c07db 100644
--- 
a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
+++ 
b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTest.java
@@ -27,8 +27,7 @@ import org.apache.stratos.integration.tests.RestConstants;
 import org.apache.stratos.integration.tests.StratosTestServerManager;
 import org.testng.annotations.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle Cartridge CRUD operations
@@ -52,7 +51,7 @@ public class CartridgeTest extends StratosTestServerManager {
                     getEntity(RestConstants.CARTRIDGES, cartridgeType,
                             CartridgeBean.class, 
RestConstants.CARTRIDGES_NAME);
             assertEquals(bean.getCategory(), "Application");
-            assertEquals(bean.getHost(), "qmog.cisco.com");
+
             for (PropertyBean property : bean.getProperty()) {
                 if (property.getName().equals("payload_parameter.CEP_IP")) {
                     assertEquals(property.getValue(), "octl.qmog.cisco.com");
@@ -76,8 +75,10 @@ public class CartridgeTest extends StratosTestServerManager {
                     assertEquals(property.getValue(), "61616");
                 }
             }
-
-
+            bean = (CartridgeBean) restClientTenant2.
+                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
+                            CartridgeBean.class, 
RestConstants.CARTRIDGES_NAME);
+            assertNull("Cartridge exists in other tenant", bean);
             boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH + "/" +
                             cartridgeType + "-v1.json",
                     RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
@@ -112,10 +113,59 @@ public class CartridgeTest extends 
StratosTestServerManager {
                 }
             }
 
+            bean = (CartridgeBean) restClientTenant2.
+                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
+                            CartridgeBean.class, 
RestConstants.CARTRIDGES_NAME);
+            assertNull("Cartridge exists in other tenant", bean);
+
+            added = restClientTenant2.addEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH + "/" +
+                            cartridgeType + ".json",
+                    RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+            assertEquals(added, true);
+
+            updated = restClientTenant2.updateEntity(RESOURCES_PATH + 
RestConstants.CARTRIDGES_PATH + "/" +
+                            cartridgeType + "-v1.json",
+                    RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+            assertEquals(updated, true);
+
+            updatedBean = (CartridgeBean) restClientTenant2.
+                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
+                            CartridgeBean.class, 
RestConstants.CARTRIDGES_NAME);
+            assertEquals(updatedBean.getType(), "c0-cartridge-test");
+            assertEquals(updatedBean.getCategory(), "Data");
+            assertEquals(updatedBean.getHost(), "qmog.cisco.com12");
+            for (PropertyBean property : updatedBean.getProperty()) {
+                if (property.getName().equals("payload_parameter.CEP_IP")) {
+                    assertEquals(property.getValue(), 
"octl.qmog.cisco.com123");
+                } else if 
(property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
+                    assertEquals(property.getValue(), "admin123");
+                } else if 
(property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
+                    assertEquals(property.getValue(), 
"octl.qmog.cisco.com123");
+                } else if 
(property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
+                    assertEquals(property.getValue(), "3");
+                } else if 
(property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD"))
 {
+                    assertEquals(property.getValue(), "admin123");
+                } else if 
(property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
+                    assertEquals(property.getValue(), "test123");
+                } else if 
(property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
+                    assertEquals(property.getValue(), "7712");
+                } else if 
(property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
+                    assertEquals(property.getValue(), "7612");
+                } else if 
(property.getName().equals("payload_parameter.CEP_PORT")) {
+                    assertEquals(property.getValue(), "7612");
+                } else if 
(property.getName().equals("payload_parameter.MB_PORT")) {
+                    assertEquals(property.getValue(), "61617");
+                }
+            }
             boolean removed = 
restClientTenant1.removeEntity(RestConstants.CARTRIDGES, cartridgeType,
                     RestConstants.CARTRIDGES_NAME);
             assertEquals(removed, true);
 
+            bean = (CartridgeBean) restClientTenant2.
+                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
+                            CartridgeBean.class, 
RestConstants.CARTRIDGES_NAME);
+            assertNotNull("Cartridge not exists in other tenant", bean);
+
             CartridgeBean beanRemoved = (CartridgeBean) restClientTenant1.
                     getEntity(RestConstants.CARTRIDGES, cartridgeType,
                             CartridgeBean.class, 
RestConstants.CARTRIDGES_NAME);

http://git-wip-us.apache.org/repos/asf/stratos/blob/61a73fda/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
----------------------------------------------------------------------
diff --git 
a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml 
b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
index d08a1f9..cd65ade 100644
--- 
a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
+++ 
b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
@@ -32,6 +32,7 @@
            <class 
name="org.apache.stratos.integration.tests.group.CartridgeGroupTest" />
        </classes>
    </test>
+
    <test name="NetworkPartitionTest">
        <classes>
            <class 
name="org.apache.stratos.integration.tests.policies.NetworkPartitionTest" />

Reply via email to