add test case to test Json to TaskConf.
Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/162b4608 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/162b4608 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/162b4608 Branch: refs/heads/master Commit: 162b4608d858799c51f80e666664b4edd9bd8325 Parents: b4dab3a Author: DO YUNG YOON <[email protected]> Authored: Tue Apr 17 18:36:44 2018 +0900 Committer: DO YUNG YOON <[email protected]> Committed: Tue Apr 17 18:36:59 2018 +0900 ---------------------------------------------------------------------- .../s2graph/s2jobs/task/TaskConfTest.scala | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/162b4608/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/task/TaskConfTest.scala ---------------------------------------------------------------------- diff --git a/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/task/TaskConfTest.scala b/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/task/TaskConfTest.scala new file mode 100644 index 0000000..95e2bac --- /dev/null +++ b/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/task/TaskConfTest.scala @@ -0,0 +1,42 @@ +package org.apache.s2graph.s2jobs.task + +import org.apache.s2graph.s2jobs.BaseSparkTest +import play.api.libs.json.Json + +class TaskConfTest extends BaseSparkTest { + test("parse dump loader TaskConf") { + val s = + """ + |{ + | "name": "s2graph_sink", + | "inputs": [ + | "filter" + | ], + | "type": "s2graph", + | "options": { + | "writeMethod": "bulk", + | "hbase.zookeeper.quorum": "localhost", + | "db.default.driver": "com.mysql.jdbc.Driver", + | "db.default.url": "jdbc:mysql://localhost:3306/graph_dev", + | "db.default.user": "graph", + | "db.default.password": "graph", + | "--input": "dummy", + | "--tempDir": "dummy", + | "--output": "/tmp/HTableMigrate", + | "--zkQuorum": "localhost", + | "--table": "CopyRated", + | "--dbUrl": "jdbc:mysql://localhost:3306/graph_dev", + | "--dbUser": "graph", + | "--dbPassword": "graph", + | "--dbDriver": "com.mysql.jdbc.Driver", + | "--autoEdgeCreate": "true", + | "--buildDegree": "true" + | } + | } + """.stripMargin + + implicit val TaskConfReader = Json.reads[TaskConf] + val taskConf = Json.parse(s).as[TaskConf] + + } +}
