usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [19/50] git commit: Fixes graph parsing
Date Wed, 12 Feb 2014 13:21:27 GMT
Fixes graph parsing


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

Branch: refs/heads/optimistic-tx-semantics
Commit: 3f1f841d8588256ac5e6016755fb2e332f28f873
Parents: b787221
Author: Todd Nine <tnine@apigee.com>
Authored: Thu Jan 30 18:02:21 2014 -0700
Committer: Todd Nine <tnine@apigee.com>
Committed: Thu Jan 30 18:02:54 2014 -0700

----------------------------------------------------------------------
 .../IdColDynamicCompositeSerializer.java        |   2 +-
 .../MultiTennantColumnFamilyDefinition.java     |  12 +-
 .../persistence/graph/SearchByIdType.java       |   5 -
 .../persistence/graph/SearchEdgeType.java       |   2 -
 .../persistence/graph/guice/GraphModule.java    |   5 +-
 .../persistence/graph/impl/EdgeManagerImpl.java |   5 -
 .../persistence/graph/impl/SimpleEdge.java      |  49 ++++++
 .../graph/impl/SimpleSearchByIdType.java        |   1 -
 .../graph/serialization/EdgeSerialization.java  |  20 ++-
 .../impl/EdgeSerializationImpl.java             | 134 ++++++++-------
 .../impl/parse/ColumnNameIterator.java          |   2 -
 .../impl/parse/ObservableIterator.java          |   2 -
 .../stage/write/EdgeWriteStage.java             |   1 -
 .../graph/serialization/util/EdgeHasher.java    |   4 -
 .../graph/serialization/util/EdgeUtils.java     |   2 +-
 .../persistence/graph/EdgeManagerIT.java        |  12 +-
 .../serialization/EdgeSerializationTest.java    | 162 +++++++++++++++++++
 .../graph/test/util/EdgeTestUtils.java          |  10 +-
 .../persistence/model/entity/SimpleId.java      |   8 +-
 stack/corepersistence/pom.xml                   |   2 +-
 20 files changed, 318 insertions(+), 122 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/astyanax/IdColDynamicCompositeSerializer.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/astyanax/IdColDynamicCompositeSerializer.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/astyanax/IdColDynamicCompositeSerializer.java
