You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/08/19 06:40:09 UTC

[1/6] stratos git commit: update sample update test with tenant

Repository: stratos
Updated Branches:
  refs/heads/tenant-isolation d1141f4b0 -> 96900b8bd


update sample update test with tenant


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

Branch: refs/heads/tenant-isolation
Commit: d9f93dc51ed816d7332243d4113074822b728f90
Parents: d1141f4
Author: gayangunarathne <ga...@wso2.com>
Authored: Tue Aug 18 20:02:35 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Aug 18 20:02:35 2015 +0530

----------------------------------------------------------------------
 .../application/ApplicationUpdateTest.java      | 61 +++++++++++++++++++-
 .../integration/tests/group/CartridgeTest.java  | 11 ++++
 .../tests/policies/AutoscalingPolicyTest.java   | 51 ++++++++++++++--
 3 files changed, 115 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d9f93dc5/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 58a48de..e199055 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
@@ -68,7 +68,6 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
 
             TopologyHandler.getInstance().assertApplicationForNonAvailability(applicationId,tenant2Id);
 
-
             boolean removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
                     RestConstants.CARTRIDGE_GROUPS_NAME);
             assertEquals(removedGroup, false);
@@ -83,12 +82,12 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
             //Trying to remove the used network partition
             assertEquals(removedNet, false);
 
-            testApplicationRuntimeForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
-
             boolean removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
                     "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, false);
 
+           // testApplicationRuntimeForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
+
             //Un-deploying the application
             String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
                     RestConstants.APPLICATIONS_UNDEPLOY;
@@ -165,6 +164,8 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
                     "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, true);
 
+           // testApplicationUndeplymentForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
+
             log.info("-------------------------Ended application runtime update test case-------------------------");
 
         } catch (Exception e) {
@@ -253,4 +254,58 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
         //Cluster active handling
         TopologyHandler.getInstance().assertClusterActivation(bean.getApplicationId(), tenantId);
     }
