ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [29/50] [abbrv] incubator-ignite git commit: IGNITE-261 Scalar: fixed examples and tests.
Date Mon, 16 Feb 2015 13:49:42 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f0209856/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
index f4e7fb8..8d91fdc 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
@@ -25,6 +25,8 @@ import org.junit.runner.RunWith
 import org.scalatest._
 import org.scalatest.junit.JUnitRunner
 
+import scala.collection.JavaConversions._
+
 /**
  * Tests for Scalar cache queries API.
  */
@@ -53,9 +55,7 @@ class ScalarCacheQueriesSpec extends FlatSpec with ShouldMatchers with BeforeAnd
 
         (1 to ENTRY_CNT).foreach(i => c.put(i, ObjectValue(i, "str " + WORDS(i))))
 
-        val peekModes = Array.empty[CachePeekMode]
-
-        assert(c.size(peekModes:_*) == ENTRY_CNT)
+        assert(c.size(Array.empty[CachePeekMode]:_*) == ENTRY_CNT)
 
         c.foreach(e => println(e.getKey + " -> " + e.getValue))
     }
@@ -70,504 +70,129 @@ class ScalarCacheQueriesSpec extends FlatSpec with ShouldMatchers with
BeforeAnd
     behavior of "Scalar cache queries API"
 
     it should "correctly execute SCAN queries" in {
-        var res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 &&
v.intVal < 8)
+        var res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 &&
v.intVal < 8).getAll
 
         assert(res.size == 2)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 ==
t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 &&
t.getKey == t.getValue.intVal))
 
-        res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8)
+        res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
 
         assert(res.size == 2)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 ==
t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 &&
t.getKey == t.getValue.intVal))
 
-        res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 &&
v.intVal < 8)
+        res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 &&
v.intVal < 8).getAll
 
         assert(res.size == 2)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 ==
t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 &&
t.getKey == t.getValue.intVal))
 
-        res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8)
+        res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
 
         assert(res.size == 2)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 ==
