@Override public boolean apply() { // (SRV_NODES + 1 client node) - 1 primary - backup nodes. return qryClient.cluster().nodes().size() == (SRV_NODES + 1 /* client node */) - 1 /* Primary node */ - backups; } }, 5000L);
/** {@inheritDoc} */ @Override public Collection<ClusterNode> call() throws Exception { return cluster().nodes(); } }
@Override public boolean apply() { return ignite1.cluster().nodes().size() == 3; } }, 20000L);
@Override public boolean apply() { return node.cluster().nodes().size() == expNodes; } }, 5000);
@Override public boolean apply() { return cnt.get() == g.cluster().nodes().size(); } }, 5000);
@Override public Object execute() { if (cacheName == null) return true; GridDiscoveryManager discoMgr = ((IgniteKernal)ignite).context().discovery(); for (ClusterNode n : ignite.cluster().nodes()) if (discoMgr.cacheNode(n, cacheName)) return true; return false; } });
@Override public Object call() throws Exception { long start = U.currentTimeMillis(); Ignite grid = startGrid(Thread.currentThread().getName()); System.out.println( ">>> Time to start: " + (U.currentTimeMillis() - start) + ", topSize=" + grid.cluster().nodes().size()); return null; } },
@Override public boolean apply() { return grid.cluster().nodes().size() == gridCount(); } }, getTestTimeout());
/** * @throws Exception If failed. */ @Test public void testGetAllNodes() throws Exception { Collection<ClusterNode> nodes = ignite.cluster().nodes(); printNodes(nodes); assert nodes != null; assert !nodes.isEmpty(); }
/** * @param node Node. * @param expNodes Expected node in cluster. * @throws Exception If failed. */ private void checkNodesNumber(final Ignite node, final int expNodes) throws Exception { GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { return node.cluster().nodes().size() == expNodes; } }, 5000); assertEquals(expNodes, node.cluster().nodes().size()); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { beforeTestsStarted(); startGrid(SRV_GRD); startGrid(CLN_GRD); blocked = new CountDownLatch(1); for (int i = 0; i < 10; ++i) { if (clientNode().cluster().nodes().size() == 2) break; TimeUnit.MILLISECONDS.sleep(100L); } assertEquals(2, clientNode().cluster().nodes().size()); }
/** * @param instances Started Ignite instances. * @param macs Mapping MAC addresses to UUID. */ private void replaceMacAddresses(List<Ignite> instances, Map<UUID, String> macs) { for (Ignite ignite : instances) { for (ClusterNode node : ignite.cluster().nodes()) { String mac = macs.get(node.id()); assertNotNull(mac); Map<String, Object> attrs = new HashMap<>(node.attributes()); attrs.put(ATTR_MACS, mac); ((TcpDiscoveryNode)node).setAttributes(attrs); } } }
/** * @throws Exception If failed. */ @Test public void testGetLocalNode() throws Exception { ClusterNode node = ignite.cluster().localNode(); assert node != null; Collection<ClusterNode> nodes = ignite.cluster().nodes(); assert nodes != null; assert nodes.contains(node); }
/** * @throws Exception If failed. */ @Test public void testRandom() throws Exception { assertTrue(ignite.cluster().nodes().contains(ignite.cluster().forRandom().node())); }
/** * Tests that node not matched by filter really does not try to participate in the query. * * @throws Exception if failed. */ @Test public void testNodeWithoutAttributeExclusion() throws Exception { try (Ignite node1 = startNodeWithCache()) { try (Ignite node2 = startGrid("node2", getConfiguration("node2", false, null))) { assertEquals(2, node2.cluster().nodes().size()); } } }
/** * @throws Exception If failed. */ @Test public void testScanQueryOverLocalCacheWithFailedClosures() throws Exception { Ignite srv = startGrids(4); queryCachesWithFailedPredicates(srv, new CacheConfiguration(LOCAL_CACHE_NAME).setCacheMode(LOCAL)); assertEquals(srv.cluster().nodes().size(), 4); };
/** * @param firstEnabled Flag value for first started node. * @throws Exception If failed. */ private void checkNodeJoinValidation(boolean firstEnabled) throws Exception { // LateAffinity should be always enabled, setLateAffinityAssignment should be ignored. lateAff = firstEnabled; Ignite ignite = startGrid(0); assertFalse(ignite.configuration().isClientMode()); lateAff = !firstEnabled; startGrid(1); client = true; startGrid(2); assertEquals(3, ignite.cluster().nodes().size()); } }
/** * @throws Exception If failed. */ @Test public void testScanQueryWithFailedClosures() throws Exception { Ignite srv = startGrids(4); Ignite client = startGrid("client"); CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME).setCacheMode(PARTITIONED); // Test query from client node. queryCachesWithFailedPredicates(client, cfg); // Test query from server node. queryCachesWithFailedPredicates(srv, cfg); assertEquals(client.cluster().nodes().size(), 5); };
/** * @throws Exception If failed. */ @Test public void testCustomPort() throws Exception { customPort = 11212; Ignite g = startGrid(); assert g != null; assert g.cluster().nodes().size() == gridCount() + 1; MemcachedClientIF c = startClient(); Assert.assertTrue(c.set("key", 0, 1).get()); Assert.assertEquals(1, c.get("key")); c.shutdown(); stopGrid(); }