+
+    private void testApplicationUndeplymentForTenant(RestClient restClientTenant,int tenantId,String autoscalingPolicyId){
+        boolean removed = restClientTenant.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
+                RestConstants.APPLICATIONS_NAME);
+        assertEquals(removed, true);
+
+        ApplicationBean beanRemoved = (ApplicationBean) restClientTenant.getEntity(RestConstants.APPLICATIONS,
+                "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+        assertEquals(beanRemoved, null);
+
+        boolean removedGroup = restClientTenant.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
+                RestConstants.CARTRIDGE_GROUPS_NAME);
+        assertEquals(removedGroup, true);
+
+        boolean removedC1 = restClientTenant.removeEntity(RestConstants.CARTRIDGES, "c1-application-update-test",
+                RestConstants.CARTRIDGES_NAME);
+        assertEquals(removedC1, true);
+
+        boolean removedC2 = restClientTenant.removeEntity(RestConstants.CARTRIDGES, "c2-application-update-test",
+                RestConstants.CARTRIDGES_NAME);
+        assertEquals(removedC2, true);
+
+        boolean removedC3 = restClientTenant.removeEntity(RestConstants.CARTRIDGES, "c3-application-update-test",
+                RestConstants.CARTRIDGES_NAME);
+        assertEquals(removedC3, true);
+
+        boolean removedAuto = restClientTenant.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+        assertEquals(removedAuto, true);
+
+        boolean removedDep = restClientTenant.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+                "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+        assertEquals(removedDep, true);
+
+        boolean removedNet = restClientTenant.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(removedNet, false);
+
+        boolean removedN2 = restClientTenant.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(removedN2, false);
+
+        boolean removeAppPolicy = restClientTenant.removeEntity(RestConstants.APPLICATION_POLICIES,
+                "application-policy-application-update-test", RestConstants.APPLICATION_POLICIES_NAME);
+        assertEquals(removeAppPolicy, true);
+
+        removedNet = restClientTenant.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(removedNet, true);
+
+        removedN2 = restClientTenant.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+        assertEquals(removedN2, true);
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/d9f93dc5/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 20c07db..afbdc1a 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
@@ -171,6 +171,17 @@ public class CartridgeTest extends StratosTestServerManager {
                             CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
             assertEquals(beanRemoved, null);
 
+            removed = restClientTenant2.removeEntity(RestConstants.CARTRIDGES, cartridgeType,
+                    RestConstants.CARTRIDGES_NAME);
+            assertEquals(removed, true);
+
+            beanRemoved = (CartridgeBean) restClientTenant2.
+                    getEntity(RestConstants.CARTRIDGES, cartridgeType,
+                            CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
+            assertEquals(beanRemoved, null);
+
+
+
             log.info("---------------------------Ended Cartridge test case-------------------------");
         } catch (Exception e) {
             log.error("An error occurred while handling RESTConstants.CARTRIDGES_PATH", e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/d9f93dc5/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
index 8064156..895e5f6 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTest.java
@@ -25,9 +25,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.assertNull;
-import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle autoscaling policy CRUD operations
@@ -59,6 +57,28 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
             assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
                     bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0);
 
+            bean = (AutoscalePolicyBean) restClientTenant2.
+                    getEntity(RestConstants.AUTOSCALING_POLICIES, policyId,
+                            AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertNull("Auto scale policy exists for other tenant",bean);
+
+            boolean addedTenant2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + ".json",
+                    RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+
+            assertEquals(String.format("Autoscaling policy did not added: [autoscaling-policy-id] %s", policyId), addedTenant2, true);
+            bean = (AutoscalePolicyBean) restClientTenant2.
+                    getEntity(RestConstants.AUTOSCALING_POLICIES, policyId,
+                            AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
+
+            assertEquals(String.format("[autoscaling-policy-id] %s is not correct", bean.getId()),
+                    bean.getId(), policyId);
+            assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId),
+                    bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 35.0, 0.0);
+            assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
+                    bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 45.0, 0.0);
+            assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
+                    bean.getLoadThresholds().getLoadAverage().getThreshold(), 25.0, 0.0);
+
             boolean updated = restClientTenant1.updateEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
                     RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
 
@@ -73,10 +93,20 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
             assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
                     updatedBean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
 
