You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/05/28 14:53:55 UTC

[50/50] [abbrv] incubator-usergrid git commit: Fixes bugs with naming regex

Fixes bugs with naming regex


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

Branch: refs/heads/USERGRID-669
Commit: bfe133765184d523f8cbde2a82f5572757074fd7
Parents: 490e2cb
Author: Todd Nine <tn...@apigee.com>
Authored: Thu May 28 06:52:54 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu May 28 06:52:54 2015 -0600

----------------------------------------------------------------------
 .../persistence/index/impl/IndexingUtils.java   |  2 +-
 .../index/impl/IndexingUtilsTest.java           | 32 ++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfe13376/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
index 94038b1..e82a082 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
@@ -42,7 +42,7 @@ public class IndexingUtils {
     public static final String UUID_REX =
         "([A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12})";
 
-    public static final String TYPE_REX = "(\\w+)";
+    public static final String TYPE_REX = "(.+)";
 
 
     private static final String APPID_NAME = "appId";

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfe13376/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexingUtilsTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexingUtilsTest.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexingUtilsTest.java
index cc66854..97389b2 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexingUtilsTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexingUtilsTest.java
@@ -91,6 +91,38 @@ public class IndexingUtilsTest {
 
 
     @Test
+    public void testDocumentIdPipes() {
+
+        final ApplicationScopeImpl applicationScope = new ApplicationScopeImpl( new SimpleId( "application" ) );
+
+        final Id id = new SimpleId( "id" );
+        final UUID version = UUIDGenerator.newTimeUUID();
+
+        final SearchEdgeImpl searchEdge =
+            new SearchEdgeImpl( new SimpleId( "source" ), "zzzcollzzz|users", SearchEdge.NodeType.TARGET );
+
+        final String output = IndexingUtils.createIndexDocId( applicationScope, id, version, searchEdge );
+
+
+        final String expected =
+            "appId(" + applicationScope.getApplication().getUuid() + ",application).entityId(" + id.getUuid() + "," + id
+                .getType() + ").version(" + version + ").nodeId(" + searchEdge.getNodeId().getUuid() + "," + searchEdge
+                .getNodeId().getType() + ").edgeName(zzzcollzzz|users).nodeType(TARGET)";
+
+
+        assertEquals( output, expected );
+
+
+        //now parse it
+
+        final CandidateResult parsedId = parseIndexDocId( output );
+
+        assertEquals(version, parsedId.getVersion());
+        assertEquals(id, parsedId.getId());
+    }
+
+
+    @Test
     public void testEntityType() {
 
         final ApplicationScopeImpl applicationScope = new ApplicationScopeImpl( new SimpleId( "application" ) );