fix test case error.
Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/3ce66d9f Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/3ce66d9f Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/3ce66d9f Branch: refs/heads/master Commit: 3ce66d9f6e584e14619bf11bb970bd79856cf580 Parents: 1bd04d5 Author: DO YUNG YOON <[email protected]> Authored: Tue Jan 30 13:33:12 2018 +0900 Committer: DO YUNG YOON <[email protected]> Committed: Tue Jan 30 13:33:12 2018 +0900 ---------------------------------------------------------------------- .../core/Integrate/IntegrateCommon.scala | 6 -- .../s2graph/core/index/IndexProviderTest.scala | 6 ++ .../s2graph/core/models/GlobalIndexTest.scala | 86 ++++++++++---------- 3 files changed, 49 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/3ce66d9f/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala b/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala index 08f075d..1b65456 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala @@ -98,12 +98,6 @@ trait IntegrateCommon extends FunSuite with Matchers with BeforeAndAfterAll { Management.addVertexProp(testServiceName, testColumnName, key, keyType) } - // vertex type global index. - val globalVertexIndex = management.buildGlobalIndex(GlobalIndex.VertexType, "test_age_index", Seq("age")) - - // edge type global index. - val globalEdgeIndex = management.buildGlobalIndex(GlobalIndex.EdgeType, "test_weight_time_edge", Seq("weight", "time")) - logger.info("[init end]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") } http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/3ce66d9f/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala index 3871399..8bea359 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala @@ -35,6 +35,12 @@ class IndexProviderTest extends IntegrateCommon { val indexProvider = IndexProvider(config) val numOfTry = 1 + // vertex type global index. + lazy val globalVertexIndex = management.buildGlobalIndex(GlobalIndex.VertexType, "test_age_index", Seq("age")) + + // edge type global index. + lazy val globalEdgeIndex = management.buildGlobalIndex(GlobalIndex.EdgeType, "test_weight_time_edge", Seq("weight", "time")) + test("test vertex write/query") { import TestUtil._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/3ce66d9f/s2core/src/test/scala/org/apache/s2graph/core/models/GlobalIndexTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/models/GlobalIndexTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/models/GlobalIndexTest.scala index 8c4ffc1..a732564 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/models/GlobalIndexTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/models/GlobalIndexTest.scala @@ -35,47 +35,47 @@ class GlobalIndexTest extends FunSuite with Matchers with TestCommonWithModels w graph.shutdown() } -// test("test buildGlobalIndex.") { -// Seq(GlobalIndex.EdgeType, GlobalIndex.VertexType).foreach { elementType => -// management.buildGlobalIndex(elementType, "test_global", Seq("weight", "date", "name")) -// } -// } -// -// test("findGlobalIndex.") { -// // (weight: 34) AND (weight: [1 TO 100]) -// Seq(GlobalIndex.EdgeType, GlobalIndex.VertexType).foreach { elementType => -// val idx1 = management.buildGlobalIndex(elementType, "test-1", Seq("weight", "age", "name")) -// val idx2 = management.buildGlobalIndex(elementType, "test-2", Seq("gender", "age")) -// val idx3 = management.buildGlobalIndex(elementType, "test-3", Seq("class")) -// -// var hasContainers = Seq( -// new HasContainer("weight", P.eq(Int.box(34))), -// new HasContainer("age", P.between(Int.box(1), Int.box(100))) -// ) -// -// GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(Option(idx1)) -// -// hasContainers = Seq( -// new HasContainer("gender", P.eq(Int.box(34))), -// new HasContainer("age", P.eq(Int.box(34))), -// new HasContainer("class", P.eq(Int.box(34))) -// ) -// -// GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(Option(idx2)) -// -// hasContainers = Seq( -// new HasContainer("class", P.eq(Int.box(34))), -// new HasContainer("_", P.eq(Int.box(34))) -// ) -// -// GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(Option(idx3)) -// -// hasContainers = Seq( -// new HasContainer("key", P.eq(Int.box(34))), -// new HasContainer("value", P.eq(Int.box(34))) -// ) -// -// GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(None) -// } -// } + test("test buildGlobalIndex.") { + Seq(GlobalIndex.EdgeType, GlobalIndex.VertexType).foreach { elementType => + management.buildGlobalIndex(elementType, "test_global", Seq("weight", "date", "name")) + } + } + + test("findGlobalIndex.") { + // (weight: 34) AND (weight: [1 TO 100]) + Seq(GlobalIndex.EdgeType, GlobalIndex.VertexType).foreach { elementType => + val idx1 = management.buildGlobalIndex(elementType, "test-1", Seq("weight", "age", "name")) + val idx2 = management.buildGlobalIndex(elementType, "test-2", Seq("gender", "age")) + val idx3 = management.buildGlobalIndex(elementType, "test-3", Seq("class")) + + var hasContainers = Seq( + new HasContainer("weight", P.eq(Int.box(34))), + new HasContainer("age", P.between(Int.box(1), Int.box(100))) + ) + + GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(Option(idx1)) + + hasContainers = Seq( + new HasContainer("gender", P.eq(Int.box(34))), + new HasContainer("age", P.eq(Int.box(34))), + new HasContainer("class", P.eq(Int.box(34))) + ) + + GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(Option(idx2)) + + hasContainers = Seq( + new HasContainer("class", P.eq(Int.box(34))), + new HasContainer("_", P.eq(Int.box(34))) + ) + + GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(Option(idx3)) + + hasContainers = Seq( + new HasContainer("key", P.eq(Int.box(34))), + new HasContainer("value", P.eq(Int.box(34))) + ) + + GlobalIndex.findGlobalIndex(elementType, hasContainers) shouldBe(None) + } + } }
