@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder builder = buildConfiguration(); return TestCacheManagerFactory.createCacheManager(builder); }
public void testTxChangesOnAtomicMap() throws Exception { AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(cache, "key"); tm().begin(); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); Transaction t = tm().suspend(); assert AtomicMapLookup.getAtomicMap(cache, "key").get("a") == null; tm().resume(t); tm().commit(); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getAtomicMap(cache, "key").get("a").equals("b"); }
public void testAtomicMapWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); cacheManager.defineConfiguration("ahm_without_batch", builder.build()); Cache<String, String> ahmCache = cacheManager.getCache("ahm_without_batch"); AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(ahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getAtomicMap(ahmCache, "key").get("a").equals("b"); }
public void testTxChangesOnAtomicMapNoLocks() throws Exception { AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(cache, "key"); tm().begin(); assert map.isEmpty(); // TestingUtil.extractComponent(cache, InvocationContextContainer.class).createInvocationContext(true, -1).setFlags(SKIP_LOCKING); map.put("a", "b"); assert map.get("a").equals("b"); Transaction t = tm().suspend(); assert AtomicMapLookup.getAtomicMap(cache, "key").get("a") == null; tm().resume(t); tm().commit(); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getAtomicMap(cache, "key").get("a").equals("b"); }
@Test(expectedExceptions = IllegalStateException.class) public void testFineGrainedAtomicMapNonTransactionWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); cacheManager.defineConfiguration("fgahm_no_tx_without_batch", builder.build()); Cache<String, String> fgahmCache = cacheManager.getCache("fgahm_no_tx_without_batch"); FineGrainedAtomicMap<String, String> map = AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key").get("a").equals("b"); }
public void testFineGrainedAtomicMapWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); cacheManager.defineConfiguration("fgahm_without_batch", builder.build()); Cache<String, String> fgahmCache = cacheManager.getCache("fgahm_without_batch"); FineGrainedAtomicMap<String, String> map = AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key").get("a").equals("b"); }
public void testFineGrainedAtomicMapWithoutTransactionManagerLookupSet() { ConfigurationBuilder builder = buildConfiguration(); builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL).transactionManagerLookup(null); cacheManager.defineConfiguration("fgahm_without_tmlookup", builder.build()); Cache<String, String> fgahmCache = cacheManager.getCache("fgahm_without_tmlookup"); FineGrainedAtomicMap<String, String> map = AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getFineGrainedAtomicMap(fgahmCache, "key").get("a").equals("b"); }
public void testAtomicMapWithoutTransactionManagerLookupSet() { ConfigurationBuilder builder = buildConfiguration(); builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL).transactionManagerLookup(null); cacheManager.defineConfiguration("ahm_without_tmlookup", builder.build()); Cache<String, String> ahmCache = cacheManager.getCache("ahm_without_tmlookup"); AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(ahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getAtomicMap(ahmCache, "key").get("a").equals("b"); }
public void testAtomicMapNonTransactionWithoutBatchSet() { ConfigurationBuilder builder = buildConfiguration(); builder.invocationBatching().disable(); builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); cacheManager.defineConfiguration("ahm_no_tx_without_batch", builder.build()); Cache<String, String> ahmCache = cacheManager.getCache("ahm_no_tx_without_batch"); AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(ahmCache, "key"); assert map.isEmpty(); map.put("a", "b"); assert map.get("a").equals("b"); // now re-retrieve the map and make sure we see the diffs assert AtomicMapLookup.getAtomicMap(ahmCache, "key").get("a").equals("b"); }