/** * @param zipBytes Zip-compressed bytes. * @return Unmarshalled object. * @throws IgniteCheckedException If failed. */ private <T> T unmarshalZip(byte[] zipBytes) throws Exception { assert zipBytes != null && zipBytes.length > 0; InflaterInputStream in = new InflaterInputStream(new ByteArrayInputStream(zipBytes)); return marsh.unmarshal(in, U.resolveClassLoader(spi.ignite().configuration())); }
/** * @return {@code True} if ssl enabled. */ boolean isSslEnabled() { return ignite().configuration().getSslContextFactory() != null; }
@Override public Object call() { nodeId.set(ignite.configuration().getNodeId()); return null; } });
/** * @param node Node. * @return Node's discovery SPI. */ static ZookeeperDiscoverySpi spi(Ignite node) { return (ZookeeperDiscoverySpi)node.configuration().getDiscoverySpi(); }
/** * @param ignite Node. * @return Node's communication SPI. */ static ZkTestCommunicationSpi testSpi(Ignite ignite) { return (ZkTestCommunicationSpi)ignite.configuration().getCommunicationSpi(); }
/** * @param ignite Node. * @return Discovery SPI. */ protected static TestTcpDiscoverySpi spi(Ignite ignite) { return ((TestTcpDiscoverySpi)ignite.configuration().getDiscoverySpi()); }
/** * Checks whether a cache should be undeployed in SHARED or CONTINUOUS modes. * * @param g Ignite node. * @return {@code true} if the cache has to be undeployed, {@code false} otherwise. */ protected boolean isCacheUndeployed(Ignite g) { return !(g.configuration().getMarshaller() instanceof BinaryMarshaller); }
@Override public Object call() throws Exception { pingLatch.countDown(); pingRes.set(pingingNode.configuration().getDiscoverySpi().pingNode( failedNodeId)); return null; } }, 1);
/** {@inheritDoc} */ @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable String arg) { for (ClusterNode node : subgrid) if (node.id().equals(ignite.configuration().getNodeId())) return Collections.singletonMap(new ComputeJobAdapter() { @Override public Serializable execute() { return null; } }, node); throw new IgniteException("Local node not found."); }
/** * Skip messages will not send anymore. */ public static void skipMsgType(Ignite ignite, Class clazz) { ((TestTcpCommunicationSpi)ignite.configuration().getCommunicationSpi()).stop(clazz); } }
/** * @return {@code True} if nodes use {@link TcpDiscoverySpi}. */ protected static boolean tcpDiscovery() { List<Ignite> nodes = G.allGrids(); assertFalse("There are no nodes", nodes.isEmpty()); return nodes.get(0).configuration().getDiscoverySpi() instanceof TcpDiscoverySpi; }
/** * @param ignite Node. * @param near Near cache flag. * @return Communication SPI. */ private TestRecordingCommunicationSpi recordGetRequests(Ignite ignite, boolean near) { TestRecordingCommunicationSpi spi = (TestRecordingCommunicationSpi)ignite.configuration().getCommunicationSpi(); spi.record(near ? GridNearGetRequest.class : GridNearSingleGetRequest.class); return spi; }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { System.setProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL, "true"); super.beforeTestsStarted(); startGrids(SRVS); for (int i = 0; i < CLIENTS; i++) { client.set(true); Ignite client = startGrid(SRVS); assertTrue(client.configuration().isClientMode()); } }
@SuppressWarnings("deprecation") @Override public Void call() throws Exception { ignite(0).configuration().getMarshaller().marshal(new C1()); ignite(0).configuration().getMarshaller().marshal(new C2()); return null; } }, 64, "marshal");
/** * @return Client node. */ private Ignite clientIgnite() { Ignite ignite = ignite(NODE_CNT - 1); assertTrue(ignite.configuration().isClientMode()); if (tcpDiscovery()) assertEquals(clientDiscovery(), ignite.configuration().getDiscoverySpi().isClientMode()); return ignite; }
@Override public Void call() throws Exception { Ignite ignite = ignite(nodeIdx.getAndIncrement()); log.info("Check get [node=" + ignite.name() + ", client=" + ignite.configuration().isClientMode() + ']'); IgniteCache<Object, Object> cache = ignite.cache(ccfg.getName()); while (U.currentTimeMillis() < stopTime) checkGet(cache); return null; } }, SRVS + CLIENTS, "get-thread");
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); startGridsMultiThreaded(SRV_CNT); client = true; Ignite client = startGrid(SRV_CNT); assertTrue(client.configuration().isClientMode()); }
@Override public Object execute() { X.println("Executing FailoverTestTask job on node " + ignite.configuration().getNodeId()); Boolean cpVal = ses.loadCheckpoint(CP_KEY); assert cpVal != null; if (cpVal) { ses.saveCheckpoint(CP_KEY, false); throw new ComputeExecutionRejectedException("Failing over the job."); } return null; } },
/** * Consistent ID is not configured neither in the {@link IgniteConfiguration} nor via the JVM property. * * @throws Exception if failed. */ @Test public void testConsistentIdNotConfigured() throws Exception { Ignite ignite = startGrid(0); assertNull(ignite.configuration().getConsistentId()); assertTrue(ADDR_WITH_PORT_PATTERN.matcher(ignite.cluster().localNode().consistentId().toString()).find()); info("Consistent ID: " + ignite.cluster().localNode().consistentId()); }
/** */ private void runRemoteUnmarshal() throws Exception { Ignite ignite = startGrid(0); byte[] one = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.ONE); byte[] two = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.TWO); startGrid(1); ignite.compute(ignite.cluster().forRemotes()).call(new UnmarshalCallable(one, two)); }