You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/09/02 00:51:53 UTC

[34/35] usergrid git commit: Update test for collection level authoritative region setting.

Update test for collection level authoritative region setting.


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

Branch: refs/heads/master
Commit: 9fae8037a4b881e9c13a5a1f23f71dc34e950c40
Parents: c97a200
Author: Michael Russo <mr...@apigee.com>
Authored: Thu Sep 1 12:05:14 2016 -0700
Committer: Michael Russo <mr...@apigee.com>
Committed: Thu Sep 1 12:05:14 2016 -0700

----------------------------------------------------------------------
 .../collection/CollectionsResourceIT.java         | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/9fae8037/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
index f13ed46..d72054a 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
@@ -49,6 +49,8 @@ import static org.junit.Assert.*;
 
 public class CollectionsResourceIT extends AbstractRestIT {
 
+    private final String REGION_SETTING = "authoritativeRegion";
+
     private static final Logger log = LoggerFactory.getLogger( CollectionsResourceIT.class );
 
 
@@ -1007,7 +1009,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
 
 
     @Test
-    public void testCollectionRegion() {
+    public void testCollectionAuthoritativeRegion() {
 
         // create collection with settings for index all
 
@@ -1022,13 +1024,13 @@ public class CollectionsResourceIT extends AbstractRestIT {
 
         Collection collection = app().collection( collectionName ).collection( "_settings" ).get();
         Map<String, Object> settings = (Map<String, Object>)collection.getResponse().getData();
-        assertNull( settings.get( "region" ));
+        assertNull( settings.get( REGION_SETTING ));
 
         // set collection region with bad region, expect error
 
         try {
             app().collection( collectionName ).collection( "_settings" )
-                .post( new Entity().chainPut( "region", "us-moon-1" ) );
+                .post( new Entity().chainPut(REGION_SETTING, "us-moon-1" ) );
             fail( "post should have failed");
 
         } catch ( BadRequestException expected ) {}
@@ -1036,26 +1038,26 @@ public class CollectionsResourceIT extends AbstractRestIT {
         // set collection region with good region
 
         app().collection( collectionName ).collection( "_settings" )
-            .post( new Entity().chainPut( "region", "us-east-1" ) );
+            .post( new Entity().chainPut( REGION_SETTING, "us-east-1" ) );
 
         // get collection settings see that we have a region
 
         collection = app().collection( collectionName ).collection( "_settings" ).get();
         settings = (Map<String, Object>)collection.getResponse().getData();
-        assertNotNull( settings.get( "region" ));
-        assertEquals( "us-east-1", settings.get( "region" ));
+        assertNotNull( settings.get( REGION_SETTING ));
+        assertEquals( "us-east-1", settings.get( REGION_SETTING ));
 
         // unset the collection region
 
         app().collection( collectionName ).collection( "_settings" )
-            .post( new Entity().chainPut( "region", "" ) );
+            .post( new Entity().chainPut( REGION_SETTING, "" ) );
         refreshIndex();
 
         // get collection settings, should see no region
 
         collection = app().collection( collectionName ).collection( "_settings" ).get();
         settings = (Map<String, Object>)collection.getResponse().getData();
-        assertNull( settings.get( "region" ));
+        assertNull( settings.get( REGION_SETTING ));
 
 
     }