/** * @param fut Future. * @throws Exception If failed. */ protected void assertNotDone(IgniteInternalFuture<?> fut) throws Exception { assertNotNull(fut); if (fut.isDone()) fail("Future completed with result: " + fut.get()); }
/** * @param e Client disconnected exception. */ protected void checkAndWait(IgniteClientDisconnectedException e) { log.info("Expected exception: " + e); assertNotNull(e.reconnectFuture()); e.reconnectFuture().get(); }
/** * @param client Client. * @return Server node client connected to. */ protected Ignite clientRouter(Ignite client) { if (tcpDiscovery()) { TcpDiscoveryNode node = (TcpDiscoveryNode)client.cluster().localNode(); assertTrue(node.isClient()); assertNotNull(node.clientRouterNodeId()); Ignite srv = G.ignite(node.clientRouterNodeId()); assertNotNull(srv); return srv; } else { for (Ignite node : G.allGrids()) { if (!node.cluster().localNode().isClient()) return node; } fail(); return null; } }
/** * @param e Client disconnected exception. * @return Reconnect future. */ protected IgniteFuture<?> check(CacheException e) { log.info("Expected exception: " + e); if (!(e.getCause() instanceof IgniteClientDisconnectedException)) log.error("Unexpected cause: " + e.getCause(), e); assertTrue("Unexpected cause: " + e.getCause(), e.getCause() instanceof IgniteClientDisconnectedException); IgniteClientDisconnectedException e0 = (IgniteClientDisconnectedException)e.getCause(); assertNotNull(e0.reconnectFuture()); return e0.reconnectFuture(); }