Codota Logo
CacheLoader.contains
Code IndexAdd Codota to your IDE (free)

How to use
contains
method
in
org.infinispan.persistence.spi.CacheLoader

Best Java code snippets using org.infinispan.persistence.spi.CacheLoader.contains (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: org.infinispan/infinispan-core

protected void verifyNoDataOnLoader(Cache<Object, Object> c) throws Exception {
 CacheLoader l = TestingUtil.getFirstLoader(c);
 assert !l.contains(A_B_AGE);
 assert !l.contains(A_B_NAME);
 assert !l.contains(A_C_AGE);
 assert !l.contains(A_C_NAME);
 assert !l.contains(A_D_AGE);
 assert !l.contains(A_D_NAME);
}
origin: org.infinispan/infinispan-core

public static void verifyNoDataOnLoader(Cache<Object, Object> c) throws Exception {
 CacheLoader l = TestingUtil.getFirstLoader(c);
 assert !l.contains(A_B_AGE);
 assert !l.contains(A_B_NAME);
 assert !l.contains(A_C_AGE);
 assert !l.contains(A_C_NAME);
 assert !l.contains(A_D_AGE);
 assert !l.contains(A_D_NAME);
}
origin: org.infinispan/infinispan-core

public static void verifyInitialDataOnLoader(Cache<Object, Object> c) throws Exception {
 CacheLoader l = TestingUtil.getFirstLoader(c);
 assert l.contains(A_B_AGE);
 assert l.contains(A_B_NAME);
 assert l.contains(A_C_AGE);
 assert l.contains(A_C_NAME);
 assert l.load(A_B_AGE).getValue().equals(TWENTY);
 assert l.load(A_B_NAME).getValue().equals(JOE);
 assert l.load(A_C_AGE).getValue().equals(FORTY);
 assert l.load(A_C_NAME).getValue().equals(BOB);
}
origin: org.infinispan/infinispan-core

protected void verifyInitialDataOnLoader(Cache<Object, Object> c) throws Exception {
 CacheLoader l = TestingUtil.getFirstLoader(c);
 assert l.contains(A_B_AGE);
 assert l.contains(A_B_NAME);
 assert l.contains(A_C_AGE);
 assert l.contains(A_C_NAME);
 assert l.load(A_B_AGE).getValue().equals(TWENTY);
 assert l.load(A_B_NAME).getValue().equals(JOE);
 assert l.load(A_C_AGE).getValue().equals(FORTY);
 assert l.load(A_C_NAME).getValue().equals(BOB);
}
origin: org.infinispan/infinispan-cachestore-jdbc

  private void assertNoOverlapingState(Cache first, Cache second, CacheLoader firstCs, CacheLoader secondCs) throws PersistenceException {
   first.put("k", "v");
   assert firstCs.contains("k");
   assert !secondCs.contains("k");
   assert first.get("k").equals("v");
   assert second.get("k") == null;

   second.put("k2", "v2");
   assert second.get("k2").equals("v2");
   assert first.get("k2") == null;
  }
}
origin: org.infinispan/infinispan-core

private static <K> void assertInCacheAndNotInStore(Cache<? super K, ?> cache, CacheLoader<? super K, ?> store, K... keys) throws PersistenceException {
 for (K key : keys) {
   assert cache.getAdvancedCache().getDataContainer().containsKey(key) : "Cache should not contain key " + key;
   assertFalse("Store should contain key " + key, store.contains(key));
 }
}
origin: org.infinispan/infinispan-core

private void initStore(Cache<String, String> cache) {
 writeToStore(cache, key, value1);
 assertTrue(TestingUtil.getFirstLoader(cache).contains(key));
 cacheLoaderInterceptor(cache).resetStatistics();
}
origin: org.infinispan/infinispan-core

public void testSkipSharedCacheStoreFlagUsage() throws PersistenceException {
 cache(0).getAdvancedCache().withFlags(Flag.SKIP_SHARED_CACHE_STORE).put("key", "value");
 assert cache(0).get("key").equals("value");
 List<CacheLoader<Object, Object>> cachestores = TestingUtil.cachestores(caches());
 for (CacheLoader cs : cachestores) {
   assert !cs.contains("key");
   DummyInMemoryStore dimcs = (DummyInMemoryStore) cs;
   assert dimcs.stats().get("write") == 0 : "Cache store should NOT contain any entry. Put was with SKIP_SHARED_CACHE_STORE flag.";
 }
}
origin: org.infinispan/infinispan-core

private <T> void assertNotInCacheAndStore(Cache cache, CacheLoader store, T... keys) throws PersistenceException {
 for (Object key : keys) {
   assertFalse("Cache should not contain key " + key, cache.getAdvancedCache().getDataContainer().containsKey(key));
   assertFalse("Store should not contain key " + key, store.contains(key));
 }
}
origin: org.infinispan/infinispan-core

  protected void verifyInitialDataOnLoader(Cache<Object, Object> c) {
   CacheLoader l = TestingUtil.getFirstLoader(c);
   for (int i = 0; i < INSERTION_COUNT; ++i) {
     assertTrue("Didn't contain key " + i, l.contains("key " + i));
   }

   for (int i = 0; i < INSERTION_COUNT; ++i) {
     assertEquals("value " + i, l.load("key " + i).getValue());
   }
  }
}
origin: org.infinispan/infinispan-core

