You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/01/30 21:21:22 UTC
[1/4] git commit: Issues fix for USERGRID-3011. Added test cases
proving issue by deleting entities with preexisting connections.
Updated Branches:
refs/heads/master 92d0adb2c -> 5faeb10bd
refs/pull/44/merge [deleted] 7427bbfb9
Issues fix for USERGRID-3011.
Added test cases proving issue by deleting entities with preexisting connections.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/443438fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/443438fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/443438fc
Branch: refs/heads/master
Commit: 443438fc3072e6ca70a22e6f6a485c209c2d632f
Parents: 304cd69
Author: GERey <gr...@apigee.com>
Authored: Thu Jan 30 09:32:57 2014 -0800
Committer: GERey <gr...@apigee.com>
Committed: Thu Jan 30 09:32:57 2014 -0800
----------------------------------------------------------------------
.../cassandra/RelationManagerImpl.java | 28 ++++++++-----
.../users/ConnectionResourceTest.java | 43 ++++++++++++++++++++
2 files changed, 61 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/443438fc/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
index 4f565c7..3414139 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
@@ -1086,22 +1086,30 @@ public class RelationManagerImpl implements RelationManager {
PagingResultsIterator itr =
- new PagingResultsIterator( getConnectingEntities( headEntity, null, null, Level.REFS ) );
+ new PagingResultsIterator( getConnectedEntities( headEntity, null, null, Level.REFS ) );
- ConnectionRefImpl connection;
+ ConnectionRefImpl connection = null;
while ( itr.hasNext() ) {
- connection = ( ConnectionRefImpl ) itr.next();
+ Object itrObj = itr.next();
+ if ( itrObj instanceof ConnectionRefImpl ) {
+ connection = (ConnectionRefImpl) itrObj;
+ }
+ else if ( itrObj instanceof SimpleEntityRef ) {
+ connection = new ConnectionRefImpl( (SimpleEntityRef) itrObj );
+ }
+ else {
+ if ( itrObj instanceof EntityRef ) {
+ connection = new ConnectionRefImpl( new SimpleEntityRef((EntityRef) itr.next()));
+ }
+ else if ( itrObj instanceof UUID ) {
+ connection = new ConnectionRefImpl( new SimpleEntityRef((UUID)itr.next()));
+ }
+ }
+
batchUpdateEntityConnection( batch, true, connection, timestampUuid );
}
- //
- // List<ConnectionRefImpl> connections = getConnectionsWithEntity(headEntity.getUuid());
- // if (connections != null) {
- // for (ConnectionRefImpl connection : connections) {
- // batchUpdateEntityConnection(batch, true, connection, timestampUuid);
- // }
- // }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/443438fc/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java b/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
index ab29ea8..af8e8b0 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
@@ -17,6 +17,7 @@ import org.usergrid.rest.test.resource.CustomCollection;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.UniformInterfaceException;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.usergrid.utils.MapUtils.hashMap;
@@ -190,4 +191,46 @@ public class ConnectionResourceTest extends AbstractRestIT {
assertEquals( "Should point to thing2 as an entity connection", thing2Id, returned );
}
+
+ @Test //USERGRID-3011
+ public void connectionsDeleteSecondEntityInConnectionTest() {
+
+ CustomCollection things = context.collection( "things" );
+
+ UUID thing1Id = getEntityId( things.create( hashMap( "name", "thing1" ) ), 0 );
+
+ UUID thing2Id = getEntityId( things.create( hashMap( "name", "thing2" ) ), 0 );
+
+ //create the connection
+ things.entity( thing1Id ).connection( "likes" ).entity( thing2Id ).post();
+
+ JsonNode response = things.entity( "thing2" ).delete();
+
+ JsonNode node = things.entity ( "thing2" ).get();
+
+ assertNull(node);
+
+ }
+
+ @Test //USERGRID-3011
+ public void connectionsDeleteFirstEntityInConnectionTest() {
+
+ CustomCollection things = context.collection( "things" );
+
+ UUID thing1Id = getEntityId( things.create( hashMap( "name", "thing1" ) ), 0 );
+
+ UUID thing2Id = getEntityId( things.create( hashMap( "name", "thing2" ) ), 0 );
+
+ //create the connection
+ things.entity( thing1Id ).connection( "likes" ).entity( thing2Id ).post();
+
+ JsonNode response = things.entity( "thing1" ).delete();
+
+ JsonNode node = things.entity ( "thing1" ).get();
+
+ assertNull(node);
+
+ }
+
+
}
[3/4] git commit: Added fix where incoming entities are deleted
instead of outgoing entities.
Posted by sn...@apache.org.
Added fix where incoming entities are deleted instead of outgoing entities.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b44a20e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b44a20e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b44a20e4
Branch: refs/heads/master
Commit: b44a20e44caf63302fb23b17de0439f2fa0ccd20
Parents: e03500d
Author: GERey <gr...@apigee.com>
Authored: Thu Jan 30 10:09:52 2014 -0800
Committer: GERey <gr...@apigee.com>
Committed: Thu Jan 30 10:09:52 2014 -0800
----------------------------------------------------------------------
.../org/usergrid/persistence/cassandra/RelationManagerImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b44a20e4/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
index 7f69e66..1273d7e 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
@@ -1086,7 +1086,7 @@ public class RelationManagerImpl implements RelationManager {
PagingResultsIterator itr =
- new PagingResultsIterator( getConnectedEntities( headEntity, null, null, Level.REFS ) );
+ new PagingResultsIterator( getConnectingEntities( headEntity, null, null, Level.REFS ) );
ConnectionRefImpl connection = null;
[2/4] git commit: Added else if instead of separate else block for
consistency/efficiency.
Posted by sn...@apache.org.
Added else if instead of separate else block for consistency/efficiency.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e03500d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e03500d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e03500d2
Branch: refs/heads/master
Commit: e03500d2662f4c8276f8eb85d3a2682bd9e6a197
Parents: 443438f
Author: GERey <gr...@apigee.com>
Authored: Thu Jan 30 09:44:07 2014 -0800
Committer: GERey <gr...@apigee.com>
Committed: Thu Jan 30 09:44:07 2014 -0800
----------------------------------------------------------------------
.../usergrid/persistence/cassandra/RelationManagerImpl.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e03500d2/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
index 3414139..7f69e66 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
@@ -1098,16 +1098,13 @@ public class RelationManagerImpl implements RelationManager {
else if ( itrObj instanceof SimpleEntityRef ) {
connection = new ConnectionRefImpl( (SimpleEntityRef) itrObj );
}
- else {
- if ( itrObj instanceof EntityRef ) {
+ else if ( itrObj instanceof EntityRef ) {
connection = new ConnectionRefImpl( new SimpleEntityRef((EntityRef) itr.next()));
- }
- else if ( itrObj instanceof UUID ) {
+ }
+ else if ( itrObj instanceof UUID ) {
connection = new ConnectionRefImpl( new SimpleEntityRef((UUID)itr.next()));
- }
}
-
batchUpdateEntityConnection( batch, true, connection, timestampUuid );
}
}
[4/4] git commit: Merge pull request #44 from
GERey/USERGRID-3011-delete-exiting-connections
Posted by sn...@apache.org.
Merge pull request #44 from GERey/USERGRID-3011-delete-exiting-connections
Issues fix for USERGRID-3011.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5faeb10b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5faeb10b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5faeb10b
Branch: refs/heads/master
Commit: 5faeb10bd634998968ea08fcac1af37b9fd79322
Parents: 92d0adb b44a20e
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Jan 30 12:15:49 2014 -0800
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Jan 30 12:15:49 2014 -0800
----------------------------------------------------------------------
.../cassandra/RelationManagerImpl.java | 23 +++++++----
.../users/ConnectionResourceTest.java | 43 ++++++++++++++++++++
2 files changed, 57 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5faeb10b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
----------------------------------------------------------------------