/** * @param obj Object to extract value from. * @return Cache object. */ @SuppressWarnings("IfMayBeConditional") private Object reflectiveValue(CacheObject obj) { if (obj instanceof BinaryObjectImpl) return GridTestUtils.getFieldValue(obj, BinaryObjectImpl.class, "obj"); else return GridTestUtils.getFieldValue(obj, CacheObjectAdapter.class, "val"); }
/** * @param spi Spi instance. * @return Zookeeper client. */ static ZooKeeper zkClient(ZookeeperDiscoverySpi spi) { return GridTestUtils.getFieldValue(spi, "impl", "rtState", "zkClient", "zk"); }
/** * @param queue Ignite queue. * @return Cache context. */ protected static GridCacheContext cctx(IgniteQueue queue) { return GridTestUtils.getFieldValue(queue, "cctx"); }
/** * @param set Ignite set. * @return Cache context. */ protected static GridCacheContext cctx(IgniteSet set) { if (set instanceof GridCacheSetProxy) return GridTestUtils.getFieldValue(set, GridCacheSetProxy.class, "cctx"); else return GridTestUtils.getFieldValue(set, GridCacheSetImpl.class, "ctx"); }
@Override public boolean apply() { Collection<? extends GridNioSession> sessions = GridTestUtils.getFieldValue(spi, "nioSrvr", "sessions"); return sessions.size() == cnt; } }, awaitForSocketWriteTimeout());
@Override public boolean apply() { Collection<? extends GridNioSession> sessions = GridTestUtils.getFieldValue(srv, "sessions"); return !sessions.isEmpty(); } }, awaitForSocketWriteTimeout());
/** {@inheritDoc} */ @Override public void sendCustomEvent(DiscoverySpiCustomMessage msg) { if (GridTestUtils.getFieldValue(msg, "delegate") instanceof CacheAffinityChangeMessage) return; failed = true; fail("Should not be called: " + msg); } }
@Override public boolean apply() { Collection<? extends GridNioSession> sessions = GridTestUtils.getFieldValue(srv, "sessions"); return !sessions.isEmpty(); } }, 5000);
@Override public boolean apply() { ZookeeperDiscoverySpi spi = spis.get(nodeName); return spi != null && GridTestUtils.getFieldValue(spi, "impl") != null; } }, 5000);
/** * Get client socket for connection. * * @param conn Connection. * @return Socket. * @throws Exception If failed. */ private static JdbcThinTcpIo io(Connection conn) throws Exception { JdbcThinConnection conn0 = conn.unwrap(JdbcThinConnection.class); return GridTestUtils.getFieldValue(conn0, JdbcThinConnection.class, "cliIo"); }
/** * @param spi SPI. * @return Znode related to given SPI. */ static String aliveZkNodePath(DiscoverySpi spi) { String path = GridTestUtils.getFieldValue(spi, "impl", "rtState", "locNodeZkPath"); return path.substring(path.lastIndexOf('/') + 1); }
/** * @param queue Ignite queue. * @return Cache configuration. */ protected CacheConfiguration getQueueCache(IgniteQueue queue) { GridCacheQueueAdapter delegate = GridTestUtils.getFieldValue(queue, "delegate"); GridCacheAdapter cache = GridTestUtils.getFieldValue(delegate, GridCacheQueueAdapter.class, "cache"); return cache.configuration(); }
/** * @param set Ignite set. * @return {@code True} If a separated cache is used to store items. */ protected boolean separated(IgniteSet set) { if (set instanceof GridCacheSetProxy) set = ((GridCacheSetProxy)set).delegate(); return GridTestUtils.getFieldValue(set, "separated"); } }
/** * Common Assertion * @param h2it target iterator */ private void checkIterator(H2ResultSetIterator h2it){ if (Objects.nonNull(h2it)) assertNull(GridTestUtils.getFieldValue(h2it, H2ResultSetIterator.class, "data")); else fail(); }
/** * @param igniteEx IgniteEx. * @return Set of timeout objects that process on current IgniteEx. */ private Set<GridTimeoutObject> getTimeoutObjects(IgniteEx igniteEx) { GridTimeoutProcessor timeout = igniteEx.context().timeout(); return GridTestUtils.getFieldValue(timeout, timeout.getClass(), "timeoutObjs"); }
/** * @param idx Index. */ @Override public Void call(int idx) throws Exception { GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(cacheName).context(); GridCacheQueryManager queries = ctx.queries(); Map map = GridTestUtils.getFieldValue(queries, GridCacheQueryManager.class, "qryIters"); for (Object obj : map.values()) assertEquals("Iterators not removed for grid " + idx, 0, ((Map)obj).size()); return null; } }
/** * @param ignite Node. * @param expEnabled Expected notifier status. */ private void checkNotifier(Ignite ignite, boolean expEnabled) { ClusterProcessor proc = ((IgniteKernal)ignite).context().cluster(); if (expEnabled) assertNotNull(GridTestUtils.getFieldValue(proc, "updateNtfTimer")); else assertNull(GridTestUtils.getFieldValue(proc, "updateNtfTimer")); } }
/** * Ensures vacuum is stopped on the given node. * * @param node Node. */ private void ensureNoVacuum(Ignite node) { MvccProcessorImpl crd = mvccProcessor(node); assertNull(GridTestUtils.<List<GridWorker>>getFieldValue(crd, "vacuumWorkers")); } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); igniteSecondary = null; secondaryFs = null; igfs = null; HadoopFileSystemsUtils.clearFileSystemCache(); FileSystem.clearStatistics(); Map stat = GridTestUtils.getFieldValue(FileSystem.class, FileSystem.class, "statisticsTable"); stat.clear(); }
/** * @param ig Ignite node. * @return H2RowCacheRegistry for checks. */ private H2RowCacheRegistry rowCache(IgniteEx ig) { IgniteH2Indexing indexing = (IgniteH2Indexing)ig.context().query().getIndexing(); return GridTestUtils.getFieldValue(indexing, "rowCache"); }