[IoVertexTest + IoEdgeTest] passed except graphson-v2-embedded.

[CommunityGeneratorTest] passed except shouldGenerateDifferentGraph.

[DistributionGeneratorTest] non deterministic.


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

Branch: refs/heads/master
Commit: 103f05eef4c8bbdf6cb4c31fd4f3003ea99284be
Parents: 3a0272f
Author: DO YUNG YOON <[email protected]>
Authored: Fri Apr 28 02:27:56 2017 +0900
Committer: DO YUNG YOON <[email protected]>
Committed: Fri Apr 28 02:27:56 2017 +0900

----------------------------------------------------------------------
 .../scala/org/apache/s2graph/core/S2Edge.scala  |  7 ++-
 .../scala/org/apache/s2graph/core/S2Graph.scala | 58 ++++++++++++++++----
 .../org/apache/s2graph/core/S2Vertex.scala      |  5 +-
 .../apache/s2graph/core/types/VertexId.scala    |  4 +-
 .../core/tinkerpop/S2GraphProvider.scala        | 31 +++++++++--
 5 files changed, 85 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/103f05ee/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala 
b/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
index e6da0bb..eca8f18 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
@@ -635,7 +635,10 @@ case class S2Edge(innerGraph: S2Graph,
         }
       })
     } else {
-      keys.foreach { key => ls.add(property(key)) }
+      keys.foreach { key =>
+        val prop = property[V](key)
+        if (prop.isPresent) ls.add(prop)
+      }
     }
     ls.iterator()
   }
@@ -685,7 +688,7 @@ case class S2Edge(innerGraph: S2Graph,
 
   override def graph(): Graph = innerGraph
 
-  lazy val edgeId: AnyRef = {
+  lazy val edgeId: EdgeId = {
     // NOTE: xxxForVertex makes direction to be "out"
     val timestamp = if (this.innerLabel.consistencyLevel == "strong") 0l else 
ts
 //    EdgeId(srcVertex.innerId, tgtVertex.innerId, label(), "out", timestamp)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/103f05ee/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 0aa570d..80285d5 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
@@ -20,7 +20,7 @@
 package org.apache.s2graph.core
 
 import java.util
-import java.util.concurrent.atomic.AtomicBoolean
+import java.util.concurrent.atomic.{AtomicBoolean, AtomicLong}
 import java.util.concurrent.{Executors, TimeUnit}
 
 import com.typesafe.config.{Config, ConfigFactory}
@@ -584,21 +584,47 @@ object S2Graph {
 //  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexTest",
 method="*", reason="no"),
   // passed: all, failed: none, all ignored
 
+//  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.star.StarGraphTest",
 method="*", reason="no"),
+  // passed: all,
+
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.CommunityGeneratorTest$DifferentDistributionsTest",
 method="shouldGenerateDifferentGraph", 
specific="test(NormalDistribution{stdDeviation=2.0, 
mean=0.0},PowerLawDistribution{gamma=2.4, multiplier=0.0},0.1)", 
reason="graphson-v2-embedded is not supported."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.CommunityGeneratorTest$DifferentDistributionsTest",
 method="shouldGenerateDifferentGraph", 
specific="test(NormalDistribution{stdDeviation=2.0, 
mean=0.0},PowerLawDistribution{gamma=2.4, multiplier=0.0},0.5)", 
reason="graphson-v2-embedded is not supported."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.CommunityGeneratorTest$DifferentDistributionsTest",
 method="shouldGenerateDifferentGraph", 
specific="test(NormalDistribution{stdDeviation=2.0, 
mean=0.0},NormalDistribution{stdDeviation=4.0, mean=0.0},0.5)", 
reason="graphson-v2-embedded is not supported."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.CommunityGeneratorTest$DifferentDistributionsTest",
 method="shouldGenerateDifferentGraph", 
