You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@s2graph.apache.org by st...@apache.org on 2017/07/01 15:28:01 UTC

[10/46] incubator-s2graph git commit: [DetachedVertexTest]: passed all.

[DetachedVertexTest]: passed all.


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

Branch: refs/heads/master
Commit: cbcb46c8e4dc292573f9eacd4facdef4b5b83beb
Parents: 302fc96
Author: DO YUNG YOON <st...@apache.org>
Authored: Wed Apr 12 23:34:36 2017 +0900
Committer: DO YUNG YOON <st...@apache.org>
Committed: Wed Apr 12 23:34:36 2017 +0900

----------------------------------------------------------------------
 .../scala/org/apache/s2graph/core/S2Graph.scala | 16 +++---
 .../org/apache/s2graph/core/S2Property.scala    |  2 +-
 .../org/apache/s2graph/core/S2Vertex.scala      | 16 ++++--
 .../core/tinkerpop/structure/S2GraphTest.scala  | 54 ++++++++++++++++++++
 4 files changed, 77 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/cbcb46c8/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
index 0b16b23..f1f00e7 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
@@ -530,16 +530,20 @@ object S2Graph {
 
 @Graph.OptIn(Graph.OptIn.SUITE_STRUCTURE_STANDARD)
 @Graph.OptOuts(value = Array(
-//  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.EdgeTest", method="*", reason="no"), // pass
-//  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.GraphConstructionTest", method="*", reason="no"), // pass
-//  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.PropertyTest", method="*", reason="no"), // pass
-
+  // pass
+  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.EdgeTest", method="*", reason="no"),
+  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.GraphConstructionTest", method="*", reason="no"),
+  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.PropertyTest", method="*", reason="no"),
+  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.VertexPropertyTest", method="*", reason="no"),
+  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexTest", method="*", reason="no"),
+
+  // not passed
   new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.FeatureSupportTest", method="*", reason="no"), // pass
-  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.VertexPropertyTest", method="*", reason="no"), // pass
+
   new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.VertexTest", method="*", reason="no"), // pss
 
   new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdgeTest", method="*", reason="no"), // pass
-  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexTest", method="*", reason="no"), // pass one error
+
   new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.detached.DetachedGraphTest", method="*", reason="no"), // pass all ignored
   new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPropertyTest", method="*", reason="no"), // pass
   new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexPropertyTest", method="*", reason="no"), // pass

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/cbcb46c8/s2core/src/main/scala/org/apache/s2graph/core/S2Property.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Property.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2Property.scala
index defa476..bca1303 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Property.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Property.scala
@@ -40,7 +40,7 @@ object S2Property {
       val key = pair.getValue0
       val value = pair.getValue1
       ElementHelper.validateProperty(key, value)
-      if (keySet.contains(key)) throw VertexProperty.Exceptions.multiPropertiesNotSupported
+//      if (keySet.contains(key)) throw VertexProperty.Exceptions.multiPropertiesNotSupported
 
       assertValidProp(key, value)
 

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/cbcb46c8/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
index b80a54c..3c771f5 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
@@ -26,14 +26,14 @@ import org.apache.s2graph.core.GraphExceptions.LabelNotExistException
 import org.apache.s2graph.core.S2Vertex.Props
 import org.apache.s2graph.core.mysqls._
 import org.apache.s2graph.core.types._
+import org.apache.s2graph.core.utils.logger
 import org.apache.tinkerpop.gremlin.structure.Edge.Exceptions
-import org.apache.tinkerpop.gremlin.structure.Graph.Features.{ElementFeatures, VertexFeatures}
 import org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality
-import org.apache.tinkerpop.gremlin.structure.{Direction, Edge, Property, T, Vertex, VertexProperty}
+import org.apache.tinkerpop.gremlin.structure.{Direction, Edge, Graph, Property, T, Vertex, VertexProperty}
 import play.api.libs.json.Json
 
 import scala.collection.JavaConverters._
-import scala.concurrent.Await
+import scala.concurrent.{Await, Future}
 
 case class S2Vertex(graph: S2Graph,
                   id: VertexId,
@@ -209,7 +209,15 @@ case class S2Vertex(graph: S2Graph,
           val op = GraphUtil.toOp(operation).getOrElse(throw new RuntimeException(s"$operation is not supported."))
 
           val edge = graph.newEdge(this, otherV, label, dir, op = op, version = ts, propsWithTs = propsWithTs)
-          // edge.relatedEdges
+//          //TODO: return type of mutateEdges can contains information if snapshot edge already exist.
+//          // instead call checkEdges, we can exploit this feature once we refactor return type.
+//          implicit val ec = graph.ec
+//          val future = graph.checkEdges(Seq(edge)).flatMap { stepResult =>
+//            if (stepResult.edgeWithScores.nonEmpty)
+//              Future.failed(throw Graph.Exceptions.edgeWithIdAlreadyExists(edge.id()))
+//            else
+//              graph.mutateEdges(Seq(edge), withWait = true)
+//          }
           val future = graph.mutateEdges(Seq(edge), withWait = true)
           Await.ready(future, graph.WaitTimeout)
           edge

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/cbcb46c8/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala
index 5454e24..cadfd37 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala
@@ -23,6 +23,7 @@ import org.apache.s2graph.core.Management.JsonModel.Prop
 import org.apache.s2graph.core._
 import org.apache.s2graph.core.utils.logger
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
+import org.apache.tinkerpop.gremlin.structure.Graph.Features.EdgePropertyFeatures
 import org.apache.tinkerpop.gremlin.structure._
 import org.apache.tinkerpop.gremlin.structure.util.Attachable
 import org.apache.tinkerpop.gremlin.structure.util.detached.{DetachedEdge, DetachedFactory}
@@ -363,4 +364,57 @@ class S2GraphTest extends FunSuite with Matchers with TestCommonWithModels {
     assert(toDetach.equals(attached))
     assert(!attached.isInstanceOf[DetachedEdge])
   }
+
+//  test("ddd") {
+////    @Test
+////    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+////    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+////    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = EdgeFeatures.FEATURE_ADD_PROPERTY)
+////    def shouldEnableFeatureOnEdgeIfNotEnabled() = {
+////      graph.features.supports(classOf[EdgePropertyFeatures], "BooleanValues")
+//////      assumeThat(graph.features().supports(EdgePropertyFeatures.class, featureName), is(false));
+//////      try {
+//////        final Edge edge = createEdgeForPropertyFeatureTests();
+//////        edge.property("aKey", value);
+//////        fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgePropertyFeatures.class.getSimpleName(), featureName));
+//////      } catch (Exception e) {
+//////        validateException(Property.Exceptions.dataTypeOfPropertyValueNotSupported(value), e);
+//////      }
+////    }
+//    val ret = graph.features.supports(classOf[EdgePropertyFeatures], "BooleanValues")
+//    logger.error(s"[Support]: $ret")
+////
+////    @Test
+////    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+////    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY)
+////    public void shouldEnableFeatureOnVertexIfNotEnabled() throws Exception {
+////      assumeThat(graph.features().supports(VertexPropertyFeatures.class, featureName), is(false));
+////      try {
+////        graph.addVertex("aKey", value);
+////        fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexPropertyFeatures.class.getSimpleName(), featureName));
+////      } catch (Exception e) {
+////        validateException(Property.Exceptions.dataTypeOfPropertyValueNotSupported(value), e);
+////      }
+////    }
+////
+////
+////
+////    @Test
+////    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+////    @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
+////    @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_ANY_IDS, supported = false)
+////    public void shouldSupportUserSuppliedIdsOfTypeAny() throws Exception {
+////      try {
+////        final Date id = new Date();
+////        graph.addVertex(T.id, id);
+////
+////        // a graph can "allow" an id without internally supporting it natively and therefore doesn't need
+////        // to throw the exception
+////        if (!graph.features().vertex().willAllowId(id))
+////          fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_ANY_IDS));
+////      } catch (Exception e) {
+////        validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e);
+////      }
+////    }
+//  }
 }
\ No newline at end of file