t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 &&
t.getKey == t.getValue.intVal))
     }
 
     it should "correctly execute SQL queries" in {
-        var res = c.sql(classOf[ObjectValue], "intVal > 5")
+        var res = c.sql(classOf[ObjectValue], "intVal > 5").getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res = c.sql(classOf[ObjectValue], "intVal > ?", 5)
+        res = c.sql(classOf[ObjectValue], "intVal > ?", 5).getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res = c.sql("intVal > 5")
+        res = c.sql("intVal > 5").getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res = c.sql("intVal > ?", 5)
+        res = c.sql("intVal > ?", 5).getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res = c.sql(classOf[ObjectValue], "intVal > 5")
+        res = c.sql(classOf[ObjectValue], "intVal > 5").getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res = c.sql(classOf[ObjectValue], "intVal > ?", 5)
+        res = c.sql(classOf[ObjectValue], "intVal > ?", 5).getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res = c.sql("intVal > 5")
+        res = c.sql("intVal > 5").getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res = c.sql("intVal > ?", 5)
+        res = c.sql("intVal > ?", 5).getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
-        res.foreach(t => assert(t._1 > 5 && t._1 == t._2.intVal))
+        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
     }
 
     it should "correctly execute TEXT queries" in {
-        var res = c.text(classOf[ObjectValue], "str")
-
-        assert(res.size == ENTRY_CNT)
-
-        res = c.text(classOf[ObjectValue], "five")
-
-        assert(res.size == 1)
-        assert(res.head._1 == 5)
-
-        res = c.text("str")
-
-        assert(res.size == ENTRY_CNT)
-
-        res = c.text("five")
-
-        assert(res.size == 1)
-        assert(res.head._1 == 5)
-
-        res = c.text(classOf[ObjectValue], "str")
-
-        assert(res.size == ENTRY_CNT)
-
-        res = c.text(classOf[ObjectValue], "five")
-
-        assert(res.size == 1)
-        assert(res.head._1 == 5)
-
-        res = c.text("str")
-
-        assert(res.size == ENTRY_CNT)
-
-        res = c.text("five")
-
-        assert(res.size == 1)
-        assert(res.head._1 == 5)
-    }
-
-    it should "correctly execute SCAN transform queries" in {
-        var res = c.scanTransform(classOf[ObjectValue], (k: Int, v: ObjectValue) => k
> 5 && v.intVal < 8,
-            (v: ObjectValue) => v.intVal + 1)
-
-        assert(res.size == 2)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 + 1
== t._2))
-
-        res = c.scanTransform((k: Int, v: ObjectValue) => k > 5 && v.intVal
< 8, (v: ObjectValue) => v.intVal + 1)
-
-        assert(res.size == 2)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 + 1
== t._2))
-
-        res = c.scanTransform(classOf[ObjectValue], (k: Int, v: ObjectValue) => k >
5 && v.intVal < 8, (v: ObjectValue) => v.intVal + 1)
-
-        assert(res.size == 2)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 + 1
== t._2))
-
-        res = c.scanTransform((k: Int, v: ObjectValue) => k > 5 && v.intVal
< 8, (v: ObjectValue) => v.intVal + 1)
-
-        assert(res.size == 2)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 < 8 && t._1 + 1
== t._2))
-    }
-
-    it should "correctly execute SQL transform queries" in {
-        var res = c.sqlTransform(classOf[ObjectValue], "intVal > 5", (v: ObjectValue)
=> v.intVal + 1)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-
-        res = c.sqlTransform(classOf[ObjectValue], "intVal > ?", (v: ObjectValue) =>
v.intVal + 1, 5)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-
-        res = c.sqlTransform("intVal > 5", (v: ObjectValue) => v.intVal + 1)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-
-        res = c.sqlTransform("intVal > ?", (v: ObjectValue) => v.intVal + 1, 5)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-
-        res = c.sqlTransform(classOf[ObjectValue], "intVal > 5", (v: ObjectValue) =>
v.intVal + 1)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-
-        res = c.sqlTransform(classOf[ObjectValue], "intVal > ?", (v: ObjectValue) =>
v.intVal + 1, 5)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-
-        res = c.sqlTransform("intVal > 5", (v: ObjectValue) => v.intVal + 1)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-
-        res = c.sqlTransform("intVal > ?", (v: ObjectValue) => v.intVal + 1, 5)
-
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t._1 > 5 && t._1 + 1 == t._2))
-    }
-
-    it should "correctly execute TEXT transform queries" in {
-        var res = c.textTransform(classOf[ObjectValue], "str", (v: ObjectValue) => v.intVal
+ 1)
+        var res = c.text(classOf[ObjectValue], "str").getAll
 
         assert(res.size == ENTRY_CNT)
 
-        res.foreach(t => assert(t._1 + 1 == t._2))
-
-        res = c.textTransform(classOf[ObjectValue], "five", (v: ObjectValue) => v.intVal
+ 1)
+        res = c.text(classOf[ObjectValue], "five").getAll
 
         assert(res.size == 1)
-        assert(res.head._1 == 5 && res.head._2 == 6)
+        assert(res.head.getKey == 5)
 
-        res = c.textTransform("str", (v: ObjectValue) => v.intVal + 1)
+        res = c.text("str").getAll
 
         assert(res.size == ENTRY_CNT)
 
-        res.foreach(t => assert(t._1 + 1 == t._2))
-
-        res = c.textTransform("five", (v: ObjectValue) => v.intVal + 1)
+        res = c.text("five").getAll
 
         assert(res.size == 1)
-        assert(res.head._1 == 5 && res.head._2 == 6)
+        assert(res.head.getKey == 5)
 
-        res = c.textTransform(classOf[ObjectValue], "str", (v: ObjectValue) => v.intVal
+ 1)
+        res = c.text(classOf[ObjectValue], "str").getAll
 
         assert(res.size == ENTRY_CNT)
 
-        res.foreach(t => assert(t._1 + 1 == t._2))
-
-        res = c.textTransform(classOf[ObjectValue], "five", (v: ObjectValue) => v.intVal
+ 1)
+        res = c.text(classOf[ObjectValue], "five").getAll
 
         assert(res.size == 1)
-        assert(res.head._1 == 5 && res.head._2 == 6)
+        assert(res.head.getKey == 5)
 
-        res = c.textTransform("str", (v: ObjectValue) => v.intVal + 1)
+        res = c.text("str").getAll
 
         assert(res.size == ENTRY_CNT)
 
-        res.foreach(t => assert(t._1 + 1 == t._2))
-
-        res = c.textTransform("five", (v: ObjectValue) => v.intVal + 1)
+        res = c.text("five").getAll
 
         assert(res.size == 1)
-        assert(res.head._1 == 5 && res.head._2 == 6)
-    }
-
-    it should "correctly execute SCAN reduce queries with two reducers" in {
-        var res = c.scanReduce(classOf[ObjectValue], (k: Int, v: ObjectValue) => k >
5 && v.intVal < 8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 13)
-
-        res = c.scanReduce((k: Int, v: ObjectValue) => k > 5 && v.intVal <
8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 13)
-
-        res = c.scanReduce(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5
&& v.intVal < 8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 13)
-
-        res = c.scanReduce((k: Int, v: ObjectValue) => k > 5 && v.intVal <
8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 13)
-    }
-
-    it should "correctly execute SQL reduce queries with two reducers" in {
-        var res = c.sqlReduce(classOf[ObjectValue], "intVal > 5",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 40)
-
-        res = c.sqlReduce(classOf[ObjectValue], "intVal > ?",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum, 3)
-
-        assert(res == 49)
-
-        res = c.sqlReduce("intVal > 5",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 40)
-
-        res = c.sqlReduce("intVal > ?",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum, 3)
-
-        assert(res == 49)
-
-        res = c.sqlReduce(classOf[ObjectValue], "intVal > 5",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 40)
-
-        res = c.sqlReduce(classOf[ObjectValue], "intVal > ?",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum, 3)
-
-        assert(res == 49)
-
-        res = c.sqlReduce("intVal > 5", (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum,
-            (i: Iterable[Int]) => i.sum)
-
-        assert(res == 40)
-
-        res = c.sqlReduce("intVal > ?", (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum,
-            (i: Iterable[Int]) => i.sum, 3)
-
-        assert(res == 49)
-    }
-
-    it should "correctly execute TEXT reduce queries with two reducers" in {
-        var res = c.textReduce(classOf[ObjectValue], "str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce(classOf[ObjectValue], "three five seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 15)
-
-        res = c.textReduce("str", (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum,
-            (i: Iterable[Int]) => i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce("three five seven", (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum,
-            (i: Iterable[Int]) => i.sum)
-
-        assert(res == 15)
-
-        res = c.textReduce(classOf[ObjectValue], "str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce(classOf[ObjectValue], "three five seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 15)
-
-        res = c.textReduce("str", (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum,
-            (i: Iterable[Int]) => i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce("three five seven", (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum,
-            (i: Iterable[Int]) => i.sum)
-
-        assert(res == 15)
-
-        res = c.textReduce(classOf[ObjectValue], "str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce(classOf[ObjectValue], "seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 7)
-
-        res = c.textReduce("str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce("seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 7)
-
-        res = c.textReduce(classOf[ObjectValue], "str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce(classOf[ObjectValue], "seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 7)
-
-        res = c.textReduce("str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 55)
-
-        res = c.textReduce("seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, (i: Iterable[Int])
=> i.sum)
-
-        assert(res == 7)
-    }
-
-    it should "correctly execute SCAN reduce queries with one reducer" in {
-        var res = c.scanReduceRemote(classOf[ObjectValue], (k: Int, v: ObjectValue) =>
k > 5 && v.intVal < 8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 13)
-
-        res = c.scanReduceRemote((k: Int, v: ObjectValue) => k > 5 && v.intVal
< 8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 13)
-
-        res = c.scanReduceRemote(classOf[ObjectValue], (k: Int, v: ObjectValue) => k >
5 && v.intVal < 8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 13)
-
-        res = c.scanReduceRemote((k: Int, v: ObjectValue) => k > 5 && v.intVal
< 8,
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 13)
-    }
-
-    it should "correctly execute SQL reduce queries with one reducer" in {
-        var res = c.sqlReduceRemote(classOf[ObjectValue], "intVal > 5",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 40)
-
-        res = c.sqlReduceRemote(classOf[ObjectValue], "intVal > ?",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, 3)
-
-        assert(res.sum == 49)
-
-        res = c.sqlReduceRemote("intVal > 5",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 40)
-
-        res = c.sqlReduceRemote("intVal > ?",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, 3)
-
-        assert(res.sum == 49)
-
-        res = c.sqlReduceRemote(classOf[ObjectValue], "intVal > 5",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 40)
-
-        res = c.sqlReduceRemote(classOf[ObjectValue], "intVal > ?",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, 3)
-
-        assert(res.sum == 49)
-
-        res = c.sqlReduceRemote("intVal > 5",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 40)
-
-        res = c.sqlReduceRemote("intVal > ?",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum, 3)
-
-        assert(res.sum == 49)
-    }
-
-    it should "correctly execute TEXT reduce queries with one reducer" in {
-        var res = c.textReduceRemote(classOf[ObjectValue], "str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 55)
-
-        res = c.textReduceRemote(classOf[ObjectValue], "seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 7)
-
-        res = c.textReduceRemote("str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 55)
-
-        res = c.textReduceRemote("seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 7)
-
-        res = c.textReduceRemote(classOf[ObjectValue], "str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 55)
-
-        res = c.textReduceRemote(classOf[ObjectValue], "seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 7)
-
-        res = c.textReduceRemote("str",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 55)
-
-        res = c.textReduceRemote("seven",
-            (i: Iterable[(Int, ObjectValue)]) => i.map(_._2.intVal).sum)
-
-        assert(res.sum == 7)
+        assert(res.head.getKey == 5)
     }
 
     it should "correctly execute fields queries" in {
-        var res = c.sqlFields(null, "select intVal from ObjectValue where intVal > 5")
+        var res = c.sqlFields("select intVal from ObjectValue where intVal > 5").getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
         res.foreach(t => assert(t.size == 1 && t.head.asInstanceOf[Int] > 5))
 
-        res = c.sqlFields(null, "select intVal from ObjectValue where intVal > ?", 5)
+        res = c.sqlFields("select intVal from ObjectValue where intVal > ?", 5).getAll
 
         assert(res.size == ENTRY_CNT - 5)
 
@@ -575,7 +200,7 @@ class ScalarCacheQueriesSpec extends FlatSpec with ShouldMatchers with
BeforeAnd
     }
 
     it should "correctly execute queries with multiple arguments" in {
-        val res = c.sql("from ObjectValue where intVal in (?, ?, ?)", 1, 2, 3)
+        val res = c.sql("from ObjectValue where intVal in (?, ?, ?)", 1, 2, 3).getAll
 
         assert(res.size == 3)
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f0209856/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
index 8ac523d..565b68f 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
@@ -38,16 +38,14 @@ class ScalarCacheSpec extends FlatSpec with ShouldMatchers {
         scalar("examples/config/example-cache.xml") {
             registerListener()
 
-            throw new RuntimeException("Test is disabled.")
+            val c = cache$[Int, Int]("partitioned").get
 
-//            val c = cache$("partitioned").get.viewByType(classOf[Int], classOf[Int])
-//
-//            c.putx(1, 1)
-//            c.putx(2, 2)
-//
-//            c.values foreach println
-//
-//            println("Size is: " + c.size)
+            c.put(1, 1)
+            c.put(2, 2)
+
+            c.iterator() foreach println
+
+            println("Size is: " + c.size())
         }
     }
 


Mime
View raw message