use of org.apache.ignite.internal.processors.cache.GridCacheTestStore in project ignite by apache.
the class GridCacheColocatedDebugTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setNearConfiguration(null);
cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 30));
cacheCfg.setBackups(1);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
if (storeEnabled) {
cacheCfg.setCacheStoreFactory(singletonFactory(new GridCacheTestStore()));
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
} else
cacheCfg.setCacheStoreFactory(null);
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
use of org.apache.ignite.internal.processors.cache.GridCacheTestStore in project ignite by apache.
the class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(CacheMode.PARTITIONED);
cc.setWriteBehindEnabled(true);
cc.setWriteBehindFlushFrequency(WRITE_BEHIND_FLUSH_FREQ);
cc.setAtomicityMode(TRANSACTIONAL);
cc.setNearConfiguration(new NearCacheConfiguration());
CacheStore store = stores[idx.getAndIncrement()] = new GridCacheTestStore();
cc.setCacheStoreFactory(singletonFactory(store));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
c.setCacheConfiguration(cc);
return c;
}
use of org.apache.ignite.internal.processors.cache.GridCacheTestStore in project ignite by apache.
the class GridCacheWriteBehindStoreSelfTest method testBatchApply.
/**
* Tests that all values will be written to the underlying store
* right in the same order as they were put into the store.
*
* @param writeCoalescing Write coalescing flag.
* @throws Exception If failed.
*/
private void testBatchApply(boolean writeCoalescing) throws Exception {
delegate = new GridCacheTestStore(new ConcurrentLinkedHashMap<Integer, String>());
initStore(1, writeCoalescing);
List<Integer> intList = new ArrayList<>(CACHE_SIZE);
try {
for (int i = 0; i < CACHE_SIZE; i++) {
store.write(new CacheEntryImpl<>(i, "val" + i));
intList.add(i);
}
} finally {
shutdownStore();
}
Map<Integer, String> underlyingMap = delegate.getMap();
assertTrue("Store map key set: " + underlyingMap.keySet(), F.eqOrdered(underlyingMap.keySet(), intList));
}
use of org.apache.ignite.internal.processors.cache.GridCacheTestStore in project ignite by apache.
the class GridCacheColocatedDebugTest method clearStores.
/**
* Clears all stores.
*
* @param cnt Grid count.
*/
private void clearStores(int cnt) {
for (int i = 0; i < cnt; i++) {
String cacheName = grid(i).configuration().getCacheConfiguration()[0].getName();
GridCacheContext ctx = ((IgniteKernal) grid()).context().cache().internalCache(cacheName).context();
CacheStore store = ctx.store().configuredStore();
((GridCacheTestStore) store).reset();
}
}
use of org.apache.ignite.internal.processors.cache.GridCacheTestStore in project ignite by apache.
the class GridCachePartitionedBasicStoreMultiNodeSelfTest method checkStoreUsage.
/**
* @param expLoad Expected load calls.
* @param expPut Expected put calls.
* @param expPutAll Expected putAll calls.
* @param expTxs Expected number of transactions.
*/
private void checkStoreUsage(int expLoad, int expPut, int expPutAll, int expTxs) {
int load = 0;
int put = 0;
int putAll = 0;
int txs = 0;
for (GridCacheTestStore store : stores) {
load += store.getLoadCount();
put += store.getPutCount();
putAll += store.getPutAllCount();
txs += store.transactions().size();
}
if (expLoad != -1)
assertEquals(expLoad, load);
assertEquals(expPut, put);
assertEquals(expPutAll, putAll);
assertEquals(expTxs, txs);
}
Aggregations