# IGNITE-153: Fixed test: reworked to new Query API and clarify test logic.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/848a9caa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/848a9caa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/848a9caa

Branch: refs/heads/ignite-143
Commit: 848a9caa020e3022c4515d5ab9e28ec57a1d5a7e
Parents: 440c629
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Fri Feb 13 23:32:54 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Fri Feb 13 23:32:54 2015 +0700

----------------------------------------------------------------------
 .../commands/cache/VisorCacheCommandSpec.scala      | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/848a9caa/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
----------------------------------------------------------------------
diff --git 
a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
 
b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
index affc123..4b1f9b8 100644
--- 
a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
+++ 
b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
@@ -20,6 +20,7 @@ package org.apache.ignite.visor.commands.cache
 import org.apache.ignite.Ignition
 import org.apache.ignite.cache.CacheAtomicityMode._
 import org.apache.ignite.cache.CacheMode._
+import org.apache.ignite.cache.query.Query._
 import org.apache.ignite.cache.query.annotations.QuerySqlField
 import org.apache.ignite.configuration._
 import org.apache.ignite.spi.discovery.tcp._
@@ -100,19 +101,22 @@ class VisorCacheCommandSpec extends 
VisorRuntimeBaseSpec(1) {
     it should "run query and display information about caches" in {
         val g = Ignition.ignite("node-1")
 
-        val c = g.cache[Int, Foo]("replicated")
+        val c = g.jcache[Int, Foo]("replicated")
 
         c.put(0, Foo(20))
         c.put(1, Foo(100))
         c.put(2, Foo(101))
         c.put(3, Foo(150))
 
-        // Create two queries
-        val q1 = c.queries().createSqlQuery(classOf[Foo], "_key > ?")
-        c.queries().createSqlQuery(classOf[Foo], "_key = ?")
+        // Create and execute query that mast return 2 rows.
+        val q1 = c.query(sql(classOf[Foo], "_key > 
?").setArgs(java.lang.Integer.valueOf(1))).getAll()
 
-        // Execute only one query
-        q1.execute(100.asInstanceOf[java.lang.Integer]).get
+        assert(q1.size() == 2)
+
+        // Create and execute query that mast return 0 rows.
+        val q2 = c.query(sql(classOf[Foo], "_key > 
?").setArgs(java.lang.Integer.valueOf(100))).getAll()
+
+        assert(q2.size() == 0)
 
         visor cache "-a"
     }

Reply via email to