Move BasicCrudSpec to CrudTest

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

Branch: refs/heads/feature/test_daewon
Commit: 0e1c0e0a3bb66ee99b05ef0236369a8c17285c3c
Parents: f75b3b3
Author: daewon <[email protected]>
Authored: Mon Dec 28 18:17:33 2015 +0900
Committer: daewon <[email protected]>
Committed: Mon Dec 28 18:17:33 2015 +0900

----------------------------------------------------------------------
 .../kakao/s2graph/core/rest/RequestParser.scala |  10 +
 .../com/kakao/s2graph/core/GraphTest.scala      |   8 -
 .../kakao/s2graph/core/Integrate/CrudTest.scala | 238 ++++++++++++++++
 .../core/Integrate/IntegrateCommon.scala        | 274 +++++++++++++++++++
 .../s2graph/core/Integrate/QueryTest.scala      |  63 +++++
 .../com/kakao/s2graph/core/JsonParserTest.scala |   3 -
 .../com/kakao/s2graph/core/QueryParamTest.scala |   3 -
 .../com/kakao/s2graph/core/TestCommon.scala     |   6 -
 .../s2graph/core/TestCommonWithModels.scala     |  15 +-
 .../test/controllers/BasicCrudSpec.scala        |   2 -
 10 files changed, 596 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala 
b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
index 2081a18..04ac113 100644
--- a/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
+++ b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
@@ -493,4 +493,14 @@ class RequestParser(config: Config) extends JSONParser {
 
     (quads, isReverted)
   }
