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/11/19 02:29:01 UTC
[18/23] incubator-s2graph git commit: remove
newVertex/newEdge/newVertexId on S2GraphLike.
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/eabe7570/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala
index 55658b9..66e44ec 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala
@@ -67,8 +67,8 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
if (version == VERSION2) TargetVertexId(ServiceColumn.Default, InnerVal.withStr("2", version))
else TargetVertexId(ServiceColumn.Default, InnerVal.withLong(2, version))
- val srcVertex = graph.newVertex(srcId, ts)
- val tgtVertex = graph.newVertex(tgtId, ts)
+ val srcVertex = builder.newVertex(srcId, ts)
+ val tgtVertex = builder.newVertex(tgtId, ts)
val (_label, dir) = if (version == VERSION2) (labelV2, labelWithDirV2.dir) else (label, labelWithDir.dir)
(srcVertex, tgtVertex, _label, dir)
@@ -81,7 +81,7 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
/** test for each version */
val js = Json.obj("is_hidden" -> true, "is_blocked" -> false, "weight" -> 10, "time" -> 3, "phone_number" -> "1234")
val propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
- val edge = graph.newEdge(srcVertex, tgtVertex, label, dir, 0.toByte, ts, propsInner)
+ val edge = builder.newEdge(srcVertex, tgtVertex, label, dir, 0.toByte, ts, propsInner)
val f = validate(label)(edge) _
@@ -101,21 +101,21 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
/** test for each version */
var js = Json.obj("phone_number" -> "")
var propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
- var edge = graph.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
+ var edge = builder.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
var f = validate(label)(edge) _
f(s"phone_number = '' ")(true)
js = Json.obj("phone_number" -> "010 3167 1897")
propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
- edge = graph.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
+ edge = builder.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
f = validate(label)(edge) _
f(s"phone_number = '010 3167 1897' ")(true)
js = Json.obj("phone_number" -> "010' 3167 1897")
propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
- edge = graph.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
+ edge = builder.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
f = validate(label)(edge) _
f(s"phone_number = '010\\' 3167 1897' ")(true)
@@ -129,7 +129,7 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
/** test for each version */
val js = Json.obj("is_hidden" -> true, "is_blocked" -> false, "weight" -> 10, "time" -> 3, "name" -> "abc")
val propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
- val edge = graph.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
+ val edge = builder.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner)
val f = validate(label)(edge) _
@@ -159,7 +159,7 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
/** test for each version */
val js = Json.obj("is_hidden" -> true, "is_blocked" -> false, "weight" -> 10, "time" -> 3, "name" -> "abc")
val propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
- val edge = graph.newEdge(srcVertex, tgtVertex, label, dir, 0.toByte, ts, propsInner)
+ val edge = builder.newEdge(srcVertex, tgtVertex, label, dir, 0.toByte, ts, propsInner)
val f = validate(label)(edge) _
@@ -183,12 +183,12 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
val propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
val parentPropsInner = Management.toProps(label, parentJs.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
- val grandParentEdge = graph.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, parentPropsInner)
+ val grandParentEdge = builder.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, parentPropsInner)
- val parentEdge = graph.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, parentPropsInner,
+ val parentEdge = builder.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, parentPropsInner,
parentEdges = Seq(EdgeWithScore(grandParentEdge, 1.0, grandParentEdge.innerLabel)))
- val edge = graph.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner,
+ val edge = builder.newEdge(srcVertex, tgtVertex, label, labelWithDir.dir, 0.toByte, ts, propsInner,
parentEdges = Seq(EdgeWithScore(parentEdge, 1.0, grandParentEdge.innerLabel)))
println(edge.toString)
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/eabe7570/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala
index 0cd975c..f1331e3 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala
@@ -46,8 +46,8 @@ class StorageIOTest extends FunSuite with Matchers with TestCommonWithModels {
throw new IllegalStateException("column not found.")
}
- val vertexId = graph.newVertexId(service, column, 1L)
- val vertex = graph.newVertex(vertexId)
+ val vertexId = builder.newVertexId(service, column, 1L)
+ val vertex = builder.newVertex(vertexId)
check(vertex, serDe.vertexSerializer, serDe.vertexDeserializer(vertex.serviceColumn.schemaVersion))
}
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/eabe7570/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala
index 24e98a1..4f38e18 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala
@@ -40,11 +40,11 @@ class IndexEdgeTest extends FunSuite with Matchers with TestCommonWithModels {
val from = InnerVal.withLong(1, l.schemaVersion)
val vertexId = SourceVertexId(ServiceColumn.Default, from)
val tgtVertexId = TargetVertexId(ServiceColumn.Default, to)
- val vertex = graph.newVertex(vertexId, ts)
- val tgtVertex = graph.newVertex(tgtVertexId, ts)
+ val vertex = builder.newVertex(vertexId, ts)
+ val tgtVertex = builder.newVertex(tgtVertexId, ts)
val labelWithDir = LabelWithDirection(l.id.get, 0)
val labelOpt = Option(l)
- val edge = graph.newEdge(vertex, tgtVertex, l, labelWithDir.dir, 0, ts, props, tsInnerValOpt = Option(InnerVal.withLong(ts, l.schemaVersion)))
+ val edge = builder.newEdge(vertex, tgtVertex, l, labelWithDir.dir, 0, ts, props, tsInnerValOpt = Option(InnerVal.withLong(ts, l.schemaVersion)))
val indexEdge = edge.edgesWithIndex.find(_.labelIndexSeq == LabelIndex.DefaultSeq).head
val kvs = graph.getStorage(l).serDe.indexEdgeSerializer(indexEdge).toKeyValues
val _indexEdgeOpt = graph.getStorage(l).serDe.indexEdgeDeserializer(l.schemaVersion).fromKeyValues(kvs, None)
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/eabe7570/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/process/S2GraphProcessStandardTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/process/S2GraphProcessStandardTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/process/S2GraphProcessStandardTest.scala
index 495f161..37be246 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/process/S2GraphProcessStandardTest.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/process/S2GraphProcessStandardTest.scala
@@ -19,7 +19,7 @@
package org.apache.s2graph.core.tinkerpop.process
-import org.apache.s2graph.core.S2Graph
+import org.apache.s2graph.core.{S2Graph, S2GraphTp}
import org.apache.s2graph.core.tinkerpop.S2GraphProvider
import org.apache.tinkerpop.gremlin.GraphProviderClass
import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite
@@ -29,7 +29,7 @@ import org.junit.runners.MethodSorters
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@RunWith(classOf[ProcessStandardSuite])
-@GraphProviderClass(provider = classOf[S2GraphProvider], graph = classOf[S2Graph])
+@GraphProviderClass(provider = classOf[S2GraphProvider], graph = classOf[S2GraphTp])
class S2GraphProcessStandardTest {
}
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/eabe7570/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureIntegrateTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureIntegrateTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureIntegrateTest.scala
index 4b88714..dd72ba6 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureIntegrateTest.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureIntegrateTest.scala
@@ -19,14 +19,14 @@
package org.apache.s2graph.core.tinkerpop.structure
-import org.apache.s2graph.core.S2Graph
+import org.apache.s2graph.core.{S2Graph, S2GraphTp}
import org.apache.s2graph.core.tinkerpop.S2GraphProvider
import org.apache.tinkerpop.gremlin.GraphProviderClass
import org.apache.tinkerpop.gremlin.structure.{StructureIntegrateSuite, StructureStandardSuite}
import org.junit.runner.RunWith
@RunWith(classOf[StructureIntegrateSuite])
-@GraphProviderClass(provider = classOf[S2GraphProvider], graph = classOf[S2Graph])
+@GraphProviderClass(provider = classOf[S2GraphProvider], graph = classOf[S2GraphTp])
class S2GraphStructureIntegrateTest {
}
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/eabe7570/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureStandardTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureStandardTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureStandardTest.scala
index ed9ab8d..3d08224 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureStandardTest.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphStructureStandardTest.scala
@@ -19,7 +19,7 @@
package org.apache.s2graph.core.tinkerpop.structure
-import org.apache.s2graph.core.S2Graph
+import org.apache.s2graph.core.{S2Graph, S2GraphTp}
import org.apache.s2graph.core.tinkerpop.S2GraphProvider
import org.apache.tinkerpop.gremlin.structure.StructureStandardSuite
import org.apache.tinkerpop.gremlin.{GraphProviderClass, LoadGraphWith}
@@ -29,7 +29,7 @@ import org.junit.runners.MethodSorters
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@RunWith(classOf[StructureStandardSuite])
-@GraphProviderClass(provider = classOf[S2GraphProvider], graph = classOf[S2Graph])
+@GraphProviderClass(provider = classOf[S2GraphProvider], graph = classOf[S2GraphTp])
class S2GraphStructureStandardTest {
}