usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: devicestest
Date Tue, 02 Jun 2015 18:28:55 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 68a2af90c -> 92ecf016d


devicestest


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

Branch: refs/heads/two-dot-o-dev
Commit: 92ecf016df8efa003eb4ff88a3e702a520dbafe4
Parents: 68a2af9
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Tue Jun 2 12:28:48 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Tue Jun 2 12:28:48 2015 -0600

----------------------------------------------------------------------
 .../org/apache/usergrid/corepersistence/CpEntityManager.java    | 5 ++++-
 .../apache/usergrid/corepersistence/index/IndexServiceImpl.java | 4 +++-
 .../rest/applications/collection/devices/DevicesResourceIT.java | 3 ++-
 3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/92ecf016/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 50f04ed..1418e06 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -682,8 +682,11 @@ public class CpEntityManager implements EntityManager {
 
         Id entityId = new SimpleId( entityRef.getUuid(), entityRef.getType() );
 
+        //for devices we don't have time uuids
+        UUID timeUUID =  UUIDUtils.isTimeBased(entityRef.getUuid()) ? entityRef.getUuid()
: UUIDUtils.newTimeUUID();
+
         //Step 1 & 2 of delete
-        return ecm.mark( entityId ).mergeWith( gm.markNode( entityId, entityRef.getUuid().timestamp()
) );
+        return ecm.mark( entityId ).mergeWith( gm.markNode( entityId, timeUUID.timestamp()
) );
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/92ecf016/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
index 883c01f..96b0792 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
@@ -23,6 +23,7 @@ package org.apache.usergrid.corepersistence.index;
 import java.util.Iterator;
 import java.util.UUID;
 
+import org.apache.usergrid.utils.UUIDUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -217,10 +218,11 @@ public class IndexServiceImpl implements IndexService {
         if(crs.isEmpty())
             return Observable.empty();
 
+        UUID timeUUID = UUIDUtils.isTimeBased(entityId.getUuid()) ? entityId.getUuid() :
UUIDUtils.newTimeUUID();
         //not actually sure about the timestamp but ah well. works.
         SearchEdge searchEdge = createSearchEdgeFromSource( new SimpleEdge( applicationScope.getApplication(),
             CpNamingUtils.getEdgeTypeFromCollectionName( InflectionUtils.pluralize( entityId.getType()
) ), entityId,
-            entityId.getUuid().timestamp() ) );
+            timeUUID.timestamp() ) );
 
 
         final Observable<IndexOperationMessage>  batches = Observable.from( crs )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/92ecf016/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
index d23014d..58d856b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
@@ -47,10 +47,10 @@ public class DevicesResourceIT extends AbstractRestIT {
         Entity payload = new Entity().chainPut("name", "foo");
         UUID uuid = UUID.randomUUID();
 
-        refreshIndex();
 
         CollectionEndpoint devicesResource  =this.app().collection("devices");
         Entity entity = devicesResource.entity(uuid).put(payload);
+        refreshIndex();
 
         // create
         assertNotNull( entity );
@@ -71,6 +71,7 @@ public class DevicesResourceIT extends AbstractRestIT {
         catch ( UniformInterfaceException e ) {
             assertEquals( 404, e.getResponse().getStatus() );
         }
+        refreshIndex();
 
         // create again
         entity = devicesResource.entity(uuid).put(payload);


Mime
View raw message