specific="test(NormalDistribution{stdDeviation=2.0, 
mean=0.0},NormalDistribution{stdDeviation=4.0, mean=0.0},0.1)", 
reason="graphson-v2-embedded is not supported."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.CommunityGeneratorTest$DifferentDistributionsTest",
 method="shouldGenerateDifferentGraph", 
specific="test(PowerLawDistribution{gamma=2.3, 
multiplier=0.0},PowerLawDistribution{gamma=2.4, multiplier=0.0},0.25)", 
reason="graphson-v2-embedded is not supported."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.CommunityGeneratorTest$DifferentDistributionsTest",
 method="shouldGenerateDifferentGraph", 
specific="test(PowerLawDistribution{gamma=2.3, 
multiplier=0.0},NormalDistribution{stdDeviation=4.0, mean=0.0},0.25)", 
reason="graphson-v2-embedded is not supported."),
+  // passed: all, except shouldGenerateDifferentGraph method.
+
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.DistributionGeneratorTest",
 method="*", reason="non-deterministic test."),
+  // all failed.
+
   new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.SerializationTest$GryoTest",
 method="shouldSerializeTree", reason="order of children is reversed. not sure 
why."),
   // passed: all, failed: $GryoTest.shouldSerializeTree
 
+//  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoCustomTest", 
method="*", reason="no"),
+  // all ignored.
 
-//  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoCustomTest", 
method="*", reason="no"), // all ignored.
-  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoEdgeTest", 
method="*", reason="no"), // all failed.
-  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoGraphTest", 
method="*", reason="no"), // all failed.
-  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoPropertyTest", 
method="*", reason="no"), // all failed.
-  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoTest", 
method="*", reason="no"), // all failed.
-  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoVertexTest", 
method="*", reason="no"), // all failed.
+//  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoPropertyTest", 
method="*", reason="no"),
+  // all passed.
 
-  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.star.StarGraphTest",
 method="*", reason="no"), // failed on shouldHandleSelfLoops
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoVertexTest", 
method="shouldReadWriteVertexWithBOTHEdges", specific="graphson-v2-embedded", 
reason="Vertex.id() is deserialized as string, not class in 
graphson-v2-embedded."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoVertexTest", 
method="shouldReadWriteVertexWithINEdges", specific="graphson-v2-embedded", 
reason="Vertex.id() is deserialized as string, not class in 
graphson-v2-embedded."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoVertexTest", 
method="shouldReadWriteDetachedVertexAsReferenceNoEdges", 
specific="graphson-v2-embedded", reason="Vertex.id() is deserialized as string, 
not class in graphson-v2-embedded."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoVertexTest", 
method="shouldReadWriteVertexNoEdges", specific="graphson-v2-embedded", 
reason="Vertex.id() is deserialized as string, not class in 
graphson-v2-embedded."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoVertexTest", 
method="shouldReadWriteVertexWithOUTEdges", specific="graphson-v2-embedded", 
reason="Vertex.id() is deserialized as string, not class in 
graphson-v2-embedded."),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoVertexTest", 
method="shouldReadWriteDetachedVertexNoEdges", specific="graphson-v2-embedded", 
reason="Vertex.id() is deserialized as string, not class in 
graphson-v2-embedded."),
+  // passed: all, except graphson-v2-embedded.
+
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoEdgeTest", 
method="shouldReadWriteDetachedEdgeAsReference", 
specific="graphson-v2-embedded", reason="no"),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoEdgeTest", 
method="shouldReadWriteEdge", specific="graphson-v2-embedded", reason="no"),
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoEdgeTest", 
method="shouldReadWriteDetachedEdge", specific="graphson-v2-embedded", 
reason="no"),
+  // passed: all, except graphson-v2-embedded.
+
+  // TODO: 
+  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoGraphTest", 
method="*", reason="no"), // all failed.
 
-  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.CommunityGeneratorTest",
 method="*", reason="no"), // all failed.
-  new 
Graph.OptOut(test="org.apache.tinkerpop.gremlin.algorithm.generator.DistributionGeneratorTest",
 method="*", reason="no") // all failed.