index 44da06b..770cc47 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/astyanax/IdColDynamicCompositeSerializer.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/astyanax/IdColDynamicCompositeSerializer.java
@@ -69,7 +69,7 @@ public class IdColDynamicCompositeSerializer implements DynamicCompositeFieldSer
     public Id fromComposite( final DynamicComposite composite, int startIndex ) {
 
 
-        Preconditions.checkArgument( composite.size() > startIndex+2, "Composite must contain a next element for uuid" );
+        Preconditions.checkArgument( composite.size() >= startIndex+2, "Composite must contain a next element for uuid and type" );
 
         final UUID uuid = composite.get(startIndex, UUID_SERIALIZER );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astyanax/MultiTennantColumnFamilyDefinition.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astyanax/MultiTennantColumnFamilyDefinition.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astyanax/MultiTennantColumnFamilyDefinition.java
index 764ae36..c0f7f13 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astyanax/MultiTennantColumnFamilyDefinition.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/astyanax/MultiTennantColumnFamilyDefinition.java
@@ -40,21 +40,21 @@ public class MultiTennantColumnFamilyDefinition {
 
 
     private final ColumnFamily columnFamily;
-    private final String comparator;
+    private final String columnComparatorType;
     private final String keyValidationType;
     private final String valueValidationType;
 
 
-    public MultiTennantColumnFamilyDefinition( final ColumnFamily columnFamily, final String comparator,
+    public MultiTennantColumnFamilyDefinition( final ColumnFamily columnFamily, final String columnComparatorType,
                                                final String keyValidationType, final String valueValidationType ) {
 
         Preconditions.checkNotNull( columnFamily, "columnFamily is required" );
-        Preconditions.checkNotNull( comparator, "comparator is required" );
+        Preconditions.checkNotNull( columnComparatorType, "columnComparatorType is required" );
         Preconditions.checkNotNull( keyValidationType, "keyValidationType is required" );
         Preconditions.checkNotNull( valueValidationType, "valueValidationType is required" );
 
         this.columnFamily = columnFamily;
-        this.comparator = comparator;
+        this.columnComparatorType = columnComparatorType;
         this.keyValidationType = keyValidationType;
         this.valueValidationType = valueValidationType;
     }
@@ -63,11 +63,11 @@ public class MultiTennantColumnFamilyDefinition {
     public Map<String, Object> getOptions() {
 
         Map<String, Object> options = new HashMap<String, Object>();
-        options.put( COMPARATOR_TYPE, comparator );
+        options.put( COMPARATOR_TYPE, columnComparatorType );
         options.put( KEY_VALIDATION, keyValidationType );
         options.put( VALUE_VALIDATION, valueValidationType );
 
-        //always use 10% load repair chance!
+        //always use 10% read repair chance!
         options.put( READ_REPAIR_CHANCE, 0.1d );
 
         return options;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchByIdType.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchByIdType.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchByIdType.java
index 0e6ae0f..f3d42a6 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchByIdType.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchByIdType.java
@@ -20,11 +20,6 @@
 package org.apache.usergrid.persistence.graph;
 
 
-import java.util.UUID;
-
-import org.apache.usergrid.persistence.model.entity.Id;
-
-
 /**
  * Search by both edge type and target type.  Only nodes
  * with the type specified will be returned

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchEdgeType.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchEdgeType.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchEdgeType.java
index 54c94dc..653547c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchEdgeType.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/SearchEdgeType.java
@@ -20,8 +20,6 @@
 package org.apache.usergrid.persistence.graph;
 
 
-import java.util.UUID;
-
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.common.base.Optional;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
index 6533b9f..6690356 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/guice/GraphModule.java
@@ -19,13 +19,10 @@
 
 package org.apache.usergrid.persistence.graph.guice;
 
+
 import org.apache.usergrid.persistence.collection.guice.CollectionModule;
 import org.apache.usergrid.persistence.collection.migration.Migration;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.mvcc.event.PostProcessObserver;
-import org.apache.usergrid.persistence.collection.serialization.impl.MvccEntitySerializationStrategyImpl;
-import org.apache.usergrid.persistence.collection.serialization.impl.MvccLogEntrySerializationStrategyImpl;
 import org.apache.usergrid.persistence.graph.EdgeManager;
 import org.apache.usergrid.persistence.graph.EdgeManagerFactory;
 import org.apache.usergrid.persistence.graph.impl.CollectionIndexObserver;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/EdgeManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/EdgeManagerImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/EdgeManagerImpl.java
index 347993f..bc5c91e 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/EdgeManagerImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/EdgeManagerImpl.java
@@ -23,7 +23,6 @@ package org.apache.usergrid.persistence.graph.impl;
 import java.util.Iterator;
 
 import org.apache.usergrid.persistence.collection.OrganizationScope;
-import org.apache.usergrid.persistence.collection.hystrix.ReadCommand;
 import org.apache.usergrid.persistence.collection.hystrix.WriteCommand;
 import org.apache.usergrid.persistence.collection.mvcc.entity.ValidationUtils;
 import org.apache.usergrid.persistence.graph.Edge;
@@ -39,13 +38,9 @@ import org.apache.usergrid.persistence.graph.serialization.stage.write.EdgeWrite
 
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
-import com.netflix.hystrix.Hystrix;
-import com.netflix.hystrix.HystrixCommand;
-import com.netflix.hystrix.HystrixCommandGroupKey;
 
 import rx.Observable;
 import rx.Scheduler;
-import rx.util.functions.Func1;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleEdge.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleEdge.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleEdge.java
index ef4515d..81a6005 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleEdge.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleEdge.java
@@ -73,4 +73,53 @@ public class SimpleEdge implements Edge {
     public UUID getVersion() {
         return version;
     }
+
+
+    @Override
+    public boolean equals( final Object o ) {
+        if ( this == o ) {
+            return true;
+        }
+        if ( !( o instanceof Edge ) ) {
+            return false;
+        }
+
+        final Edge that = ( Edge ) o;
+
+        if ( !sourceNode.equals( that.getSourceNode() ) ) {
+            return false;
+        }
+        if ( !targetNode.equals( that.getTargetNode() ) ) {
+            return false;
+        }
+        if ( !type.equals( that.getType() ) ) {
+            return false;
+        }
+        if ( !version.equals( that.getVersion() ) ) {
+            return false;
+        }
+
+        return true;
+    }
+
+
+    @Override
+    public int hashCode() {
+        int result = sourceNode.hashCode();
+        result = 31 * result + type.hashCode();
+        result = 31 * result + targetNode.hashCode();
+        result = 31 * result + version.hashCode();
+        return result;
+    }
+
+
+    @Override
+    public String toString() {
+        return "SimpleEdge{" +
+                "sourceNode=" + sourceNode +
+                ", type='" + type + '\'' +
+                ", targetNode=" + targetNode +
+                ", version=" + version +
+                '}';
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByIdType.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByIdType.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByIdType.java
index e3fd2b4..e00ed87 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByIdType.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/impl/SimpleSearchByIdType.java
@@ -24,7 +24,6 @@ import java.util.UUID;
 
 import org.apache.usergrid.persistence.collection.mvcc.entity.ValidationUtils;
 import org.apache.usergrid.persistence.graph.Edge;
-import org.apache.usergrid.persistence.graph.SearchByEdgeType;
 import org.apache.usergrid.persistence.graph.SearchByIdType;
 import org.apache.usergrid.persistence.model.entity.Id;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerialization.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerialization.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerialization.java
index 2fa8dc2..f6434df 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerialization.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerialization.java
@@ -54,38 +54,36 @@ public interface EdgeSerialization {
     MutationBatch deleteEdge( OrganizationScope scope, Edge edge );
 
     /**
-     * Get an iterator of all edges by edge type from source node
+     * Get an iterator of all edges by edge type originating from source node
      *
      * @param scope The org scope of the graph
      * @param edgeType The search edge
      */
-    Iterator<Edge> getTargetEdges( OrganizationScope scope, SearchByEdgeType edgeType );
+    Iterator<Edge> getEdgesFromSource( OrganizationScope scope, SearchByEdgeType edgeType );
 
 
     /**
-     * Get an iterator of all edges by edge type and target type from source node * @param scope The org scope of the
-     * graph
+     * Get an iterator of all edges by edge type originating from source node.  Also filters by target node id type
      *
      * @param scope The org scope of the graph
      * @param edgeType The search edge
      */
-    Iterator<Edge> getTargetIdEdges( OrganizationScope scope, SearchByIdType edgeType );
+    Iterator<Edge> getEdgesFromSourceByTargetType( OrganizationScope scope, SearchByIdType edgeType );
 
     /**
-     * Get an iterator of all edges by edge type from target node * @param scope The org scope of the graph
-     *
+     * Get an iterator of all edges by edge type pointing to the target node
      * @param scope The org scope of the graph
      * @param edgeType The search edge
      */
-    Iterator<Edge> getSourceEdges( OrganizationScope scope, SearchByEdgeType edgeType );
+    Iterator<Edge> getEdgesToTarget( OrganizationScope scope, SearchByEdgeType edgeType );
 
 
     /**
-     * Get an iterator of all edges by edge type and source type from target node * @param scope The org scope of the
-     * graph
+     * Get an iterator of all edges by edge type pointing to the target node.  Also uses the source id
+     * type to limit the results
      *
      * @param scope The org scope of the graph
      * @param edgeType The search edge
      */
-    Iterator<Edge> getSourceIdEdges( OrganizationScope scope, SearchByIdType edgeType );
+    Iterator<Edge> getEdgesToTargetBySourceType( OrganizationScope scope, SearchByIdType edgeType );
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
index c100e31..a726e3e 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeSerializationImpl.java
@@ -29,13 +29,14 @@ import java.util.UUID;
 import javax.inject.Inject;
 
 import org.apache.cassandra.db.marshal.BytesType;
-import org.apache.cassandra.db.marshal.DynamicCompositeType;
 
+import org.apache.usergrid.persistence.astyanax.IdColDynamicCompositeSerializer;
 import org.apache.usergrid.persistence.collection.OrganizationScope;
 import org.apache.usergrid.persistence.collection.astyanax.IdRowCompositeSerializer;
 import org.apache.usergrid.persistence.collection.astyanax.MultiTennantColumnFamily;
 import org.apache.usergrid.persistence.collection.astyanax.MultiTennantColumnFamilyDefinition;
 import org.apache.usergrid.persistence.collection.astyanax.ScopedRowKey;
+import org.apache.usergrid.persistence.collection.cassandra.ColumnTypes;
 import org.apache.usergrid.persistence.collection.migration.Migration;
 import org.apache.usergrid.persistence.collection.mvcc.entity.ValidationUtils;
 import org.apache.usergrid.persistence.graph.Edge;
@@ -59,9 +60,9 @@ import com.netflix.astyanax.model.Column;
 import com.netflix.astyanax.model.DynamicComposite;
 import com.netflix.astyanax.query.RowQuery;
 import com.netflix.astyanax.serializers.AbstractSerializer;
+import com.netflix.astyanax.serializers.LongSerializer;
 import com.netflix.astyanax.serializers.UUIDSerializer;
 import com.netflix.astyanax.util.RangeBuilder;
-import org.apache.usergrid.persistence.astyanax.IdColDynamicCompositeSerializer;
 
 
 /**
@@ -89,23 +90,35 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
 
 
     // column families
-    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> CF_SOURCE_EDGES =
-            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_Source_Edges", ORG_ROW_KEY_SER,
-                    EDGE_TYPE_SERIALIZER );
+    /**
+     * Edges that are from the source node. The row key is the source node
+     */
+    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> GRAPH_SOURCE_NODE_EDGES =
+            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_Source_Node_Edges",
+                    ORG_ROW_KEY_SER, EDGE_TYPE_SERIALIZER );
 
 
-    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> CF_TARGET_EDGES =
-            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_Target_Edges", ORG_ROW_KEY_SER,
-                    EDGE_TYPE_SERIALIZER );
+    /**
+     * Edges that are incoming to the target node.  The target node is the row key
+     */
+    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> GRAPH_TARGET_NODE_EDGES =
+            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_Target_Node_Edges",
+                    ORG_ROW_KEY_SER, EDGE_TYPE_SERIALIZER );
 
 
-    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> CF_SOURCE_TYPE_EDGES =
-            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_SourceType_Edges",
+    /**
+     * The edges that are from the source node with target type.  The source node is the row key.
+     */
+    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> GRAPH_SOURCE_NODE_TARGET_TYPE =
+            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_Source_Node_Target_Type",
                     ORG_ROW_KEY_SER, EDGE_TYPE_ID_SERIALIZER );
 
 
-    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> CF_TARGET_TYPE_EDGES =
-            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_TargetType_Edges",
+    /**
+     * The edges that are to the target node with the source type.  The target node is the row key
+     */
+    private static final MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> GRAPH_TARGET_NODE_SOURCE_TYPE =
+            new MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge>( "Graph_Target_Node_Source_Type",
                     ORG_ROW_KEY_SER, EDGE_TYPE_ID_SERIALIZER );
 
 
@@ -155,20 +168,21 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
         final DirectedEdge targetEdge = new DirectedEdge( edgeTypeName, sourceNodeId, version );
 
 
+        //TODO T.N Resume here
         /**
-         * Write edges from source->target
+         * Write edges from target<-source
          */
-        batch.withRow( CF_SOURCE_EDGES, sourceKey ).putColumn( sourceEdge, HOLDER );
+        batch.withRow( GRAPH_SOURCE_NODE_EDGES, sourceKey ).putColumn( sourceEdge, HOLDER );
 
-        batch.withRow( CF_SOURCE_TYPE_EDGES, sourceKey ).putColumn( sourceEdge, HOLDER );
+        batch.withRow( GRAPH_SOURCE_NODE_TARGET_TYPE, sourceKey ).putColumn( sourceEdge, HOLDER );
 
         /**
-         * Write edges target<- source
+         * Write edges source->target
          */
 
-        batch.withRow( CF_TARGET_EDGES, targetKey ).putColumn( targetEdge, HOLDER );
+        batch.withRow( GRAPH_TARGET_NODE_EDGES, targetKey ).putColumn( targetEdge, HOLDER );
 
-        batch.withRow( CF_TARGET_TYPE_EDGES, targetKey ).putColumn( targetEdge, HOLDER );
+        batch.withRow( GRAPH_TARGET_NODE_SOURCE_TYPE, targetKey ).putColumn( targetEdge, HOLDER );
 
         return batch;
     }
