Repository: incubator-griffin
Updated Branches:
  refs/heads/master df4451432 -> 6fd22ae71


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/6fd22ae7/measure/src/test/scala/org/apache/griffin/measure/result/ProfileResultTest.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/test/scala/org/apache/griffin/measure/result/ProfileResultTest.scala
 
b/measure/src/test/scala/org/apache/griffin/measure/result/ProfileResultTest.scala
new file mode 100644
index 0000000..2c4fc5f
--- /dev/null
+++ 
b/measure/src/test/scala/org/apache/griffin/measure/result/ProfileResultTest.scala
@@ -0,0 +1,57 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.griffin.measure.result
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
+
+@RunWith(classOf[JUnitRunner])
+class ProfileResultTest extends FunSuite with BeforeAndAfter with Matchers {
+
+  test ("update") {
+    val result = ProfileResult(10, 100)
+    val delta = ProfileResult(30, 90)
+    result.update(delta) should be (ProfileResult(40, 100))
+  }
+
+  test ("eventual") {
+    val result1 = ProfileResult(10, 100)
+    result1.eventual should be (false)
+
+    val result2 = ProfileResult(100, 100)
+    result2.eventual should be (true)
+  }
+
+  test ("differsFrom") {
+    val result = ProfileResult(10, 100)
+    result.differsFrom(ProfileResult(11, 100)) should be (true)
+    result.differsFrom(ProfileResult(10, 110)) should be (true)
+    result.differsFrom(ProfileResult(10, 100)) should be (false)
+  }
+
+  test ("matchPercentage") {
+    val result1 = ProfileResult(90, 100)
+    result1.matchPercentage should be (90.0)
+
+    val result2 = ProfileResult(10, 0)
+    result2.matchPercentage should be (0.0)
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/6fd22ae7/measure/src/test/scala/org/apache/griffin/measure/rule/ExprValueUtilTest.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/test/scala/org/apache/griffin/measure/rule/ExprValueUtilTest.scala
 
b/measure/src/test/scala/org/apache/griffin/measure/rule/ExprValueUtilTest.scala
new file mode 100644
index 0000000..dd8d4a0
--- /dev/null
+++ 
b/measure/src/test/scala/org/apache/griffin/measure/rule/ExprValueUtilTest.scala
@@ -0,0 +1,86 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.griffin.measure.rule
+
+import org.apache.griffin.measure.config.params.user.EvaluateRuleParam
+import org.apache.griffin.measure.rule.expr.{Expr, StatementExpr}
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
+
+@RunWith(classOf[JUnitRunner])
+class ExprValueUtilTest extends FunSuite with BeforeAndAfter with Matchers {
+
+  test ("rule calculation") {
+    //    val rules = "$source.json().name = 's2' and $source.json().age[*] = 
32"
+    //    val rules = "$source.json().items[*] = 202 AND $source.json().age[*] 
= 32 AND $source.json().df[*].a = 1"
+    val rules = "$source.json().items[*] = 202 AND $source.json().age[*] = 32 
AND $source.json().df['a' = 1].b = 4"
+    //    val rules = "$source.json().df[0].a = 1"
+    val ep = EvaluateRuleParam(1, rules)
+
+    val ruleFactory = RuleFactory(ep)
+    val rule: StatementExpr = ruleFactory.generateRule()
+    val ruleAnalyzer: RuleAnalyzer = RuleAnalyzer(rule)
+
+    val ruleExprs = ruleAnalyzer.sourceRuleExprs
+    val constFinalExprValueMap = Map[String, Any]()
+
+    val data = List[String](
+      ("""{"name": "s1", "age": [22, 23], "items": [102, 104, 106], "df": 
[{"a": 1, "b": 3}, {"a": 2, "b": 4}]}"""),
+      ("""{"name": "s2", "age": [32, 33], "items": [202, 204, 206], "df": 
[{"a": 1, "b": 4}, {"a": 2, "b": 4}]}"""),
+      ("""{"name": "s3", "age": [42, 43], "items": [302, 304, 306], "df": 
[{"a": 1, "b": 5}, {"a": 2, "b": 4}]}""")
+    )
+
+    def str(expr: Expr) = {
+      s"${expr._id}: ${expr.desc} [${expr.getClass.getSimpleName}]"
+    }
+    println("====")
+    ruleExprs.finalCacheExprs.foreach { expr =>
+      println(str(expr))
+    }
+    println("====")
+    ruleExprs.cacheExprs.foreach { expr =>
+      println(str(expr))
+    }
+
+    val constExprValueMap = ExprValueUtil.genExprValueMaps(None, 
ruleAnalyzer.constCacheExprs, Map[String, Any]())
+    val finalConstExprValueMap = 
ExprValueUtil.updateExprValueMaps(ruleAnalyzer.constFinalCacheExprs, 
constExprValueMap)
+    val finalConstMap = finalConstExprValueMap.headOption match {
+      case Some(m) => m
+      case _ => Map[String, Any]()
+    }
+    println("====")
+    println(ruleAnalyzer.constCacheExprs)
+    println(ruleAnalyzer.constFinalCacheExprs)
+    println(finalConstMap)
+
+    println("====")
+    val valueMaps = data.flatMap { msg =>
+      val cacheExprValueMaps = ExprValueUtil.genExprValueMaps(Some(msg), 
ruleExprs.cacheExprs, finalConstMap)
+      val finalExprValueMaps = 
ExprValueUtil.updateExprValueMaps(ruleExprs.finalCacheExprs, cacheExprValueMaps)
+
+      finalExprValueMaps
+    }
+
+    valueMaps.foreach(println)
+    println(valueMaps.size)
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/6fd22ae7/measure/src/test/scala/org/apache/griffin/measure/rule/RuleAnalyzerTest.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/test/scala/org/apache/griffin/measure/rule/RuleAnalyzerTest.scala 
b/measure/src/test/scala/org/apache/griffin/measure/rule/RuleAnalyzerTest.scala
new file mode 100644
index 0000000..47b36e8
--- /dev/null
+++ 
b/measure/src/test/scala/org/apache/griffin/measure/rule/RuleAnalyzerTest.scala
@@ -0,0 +1,60 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.griffin.measure.rule
+
+import org.apache.griffin.measure.config.params.user.EvaluateRuleParam
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
+
+@RunWith(classOf[JUnitRunner])
+class RuleAnalyzerTest extends FunSuite with BeforeAndAfter with Matchers {
+
+  test ("rule analyze") {
+    val rule = "$source.name = $target.name AND $source.age = $target.age + (2 
* 5) AND $source.born > (6 - 2 * 2)"
+    val evaluateRuleParam = EvaluateRuleParam(1.0, rule)
+    val ruleFactory = RuleFactory(evaluateRuleParam)
+    val statement = ruleFactory.generateRule
+
+    val ruleAnalyzer = RuleAnalyzer(statement)
+
+    ruleAnalyzer.constCacheExprs.map(_.desc) should be (List[String]("2 * 5", 
"2 * 2", "6 - 2 * 2"))
+    ruleAnalyzer.constFinalCacheExprs.map(_.desc) should be (Set[String]("2 * 
5", "6 - 2 * 2"))
+
+    ruleAnalyzer.sourceRuleExprs.groupbyExprs.map(_.desc) should be 
(List[String](
+      "$source['name']", "$source['age']"))
+    ruleAnalyzer.sourceRuleExprs.cacheExprs.map(_.desc) should be 
(List[String](
+      "$source['name']", "$source['age']", "$source['born']", "$source['born'] 
> 6 - 2 * 2"))
+    ruleAnalyzer.sourceRuleExprs.finalCacheExprs.map(_.desc) should be 
(Set[String](
+      "$source['name']", "$source['age']", "$source['born']", "$source['born'] 
> 6 - 2 * 2"))
+    ruleAnalyzer.sourceRuleExprs.persistExprs.map(_.desc) should be 
(List[String](
+      "$source['name']", "$source['age']", "$source['born']"))
+
+    ruleAnalyzer.targetRuleExprs.groupbyExprs.map(_.desc) should be 
(List[String](
+      "$target['name']", "$target['age'] + 2 * 5"))
+    ruleAnalyzer.targetRuleExprs.cacheExprs.map(_.desc) should be 
(List[String](
+      "$target['name']", "$target['age']", "$target['age'] + 2 * 5"))
+    ruleAnalyzer.targetRuleExprs.finalCacheExprs.map(_.desc) should be 
(Set[String](
+      "$target['name']", "$target['age']", "$target['age'] + 2 * 5"))
+    ruleAnalyzer.targetRuleExprs.persistExprs.map(_.desc) should be 
(List[String](
+      "$target['name']", "$target['age']"))
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/6fd22ae7/measure/src/test/scala/org/apache/griffin/measure/rule/RuleFactoryTest.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/test/scala/org/apache/griffin/measure/rule/RuleFactoryTest.scala 
b/measure/src/test/scala/org/apache/griffin/measure/rule/RuleFactoryTest.scala
new file mode 100644
index 0000000..c14cd04
--- /dev/null
+++ 
b/measure/src/test/scala/org/apache/griffin/measure/rule/RuleFactoryTest.scala
@@ -0,0 +1,44 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.griffin.measure.rule
+
+import org.apache.griffin.measure.config.params.user.EvaluateRuleParam
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
+
+@RunWith(classOf[JUnitRunner])
+class RuleFactoryTest extends FunSuite with BeforeAndAfter with Matchers {
+
+  test ("generate rule") {
+    val rule = "$source.name = $target.name AND $source.age = $target.age"
+    val evaluateRuleParam = EvaluateRuleParam(1.0, rule)
+    val ruleFactory = RuleFactory(evaluateRuleParam)
+    ruleFactory.generateRule.desc should be ("$source['name'] = 
$target['name'] AND $source['age'] = $target['age']")
+
+    val wrong_rule = "$source.name = $target.name AND $source.age = 
$target1.age"
+    val evaluateRuleParam1 = EvaluateRuleParam(1.0, wrong_rule)
+    val ruleFactory1 = RuleFactory(evaluateRuleParam1)
+    val thrown = intercept[Exception] {
+      ruleFactory1.generateRule
+    }
+    thrown.getMessage should be ("parse rule error!")
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/6fd22ae7/measure/src/test/scala/org/apache/griffin/measure/rule/RuleParserTest.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/test/scala/org/apache/griffin/measure/rule/RuleParserTest.scala 
b/measure/src/test/scala/org/apache/griffin/measure/rule/RuleParserTest.scala
new file mode 100644
index 0000000..1d15375
--- /dev/null
+++ 
b/measure/src/test/scala/org/apache/griffin/measure/rule/RuleParserTest.scala
@@ -0,0 +1,213 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.griffin.measure.rule
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
+//import org.scalatest.FlatSpec
+//import org.scalamock.scalatest.MockFactory
+
+@RunWith(classOf[JUnitRunner])
+class RuleParserTest extends FunSuite with Matchers with BeforeAndAfter {
+
+  val ruleParser = RuleParser()
+
+  test ("literal number") {
+    val rule1 = "123"
+    val result1 = ruleParser.parseAll(ruleParser.literal, rule1)
+    result1.successful should be (true)
+    result1.get.value should be (Some(123))
+
+    val rule2 = "12.3"
+    val result2 = ruleParser.parseAll(ruleParser.literal, rule2)
+    result2.successful should be (true)
+    result2.get.value should be (Some(12.3))
+  }
+
+  test ("literial string") {
+    val rule1 = "'123'"
+    val result1 = ruleParser.parseAll(ruleParser.literal, rule1)
+    result1.successful should be (true)
+    result1.get.value should be (Some("123"))
+
+    val rule2 = "\"123\""
+    val result2 = ruleParser.parseAll(ruleParser.literal, rule1)
+    result2.successful should be (true)
+    result2.get.value should be (Some("123"))
+
+    val rule3 = "'1+2-3'"
+    val result3 = ruleParser.parseAll(ruleParser.literal, rule3)
+    result3.successful should be (true)
+    result3.get.value should be (Some("1+2-3"))
+  }
+
+  test ("literial time") {
+    val rule = "3h"
+    val result = ruleParser.parseAll(ruleParser.literal, rule)
+    result.successful should be (true)
+    result.get.value should be (Some(3*3600*1000))
+  }
+
+  test ("literial boolean") {
+    val rule = "true"
+    val result = ruleParser.parseAll(ruleParser.literal, rule)
+    result.successful should be (true)
+    result.get.value should be (Some(true))
+  }
+
+  test ("literial null") {
+    val rule = "null"
+    val result = ruleParser.parseAll(ruleParser.literal, rule)
+    result.successful should be (true)
+    result.get.value should be (Some(null))
+  }
+
+  test ("literial none") {
+    val rule = "none"
+    val result = ruleParser.parseAll(ruleParser.literal, rule)
+    result.successful should be (true)
+    result.get.value should be (None)
+  }
+
+  test ("selection head") {
+    val rule = "$source"
+    val result = ruleParser.parseAll(ruleParser.selectionHead, rule)
+    result.successful should be (true)
+    result.get.head should be ("source")
+  }
+
+  test ("field select") {
+    val rule = ".name"
+    val result = ruleParser.parseAll(ruleParser.selector, rule)
+    result.successful should be (true)
+    result.get.desc should be ("['name']")
+  }
+
+  test ("function operation") {
+    val rule = ".func(1, 'abc', 3 + 4)"
+    val result = ruleParser.parseAll(ruleParser.selector, rule)
+    result.successful should be (true)
+    result.get.desc should be (".func(1, 'abc', 3 + 4)")
+  }
+
+  test ("index field range select") {
+    val rule1 = "['field']"
+    val result1 = ruleParser.parseAll(ruleParser.selector, rule1)
+    result1.successful should be (true)
+    result1.get.desc should be ("['field']")
+
+    val rule2 = "[1, 4]"
+    val result2 = ruleParser.parseAll(ruleParser.selector, rule2)
+    result2.successful should be (true)
+    result2.get.desc should be ("[1, 4]")
+
+    val rule3 = "[1, 'name', 'age', 5, (6, 8)]"
+    val result3 = ruleParser.parseAll(ruleParser.selector, rule3)
+    result3.successful should be (true)
+    result3.get.desc should be ("[1, 'name', 'age', 5, (6, 8)]")
+  }
+
+  test ("index field range") {
+    val rule1 = "(3, 5)"
+    val result1 = ruleParser.parseAll(ruleParser.indexFieldRange, rule1)
+    result1.successful should be (true)
+    result1.get.desc should be ("(3, 5)")
+
+    val rule2 = "'name'"
+    val result2 = ruleParser.parseAll(ruleParser.indexFieldRange, rule2)
+    result2.successful should be (true)
+    result2.get.desc should be ("'name'")
+
+    val rule3 = "*"
+    val result3 = ruleParser.parseAll(ruleParser.indexFieldRange, rule3)
+    result3.successful should be (true)
+    result3.get.desc should be ("*")
+  }
+
+  test ("filter select") {
+    val rule = "['age' > 16]"
+    val result = ruleParser.parseAll(ruleParser.selector, rule)
+    result.successful should be (true)
+    result.get.desc should be ("['age' > 16]")
+  }
+
+  test ("selection") {
+    val rule = "$source['age' > 16].func(1, 'abc')[1, 3, 'name'].time[*]"
+    val result = ruleParser.parseAll(ruleParser.selection, rule)
+    result.successful should be (true)
+    result.get.desc should be ("$source['age' > 16].func(1, 'abc')[1, 3, 
'name']['time'][*]")
+  }
+
+  test ("math expr") {
+    val rule = "$source.age * 6 + 4 / 2"
+    val result = ruleParser.parseAll(ruleParser.mathExpr, rule)
+    result.successful should be (true)
+    result.get.desc should be ("$source['age'] * 6 + 4 / 2")
+
+    val rule2 = "'age + 1' / 'vv'"
+    val result2 = ruleParser.parseAll(ruleParser.mathExpr, rule2)
+    result2.successful should be (true)
+    result2.get.desc should be ("'age + 1' / 'vv'")
+    println(result2)
+  }
+
+  test ("range expr") {
+    val rule = "($source.age + 1, $target.age + 3, 40)"
+    val result = ruleParser.parseAll(ruleParser.rangeExpr, rule)
+    result.successful should be (true)
+    result.get.desc should be ("($source['age'] + 1, $target['age'] + 3, 40)")
+  }
+
+  test ("logical expr") {
+    val rule1 = "$source.age + 1 = $target.age"
+    val result1 = ruleParser.parseAll(ruleParser.logicalExpr, rule1)
+    result1.successful should be (true)
+    result1.get.desc should be ("$source['age'] + 1 = $target['age']")
+
+    val rule2 = "$source.age in (3, 5, 6, 10)"
+    val result2 = ruleParser.parseAll(ruleParser.logicalExpr, rule2)
+    result2.successful should be (true)
+    result2.get.desc should be ("$source['age'] in (3, 5, 6, 10)")
+  }
+
+  test ("logical statement") {
+    val rule1 = "$source.descs[0] = $target.desc AND $source.name = 
$target.name"
+    val result1 = ruleParser.parseAll(ruleParser.logicalStatement, rule1)
+    result1.successful should be (true)
+    result1.get.desc should be ("$source['descs'][0] = $target['desc'] AND 
$source['name'] = $target['name']")
+
+    val rule2 = "NOT $source.age = $target.age"
+    val result2 = ruleParser.parseAll(ruleParser.logicalStatement, rule2)
+    result2.successful should be (true)
+    result2.get.desc should be ("NOT $source['age'] = $target['age']")
+  }
+
+  test ("whole rule") {
+    val rule1 = "$source.name = $target.name AND $source.age = $target.age"
+    val result1 = ruleParser.parseAll(ruleParser.rule, rule1)
+    result1.successful should be (true)
+    result1.get.desc should be ("$source['name'] = $target['name'] AND 
$source['age'] = $target['age']")
+
+    val rule2 = "$source.name = $target.name AND $source.age = $target.age AND 
$source.id > 1000"
+    val result2 = ruleParser.parseAll(ruleParser.rule, rule2)
+    result2.successful should be (true)
+    result2.get.desc should be ("$source['name'] = $target['name'] AND 
$source['age'] = $target['age'] AND $source['id'] > 1000")
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/6fd22ae7/measure/src/test/scala/org/apache/griffin/measure/utils/JsonUtilTest.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/test/scala/org/apache/griffin/measure/utils/JsonUtilTest.scala 
b/measure/src/test/scala/org/apache/griffin/measure/utils/JsonUtilTest.scala
new file mode 100644
index 0000000..4daebb6
--- /dev/null
+++ b/measure/src/test/scala/org/apache/griffin/measure/utils/JsonUtilTest.scala
@@ -0,0 +1,60 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.griffin.measure.utils
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
+
+
+@RunWith(classOf[JUnitRunner])
+class JsonUtilTest extends FunSuite with Matchers with BeforeAndAfter {
+
+  val map = Map[String, Any](("name" -> "test"), ("age" -> 15))
+  val json = """{"name":"test","age":15}"""
+
+  val person = JsonUtilTest.Person("test", 15)
+
+  test ("toJson 1") {
+    val symbolMap = map.map(p => (Symbol(p._1), p._2))
+    JsonUtil.toJson(symbolMap) should equal (json)
+  }
+
+  test ("toJson 2") {
+    JsonUtil.toJson(map) should equal (json)
+  }
+
+  test ("toMap") {
+    JsonUtil.toMap(json) should equal (map)
+  }
+
+  test ("fromJson 1") {
+    JsonUtil.fromJson[JsonUtilTest.Person](json) should equal (person)
+  }
+
+  test ("fromJson 2") {
+    val is = new java.io.ByteArrayInputStream(json.getBytes("utf-8"));
+    JsonUtil.fromJson[JsonUtilTest.Person](is) should equal (person)
+  }
+
+}
+
+object JsonUtilTest {
+  case class Person(name: String, age: Int){}
+}

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/6fd22ae7/service/src/main/resources/sparkJob.properties
----------------------------------------------------------------------
diff --git a/service/src/main/resources/sparkJob.properties 
b/service/src/main/resources/sparkJob.properties
index bbeb802..371ed11 100644
--- a/service/src/main/resources/sparkJob.properties
+++ b/service/src/main/resources/sparkJob.properties
@@ -19,7 +19,7 @@
 
 
 sparkJob.file=hdfs:///griffin/griffin-measure.jar
-sparkJob.className=org.apache.griffin.measure.batch.Application
+sparkJob.className=org.apache.griffin.measure.Application
 sparkJob.args_1=hdfs:///griffin/json/env.json
 sparkJob.args_3=hdfs,raw
 sparkJob.name=griffin

Reply via email to