+  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.io.IoTest", 
method="*", reason="no")
+  // all failed.
 ))
 class S2Graph(_config: Config)(implicit val ec: ExecutionContext) extends 
Graph {
 
@@ -632,8 +658,13 @@ class S2Graph(_config: Config)(implicit val ec: 
ExecutionContext) extends Graph
   val scheduledEx = 
ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor())
 
   val management = new Management(this)
+
   def getManagement() = management
 
+  private val localLongId = new AtomicLong()
+
+  def nextLocalLongId = localLongId.getAndIncrement()
+
   private def confWithFallback(conf: Config): Config = {
     conf.withFallback(config)
   }
@@ -707,6 +738,7 @@ class S2Graph(_config: Config)(implicit val ec: 
ExecutionContext) extends Graph
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "location", "string", 
useCache = false)
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "status", "string", useCache 
= false)
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "myId", "integer", useCache 
= false)
+    ColumnMeta.findOrInsert(DefaultColumn.id.get, "acl", "string", useCache = 
false)
   }
 
   val DefaultLabel = management.createLabel("_s2graph", 
DefaultService.serviceName, DefaultColumn.columnName, DefaultColumn.columnType,
@@ -1201,6 +1233,7 @@ class S2Graph(_config: Config)(implicit val ec: 
ExecutionContext) extends Graph
       flushStorage()
       Model.shutdown(modelDataDelete)
       defaultStorage.shutdown()
+      localLongId.set(0l)
     }
 
   def toGraphElement(s: String, labelMapping: Map[String, String] = 
Map.empty): Option[GraphElement] = Try {
@@ -1571,7 +1604,7 @@ class S2Graph(_config: Config)(implicit val ec: 
ExecutionContext) extends Graph
 
     val vertex = kvsMap.get(T.id.name()) match {
       case None => // do nothing
-        val id = Random.nextLong
+        val id = nextLocalLongId
         makeVertex(Long.box(id), kvsMap)
       case Some(idValue) if S2Property.validType(idValue) =>
         makeVertex(idValue, kvsMap)
@@ -1582,6 +1615,9 @@ class S2Graph(_config: Config)(implicit val ec: 
ExecutionContext) extends Graph
     addVertexInner(vertex)
   }
 
+
+
+
   def addVertex(id: VertexId,
                 ts: Long = System.currentTimeMillis(),
                 props: S2Vertex.Props = S2Vertex.EmptyProps,

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/103f05ee/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 9a9dfa8..64d298d 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
@@ -249,7 +249,10 @@ case class S2Vertex(graph: S2Graph,
         }
       })
     } else {
-      keys.foreach { key => ls.add(property[V](key)) }
+      keys.foreach { key =>
+        val prop = property[V](key)
+        if (prop.isPresent) ls.add(prop)
+      }
     }
     ls.iterator
   }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/103f05ee/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala 