@@ -210,60 +224,67 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
         /**
          * Write edges from source->target
          */
-        batch.withRow( CF_SOURCE_EDGES, sourceKey ).deleteColumn( sourceEdge );
+        batch.withRow( GRAPH_SOURCE_NODE_EDGES, sourceKey ).deleteColumn( sourceEdge );
 
-        batch.withRow( CF_SOURCE_TYPE_EDGES, sourceKey ).deleteColumn( sourceEdge );
+        batch.withRow( GRAPH_SOURCE_NODE_TARGET_TYPE, sourceKey ).deleteColumn( sourceEdge );
 
         /**
          * Write edges target<- source
          */
 
-        batch.withRow( CF_TARGET_EDGES, targetKey ).deleteColumn( targetEdge );
+        batch.withRow( GRAPH_TARGET_NODE_EDGES, targetKey ).deleteColumn( targetEdge );
 
-        batch.withRow( CF_TARGET_TYPE_EDGES, targetKey ).deleteColumn( targetEdge );
+        batch.withRow( GRAPH_TARGET_NODE_SOURCE_TYPE, targetKey ).deleteColumn( targetEdge );
 
         return batch;
     }
 
 
     @Override
-    public Iterator<Edge> getTargetEdges( final OrganizationScope scope, final SearchByEdgeType edgeType ) {
-        return getEdges( scope, edgeType, CF_SOURCE_EDGES, EDGE_TYPE_ID_SERIALIZER, SOURCE_DIRECTED_EDGE_CREATOR );
+    public Iterator<Edge> getEdgesFromSource( final OrganizationScope scope, final SearchByEdgeType edgeType ) {
+        return getEdges( scope, edgeType, GRAPH_SOURCE_NODE_EDGES, EDGE_TYPE_SERIALIZER, TARGET_DIRECTED_EDGE_CREATOR, new SourceEdgeColumnParser( edgeType ) );
     }
 
 
     @Override
-    public Iterator<Edge> getTargetIdEdges( final OrganizationScope scope, final SearchByIdType edgeType ) {
-        return getEdges( scope, edgeType, CF_SOURCE_TYPE_EDGES, EDGE_TYPE_SERIALIZER, SOURCE_DIRECTED_EDGE_CREATOR );
+    public Iterator<Edge> getEdgesFromSourceByTargetType( final OrganizationScope scope,
+                                                          final SearchByIdType edgeType ) {
+        return getEdges( scope, edgeType, GRAPH_SOURCE_NODE_TARGET_TYPE, EDGE_TYPE_SERIALIZER,
+                SOURCE_DIRECTED_EDGE_CREATOR,  new SourceEdgeColumnParser( edgeType ) );
     }
 
 
-
     @Override
-    public Iterator<Edge> getSourceEdges( final OrganizationScope scope, final SearchByEdgeType edgeType ) {
-        return getEdges( scope, edgeType, CF_TARGET_EDGES, EDGE_TYPE_SERIALIZER, TARGET_DIRECTED_EDGE_CREATOR );
+    public Iterator<Edge> getEdgesToTarget( final OrganizationScope scope, final SearchByEdgeType edgeType ) {
+        return getEdges( scope, edgeType, GRAPH_TARGET_NODE_EDGES, EDGE_TYPE_ID_SERIALIZER,
+                SOURCE_DIRECTED_EDGE_CREATOR,  new TargetEdgeColumnParser( edgeType ) );
     }
 
 
     @Override
-    public Iterator<Edge> getSourceIdEdges( final OrganizationScope scope, final SearchByIdType edgeType ) {
-        return getEdges( scope, edgeType, CF_TARGET_TYPE_EDGES, EDGE_TYPE_ID_SERIALIZER, TARGET_DIRECTED_EDGE_CREATOR );
+    public Iterator<Edge> getEdgesToTargetBySourceType( final OrganizationScope scope, final SearchByIdType edgeType ) {
+        return getEdges( scope, edgeType, GRAPH_TARGET_NODE_SOURCE_TYPE, EDGE_TYPE_ID_SERIALIZER,
+                TARGET_DIRECTED_EDGE_CREATOR,  new TargetEdgeColumnParser( edgeType ) );
     }
 
 
     /**
      * Get the edges with the specified criteria
+     *
      * @param scope The organization scope
      * @param edgeType The search type
      * @param cf The column familiy to search
      * @param edgeSerializer The serializer to use when reading columns
      * @param directedEdgeCreator The creator to use when creating the edges for searching
+     * @param edgeColumnParser The parser to user when iterating the columns
+     *
      * @return An iterator of all Edge instance that match the criteria
      */
     private Iterator<Edge> getEdges( final OrganizationScope scope, final SearchByEdgeType edgeType,
                                      MultiTennantColumnFamily<OrganizationScope, Id, DirectedEdge> cf,
                                      final EdgeSerializer edgeSerializer,
-                                     final DirectedEdgeCreator directedEdgeCreator ) {
+                                     final DirectedEdgeCreator directedEdgeCreator,
+                                     final EdgeColumnParser edgeColumnParser) {
         ValidationUtils.validateOrganizationScope( scope );
         EdgeUtils.validateSearchByEdgeType( edgeType );
 
@@ -276,33 +297,33 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
         /**
          * Edge from source->target
          */
-        final ScopedRowKey<OrganizationScope, Id> sourceKey = new ScopedRowKey<OrganizationScope, Id>( scope, nodeId );
+        final ScopedRowKey<OrganizationScope, Id> rowkey = new ScopedRowKey<OrganizationScope, Id>( scope, nodeId );
 
 
-        DirectedEdge sourceEdge;
+        DirectedEdge lastEdge;
 
         /**
          * If the edge is present, we need to being seeking from this
          */
         if ( edgeType.last().isPresent() ) {
-            sourceEdge = directedEdgeCreator.getDirectedEdge( edgeType.last().get() );
+            lastEdge = directedEdgeCreator.getDirectedEdge( edgeType.last().get() );
         }
         else {
-            sourceEdge = new DirectedEdge( edgeTypeName, nodeId, version );
+            lastEdge = new DirectedEdge( edgeTypeName, nodeId, version );
         }
 
 
         //resume from the last if specified.  Also set the range
         final ByteBufferRange searchRange =
-                new RangeBuilder().setLimit( PAGE_SIZE ).setStart( sourceEdge, edgeSerializer ).build();
+                new RangeBuilder().setLimit( PAGE_SIZE ).setStart( lastEdge, edgeSerializer ).build();
 
         RowQuery<ScopedRowKey<OrganizationScope, Id>, DirectedEdge> query =
-                keyspace.prepareQuery( cf ).getKey( sourceKey ).autoPaginate( true ).withColumnRange( searchRange );
+                keyspace.prepareQuery( cf ).getKey( rowkey ).autoPaginate( true ).withColumnRange( searchRange );
 
 
         try {
             return new ColumnNameIterator<DirectedEdge, Edge>( query.execute().getResult().iterator(),
-                    new SourceEdgeColumnParser( nodeId, edgeTypeName ), edgeType.last().isPresent() );
+                   edgeColumnParser, edgeType.last().isPresent() );
         }
         catch ( ConnectionException e ) {
             throw new RuntimeException( "Unable to connect to cassandra", e );
@@ -310,12 +331,10 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
     }
 
 
-
-
     @Override
     public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
-        return Arrays.asList( graphCf( CF_SOURCE_EDGES ), graphCf( CF_TARGET_EDGES ),
-                graphCf( CF_SOURCE_TYPE_EDGES ), graphCf( CF_TARGET_TYPE_EDGES ) );
+        return Arrays.asList( graphCf( GRAPH_SOURCE_NODE_EDGES ), graphCf( GRAPH_TARGET_NODE_EDGES ),
+                graphCf( GRAPH_SOURCE_NODE_TARGET_TYPE ), graphCf( GRAPH_TARGET_NODE_SOURCE_TYPE ) );
     }
 
 
@@ -323,7 +342,7 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
      * Helper to generate an edge definition by the type
      */
     private MultiTennantColumnFamilyDefinition graphCf( MultiTennantColumnFamily cf ) {
-        return new MultiTennantColumnFamilyDefinition( cf, DynamicCompositeType.class.getSimpleName(),
+        return new MultiTennantColumnFamilyDefinition( cf, ColumnTypes.DYNAMIC_COMPOSITE_TYPE,
                 BytesType.class.getSimpleName(), BytesType.class.getSimpleName() );
     }
 
@@ -337,6 +356,7 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
         private static final IdColDynamicCompositeSerializer ID_COL_SERIALIZER = IdColDynamicCompositeSerializer.get();
 
         private static final UUIDSerializer UUID_SERIALIZER = UUIDSerializer.get();
+        private static final LongSerializer LONG_SERIALIZER = LongSerializer.get();
 
 
         @Override
@@ -346,14 +366,13 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
 
             DynamicComposite composite = new DynamicComposite();
 
-            for ( long hash : targetEdgeTypes ) {
-                composite.add( hash );
-            }
+            composite.addComponent( targetEdgeTypes[0], LONG_SERIALIZER );
+            composite.addComponent( targetEdgeTypes[1], LONG_SERIALIZER );
 
-            ID_COL_SERIALIZER.toComposite( composite, edge.id );
 
             composite.addComponent( edge.version, UUID_SERIALIZER );
 
+            ID_COL_SERIALIZER.toComposite( composite, edge.id );
 
             return composite.serialize();
         }
@@ -366,9 +385,10 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
 
             Preconditions.checkArgument( composite.size() == 5, "Composite should have 5 elements" );
 
+            final UUID version = composite.get( 2, UUID_SERIALIZER );
+
             final Id id = ID_COL_SERIALIZER.fromComposite( composite, 3 );
 
-            final UUID version = composite.get( 5, UUID_SERIALIZER );
 
             return new DirectedEdge( null, id, version );
         }
@@ -435,9 +455,9 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
         /**
          * Default constructor. Needs to take the id and edge used in the search
          */
-        protected EdgeColumnParser( final Id id, final String edgeType ) {
-            this.id = id;
-            this.edgeType = edgeType;
+        protected EdgeColumnParser( SearchByEdgeType searchByEdgeType ) {
+            this.id = searchByEdgeType.getNode();
+            this.edgeType = searchByEdgeType.getType();
         }
 
 
@@ -460,11 +480,12 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
      */
     private static class SourceEdgeColumnParser extends EdgeColumnParser {
 
+
         /**
          * Default constructor. Needs to take the id and edge used in the search
          */
-        protected SourceEdgeColumnParser( final Id id, final String edgeType ) {
-            super( id, edgeType );
+        protected SourceEdgeColumnParser( final SearchByEdgeType searchByEdgeType ) {
+            super( searchByEdgeType );
         }
 
 
@@ -480,11 +501,12 @@ public class EdgeSerializationImpl implements EdgeSerialization, Migration {
      */
     private static class TargetEdgeColumnParser extends EdgeColumnParser {
 
+
         /**
          * Default constructor. Needs to take the id and edge used in the search
          */
-        protected TargetEdgeColumnParser( final Id id, final String edgeType ) {
-            super( id, edgeType );
+        protected TargetEdgeColumnParser( final SearchByEdgeType searchByEdgeType ) {
+            super( searchByEdgeType );
         }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ColumnNameIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ColumnNameIterator.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ColumnNameIterator.java
index 7979e3b..eeb8d74 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ColumnNameIterator.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ColumnNameIterator.java
@@ -3,8 +3,6 @@ package org.apache.usergrid.persistence.graph.serialization.impl.parse;
 
 import java.util.Iterator;
 
-import org.apache.usergrid.persistence.graph.serialization.impl.parse.ColumnParser;
-
 import com.netflix.astyanax.model.Column;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ObservableIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ObservableIterator.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ObservableIterator.java
index 0272f74..f820aa9 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ObservableIterator.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/parse/ObservableIterator.java
@@ -3,8 +3,6 @@ package org.apache.usergrid.persistence.graph.serialization.impl.parse;
 
 import java.util.Iterator;
 
-import com.netflix.hystrix.HystrixCommand;
-
 import rx.Observable;
 import rx.Observer;
 import rx.Subscription;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/stage/write/EdgeWriteStage.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/stage/write/EdgeWriteStage.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/stage/write/EdgeWriteStage.java
index b4c9355..03deec6 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/stage/write/EdgeWriteStage.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/stage/write/EdgeWriteStage.java
@@ -12,7 +12,6 @@ import com.google.inject.Singleton;
 import com.netflix.astyanax.MutationBatch;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 
-import rx.util.functions.Action1;
 import rx.util.functions.Func1;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeHasher.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeHasher.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeHasher.java
index 4d6b397..717773c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeHasher.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeHasher.java
@@ -22,15 +22,11 @@ package org.apache.usergrid.persistence.graph.serialization.util;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.UUID;
 
 import org.apache.cassandra.utils.MurmurHash;
 
 import org.apache.usergrid.persistence.model.entity.Id;
 
-import com.netflix.astyanax.serializers.StringSerializer;
-
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeUtils.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeUtils.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeUtils.java
index 18c8127..0979d95 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeUtils.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/util/EdgeUtils.java
@@ -24,8 +24,8 @@ import org.apache.usergrid.persistence.collection.mvcc.entity.ValidationUtils;
 import org.apache.usergrid.persistence.graph.Edge;
 import org.apache.usergrid.persistence.graph.SearchByEdgeType;
 import org.apache.usergrid.persistence.graph.SearchByIdType;
-import org.apache.usergrid.persistence.graph.SearchIdType;
 import org.apache.usergrid.persistence.graph.SearchEdgeType;
+import org.apache.usergrid.persistence.graph.SearchIdType;
 
 import com.google.common.base.Preconditions;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/EdgeManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/EdgeManagerIT.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/EdgeManagerIT.java
index 5a7c95a..17cff7d 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/EdgeManagerIT.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/EdgeManagerIT.java
@@ -27,18 +27,16 @@ import org.jukito.JukitoRunner;
 import org.jukito.UseModules;
 import org.junit.Before;
 import org.junit.ClassRule;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import org.apache.usergrid.persistence.collection.OrganizationScope;
 import org.apache.usergrid.persistence.collection.cassandra.CassandraRule;
-import org.apache.usergrid.persistence.collection.guice.CollectionModule;
 import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.graph.guice.GraphModule;
 import org.apache.usergrid.persistence.graph.impl.SimpleEdge;
-import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
-import org.apache.usergrid.persistence.graph.impl.SimpleSearchByIdType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchIdType;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -49,18 +47,16 @@ import com.google.inject.Inject;
 
 import rx.Observable;
 
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdge;
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdgeAndId;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import org.junit.Ignore;
 import static org.mockito.Mockito.mock;
-
-
 import static org.mockito.Mockito.when;
 
-import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.*;
-
 
 @Ignore // tests fail due to unimplemented methods in EdgeManagerImpl that return null
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
new file mode 100644
index 0000000..5bee908
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/EdgeSerializationTest.java
@@ -0,0 +1,162 @@
+package org.apache.usergrid.persistence.graph.serialization;
+
+
+import java.util.Iterator;
+import java.util.UUID;
+
+import org.jukito.JukitoRunner;
+import org.jukito.UseModules;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.usergrid.persistence.collection.OrganizationScope;
+import org.apache.usergrid.persistence.collection.cassandra.CassandraRule;
+import org.apache.usergrid.persistence.collection.guice.MigrationManagerRule;
+import org.apache.usergrid.persistence.graph.Edge;
+import org.apache.usergrid.persistence.graph.guice.GraphModule;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import com.google.inject.Inject;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createEdge;
+import static org.apache.usergrid.persistence.graph.test.util.EdgeTestUtils.createSearchByEdge;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+
+/**
+ *
+ *
+ */
+@RunWith( JukitoRunner.class )
+@UseModules( { GraphModule.class } )
+public class EdgeSerializationTest {
+
+    @ClassRule
+    public static CassandraRule rule = new CassandraRule();
+
+
+    @Inject
+    @Rule
+    public MigrationManagerRule migrationManagerRule;
+
+
+    @Inject
+    protected EdgeSerialization serialization;
+
+    protected OrganizationScope scope;
+
+
+    @Before
+    public void setup() {
+        scope = mock( OrganizationScope.class );
+
+        Id orgId = mock( Id.class );
+
+        when( orgId.getType() ).thenReturn( "organization" );
+        when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
+
+        when( scope.getOrganization() ).thenReturn( orgId );
+    }
+
+
+    /**
+     * Tests mixing 2 edge types between 2 nodes.  We should get results for the same source->destination with the 2
+     * edge types
+     */
+    @Test
+    public void mixedEdgeTypes() throws ConnectionException {
+        final Edge edge1 = createEdge( "source", "edge1", "target" );
+
+        final Id sourceId = edge1.getSourceNode();
+        final Id targetId = edge1.getTargetNode();
+
+
+        final Edge edge2 = createEdge( sourceId, "edge2", targetId );
+
+        serialization.writeEdge( scope, edge1 ).execute();
+        serialization.writeEdge( scope, edge2 ).execute();
+
+
+        UUID now = UUIDGenerator.newTimeUUID();
+
+        //get our edges out by name
+
+        Iterator<Edge> results =
+                serialization.getEdgesFromSource( scope, createSearchByEdge( sourceId, "edge1", now, null ) );
+
+        assertEquals( edge1, results.next() );
+        assertFalse( results.hasNext() );
+
+        //test getting the next edge
+        results = serialization.getEdgesFromSource( scope, createSearchByEdge( sourceId, "edge2", now, null ) );
+
+        assertEquals( edge2, results.next() );
+        assertFalse( results.hasNext() );
+
+        //test getting source edges from the target
+
+        results = serialization.getEdgesToTarget( scope, createSearchByEdge( targetId, "edge1", now, null ) );
+        assertEquals( edge1, results.next() );
+        assertFalse( results.hasNext() );
+
+
+        results = serialization.getEdgesToTarget( scope, createSearchByEdge( targetId, "edge2", now, null ) );
+        assertEquals( edge2, results.next() );
+        assertFalse( results.hasNext() );
+    }
+
+
+    /**
+     * Test paging by resuming the search from the edge
+     */
+    @Test
+    public void testPaging() throws ConnectionException {
+        final Edge edge1 = createEdge( "source", "edge", "target" );
+
+        final Id sourceId = edge1.getSourceNode();
+        final Id targetId = edge1.getTargetNode();
+
+
+        final Edge edge2 = createEdge( sourceId, "edge", targetId );
+
+
+        serialization.writeEdge( scope, edge1 ).execute();
+        serialization.writeEdge( scope, edge2 ).execute();
+
+
+        UUID now = UUIDGenerator.newTimeUUID();
+
+        //get our edges out by name
+
+        Iterator<Edge> results =
+                serialization.getEdgesFromSource( scope, createSearchByEdge( sourceId, "edge", now, edge1 ) );
+
+        assertEquals(edge2, results.next());
+        assertFalse( results.hasNext() );
+
+        //test getting the next edge
+        results = serialization.getEdgesFromSource( scope, createSearchByEdge( sourceId, "edge", now, edge2 ) );
+
+        assertFalse( "No results should be returned", results.hasNext() );
+
+        //test getting source edges from the target
+
+        results = serialization.getEdgesToTarget( scope, createSearchByEdge( targetId, "edge", now, edge1 ) );
+        assertEquals(edge2, results.next());
+        assertFalse( results.hasNext() );
+
+
+        results = serialization.getEdgesToTarget( scope, createSearchByEdge( targetId, "edge", now, edge2 ) );
+        assertFalse( "No results should be returned", results.hasNext() );
+        //test resume by name
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/test/util/EdgeTestUtils.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/test/util/EdgeTestUtils.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/test/util/EdgeTestUtils.java
index 9f779c9..5e063ee 100644
--- a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/test/util/EdgeTestUtils.java
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/test/util/EdgeTestUtils.java
@@ -32,11 +32,9 @@ import org.apache.usergrid.persistence.graph.impl.SimpleSearchByIdType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchIdType;
 import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.entity.SimpleId;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 
 /**
  *  Simple class for edge testing generation
@@ -75,11 +73,7 @@ public class EdgeTestUtils {
      * @return
      */
     public static Id createId(String type){
-        Id sourceId = mock( Id.class );
-        when( sourceId.getType() ).thenReturn( type );
-        when( sourceId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
-
-        return sourceId;
+       return new SimpleId( UUIDGenerator.newTimeUUID(), type );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/SimpleId.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/SimpleId.java b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/SimpleId.java
index e894891..64d6b6b 100644
--- a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/SimpleId.java
+++ b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/SimpleId.java
@@ -72,16 +72,16 @@ public class SimpleId implements Id, Serializable {
         if ( this == o ) {
             return true;
         }
-        if ( !( o instanceof SimpleId ) ) {
+        if ( !( o instanceof Id ) ) {
             return false;
         }
 
-        final SimpleId simpleId = ( SimpleId ) o;
+        final Id id = ( Id ) o;
 
-        if ( !type.equals( simpleId.type ) ) {
+        if ( !type.equals( id.getType() ) ) {
             return false;
         }
-        if ( !uuid.equals( simpleId.uuid ) ) {
+        if ( !uuid.equals( id.getUuid() ) ) {
             return false;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3f1f841d/stack/corepersistence/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/pom.xml b/stack/corepersistence/pom.xml
index 31b32d7..16288a7 100644
--- a/stack/corepersistence/pom.xml
+++ b/stack/corepersistence/pom.xml
@@ -13,7 +13,7 @@
     <version>1.0-SNAPSHOT</version>
 
     <properties>
-        <astyanax.version>1.56.46-UG</astyanax.version>
+        <astyanax.version>1.56.48</astyanax.version>
         <jukito.version>1.4-UG</jukito.version>
         <guice.version>3.0</guice.version>
         <archaius.version>0.5.12</archaius.version>


Mime
View raw message