/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { if (cache != null) cache.destroy(); }
@Override public void run() { for (int i = 0; i < 100; i++) { int idx = maxIdx.incrementAndGet(); String tbl = "Person" + idx; IgniteCache<Long, Person> cache = registerQueryEntity(tbl, "PersonCache" + idx); testQueryEntity(cache, tbl); cache.destroy(); } } }, 4, "schema-test");
/** {@inheritDoc} */ @Override public void close() { datasetCache.destroy(); ComputeUtils.removeData(ignite, datasetId); ComputeUtils.removeLearningEnv(ignite, datasetId); }
/** {@inheritDoc} */ @Override public Void call() { cache().destroy(); return null; } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { ignite.cache(DEFAULT_CACHE_NAME).destroy(); }
@Override public void run() { for (int i = 0; i < NUM_CACHES; i++) { IgniteCache cache = client1.getOrCreateCache(testCacheConfiguration(DEFAULT_CACHE_NAME + i)); try { U.sleep(100); } catch (Exception e) { //Ignore. } cache.destroy(); } } }, 1, "tx-thread");
/** {@inheritDoc} */ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) { assert msg != null; if ( GridIoMessage.class.isAssignableFrom(msg.getClass())){ GridIoMessage gridMsg = (GridIoMessage)msg; if ( GridH2QueryRequest.class.isAssignableFrom( gridMsg.message().getClass() ) ){ GridH2QueryRequest req = (GridH2QueryRequest) (gridMsg.message()); req.requestId(); orgCache.destroy(); } } super.sendMessage(node, msg, ackC); } });
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); mbSrv.clear(); for (String cacheName : grid(0).cacheNames()) { if (!(EXISTING_CACHE_NAME.equals(cacheName) || DEFAULT_CACHE_NAME.equals(cacheName))) grid(0).cache(cacheName).destroy(); } }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); IgniteCache cache = ignite(0).cache(DEFAULT_CACHE_NAME); if (cache != null) cache.destroy(); // Setting different MAC addresses for all nodes Map<UUID, String> macs = getClusterMacs(); int idx = 0; for (Map.Entry<UUID, String> entry : macs.entrySet()) entry.setValue("x2-xx-xx-xx-xx-x" + idx++); replaceMacAddresses(G.allGrids(), macs); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); for(String cacheName : ignite().cacheNames()) ignite().cache(cacheName).destroy(); }
/** * @throws Exception If failed. */ @Test public void testCreateDropCache1() throws Exception { CacheConfiguration ccfg1 = cacheConfiguration(GROUP1, "c1", PARTITIONED, ATOMIC, 1); CacheConfiguration ccfg2 = cacheConfiguration(GROUP1, "c2", PARTITIONED, ATOMIC, 1); Ignite ignite = startGrid(); ignite.active(true); ignite.createCaches(Arrays.asList(ccfg1, ccfg2)); ignite.cache("c1").destroy(); ignite.cache("c2").destroy(); ignite.createCache(ccfg1); ignite.createCache(ccfg2); stopGrid(); }
/** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { if (testsCfg.isStopCache()) { for (int i = 0; i < gridCount(); i++) { info("Destroing cache on grid: " + i); IgniteCache<String, Integer> cache = jcache(i); assert i != 0 || cache != null; if (cache != null) cache.destroy(); } } storeStgy.resetStore(); super.afterTestsStopped(); }
/** * @throws Exception If failed. */ @Test public void testCreateDropCache() throws Exception { ccfgs = new CacheConfiguration[]{cacheConfiguration(GROUP1, "c1", PARTITIONED, ATOMIC, 1) .setIndexedTypes(Integer.class, Person.class)}; Ignite ignite = startGrid(); ignite.active(true); ignite.cache("c1").destroy(); stopGrid(); }
/** */ private void doWithCache(ThrowingRunnable action) throws Exception { cache = grid(0).getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setAtomicityMode(TRANSACTIONAL_SNAPSHOT) .setBackups(1) .setCacheMode(cacheMode())); try { action.run(); } finally { cache.destroy(); } }
/** * @throws Exception If failed. */ @Test public void testStartStop() throws Exception { startGrids(2); awaitPartitionMapExchange(); Ignite ig = ignite(0); IgniteCache<Integer, Integer> cache = ig.getOrCreateCache(CCFG); for (int i = 0; i < 1000; i++) cache.put(i, i); cache.destroy(); grid(DUMMY_GRID_NAME).createCache(CCFG); }
/** * @throws Exception If failed. */ @Test public void testCreateDropCache2() throws Exception { CacheConfiguration ccfg1 = cacheConfiguration(GROUP1, "c1", PARTITIONED, ATOMIC, 1) .setIndexedTypes(Integer.class, Person.class); CacheConfiguration ccfg2 = cacheConfiguration(GROUP1, "c2", PARTITIONED, ATOMIC, 1) .setIndexedTypes(Integer.class, Person.class); Ignite ignite = startGrid(); ignite.active(true); ignite.createCaches(Arrays.asList(ccfg1, ccfg2)); ignite.cache("c1").destroy(); ignite.createCache(ccfg1); stopGrid(); }
/** * @param key Key. */ private void checkAffinityImplCacheDeleted(Object key) throws InterruptedException { IgniteEx grid = grid(0); final String cacheName = "cacheToBeDeleted"; grid(1).getOrCreateCache(cacheName); awaitPartitionMapExchange(); Affinity<Object> affinity = grid.affinity(cacheName); assertTrue(affinity instanceof GridCacheAffinityImpl); final ClusterNode n = grid.cluster().localNode(); grid.cache(cacheName).destroy(); awaitPartitionMapExchange(); assertAffinityMethodsException(grid.affinity(cacheName), key, n); }
/** * Check that few sequential start-stops of the cache do not affect work of DML. */ @Test public void testCacheRestartHandling() { for (int i = 0; i < 4; i++) { IgniteCache<Integer, AllTypes> p = ignite(0).getOrCreateCache(cacheConfig("I2AT", true, false, Integer.class, AllTypes.class)); p.query(new SqlFieldsQuery("INSERT INTO AllTypes(_key, _val) VALUES (1, ?)") .setArgs(new AllTypes(1L))).getAll(); p.query(new SqlFieldsQuery("UPDATE AllTypes SET dateCol = null;")).getAll(); p.destroy(); } } }
/** * @throws Exception If failed. */ @Test public void testAwaitPartitionMapExchange() throws Exception { IgniteCache cache = grid(0).getOrCreateCache(new CacheConfiguration(DYNAMIC_CACHE_NAME)); awaitPartitionMapExchange(); startGrid(nodeCount()); awaitPartitionMapExchange(); startGrid(nodeCount() + 1); awaitPartitionMapExchange(); stopGrid(nodeCount() + 1); awaitPartitionMapExchange(); stopGrid(nodeCount()); cache.destroy(); }