ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [1/2] incubator-ignite git commit: # ignite-153 Fixed VisorConsole test.
Date Fri, 13 Feb 2015 11:17:40 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-sql-tests 6261113ec -> 1f6d6611e


# ignite-153 Fixed VisorConsole test.


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

Branch: refs/heads/ignite-sql-tests
Commit: 09ef80ae1174f2327645544cd4c3a233b140ed65
Parents: f05ade2
Author: anovikov <anovikov@gridgain.com>
Authored: Fri Feb 13 18:16:42 2015 +0700
Committer: anovikov <anovikov@gridgain.com>
Committed: Fri Feb 13 18:16:42 2015 +0700

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


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/09ef80ae/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 e023275..affc123 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
@@ -18,40 +18,73 @@
 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.annotations.QuerySqlField
-import org.apache.ignite.visor.visor
-import org.scalatest._
+import org.apache.ignite.configuration._
+import org.apache.ignite.spi.discovery.tcp._
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm._
 
+import org.jetbrains.annotations._
+
+import org.apache.ignite.visor._
 import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
 
 /**
  * Unit test for 'events' command.
  */
-class VisorCacheCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAll {
+class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) {
+    behavior of "A 'cache' visor command"
+
+    /** IP finder. */
+    val ipFinder = new TcpDiscoveryVmIpFinder(true)
+
     /**
-     * Open Visor.
+     * @param name Cache name.
+     * @return Cache Configuration.
      */
-    override def beforeAll() {
-        val g = Ignition.start("examples/config/example-cache.xml")
+    def cacheConfig(@Nullable name: String): CacheConfiguration = {
+        val cfg = new CacheConfiguration
+
+        cfg.setCacheMode(REPLICATED)
+        cfg.setAtomicityMode(TRANSACTIONAL)
+        cfg.setName(name)
+        cfg.setQueryIndexEnabled(true)
+
+        val qc = new CacheQueryConfiguration()
+
+        qc.setIndexPrimitiveKey(true)
+        qc.setIndexFixedTyping(true)
 
-        assert(g.caches().size() > 0)
+        cfg.setQueryConfiguration(qc)
 
-        visor.open("-d")
+        cfg
     }
 
     /**
-     * Close Visor.
+     * Creates grid configuration for provided grid host.
+     *
+     * @param name Grid name.
+     * @return Grid configuration.
      */
-    override def afterAll() {
-        visor.close()
+    override def config(name: String): IgniteConfiguration = {
+        val cfg = new IgniteConfiguration
 
-        Ignition.stop(false)
-    }
+        cfg.setGridName(name)
+        cfg.setLocalHost("127.0.0.1")
+        cfg.setCacheConfiguration(cacheConfig("replicated"))
 
-    behavior of "A 'cache' visor command"
+        val discoSpi = new TcpDiscoverySpi()
+
+        discoSpi.setIpFinder(ipFinder)
+
+        cfg.setDiscoverySpi(discoSpi)
+
+        cfg
+    }
 
     it should "put/get some values to/from cache and display information about caches" in
{
-        val c = Ignition.ignite.jcache[String, String]("partitioned")
+        val c = Ignition.ignite("node-1").jcache[String, String]("replicated")
 
         for (i <- 0 to 3) {
             val kv = "" + i
@@ -65,7 +98,7 @@ class VisorCacheCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAl
     }
 
     it should "run query and display information about caches" in {
-        val g = Ignition.ignite
+        val g = Ignition.ignite("node-1")
 
         val c = g.cache[Int, Foo]("replicated")
 


Mime
View raw message