+
+  def toGraphElements(str: String): Seq[GraphElement] = {
+    val edgeStrs = str.split("\\n")
+
+    for {
+      edgeStr <- edgeStrs
+      str <- GraphUtil.parseString(edgeStr)
+      element <- Graph.toGraphElement(str)
+    } yield element
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/GraphTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/com/kakao/s2graph/core/GraphTest.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/GraphTest.scala
deleted file mode 100644
index 9a58bd0..0000000
--- a/s2core/src/test/scala/com/kakao/s2graph/core/GraphTest.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.kakao.s2graph.core
-
-/**
- * Created by shon on 5/29/15.
- */
-class GraphTest {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/CrudTest.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/CrudTest.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/CrudTest.scala
new file mode 100644
index 0000000..a093dcc
--- /dev/null
+++ b/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/CrudTest.scala
@@ -0,0 +1,238 @@
+package com.kakao.s2graph.core.Integrate
+
+import com.kakao.s2graph.core.{Management, PostProcess}
+import com.kakao.s2graph.core.mysqls._
+import play.api.libs.json.{JsObject, Json}
+
+import scala.concurrent.Await
+import scala.concurrent.duration.Duration
+
+class CrudTest extends IntegrateCommon {
+
+  test("test CRUD") {
+    var tcNum = 0
+    var tcString = ""
+    var bulkQueries = List.empty[(Long, String, String)]
+    var expected = Map.empty[String, String]
+
+    val curTime = System.currentTimeMillis
+    val t1 = curTime + 0
+    val t2 = curTime + 1
+    val t3 = curTime + 2
+    val t4 = curTime + 3
+    val t5 = curTime + 4
+
+    val tcRunner = new CrudTestRunner()
+    tcNum = 1
+    tcString = "[t1 -> t2 -> t3 test case] insert(t1) delete(t2) insert(t3) 
test "
+
+    bulkQueries = List(
+      (t1, "insert", "{\"time\": 10}"),
+      (t2, "delete", ""),
+      (t3, "insert", "{\"time\": 10, \"weight\": 20}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+
+    tcNum = 2
+    tcString = "[t1 -> t2 -> t3 test case] insert(t1) delete(t2) insert(t3) 
test "
+    bulkQueries = List(
+      (t1, "insert", "{\"time\": 10}"),
+      (t3, "insert", "{\"time\": 10, \"weight\": 20}"),
+      (t2, "delete", ""))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+
+    tcNum = 3
+    tcString = "[t3 -> t2 -> t1 test case] insert(t3) delete(t2) insert(t1) 
test "
+    bulkQueries = List(
+      (t3, "insert", "{\"time\": 10, \"weight\": 20}"),
+      (t2, "delete", ""),
+      (t1, "insert", "{\"time\": 10}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+
+    tcNum = 4
+    tcString = "[t3 -> t1 -> t2 test case] insert(t3) insert(t1) delete(t2) 
test "
+    bulkQueries = List(
+      (t3, "insert", "{\"time\": 10, \"weight\": 20}"),
+      (t1, "insert", "{\"time\": 10}"),
+      (t2, "delete", ""))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+
+    tcNum = 5
+    tcString = "[t2 -> t1 -> t3 test case] delete(t2) insert(t1) insert(t3) 
test"
+    bulkQueries = List(
+      (t2, "delete", ""),
+      (t1, "insert", "{\"time\": 10}"),
+      (t3, "insert", "{\"time\": 10, \"weight\": 20}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+
+    tcNum = 6
+    tcString = "[t2 -> t3 -> t1 test case] delete(t2) insert(t3) insert(t1) 
test "
+    bulkQueries = List(
+      (t2, "delete", ""),
+      (t3, "insert", "{\"time\": 10, \"weight\": 20}"),
+      (t1, "insert", "{\"time\": 10}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+
+    tcNum = 7
+    tcString = "[t1 -> t2 -> t3 test case] update(t1) delete(t2) update(t3) 
test "
+    bulkQueries = List(
+      (t1, "update", "{\"time\": 10}"),
+      (t2, "delete", ""),
+      (t3, "update", "{\"time\": 10, \"weight\": 20}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+    tcNum = 8
+    tcString = "[t1 -> t3 -> t2 test case] update(t1) update(t3) delete(t2) 
test "
+    bulkQueries = List(
+      (t1, "update", "{\"time\": 10}"),
+      (t3, "update", "{\"time\": 10, \"weight\": 20}"),
+      (t2, "delete", ""))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+    tcNum = 9
+    tcString = "[t2 -> t1 -> t3 test case] delete(t2) update(t1) update(t3) 
test "
+    bulkQueries = List(
+      (t2, "delete", ""),
+      (t1, "update", "{\"time\": 10}"),
+      (t3, "update", "{\"time\": 10, \"weight\": 20}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+    tcNum = 10
+    tcString = "[t2 -> t3 -> t1 test case] delete(t2) update(t3) update(t1) 
test"
+    bulkQueries = List(
+      (t2, "delete", ""),
+      (t3, "update", "{\"time\": 10, \"weight\": 20}"),
+      (t1, "update", "{\"time\": 10}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+    tcNum = 11
+    tcString = "[t3 -> t2 -> t1 test case] update(t3) delete(t2) update(t1) 
test "
+    bulkQueries = List(
+      (t3, "update", "{\"time\": 10, \"weight\": 20}"),
+      (t2, "delete", ""),
+      (t1, "update", "{\"time\": 10}"))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+    tcNum = 12
+    tcString = "[t3 -> t1 -> t2 test case] update(t3) update(t1) delete(t2) 
test "
+    bulkQueries = List(
+      (t3, "update", "{\"time\": 10, \"weight\": 20}"),
+      (t1, "update", "{\"time\": 10}"),
+      (t2, "delete", ""))
+    expected = Map("time" -> "10", "weight" -> "20")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+
+    tcNum = 13
+    tcString = "[t5 -> t1 -> t3 -> t2 -> t4 test case] update(t5) insert(t1) 
insert(t3) delete(t2) update(t4) test "
+    bulkQueries = List(
+      (t5, "update", "{\"is_blocked\": true}"),
+      (t1, "insert", "{\"is_hidden\": false}"),
+      (t3, "insert", "{\"is_hidden\": false, \"weight\": 10}"),
+      (t2, "delete", ""),
+      (t4, "update", "{\"time\": 1, \"weight\": -10}"))
+    expected = Map("time" -> "1", "weight" -> "-10", "is_hidden" -> "false", 
"is_blocked" -> "true")
+
+    tcRunner.run(tcNum, tcString, bulkQueries, expected)
+  }
+
+  class CrudTestRunner {
+    var seed = 0
+
+    def run(tcNum: Int, tcString: String, opWithProps: List[(Long, String, 
String)], expected: Map[String, String]) = {
+      for {
+        labelName <- List(testLabelName, testLabelName2)
+        i <- 0 until NumOfEachTest
+      } {
+        seed += 1
+        val srcId = seed.toString
+        val tgtId = srcId
+
+        val maxTs = opWithProps.map(t => t._1).max
+
+        /** insert edges */
+        println(s"---- TC${tcNum}_init ----")
+        val bulkEdges = (for ((ts, op, props) <- opWithProps) yield {
+          TestHelper.toEdge(ts, op, "e", srcId, tgtId, labelName, props)
+        })
+
+        TestHelper.insertEdges(bulkEdges:_*)
+
+        for {
+          label <- Label.findByName(labelName)
+          direction <- List("out", "in")
+          cacheTTL <- List(-1L)
+        } {
+          val (serviceName, columnName, id, otherId) = direction match {
+            case "out" => (label.srcService.serviceName, 
label.srcColumn.columnName, srcId, tgtId)
+            case "in" => (label.tgtService.serviceName, 
label.tgtColumn.columnName, tgtId, srcId)
+          }
+
+          val qId = if (labelName == testLabelName) id else "\"" + id + "\""
+          val query = queryJson(serviceName, columnName, labelName, qId, 
direction, cacheTTL)
+
+          val jsResult = TestHelper.getEdges(query)
+
+          val results = jsResult \ "results"
+          val deegrees = (jsResult \ "degrees").as[List[JsObject]]
+          val propsLs = (results \\ "props").seq
+          (deegrees.head \ LabelMeta.degree.name).as[Int] should be(1)
+
+          val from = (results \\ "from").seq.last.toString.replaceAll("\"", "")
+          val to = (results \\ "to").seq.last.toString.replaceAll("\"", "")
+
+          from should be(id.toString)
+          to should be(otherId.toString)
+          (results \\ "_timestamp").seq.last.as[Long] should be(maxTs)
+
+          for ((key, expectedVal) <- expected) {
+            propsLs.last.as[JsObject].keys.contains(key) should be(true)
+            (propsLs.last \ key).toString should be(expectedVal)
+          }
+        }
+      }
+    }
+
+    def queryJson(serviceName: String, columnName: String, labelName: String, 
id: String, dir: String, cacheTTL: Long = -1L) = {
+      val s =
+        s"""{
+      "srcVertices": [
+      {
+        "serviceName": "$serviceName",
+        "columnName": "$columnName",
+        "id": $id
+      }
+      ],
+      "steps": [
+      [
+      {
+        "label": "$labelName",
+        "direction": "$dir",
+        "offset": 0,
+        "limit": 10,
+        "cacheTTL": $cacheTTL
+      }
+      ]
+      ]
+    }"""
+      Json.parse(s)
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/IntegrateCommon.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/IntegrateCommon.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/IntegrateCommon.scala
new file mode 100644
index 0000000..2aa8abf
--- /dev/null
+++ 
b/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/IntegrateCommon.scala
@@ -0,0 +1,274 @@
+package com.kakao.s2graph.core.Integrate
+
+import com.kakao.s2graph.core._
+import com.kakao.s2graph.core.mysqls.Label
+import com.kakao.s2graph.core.rest.RequestParser
+import com.typesafe.config._
+import org.scalatest._
+import play.api.libs.json.{JsValue, Json}
+
+import scala.concurrent.duration.Duration
+import scala.concurrent.{Await, ExecutionContext}
+
+trait IntegrateCommon extends FunSuite with Matchers with BeforeAndAfterAll {
+  var graph: Graph = _
+  var parser: RequestParser = _
+  var config: Config = _
+
+  override def beforeAll(): Unit = {
+    config = ConfigFactory.load()
+    graph = new Graph(config)(ExecutionContext.Implicits.global)
+    parser = new RequestParser(graph.config)
+    initTestData()
+  }
+
+  override def afterAll(): Unit = {
+    graph.shutdown()
+  }
+
+  /**
+    * Make Service, Label, Vertex for integrate test
+    */
+  def initTestData() = {
+    println("[init start]: 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
+    Management.deleteService(testServiceName)
+
+    // 1. createService
+    val jsValue = Json.parse(createService)
+    val (serviceName, cluster, tableName, preSplitSize, ttl, 
compressionAlgorithm) =
+      parser.toServiceElements(jsValue)
+
+    val tryRes =
+      Management.createService(serviceName, cluster, tableName, preSplitSize, 
ttl, compressionAlgorithm)
+    println(s">> Service created : $createService, $tryRes")
+
+    val labelNames = Map(testLabelName -> testLabelNameCreate,
+      testLabelName2 -> testLabelName2Create,
+      testLabelNameV1 -> testLabelNameV1Create,
+      testLabelNameWeak -> testLabelNameWeakCreate)
+
+    for {
+      (labelName, create) <- labelNames
+    } {
+      Management.deleteLabel(labelName)
+      Label.findByName(labelName, useCache = false) match {
+        case None =>
+          val json = Json.parse(create)
+          val tryRes = for {
+            labelArgs <- parser.toLabelElements(json)
+            label <- (Management.createLabel _).tupled(labelArgs)
+          } yield label
+
+          tryRes.get
+        case Some(label) =>
+          println(s">> Label already exist: $create, $label")
+      }
+    }
+
+    val vertexPropsKeys = List("age" -> "int")
+
+    vertexPropsKeys.map { case (key, keyType) =>
+      Management.addVertexProp(testServiceName, testColumnName, key, keyType)
+    }
+
+    println("[init end]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
+  }
+
+
+  /**
+    * Test Helpers
+    */
+  object TestHelper {
+    def getEdges(queryJson: JsValue): JsValue = {
+      val ret = graph.getEdges(parser.toQuery(queryJson))
+      val result = Await.result(ret, HttpRequestWaitingTime)
+      val jsResult = PostProcess.toSimpleVertexArrJson(result)
+
+      jsResult
+    }
+
+    def insertEdges(bulkEdges: String*) = {
+      val req = 
graph.mutateElements(parser.toGraphElements(bulkEdges.mkString("\n")), withWait 
= true)
+      val jsResult = Await.result(req, HttpRequestWaitingTime)
+    }
+
+    def toEdge(elems: Any*): String = elems.mkString("\t")
+  }
+
+  // common tables
+  protected val testServiceName = "s2graph"
+  protected val testLabelName = "s2graph_label_test"
+  protected val testLabelName2 = "s2graph_label_test_2"
+  protected val testLabelNameV1 = "s2graph_label_test_v1"
+  protected val testLabelNameWeak = "s2graph_label_test_weak"
+  protected val testColumnName = "user_id_test"
+  protected val testColumnType = "long"
+  protected val testTgtColumnName = "item_id_test"
+  protected val testHTableName = "test-htable"
+  protected val newHTableName = "new-htable"
+  protected val index1 = "idx_1"
+  protected val index2 = "idx_2"
+
+  val NumOfEachTest = 30
+  val HttpRequestWaitingTime = Duration("Inf")
+
+  val createService = s"""{"serviceName" : "$testServiceName"}"""
+
+  val testLabelNameCreate =
+    s"""
+  {
+    "label": "$testLabelName",
+    "srcServiceName": "$testServiceName",
+    "srcColumnName": "$testColumnName",
+    "srcColumnType": "long",
+    "tgtServiceName": "$testServiceName",
+    "tgtColumnName": "$testColumnName",
+    "tgtColumnType": "long",
+    "indices": [
+      {"name": "$index1", "propNames": ["weight", "time", "is_hidden", 
"is_blocked"]},
+      {"name": "$index2", "propNames": ["_timestamp"]}
+    ],
+    "props": [
+    {
+      "name": "time",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "weight",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "is_hidden",
+      "dataType": "boolean",
+      "defaultValue": false
+    },
+    {
+      "name": "is_blocked",
+      "dataType": "boolean",
+      "defaultValue": false
+    }
+    ],
+    "consistencyLevel": "strong",
+    "schemaVersion": "v2",
+    "compressionAlgorithm": "gz",
+    "hTableName": "$testHTableName"
+  }"""
+
+  val testLabelName2Create =
+    s"""
+  {
+    "label": "$testLabelName2",
+    "srcServiceName": "$testServiceName",
+    "srcColumnName": "$testColumnName",
+    "srcColumnType": "long",
+    "tgtServiceName": "$testServiceName",
+    "tgtColumnName": "$testTgtColumnName",
+    "tgtColumnType": "string",
+    "indices": [{"name": "$index1", "propNames": ["time", "weight", 
"is_hidden", "is_blocked"]}],
+    "props": [
+    {
+      "name": "time",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "weight",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "is_hidden",
+      "dataType": "boolean",
+      "defaultValue": false
+    },
+    {
+      "name": "is_blocked",
+      "dataType": "boolean",
+      "defaultValue": false
+    }
+    ],
+    "consistencyLevel": "strong",
+    "isDirected": false,
+    "schemaVersion": "v3",
+    "compressionAlgorithm": "gz"
+  }"""
+
+  val testLabelNameV1Create =
+    s"""
+  {
+    "label": "$testLabelNameV1",
+    "srcServiceName": "$testServiceName",
+    "srcColumnName": "$testColumnName",
+    "srcColumnType": "long",
+    "tgtServiceName": "$testServiceName",
+    "tgtColumnName": "${testTgtColumnName}_v1",
+    "tgtColumnType": "string",
+    "indices": [{"name": "$index1", "propNames": ["time", "weight", 
"is_hidden", "is_blocked"]}],
+    "props": [
+    {
+      "name": "time",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "weight",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "is_hidden",
+      "dataType": "boolean",
+      "defaultValue": false
+    },
+    {
+      "name": "is_blocked",
+      "dataType": "boolean",
+      "defaultValue": false
+    }
+    ],
+    "consistencyLevel": "strong",
+    "isDirected": true,
+    "schemaVersion": "v1",
+    "compressionAlgorithm": "gz"
+  }"""
+
+  val testLabelNameWeakCreate =
+    s"""
+  {
+    "label": "$testLabelNameWeak",
+    "srcServiceName": "$testServiceName",
+    "srcColumnName": "$testColumnName",
+    "srcColumnType": "long",
+    "tgtServiceName": "$testServiceName",
+    "tgtColumnName": "$testTgtColumnName",
+    "tgtColumnType": "string",
+    "indices": [{"name": "$index1", "propNames": ["time", "weight", 
"is_hidden", "is_blocked"]}],
+    "props": [
+    {
+      "name": "time",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "weight",
+      "dataType": "long",
+      "defaultValue": 0
+    },
+    {
+      "name": "is_hidden",
+      "dataType": "boolean",
+      "defaultValue": false
+    },
+    {
+      "name": "is_blocked",
+      "dataType": "boolean",
+      "defaultValue": false
+    }
+    ],
+    "consistencyLevel": "weak",
+    "isDirected": true,
+    "compressionAlgorithm": "gz"
+  }"""
+}

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/QueryTest.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/QueryTest.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/QueryTest.scala
new file mode 100644
index 0000000..53696b0
--- /dev/null
+++ b/s2core/src/test/scala/com/kakao/s2graph/core/Integrate/QueryTest.scala
@@ -0,0 +1,63 @@
+package com.kakao.s2graph.core.Integrate
+
+import com.kakao.s2graph.core.Management
+import com.kakao.s2graph.core.mysqls._
+import play.api.libs.json.{JsValue, Json}
+
+class QueryTest extends IntegrateCommon {
+
+//  test("test Query") {
+//
+//  }
+//
+//  test("test returnTree") {
+//    def queryParents(id: Long) = Json.parse(
+//      s"""
+//        {
+//          "returnTree": true,
+//          "srcVertices": [
+//          { "serviceName": "${testServiceName}",
+//            "columnName": "${testColumnName}",
+//            "id": ${id}
+//           }],
+//          "steps": [
+//          [ {
+//              "label": "${testLabelName}",
+//              "direction": "out",
+//              "offset": 0,
+//              "limit": 2
+//            }
+//          ],[{
+//              "label": "${testLabelName}",
+//              "direction": "in",
+//              "offset": 0,
+//              "limit": -1
+//            }
+//          ]]
+//        }""".stripMargin)
+//
+//    val src = 100
+//    val tgt = 200
+//    val labelName = testLabelName
+//
+//    insertEdges(
+//      toEdge(1001, "insert", "e", src, tgt, labelName)
+//    )
+//
+//    val result = getEdges(queryParents(src))
+//    val parents = (result \ "results").as[Seq[JsValue]]
+//    val ret = parents.forall { edge => (edge \ 
"parents").as[Seq[JsValue]].size == 1 }
+//
+//    ret === true
+//  }
+
+  override def beforeAll(): Unit = {
+    super.beforeAll()
+
+
+  }
+
+  override def afterAll(): Unit = {
+    super.afterAll()
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/JsonParserTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/com/kakao/s2graph/core/JsonParserTest.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/JsonParserTest.scala
index 84349cb..127f2fe 100644
--- a/s2core/src/test/scala/com/kakao/s2graph/core/JsonParserTest.scala
+++ b/s2core/src/test/scala/com/kakao/s2graph/core/JsonParserTest.scala
@@ -3,9 +3,6 @@ package com.kakao.s2graph.core
 import com.kakao.s2graph.core.types.{InnerValLike, InnerVal}
 import org.scalatest.{Matchers, FunSuite}
 
-/**
- * Created by shon on 5/30/15.
- */
 class JsonParserTest extends FunSuite with Matchers with TestCommon with 
JSONParser {
 
   import types.HBaseType._

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/QueryParamTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/com/kakao/s2graph/core/QueryParamTest.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/QueryParamTest.scala
index 374293e..544c17c 100644
--- a/s2core/src/test/scala/com/kakao/s2graph/core/QueryParamTest.scala
+++ b/s2core/src/test/scala/com/kakao/s2graph/core/QueryParamTest.scala
@@ -4,9 +4,6 @@ import com.kakao.s2graph.core.types.LabelWithDirection
 import org.apache.hadoop.hbase.util.Bytes
 import org.scalatest.{FunSuite, Matchers}
 
-/**
- * Created by shon on 7/31/15.
- */
 class QueryParamTest extends FunSuite with Matchers with TestCommon {
 //  val version = HBaseType.VERSION2
 //  val testEdge = Management.toEdge(ts, "insert", "1", "10", labelNameV2, 
"out", Json.obj("is_blocked" -> true, "phone_number" -> "xxxx", "age" -> 
20).toString)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/TestCommon.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/com/kakao/s2graph/core/TestCommon.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/TestCommon.scala
index fae3d06..b18672f 100644
--- a/s2core/src/test/scala/com/kakao/s2graph/core/TestCommon.scala
+++ b/s2core/src/test/scala/com/kakao/s2graph/core/TestCommon.scala
@@ -9,13 +9,7 @@ import org.apache.hadoop.hbase.util.Bytes
 import org.hbase.async.{PutRequest, KeyValue}
 
 
-/**
- * Created by shon on 6/1/15.
- */
 trait TestCommon {
-
-
-
   val ts = System.currentTimeMillis()
   val testServiceId = 1
   val testColumnId = 1

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2core/src/test/scala/com/kakao/s2graph/core/TestCommonWithModels.scala
----------------------------------------------------------------------
diff --git 
a/s2core/src/test/scala/com/kakao/s2graph/core/TestCommonWithModels.scala 
b/s2core/src/test/scala/com/kakao/s2graph/core/TestCommonWithModels.scala
index d350ab4..e2a3363 100644
--- a/s2core/src/test/scala/com/kakao/s2graph/core/TestCommonWithModels.scala
+++ b/s2core/src/test/scala/com/kakao/s2graph/core/TestCommonWithModels.scala
@@ -2,18 +2,16 @@ package com.kakao.s2graph.core
 
 import com.kakao.s2graph.core.Management.JsonModel.{Index, Prop}
 import com.kakao.s2graph.core.mysqls._
-import org.scalatest.BeforeAndAfterAll
 import scalikejdbc.AutoSession
 
 //import com.kakao.s2graph.core.models._
 
-
 import com.kakao.s2graph.core.types.{InnerVal, LabelWithDirection}
 import com.typesafe.config.{Config, ConfigFactory}
 
 import scala.concurrent.ExecutionContext
 
-trait TestCommonWithModels  {
+trait TestCommonWithModels {
 
   import InnerVal._
   import types.HBaseType._
@@ -35,6 +33,7 @@ trait TestCommonWithModels  {
   }
 
   def zkQuorum = config.getString("hbase.zookeeper.quorum")
+
   def cluster = config.getString("hbase.zookeeper.quorum")
 
   implicit val session = AutoSession
@@ -94,7 +93,6 @@ trait TestCommonWithModels  {
     Management.deleteLabel(undirectedLabelNameV2)
   }
 
-
   def createTestLabel() = {
     implicit val session = AutoSession
     Management.createLabel(labelName, serviceName, columnName, columnType, 
serviceName, columnName, columnType,
@@ -111,27 +109,36 @@ trait TestCommonWithModels  {
   }
 
   def service = Service.findByName(serviceName, useCache = false).get
+
   def serviceV2 = Service.findByName(serviceNameV2, useCache = false).get
 
   def column = ServiceColumn.find(service.id.get, columnName, useCache = 
false).get
+
   def columnV2 = ServiceColumn.find(serviceV2.id.get, columnNameV2, useCache = 
false).get
 
   def tgtColumn = ServiceColumn.find(service.id.get, tgtColumnName, useCache = 
false).get
+
   def tgtColumnV2 = ServiceColumn.find(serviceV2.id.get, tgtColumnNameV2, 
useCache = false).get
 
   def label = Label.findByName(labelName, useCache = false).get
+
   def labelV2 = Label.findByName(labelNameV2, useCache = false).get
 
   def undirectedLabel = Label.findByName(undirectedLabelName, useCache = 
false).get
+
   def undirectedLabelV2 = Label.findByName(undirectedLabelNameV2, useCache = 
false).get
 
   def dir = GraphUtil.directions("out")
+
   def op = GraphUtil.operations("insert")
+
   def labelOrderSeq = LabelIndex.DefaultSeq
 
   def labelWithDir = LabelWithDirection(label.id.get, dir)
+
   def labelWithDirV2 = LabelWithDirection(labelV2.id.get, dir)
 
   def queryParam = QueryParam(labelWithDir)
+
   def queryParamV2 = QueryParam(labelWithDirV2)
 }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/0e1c0e0a/s2rest_play/test/controllers/BasicCrudSpec.scala
----------------------------------------------------------------------
diff --git a/s2rest_play/test/controllers/BasicCrudSpec.scala 
b/s2rest_play/test/controllers/BasicCrudSpec.scala
index f4f11b4..07419b3 100644
--- a/s2rest_play/test/controllers/BasicCrudSpec.scala
+++ b/s2rest_play/test/controllers/BasicCrudSpec.scala
@@ -13,8 +13,6 @@ import scala.concurrent.Await
 
 
 class BasicCrudSpec extends SpecCommon {
-  sequential
-
   var seed = 0
   def runTC(tcNum: Int, tcString: String, opWithProps: List[(Long, String, 
String)], expected: Map[String, String]) = {
     for {

Reply via email to