Additional test.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/317714bc Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/317714bc Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/317714bc Branch: refs/heads/master Commit: 317714bc4e5be27a220420c4df4ab281309ba086 Parents: e9228e1 Author: Dave Johnson <[email protected]> Authored: Fri Jun 3 08:30:42 2016 -0400 Committer: Dave Johnson <[email protected]> Committed: Fri Jun 3 08:30:42 2016 -0400 ---------------------------------------------------------------------- .../queries/SelectMappingsQueryTest.java | 38 ++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/317714bc/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/SelectMappingsQueryTest.java ---------------------------------------------------------------------- diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/SelectMappingsQueryTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/SelectMappingsQueryTest.java index 4a291b6..fd33c15 100644 --- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/SelectMappingsQueryTest.java +++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/SelectMappingsQueryTest.java @@ -103,7 +103,7 @@ public class SelectMappingsQueryTest extends QueryTestBase { * Field named testProp can be over-written by field named TESTPROP. */ @Test - public void testFieldOverride() throws Exception { + public void testFieldOverride1() throws Exception { String collectionName = "things"; @@ -119,7 +119,7 @@ public class SelectMappingsQueryTest extends QueryTestBase { app().collection( collectionName ).post( entity ); refreshIndex(); - // testProp and TESTPROP should now have newValue + // testProp and TESTPROP should new be queryable by new value QueryParameters params = new QueryParameters() .setQuery( "select * where testProp='" + newValue + "'" ); @@ -131,4 +131,38 @@ public class SelectMappingsQueryTest extends QueryTestBase { things = app().collection( "things" ).get( params ); assertEquals( 1, things.getNumOfEntities() ); } + + /** + * Field named testProp can be over-written by field named TESTPROP. + */ + @Test + public void testFieldOverride2() throws Exception { + + String collectionName = "things"; + + // create entity with TESTPROP=value + String value = RandomStringUtils.randomAlphabetic( 20 ); + Entity entity = new Entity().withProp( "TESTPROP", value ); + app().collection( collectionName ).post( entity ); + refreshIndex(); + + // override with testProp=newValue + String newValue = RandomStringUtils.randomAlphabetic( 20 ); + entity = new Entity().withProp( "testProp", newValue ); + app().collection( collectionName ).post( entity ); + refreshIndex(); + + // testProp and TESTPROP should new be queryable by new value + + QueryParameters params = new QueryParameters() + .setQuery( "select * where testProp='" + newValue + "'" ); + Collection things = this.app().collection( "things" ).get( params ); + assertEquals( 1, things.getNumOfEntities() ); + + params = new QueryParameters() + .setQuery( "select * where TESTPROP='" + newValue + "'" ); + things = app().collection( "things" ).get( params ); + assertEquals( 1, things.getNumOfEntities() ); + } + }
