ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-737 ClusterGroup.forDataNodes() returns empty cluster group for daemon node
Date Tue, 14 Apr 2015 15:22:32 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-737 [created] 2c20c9b0d


ignite-737 ClusterGroup.forDataNodes() returns empty cluster group for daemon node


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

Branch: refs/heads/ignite-737
Commit: 2c20c9b0db8ec7c14fb938c60129ebe50271e8ea
Parents: 9c0ef57
Author: agura <agura@gridgain.com>
Authored: Tue Apr 14 18:21:07 2015 +0300
Committer: agura <agura@gridgain.com>
Committed: Tue Apr 14 18:21:41 2015 +0300

----------------------------------------------------------------------
 ...ProjectionForCachesOnDaemonNodeSelfTest.java | 124 +++++++++++++++++++
 .../ignite/testsuites/IgniteBasicTestSuite.java |   2 +
 2 files changed, 126 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c20c9b0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
new file mode 100644
index 0000000..11a5a41
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.spi.discovery.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+/**
+ * Tests for cluster projection for daemon node.
+ */
+public class GridProjectionForCachesOnDaemonNodeSelfTest extends GridCommonAbstractTest {
+    /** Ip finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Grid count. */
+    private static final int GRID_CNT = 3;
+
+    /** Cache. */
+    private static final String CACHE = "cache";
+
+    /** Daemon node. */
+    private boolean daemonNode;
+
+    /** Ignite. */
+    private static Ignite ignite;
+
+    /** Daemon. */
+    private static Ignite daemon;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setDiscoverySpi(discoverySpi());
+
+        cfg.setDaemon(daemonNode);
+
+        CacheConfiguration ccfg1 = defaultCacheConfiguration();
+
+        CacheConfiguration ccfg2 = defaultCacheConfiguration();
+        ccfg2.setName(CACHE);
+
+        cfg.setCacheConfiguration(ccfg1, ccfg2);
+
+        return cfg;
+    }
+
+    /**
+     * @return Discovery SPI;
+     */
+    private DiscoverySpi discoverySpi() {
+        TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+        spi.setIpFinder(IP_FINDER);
+
+        return spi;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        daemonNode = false;
+
+        ignite = startGrids(GRID_CNT);
+
+        daemonNode = true;
+
+        daemon = startGrid();
+
+        assert ((IgniteKernal)daemon).localNode().isDaemon();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testForDataNodes() throws Exception {
+        ClusterGroup grp;
+
+        grp = ignite.cluster().forDataNodes(null);
+        assertEquals(GRID_CNT, grp.nodes().size());
+
+        grp = ignite.cluster().forDataNodes(CACHE);
+        assertEquals(GRID_CNT, grp.nodes().size());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testForDataNodesDaemon() throws Exception {
+        ClusterGroup grp;
+
+        grp = daemon.cluster().forDataNodes(null);
+        assertEquals(GRID_CNT, grp.nodes().size());
+
+        grp = daemon.cluster().forDataNodes(CACHE);
+        assertEquals(GRID_CNT, grp.nodes().size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c20c9b0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 7ae237f..545c8d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -21,6 +21,7 @@ import junit.framework.*;
 import org.apache.ignite.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.closure.*;
 import org.apache.ignite.internal.processors.continuous.*;
 import org.apache.ignite.internal.product.*;
@@ -61,6 +62,7 @@ public class IgniteBasicTestSuite extends TestSuite {
         suite.addTestSuite(GridClosureProcessorSelfTest.class);
         suite.addTestSuite(GridStartStopSelfTest.class);
         suite.addTestSuite(GridProjectionForCachesSelfTest.class);
+        suite.addTestSuite(GridProjectionForCachesOnDaemonNodeSelfTest.class);
         suite.addTestSuite(GridSpiLocalHostInjectionTest.class);
         suite.addTestSuite(GridLifecycleBeanSelfTest.class);
         suite.addTestSuite(GridStopWithCancelSelfTest.class);


Mime
View raw message