-            updatedBean = (AutoscalePolicyBean) restClientTenant2.getEntity(
+            boolean updatedTenant2 = restClientTenant2.updateEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + policyId + "-v1.json",
+                    RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+
+            assertEquals(String.format("[autoscaling-policy-id] %s update failed", policyId), updatedTenant2, true);
+            AutoscalePolicyBean updatedTenant2Bean = (AutoscalePolicyBean) restClientTenant2.getEntity(
                     RestConstants.AUTOSCALING_POLICIES, policyId,
                     AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertNull("Auto scaling policy found in tenant 2",updatedBean);
+            assertEquals(String.format("[autoscaling-policy-id] %s RIF is not correct", policyId),
+                    updatedTenant2Bean.getLoadThresholds().getRequestsInFlight().getThreshold(), 30.0, 0.0);
+            assertEquals(String.format("[autoscaling-policy-id] %s Load is not correct", policyId),
+                    updatedTenant2Bean.getLoadThresholds().getMemoryConsumption().getThreshold(), 40.0, 0.0);
+            assertEquals(String.format("[autoscaling-policy-id] %s Memory is not correct", policyId),
+                    updatedTenant2Bean.getLoadThresholds().getLoadAverage().getThreshold(), 20.0, 0.0);
+
 
             boolean removed = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
                     policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
@@ -88,6 +118,17 @@ public class AutoscalingPolicyTest extends StratosTestServerManager {
                     AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
             assertEquals(String.format("[autoscaling-policy-id] %s didn't get removed successfully",
                     policyId), beanRemoved, null);
+
+            beanRemoved = (AutoscalePolicyBean) restClientTenant2.getEntity(
+                    RestConstants.AUTOSCALING_POLICIES, policyId,
+                    AutoscalePolicyBean.class, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertNotNull("Auto scale policy not exist in other tenant",beanRemoved);
+
+            removed = restClientTenant2.removeEntity(RestConstants.AUTOSCALING_POLICIES,
+                    policyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+            assertEquals(String.format("[autoscaling-policy-id] %s couldn't be removed", policyId),
+                    removed, true);
+
             log.info("-------------------------Ended autoscaling policy test case---------------------------");
         } catch (Exception e) {
             log.error("An error occurred while handling [autoscaling policy] " + policyId, e);


[3/6] stratos git commit: Update the integration test with tenant operations

Posted by ga...@apache.org.
Update the integration test with tenant operations


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

Branch: refs/heads/tenant-isolation
Commit: 7c8a22cfff505e6dba1251e4a2adc8a2b72fb63e
Parents: 86fdc88
Author: gayangunarathne <ga...@wso2.com>
Authored: Tue Aug 18 21:17:47 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Aug 18 21:17:47 2015 +0530

----------------------------------------------------------------------
 .../application/ApplicationUpdateTest.java      | 100 +++++--------------
 .../src/test/resources/stratos-testing.xml      |   9 +-
 2 files changed, 26 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7c8a22cf/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 092e6c4..9ba62f6 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
@@ -58,7 +58,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
                     RestConstants.APPLICATIONS_NAME);
             assertEquals(updated, true);
 
-            TopologyHandler.getInstance().assertGroupInstanceCount(applicationId, "group3-application-update-test", 2, tenant1Id);
+            TopologyHandler.getInstance().assertGroupInstanceCount(applicationId, "group3-application-update-test", 1, tenant1Id);
 
             TopologyHandler.getInstance().assertClusterMinMemberCount(applicationId, 1, tenant1Id);
 
@@ -88,81 +88,9 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
 
             testApplicationRuntimeForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
 
-            //Un-deploying the application
-            String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
-                    RestConstants.APPLICATIONS_UNDEPLOY;
+            testApplicationUndeplymentForTenant(restClientTenant1,tenant1Id,autoscalingPolicyId);
 
-            boolean unDeployed = restClientTenant1.undeployEntity(resourcePathUndeploy,
-                    RestConstants.APPLICATIONS_NAME);
-            assertEquals(unDeployed, true);
-
-
-            boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test", tenant1Id);
-            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");
-
-                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", tenant1Id);
-                assertEquals(String.format("Forceful undeployment failed for the application %s",
-                        "g-sc-G123-1-application-update-test"), forceUndeployed, true);
-
-            }
-
-
-            boolean removed = restClientTenant1.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
-                    RestConstants.APPLICATIONS_NAME);
-            assertEquals(removed, true);
-
-            ApplicationBean beanRemoved = (ApplicationBean) restClientTenant1.getEntity(RestConstants.APPLICATIONS,
-                    "g-sc-G123-1-application-update-test", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
-            assertEquals(beanRemoved, null);
-
-            removedGroup = restClientTenant1.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G1-application-update-test",
-                    RestConstants.CARTRIDGE_GROUPS_NAME);
-            assertEquals(removedGroup, true);
-
-            boolean removedC1 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c1-application-update-test",
-                    RestConstants.CARTRIDGES_NAME);
-            assertEquals(removedC1, true);
-
-            boolean removedC2 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c2-application-update-test",
-                    RestConstants.CARTRIDGES_NAME);
-            assertEquals(removedC2, true);
-
-            boolean removedC3 = restClientTenant1.removeEntity(RestConstants.CARTRIDGES, "c3-application-update-test",
-                    RestConstants.CARTRIDGES_NAME);
-            assertEquals(removedC3, true);
-
-            removedAuto = restClientTenant1.removeEntity(RestConstants.AUTOSCALING_POLICIES,
-                    autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
-            assertEquals(removedAuto, true);
-
-            removedDep = restClientTenant1.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
-                    "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
-            assertEquals(removedDep, true);
-
-            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedNet, false);
-
-            boolean removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, false);
-
-            boolean removeAppPolicy = restClientTenant1.removeEntity(RestConstants.APPLICATION_POLICIES,
-                    "application-policy-application-update-test", RestConstants.APPLICATION_POLICIES_NAME);
-            assertEquals(removeAppPolicy, true);
-
-            removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    "network-partition-application-update-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedNet, true);
-
-            removedN2 = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
-                    "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
-            assertEquals(removedN2, true);
+            TopologyHandler.getInstance().assertApplicationForNonAvailability(applicationId,tenant1Id);
 
             testApplicationUndeplymentForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
 