private <T> void assertNotInCacheAndStore(Cache cache, CacheLoader store, T... keys) throws PersistenceException {
 for (Object key : keys) {
   assertFalse("Cache should not contain key " + key, cache.getAdvancedCache().getDataContainer().containsKey(key));
   assertFalse("Store should not contain key " + key, store.contains(key));
 }
}
origin: org.infinispan/infinispan-core

private void assertInCacheNotInStore(Object key) throws PersistenceException {
 InternalCacheValue ice = cache.getAdvancedCache().getDataContainer().get(key).toInternalCacheValue();
 testStoredEntry(ice, key, "Cache");
 assert !loader.contains(key) : "Key " + key + " should not be in store!";
}
origin: org.infinispan/infinispan-core

private static <K> void assertNotInCacheAndStore(Cache<? super K, ?> cache, CacheLoader<? super K, ?> store, K... keys) throws PersistenceException {
 for (K key : keys) {
   assertFalse("Cache should not contain key " + key, cache.getAdvancedCache().getDataContainer().containsKey(key));
   assertFalse("Store should not contain key " + key, store.contains(key));
 }
}
origin: org.infinispan/infinispan-core

private static <K> void assertInStoreNotInCache(Cache<? super K, ?> cache, CacheLoader<? super K, ?> store, K... keys) throws PersistenceException {
 for (K key : keys) {
   assertFalse("Cache should not contain key " + key, cache.getAdvancedCache().getDataContainer().containsKey(key));
   assertTrue("Store should contain key " + key, store.contains(key));
 }
}
origin: org.infinispan/infinispan-core

public void testPutFromNonOwner(Method m) throws Exception {
 String key = k(m), value = "value2";
 Cache<Object, String> nonOwner = getFirstNonOwner(key);
 Cache<Object, String> owner = getFirstOwner(key);
 CacheLoader nonOwnerLoader = TestingUtil.getFirstLoader(nonOwner);
 CacheLoader ownerLoader = TestingUtil.getFirstLoader(owner);
 assertFalse(nonOwnerLoader.contains(key));
 assertFalse(ownerLoader.contains(key));
 Object retval = nonOwner.put(key, value);
 assertInStores(key, value, true);
 if (testRetVals) assert retval == null;
 assertOnAllCachesAndOwnership(key, value);
}
origin: org.infinispan/infinispan-core

public void testRemoveFromNonOwnerWithFlags() throws Exception {
 String key = "k1", value = "value";
 initAndTest();
 Object retval = getFirstNonOwner(key).getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE).remove(key);
 if (testRetVals) assert value.equals(retval);
 for (Cache<Object, String> c : caches) {
   if (isOwner(c, key)) {
    CacheLoader store = TestingUtil.getFirstLoader(c);
    assertTrue(store.contains(key));
   }
 }
}
origin: org.infinispan/infinispan-core

private boolean isEntryInStore(String key) throws Exception {
 Cache<String, String> testCache = cacheManager.getCache(CACHE_NAME);
 CacheLoader<String, String> loader = TestingUtil.getFirstLoader(testCache);
 Object loaderKey = key;
 if (storage == StorageType.OFF_HEAP) {
   GlobalMarshaller gm = TestingUtil.extractGlobalMarshaller(testCache.getCacheManager());
   loaderKey = new WrappedByteArray(gm.objectToByteBuffer(key));
 }
 return loader.contains(loaderKey);
}
origin: org.infinispan/infinispan-core

public void testPutAllWithFlags() throws Exception {
 Map<String, String> data = makePutAllTestData();
 c1.getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE).putAll(data);
 for (Cache<Object, String> c : caches) {
   CacheLoader store = TestingUtil.getFirstLoader(c);
   for (String key : keys) {
    assertFalse(store.contains(key));
    if (isOwner(c, key)) {
      assertIsInContainerImmortal(c, key);
    }
   }
 }
}
origin: org.infinispan/infinispan-core

public void testPutForStateTransfer() throws Exception {
 MagicKey k1 = getMagicKey();
 CacheLoader store2 = TestingUtil.getFirstLoader(c2);
 c2.put(k1, v1);
 assertTrue(store2.contains(k1));
 assertEquals(v1, store2.load(k1).getValue());
 c2.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).put(k1, v2);
 assertEquals(v2, store2.load(k1).getValue());
}
origin: org.infinispan/infinispan-core

public void testAtomicPutIfAbsentFromNonOwnerWithFlag(Method m) throws Exception {
 String key = k(m), value = "value";
 String replaced = getFirstNonOwner(key).getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE).putIfAbsent(key, value);
 assertNull(replaced);
 //interesting case: fails to put as value exists, put actually missing in Store
 replaced = getFirstNonOwner(key).putIfAbsent(key, value);
 assertEquals(replaced, value);
 for (Cache<Object, String> c : caches) {
   assertEquals(replaced, c.get(key));
   CacheLoader store = TestingUtil.getFirstLoader(c);
   assertFalse(store.contains(key));
 }
}
org.infinispan.persistence.spiCacheLoadercontains

Popular methods of CacheLoader

  • load

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JTable (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now