/** * */ public void consistencyCheck(IgniteEx ignite) { IgniteCache<Integer, TestValue> cache = ignite.getOrCreateCache(cacheName); for (int key = 0; key < KEYS_SPACE; key++) { TestValue expectedVal = locCache.get(key); TestValue actualVal = cache.get(key); Assert.assertEquals("Consistency check failed for: " + cache.getName() + ", key=" + key, expectedVal, actualVal); } }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected void beforeTest() throws Exception { super.beforeTest(); client().getOrCreateCache(cacheConfigurationForIndexing()); client().getOrCreateCache(cacheConfigurationForIndexingInPublicSchema()); }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); startGrid(0).getOrCreateCache(defaultCacheConfiguration()); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); grid(0).getOrCreateCache(QUERY_CACHE).removeAll(); }
@Override public void run(IgniteServices services, String svcName, TestService svc) { IgniteCache<Object, Object> cache = grid(testedNodeIdx).getOrCreateCache(CACHE_NAME); try { services.deployKeyAffinitySingleton(svcName, (Service)svc, cache.getName(), primaryKey(cache)); } catch (IgniteCheckedException e) { throw new IgniteException(e); } } }));
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); ignite = startGrid(1); cache = ignite.getOrCreateCache("testTableCache"); execute("CREATE TABLE PUBLIC.TEST (ID LONG PRIMARY KEY, VAL LONG) WITH \"template=replicated\";", false); }
/** * Test from client node to get cache elements through cache API. */ @Test public void testClientSqlQuery() { SqlQuery<Integer, Person> qry = new SqlQuery<>(PERSON_CACHE, "FROM " + PERSON_CACHE); Assert.assertEquals(CACHE_ELEMENT_COUNT, clientNode.getOrCreateCache(PERSON_CACHE).query(qry).getAll().size()); }
/** * */ private void destroyIndex(IgniteEx ignite, T3<String, String, String> pair) { IgniteCache<?, ?> cache = ignite.getOrCreateCache(pair.get1()); String createIdxQryStr = String.format("DROP INDEX %s", pair.get3()); cache.query(new SqlFieldsQuery(createIdxQryStr)).getAll(); }
/** * @throws Exception If failed. */ @Test public void testDeleteEntryWithOtherCacheInGroup() throws Exception { grid().getOrCreateCache(cacheConfiguration("cacheWithoutOnheapCache", false)); checkDeleteEntry(); }
/** * @throws Exception If failed. */ @Test public void testUpdateEntryWithOtherCacheInGroup() throws Exception { grid().getOrCreateCache(cacheConfiguration("cacheWithoutOnheapCache", false)); checkUpdateEntry(); }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); IgniteEx ign = startGrid(0); cache = ign.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); }
/** * Tests that there are no redundant calls of {@link CacheStoreSessionListener#onSessionStart(CacheStoreSession)} * while {@link IgniteCache#remove(Object)} performed. */ @Test public void testRemove() { IgniteCache<Object, Object> cache = grid(0).getOrCreateCache(DEFAULT_CACHE_NAME); for (int i = 0; i < CNT; ++i) { cache.remove(i); } checkSessionCounters(1); }
/** * @throws IgniteCheckedException If failed. */ @Test public void testDestroyCacheWithOtherCacheInGroup() throws IgniteCheckedException { grid().getOrCreateCache(cacheConfiguration("cacheWithoutOnheapCache", false)); checkDestroyCache(); }
/** * Tests that there are no redundant calls of {@link CacheStoreSessionListener#onSessionStart(CacheStoreSession)} * while {@link IgniteCache#get(Object)} performed. */ @Test public void testLookup() { IgniteCache<Object, Object> cache = grid(0).getOrCreateCache(DEFAULT_CACHE_NAME); for (int i = 0; i < CNT; ++i) cache.get(i); checkSessionCounters(CNT); }
/** * Tests that there are no redundant calls of {@link CacheStoreSessionListener#onSessionStart(CacheStoreSession)} * while {@link IgniteCache#put(Object, Object)} performed. */ @Test public void testUpdate() { IgniteCache<Object, Object> cache = grid(0).getOrCreateCache(DEFAULT_CACHE_NAME); for (int i = 0; i < CNT; ++i) cache.put(i, i); checkSessionCounters(1); }
/** * */ private void createIndex(IgniteEx ignite, T3<String, String, String> pair) { IgniteCache<?, ?> cache = ignite.getOrCreateCache(pair.get1()); String createIdxQryStr = String.format("CREATE INDEX %S on %s (city_id)", pair.get3(), pair.get2()); cache.query(new SqlFieldsQuery(createIdxQryStr)).getAll(); }
/** */ private static IgniteCache<?, ?> createTable(IgniteEx ignite) { IgniteCache<?, ?> sqlNexus = ignite.getOrCreateCache(new CacheConfiguration<>("sqlNexus").setSqlSchema("PUBLIC")); sqlNexus.query(q("" + "create table person(" + " id int primary key," + " name varchar" + ") with \"atomicity=transactional_snapshot,template=replicated,cache_name=person\"")); return table(ignite); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); cache = startGrid(0).getOrCreateCache( new CacheConfiguration<>("test") .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) .setSqlSchema("PUBLIC") .setIndexedTypes(Integer.class, Integer.class) ); }
/** * @param ig Ig. * @param cacheName Cache name. */ private void createCache(IgniteEx ig, String cacheName) { ig.getOrCreateCache(new CacheConfiguration<>(cacheName) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setAffinity(new RendezvousAffinityFunction(false, 1)) .setBackups(1) .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC) .setRebalanceBatchSize(100)); }
/** * Test DDL operation for not started cache on client node. */ @Test public void testDropIdxOnClient() { srvNode.getOrCreateCache(DEFAULT_CACHE_NAME).query(new SqlFieldsQuery("CREATE INDEX IDX_TST ON " + FULL_TABLE_NAME + " (name desc)")).getAll(); //Due to client receive created index asynchronously we need add the ugly sleep. doSleep(2000); getDefaultCacheOnClient().query(new SqlFieldsQuery("DROP INDEX " + PERSON_SCHEMA + ".IDX_TST")).getAll(); }