b/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
index 628a149..f93df4a 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
@@ -102,7 +102,9 @@ class VertexId (val column: ServiceColumn, val innerId: 
InnerValLike) extends HB
   }
   override def equals(obj: Any): Boolean = {
     val ret = obj match {
-      case other: VertexId => column.id.get == other.column.id.get && 
innerId.toIdString() == other.innerId.toIdString()
+      case other: VertexId =>
+        val ret = column.id.get == other.column.id.get && innerId.toIdString() 
== other.innerId.toIdString()
+        ret
       case _ => false
     }
 //    logger.debug(s"VertexId.equals: $this, $obj => $ret")

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/103f05ee/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala 
b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
index 5165252..3934264 100644
--- 
a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
+++ 
b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
@@ -19,6 +19,8 @@ import com.typesafe.config.ConfigFactory
 import org.apache.commons.io.FileUtils
 import org.apache.s2graph.core.utils.logger
 
+import scala.concurrent.ExecutionContext
+
 object S2GraphProvider {
   val Implementation: Set[Class[_]] = Set(
     classOf[S2Edge],
@@ -28,6 +30,7 @@ object S2GraphProvider {
     classOf[S2Graph]
   )
 }
+
 class S2GraphProvider extends AbstractGraphProvider {
 
   override def getBaseConfiguration(s: String, aClass: Class[_], s1: String, 
graphData: GraphData): util.Map[String, AnyRef] = {
@@ -82,6 +85,8 @@ class S2GraphProvider extends AbstractGraphProvider {
     }
   }
 
+//  override def openTestGraph(config: Configuration): Graph = new 
S2Graph(config)(ExecutionContext.global)
+
   override def loadGraphData(graph: Graph, loadGraphWith: LoadGraphWith, 
testClass: Class[_], testName: String): Unit = {
     val s2Graph = graph.asInstanceOf[S2Graph]
     val mnt = s2Graph.getManagement()
@@ -139,7 +144,13 @@ class S2GraphProvider extends AbstractGraphProvider {
       ColumnMeta.findOrInsert(defaultServiceColumn.id.get, "aKey", dataType, 
useCache = false)
     }
 
-    if (testClass.getName.contains("SerializationTest") || 
testClass.getSimpleName == "IoPropertyTest") {
+    if (testClass.getSimpleName == "IoGraphTest") {
+      mnt.createLabel("knows", defaultService.serviceName, "person", 
"integer", defaultService.serviceName, "person", "integer",
+        true, defaultService.serviceName, Nil, knowsProp, "strong", None, 
None, options = Option("""{"skipReverse": false}"""))
+    } else if (testClass.getSimpleName == "DifferentDistributionsTest") {
+      mnt.createLabel("knows", defaultService.serviceName, "person", 
"integer", defaultService.serviceName, "person", "integer",
+        true, defaultService.serviceName, Nil, knowsProp, "strong", None, 
None, options = Option("""{"skipReverse": false}"""))
+    } else if (testClass.getName.contains("SerializationTest") || 
testClass.getSimpleName == "IoPropertyTest") {
       mnt.createLabel("knows", defaultService.serviceName, "person", 
"integer", defaultService.serviceName, "person", "integer",
         true, defaultService.serviceName, Nil, knowsProp, "strong", None, 
None, options = Option("""{"skipReverse": false}"""))
     } else if (testClass.getSimpleName.contains("CommunityGeneratorTest")) {
@@ -196,10 +207,20 @@ class S2GraphProvider extends AbstractGraphProvider {
         options = Option("""{"skipReverse": true}"""))
     }
 
-    val friends = mnt.createLabel("friends", defaultService.serviceName, 
defaultServiceColumn.columnName, defaultServiceColumn.columnType, 
defaultService.serviceName, defaultServiceColumn.columnName, 
defaultServiceColumn.columnType,
-      true, defaultService.serviceName, Nil, Nil,
-      "strong", None, None,
-      options = Option("""{"skipReverse": false}"""))
+    val friends =
+      if (testClass.getSimpleName == "IoVertexTest") {
+        mnt.createLabel("friends",
+          defaultService.serviceName, "person", "integer",
+          defaultService.serviceName, "person", "integer",
+          true, defaultService.serviceName, Nil, Seq(Prop("weight", "0.0", 
"double")),
+          "strong", None, None,
+          options = Option("""{"skipReverse": false}"""))
+      } else {
+        mnt.createLabel("friends", defaultService.serviceName, 
defaultServiceColumn.columnName, defaultServiceColumn.columnType, 
defaultService.serviceName, defaultServiceColumn.columnName, 
defaultServiceColumn.columnType,
+          true, defaultService.serviceName, Nil, Nil,
+          "strong", None, None,
+          options = Option("""{"skipReverse": false}"""))
+      }
 
     val friend = if (testClass.getSimpleName.contains("IoEdgeTest")) {
       mnt.createLabel("friend", defaultService.serviceName, "person", 
"integer", defaultService.serviceName, "person", "integer",

Reply via email to