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

[6/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/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);