ClusterMetrics metrics = cluster().metrics();
/** * @throws Exception If failed. */ @Test public void testOneIgniteNodeIsAlone() throws Exception { startGrid(0); assertEquals(1, grid(0).cluster().metrics().getTotalNodes()); stopAllGrids(); }
/** * @throws Exception If failed. */ @Test public void testTwoIgniteNodesFindEachOther() throws Exception { // start one node startGrid(0); // set up an event listener to expect one NODE_JOINED event CountDownLatch latch = expectJoinEvents(grid(0), 1); // start the other node startGrid(1); // assert the nodes see each other assertEquals(2, grid(0).cluster().metrics().getTotalNodes()); assertEquals(2, grid(1).cluster().metrics().getTotalNodes()); // assert the event listener got as many events as expected latch.await(1, TimeUnit.SECONDS); stopAllGrids(); }
assertEquals(4, grid(0).cluster().metrics().getTotalNodes()); assertEquals(4, grid(1).cluster().metrics().getTotalNodes()); assertEquals(4, grid(2).cluster().metrics().getTotalNodes()); assertEquals(4, grid(3).cluster().metrics().getTotalNodes()); assertEquals(3, grid(1).cluster().metrics().getTotalNodes()); assertEquals(3, grid(2).cluster().metrics().getTotalNodes()); assertEquals(3, grid(3).cluster().metrics().getTotalNodes());
/** * @throws Exception If failed. */ @Test public void testThreeNodesWithThreeDifferentConfigMethods() throws Exception { // start one node startGrid(0); // set up an event listener to expect one NODE_JOINED event CountDownLatch latch = expectJoinEvents(grid(0), 2); // start the 2nd node startGrid(1); // start the 3rd node, first setting the system property System.setProperty(TcpDiscoveryZookeeperIpFinder.PROP_ZK_CONNECTION_STRING, zkCluster.getConnectString()); startGrid(2); // wait until all grids are started waitForRemoteNodes(grid(0), 2); // assert the nodes see each other assertEquals(3, grid(0).cluster().metrics().getTotalNodes()); assertEquals(3, grid(1).cluster().metrics().getTotalNodes()); assertEquals(3, grid(2).cluster().metrics().getTotalNodes()); // assert the event listener got as many events as expected latch.await(1, TimeUnit.SECONDS); stopAllGrids(); }
ClusterMetrics metrics = cluster().metrics();