/** * @throws Exception If failed. */ @Test public void testClientNodeLeaveOneServer() throws Exception { startServerNodes(1); startClientNodes(1); checkNodes(1, 1); srvLeftLatch = new CountDownLatch(1); attachListeners(1, 0); stopGrid("client-0"); await(srvLeftLatch); checkNodes(1, 0); }
/** * Test that server not fire client failure event after failure detection timeout. * * @throws Exception If failed. */ @Test public void testClientNodeFailOneServer() throws Exception { startServerNodes(1); startClientNodes(1); checkNodes(1, 1); srvFailedLatch = new CountDownLatch(1); attachListeners(1, 0); failClient(0); await(srvFailedLatch); checkNodes(1, 0); }
/** * @throws Exception If failed. */ @Test public void testClientNodeJoin() throws Exception { startServerNodes(3); startClientNodes(3); checkNodes(3, 3); srvJoinedLatch = new CountDownLatch(3); clientJoinedLatch = new CountDownLatch(3); attachListeners(3, 3); startClientNodes(1); await(srvJoinedLatch); await(clientJoinedLatch); checkNodes(3, 4); }
/** * @throws Exception If failed. */ @Test public void testServerNodeLeave() throws Exception { startServerNodes(3); startClientNodes(3); checkNodes(3, 3); srvLeftLatch = new CountDownLatch(2); clientLeftLatch = new CountDownLatch(3); attachListeners(3, 3); stopGrid("server-2"); await(srvLeftLatch); await(clientLeftLatch); checkNodes(2, 3); }
/** * @throws Exception If failed. */ @Test public void testClientNodeLeave() throws Exception { startServerNodes(3); startClientNodes(3); checkNodes(3, 3); srvLeftLatch = new CountDownLatch(3); clientLeftLatch = new CountDownLatch(2); attachListeners(3, 3); stopGrid("client-2"); await(srvLeftLatch); await(clientLeftLatch); checkNodes(3, 2); }
/** * @throws Exception If failed. */ @Test public void testClientNodeFail() throws Exception { startServerNodes(3); startClientNodes(3); checkNodes(3, 3); srvFailedLatch = new CountDownLatch(3); clientFailedLatch = new CountDownLatch(2); attachListeners(3, 3); failClient(2); awaitClient(srvFailedLatch); awaitClient(clientFailedLatch); checkNodes(3, 2); }
/** * @throws Exception If failed. */ @Test public void testServerNodeJoin() throws Exception { startServerNodes(3); startClientNodes(3); checkNodes(3, 3); srvJoinedLatch = new CountDownLatch(3); clientJoinedLatch = new CountDownLatch(3); attachListeners(3, 3); startServerNodes(1); await(srvJoinedLatch); await(clientJoinedLatch); checkNodes(4, 3); }
/** * @throws Exception If failed. */ @Test public void testClientNodeJoinOneServer() throws Exception { startServerNodes(1); srvJoinedLatch = new CountDownLatch(1); attachListeners(1, 0); startClientNodes(1); await(srvJoinedLatch); checkNodes(1, 1); }
/** * @throws Exception If failed. */ @Test public void testClientReconnectOneServerOneClient() throws Exception { clientsPerSrv = 1; startServerNodes(1); startClientNodes(1); checkNodes(1, 1); srvLeftLatch = new CountDownLatch(1); srvFailedLatch = new CountDownLatch(1); attachListeners(1, 0); ((TcpDiscoverySpi)G.ignite("client-0").configuration().getDiscoverySpi()).brakeConnection(); assertFalse(srvFailedLatch.await(2000, TimeUnit.MILLISECONDS)); assertEquals(1L, srvLeftLatch.getCount()); checkNodes(1, 1); }
/** * @throws Exception If failed. */ @Test public void testJoinMutlithreaded() throws Exception { startServerNodes(1); final int CLIENTS = 30; clientsPerSrv = CLIENTS; GridTestUtils.runMultiThreaded(new Callable<Void>() { @Override public Void call() throws Exception { Ignite g = startGrid("client-" + clientIdx.getAndIncrement()); clientNodeIds.add(g.cluster().localNode().id()); return null; } }, CLIENTS, "start-client"); checkNodes(1, CLIENTS); }
/** * @throws Exception If failed. */ @Test public void testClientReconnectOnRouterFail() throws Exception { clientsPerSrv = 1; startServerNodes(3); startClientNodes(3); checkNodes(3, 3); setClientRouter(2, 0); srvFailedLatch = new CountDownLatch(2); clientFailedLatch = new CountDownLatch(3); attachListeners(2, 3); failServer(2); await(srvFailedLatch); await(clientFailedLatch); checkNodes(2, 3); }
/** * @throws Exception If failed. */ @Test public void testServerNodeFail() throws Exception { startServerNodes(3); startClientNodes(3); checkNodes(3, 3); srvFailedLatch = new CountDownLatch(2); clientFailedLatch = new CountDownLatch(3); attachListeners(3, 3); assert ((TcpDiscoverySpi)G.ignite("server-2").configuration().getDiscoverySpi()).clientWorkerCount() == 0; failServer(2); await(srvFailedLatch); await(clientFailedLatch); checkNodes(2, 3); }
/** * @throws Exception If failed. */ @Test public void testClientReconnectOnNetworkProblem() throws Exception { clientsPerSrv = 1; startServerNodes(3); startClientNodes(3); checkNodes(3, 3); setClientRouter(2, 0); srvFailedLatch = new CountDownLatch(2); clientFailedLatch = new CountDownLatch(3); attachListeners(2, 3); ((TcpDiscoverySpi)G.ignite("client-2").configuration().getDiscoverySpi()).brakeConnection(); G.ignite("client-2").message().remoteListen(null, new MessageListener()); // Send some discovery message. checkNodes(3, 3); }
/** * @param masterName Node name * @throws Exception If failed. */ private void testDataExchange(String masterName) throws Exception { startServerNodes(2); startClientNodes(2); checkNodes(2, 2); IgniteMessaging msg = grid(masterName).message(); UUID id = msg.remoteListen(null, new MessageListener()); try { msgLatch = new CountDownLatch(2); msg.send(null, "Message 1"); await(msgLatch); startServerNodes(1); startClientNodes(1); checkNodes(3, 3); msgLatch = new CountDownLatch(3); msg.send(null, "Message 2"); await(msgLatch); } finally { msg.stopRemoteListen(id); } }
/** * @throws Exception If failed. */ @Test public void testGetMissedMessagesOnReconnect() throws Exception { clientsPerSrv = 1; startServerNodes(3); startClientNodes(2); checkNodes(3, 2); clientLeftLatch = new CountDownLatch(1); srvLeftLatch = new CountDownLatch(2); attachListeners(2, 2); ((TestTcpDiscoverySpi)G.ignite("client-1").configuration().getDiscoverySpi()).pauseAll(true); stopGrid("server-2"); await(srvLeftLatch); await(srvLeftLatch); Thread.sleep(500); assert G.ignite("client-0").cluster().nodes().size() == 4; assert G.ignite("client-1").cluster().nodes().size() == 5; clientLeftLatch = new CountDownLatch(1); ((TestTcpDiscoverySpi)G.ignite("client-1").configuration().getDiscoverySpi()).resumeAll(); await(clientLeftLatch); checkNodes(2, 2); }
/** * @throws Exception If failed. */ @Test public void testJoinError() throws Exception { startServerNodes(1); Ignite ignite = G.ignite("server-0"); TestTcpDiscoverySpi srvSpi = ((TestTcpDiscoverySpi)ignite.configuration().getDiscoverySpi()); srvSpi.failNodeAddedMessage(); startClientNodes(1); checkNodes(1, 1); }
/** * @throws Exception If failed. */ @Test public void testJoinError3() throws Exception { startServerNodes(1); Ignite ignite = G.ignite("server-0"); TestTcpDiscoverySpi srvSpi = ((TestTcpDiscoverySpi)ignite.configuration().getDiscoverySpi()); srvSpi.failNodeAddFinishedMessage(); startClientNodes(1); checkNodes(1, 1); }
/** * @throws Exception If failed. */ @Test public void testJoinError2() throws Exception { startServerNodes(1); Ignite ignite = G.ignite("server-0"); TestTcpDiscoverySpi srvSpi = ((TestTcpDiscoverySpi)ignite.configuration().getDiscoverySpi()); srvSpi.failNodeAddedMessage(); srvSpi.failClientReconnectMessage(); startClientNodes(1); checkNodes(1, 1); }
/** * @throws Exception If failed. */ @Test public void testDataExchangeFromServer2() throws Exception { startServerNodes(2); IgniteMessaging msg = grid("server-1").message(); UUID id = msg.remoteListen(null, new MessageListener()); try { startClientNodes(1); assertEquals(G.ignite("server-0").cluster().localNode().id(), ((TcpDiscoveryNode) G.ignite("client-0").cluster().localNode()).clientRouterNodeId()); checkNodes(2, 1); msgLatch = new CountDownLatch(3); msg.send(null, "Message"); await(msgLatch); } finally { msg.stopRemoteListen(id); } }
/** * @throws Exception If failed. */ @Test public void testPingFailedClientNode() throws Exception { startServerNodes(2); startClientNodes(1); checkNodes(2, 1); Ignite srv0 = G.ignite("server-0"); Ignite srv1 = G.ignite("server-1"); Ignite client = G.ignite("client-0"); if (!useFailureDetectionTimeout()) ((TcpDiscoverySpi)srv0.configuration().getDiscoverySpi()).setAckTimeout(1000); ((TestTcpDiscoverySpi)client.configuration().getDiscoverySpi()).pauseSocketWrite(); assert !((IgniteEx)srv1).context().discovery().pingNode(client.cluster().localNode().id()); assert !((IgniteEx)srv0).context().discovery().pingNode(client.cluster().localNode().id()); ((TestTcpDiscoverySpi)client.configuration().getDiscoverySpi()).resumeAll(); Thread.sleep(2000); assert ((IgniteEx)srv1).context().discovery().pingNode(client.cluster().localNode().id()); assert ((IgniteEx)srv0).context().discovery().pingNode(client.cluster().localNode().id()); }