@@ -256,6 +184,28 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
     }
 
     private void testApplicationUndeplymentForTenant(RestClient restClientTenant,int tenantId,String autoscalingPolicyId){
+
+        String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
+                RestConstants.APPLICATIONS_UNDEPLOY;
+
+        boolean unDeployed = restClientTenant.undeployEntity(resourcePathUndeploy,
+                RestConstants.APPLICATIONS_NAME);
+        assertEquals(unDeployed, true);
+
+        boolean undeploy = TopologyHandler.getInstance().assertApplicationUndeploy("g-sc-G123-1-application-update-test", tenantId);
+        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");
+
+            restClientTenant.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", tenantId);
+            assertEquals(String.format("Forceful undeployment failed for the application %s",
+                    "g-sc-G123-1-application-update-test"), forceUndeployed, true);
+
+        }
+
         boolean removed = restClientTenant.removeEntity(RestConstants.APPLICATIONS, "g-sc-G123-1-application-update-test",
                 RestConstants.APPLICATIONS_NAME);
         assertEquals(removed, true);

http://git-wip-us.apache.org/repos/asf/stratos/blob/7c8a22cf/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 c9de52a..ede5ff3 100644
--- a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
+++ b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
@@ -21,7 +21,7 @@
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
 
 <suite name="StratosIntegrationSuite">
-  <!--
+
    <test name="CartridgeTest">
        <classes>
            <class name="org.apache.stratos.integration.tests.group.CartridgeTest" />
@@ -85,11 +85,4 @@
             <class name="org.apache.stratos.integration.tests.application.GroupTerminationBehaviorTest" />
         </classes>
     </test>
-    -->
-    <test name="ApplicationUpdateTest">
-        <classes>
-            <class name="org.apache.stratos.integration.tests.application.ApplicationUpdateTest" />
-        </classes>
-    </test>
-
 </suite>


[4/6] stratos git commit: Update the integration test with tenant operations

Posted by ga...@apache.org.
Update the integration test with tenant operations


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

Branch: refs/heads/tenant-isolation
Commit: bf81f776ca83617c425a2764f5a2ac32f6306d5a
Parents: 7c8a22c
Author: gayangunarathne <ga...@wso2.com>
Authored: Tue Aug 18 21:59:21 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Aug 18 21:59:21 2015 +0530

----------------------------------------------------------------------
 .../tests/policies/ApplicationPolicyTest.java   | 57 ++++++++++++++++++--
 1 file changed, 54 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/bf81f776/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
