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:13 UTC

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

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) {