index 5c05725..6800200 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTest.java
@@ -28,9 +28,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.assertNull;
-import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle Network partition CRUD operations
@@ -97,6 +95,27 @@ public class ApplicationPolicyTest extends StratosTestServerManager {
                             ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
             assertNull("Application policy bean found in tenant 2",bean);
 
+            addedN1 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-application-policy-test-1" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(addedN1, true);
+
+            addedN2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-application-policy-test-2" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(addedN2, true);
+
+            boolean addedTenant2Dep = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
+                            applicationPolicyId + ".json",
+                    RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
+            assertEquals(addedTenant2Dep, true);
+
+            ApplicationPolicyBean tenant2bean = (ApplicationPolicyBean) restClientTenant2.
+                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+                            ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+            assertNotNull("Application is not exist in tenant 2", tenant2bean);
+
+
             boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
@@ -129,6 +148,38 @@ public class ApplicationPolicyTest extends StratosTestServerManager {
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(beanRemovedN2, null);
 
+            tenant2bean = (ApplicationPolicyBean) restClientTenant2.
+                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+                            ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+            assertNotNull("Application is not exist in tenant 2", tenant2bean);
+
+            removedDep = restClientTenant2.removeEntity(RestConstants.APPLICATION_POLICIES,
+                    applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME);
+            assertEquals(removedDep, true);
+
+            beanRemovedDep = (ApplicationPolicyBean) restClientTenant2.
+                    getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+                            ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+            assertEquals(beanRemovedDep, null);
+
+            removedN1 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(removedN1, true);
+
+            beanRemovedN1 = (NetworkPartitionBean) restClientTenant2.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(beanRemovedN1, null);
+
+            removedN2 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-application-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(removedN2, true);
+
+            beanRemovedN2 = (NetworkPartitionBean) restClientTenant2.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2",
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(beanRemovedN2, null);
+
             log.info("-------------------------Ended deployment policy test case-------------------------");
 
         } catch (Exception e) {


[6/6] stratos git commit: Update the integration test with tenant operations

Posted by ga...@apache.org.
Update the integration test with tenant operations


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

Branch: refs/heads/tenant-isolation
Commit: 96900b8bdba58fe727550cbf267eb314724d1f4c
Parents: 06a0d30
Author: gayangunarathne <ga...@wso2.com>
Authored: Tue Aug 18 22:26:19 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Aug 18 22:26:19 2015 +0530

----------------------------------------------------------------------
 .../tests/policies/NetworkPartitionTest.java    | 28 +++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/96900b8b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
index a0fa583..de5c4fd 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTest.java
@@ -27,9 +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.assertNull;
-import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle Network partition CRUD operations
@@ -84,6 +82,16 @@ public class NetworkPartitionTest extends StratosTestServerManager {
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
             assertNull("Network partition found in tenant 2",updatedBean);
 
+            added = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            networkPartitionId + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+
+            assertEquals(added, true);
+            bean = (NetworkPartitionBean) restClientTenant2.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNotNull("Network partition not exist in other tenant",bean);
+
             boolean removed = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removed, true);
@@ -93,6 +101,20 @@ public class NetworkPartitionTest extends StratosTestServerManager {
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(beanRemoved, null);
 
+            bean = (NetworkPartitionBean) restClientTenant2.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertNotNull("Network partition not exist in other tenant",bean);
+
+            removed = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    networkPartitionId, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(removed, true);
+
+            beanRemoved = (NetworkPartitionBean) restClientTenant2.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, networkPartitionId,
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(beanRemoved, null);
+
             log.info("-------------------------Ended network partition test case-------------------------");
         } catch (Exception e) {
             log.error("An error occurred while handling network partitions", e);


[5/6] stratos git commit: Update the integration test with tenant operations

Posted by ga...@apache.org.
Update the integration test with tenant operations


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

Branch: refs/heads/tenant-isolation
Commit: 06a0d300b4c6f64515a7f50bd657b73827da4fe0
Parents: bf81f77
Author: gayangunarathne <ga...@wso2.com>
Authored: Tue Aug 18 22:14:39 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Aug 18 22:14:39 2015 +0530

----------------------------------------------------------------------
 .../tests/policies/DeploymentPolicyTest.java    | 56 ++++++++++++++++++--
 1 file changed, 53 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/06a0d300/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
index 7452dca..b784baf 100644
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
+++ b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTest.java
@@ -29,9 +29,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.assertNull;
-import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.*;
 
 /**
  * Test to handle Deployment policy CRUD operations
@@ -138,6 +136,26 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
                             DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertNull("Deployment policy found in tenant 2",updatedBean);
 
+            addedN1 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-deployment-policy-test-1" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(addedN1, true);
+
+            addedN2 = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
+                            "network-partition-deployment-policy-test-2" + ".json",
+                    RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(addedN2, true);
+
+            addedDep = restClientTenant2.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
+                            deploymentPolicyId + ".json",
+                    RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertEquals(addedDep, true);
+
+            bean = (DeploymentPolicyBean) restClientTenant2.
+                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+                            DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertNotNull("Deployment policy not exist in other tenant",bean);
+
             boolean removedNet = restClientTenant1.removeEntity(RestConstants.NETWORK_PARTITIONS,
                     "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
             //Trying to remove the used network partition
@@ -170,6 +188,38 @@ public class DeploymentPolicyTest extends StratosTestServerManager {
                             NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(beanRemovedN2, null);
 
+            bean = (DeploymentPolicyBean) restClientTenant2.
+                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+                            DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertNotNull("Deployment policy not exist in other tenant",bean);
+
+            removedDep = restClientTenant2.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
+                    deploymentPolicyId, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertEquals(removedDep, true);
+
+            beanRemovedDep = (DeploymentPolicyBean) restClientTenant2.
+                    getEntity(RestConstants.DEPLOYMENT_POLICIES, deploymentPolicyId,
+                            DeploymentPolicyBean.class, RestConstants.DEPLOYMENT_POLICIES_NAME);
+            assertEquals(beanRemovedDep, null);
+
+            removedN1 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-deployment-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(removedN1, true);
+
+            beanRemovedN1 = (NetworkPartitionBean) restClientTenant2.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-1",
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(beanRemovedN1, null);
+
+            removedN2 = restClientTenant2.removeEntity(RestConstants.NETWORK_PARTITIONS,
+                    "network-partition-deployment-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(removedN2, true);
+
+            beanRemovedN2 = (NetworkPartitionBean) restClientTenant2.
+                    getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-deployment-policy-test-2",
+                            NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
+            assertEquals(beanRemovedN2, null);
+
             log.info("-------------------------Ended deployment policy test case-------------------------");
 
         } catch (Exception e) {


[2/6] stratos git commit: Update the integration test with tenant operations

Posted by ga...@apache.org.
Update the integration test with tenant operations


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

Branch: refs/heads/tenant-isolation
Commit: 86fdc880a77ca6f071853e9f2bd14a546268fc34
Parents: d9f93dc
Author: gayangunarathne <ga...@wso2.com>
Authored: Tue Aug 18 20:06:52 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Tue Aug 18 20:06:52 2015 +0530

----------------------------------------------------------------------
 .../integration/tests/application/ApplicationUpdateTest.java | 4 ++--
 .../integration/src/test/resources/stratos-testing.xml       | 8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/86fdc880/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 e199055..092e6c4 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
@@ -86,7 +86,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
                     "deployment-policy-application-update-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
             assertEquals(removedDep, false);
 
-           // testApplicationRuntimeForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
+            testApplicationRuntimeForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
 
             //Un-deploying the application
             String resourcePathUndeploy = RestConstants.APPLICATIONS + "/" + "g-sc-G123-1-application-update-test" +
@@ -164,7 +164,7 @@ public class ApplicationUpdateTest extends StratosTestServerManager {
                     "network-partition-application-update-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
             assertEquals(removedN2, true);
 
-           // testApplicationUndeplymentForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
+            testApplicationUndeplymentForTenant(restClientTenant2,tenant2Id,autoscalingPolicyId);
 
             log.info("-------------------------Ended application runtime update test case-------------------------");
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fdc880/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 d9660b9..c9de52a 100644
--- a/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
+++ b/products/stratos/modules/integration/src/test/resources/stratos-testing.xml
@@ -21,7 +21,7 @@
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
 
 <suite name="StratosIntegrationSuite">
-
+  <!--
    <test name="CartridgeTest">
        <classes>
            <class name="org.apache.stratos.integration.tests.group.CartridgeTest" />
@@ -85,5 +85,11 @@
             <class name="org.apache.stratos.integration.tests.application.GroupTerminationBehaviorTest" />
         </classes>
     </test>
+    -->
+    <test name="ApplicationUpdateTest">
+        <classes>
+            <class name="org.apache.stratos.integration.tests.application.ApplicationUpdateTest" />
+        </classes>
+    </test>
 
 </suite>