@Override public boolean contains(Object key) { return this.remoteCache.containsKey(this.marshall(key)); }
public boolean containsKey(K key) { return cache.containsKey(key); }
@Override public boolean exists(String index, String id) { return Optional.ofNullable(this.infinispanContext.getCache(index)) .map(i -> i.containsKey(id)) .orElse(false); }
@Override public boolean exists(String index, String id) { return Optional.ofNullable(this.infinispanContext.getCache(index)) .map(i -> i.containsKey(id)) .orElse(false); }
@Override public boolean contains(Object key) { return this.remoteCache.containsKey(this.marshall(key)); }
@Override public boolean containsKey(K key) { checkNotClosed(); checkNotNull(key, "key"); return cache.containsKey(key); //FIXME implement me }
public static void testRemoveContainsAsync(RemoteCache<String, String> remoteCache) throws Exception { remoteCache.put(KEY1, VALUE1); assertTrue(remoteCache.containsKey(KEY1)); CompletableFuture<String> f = remoteCache.removeAsync(KEY1); f.get(ASYNC_TIMEOUT, TimeUnit.SECONDS); assertFalse(remoteCache.containsKey(KEY1)); }
public static void testRemoveContains(RemoteCache<String, String> remoteCache) { remoteCache.put(KEY1, VALUE1); assertTrue(remoteCache.containsKey(KEY1)); remoteCache.remove(KEY1); assertFalse(remoteCache.containsKey(KEY1)); }
@Test public void testContains() { assertTrue(!remoteCache.containsKey("aKey")); remoteCache.put("aKey", "aValue"); assertTrue(remoteCache.containsKey("aKey")); }
public static void testPutContainsKey(RemoteCache<String, String> remoteCache) { remoteCache.put(KEY1, VALUE1); assertTrue(remoteCache.containsKey(KEY1)); }
public static void testGetAsync(RemoteCache<String, String> remoteCache) throws Exception { assertTrue(remoteCache.containsKey(KEY1)); CompletableFuture<String> f = remoteCache.getAsync(KEY1); assertEquals(VALUE1, f.get(ASYNC_TIMEOUT, TimeUnit.SECONDS)); }
public static void testPutClearAsync(RemoteCache<String, String> remoteCache) throws Exception { CompletableFuture<String> f1 = remoteCache.putAsync(KEY1, VALUE1); CompletableFuture<String> f2 = remoteCache.putAsync(KEY2, VALUE2); f1.get(ASYNC_TIMEOUT, TimeUnit.SECONDS); f2.get(ASYNC_TIMEOUT, TimeUnit.SECONDS); CompletableFuture<Void> c = remoteCache.clearAsync(); c.get(ASYNC_TIMEOUT, TimeUnit.SECONDS); assertFalse(remoteCache.containsKey(KEY1)); assertFalse(remoteCache.containsKey(KEY2)); assertTrue(remoteCache.isEmpty()); }
@Test public void testClear() { remoteCache.put("aKey", "aValue"); remoteCache.put("aKey2", "aValue"); remoteCache.clear(); assertTrue(!remoteCache.containsKey("aKey")); assertTrue(!remoteCache.containsKey("aKey2")); }
public static void testGet(RemoteCache<String, String> remoteCache) { assertTrue(remoteCache.containsKey(KEY1)); assertEquals(VALUE1, remoteCache.get(KEY1)); }
public static void testPutClear(RemoteCache<String, String> remoteCache) { remoteCache.put(KEY1, VALUE1); remoteCache.put(KEY2, VALUE2); remoteCache.clear(); assertFalse(remoteCache.containsKey(KEY1)); assertFalse(remoteCache.containsKey(KEY2)); assertTrue(remoteCache.isEmpty()); }
@Test public void testRemoveConditional() throws IOException { assertNull(remoteCache.put("aKey", "aValue")); assertEquals(remoteCache.get("aKey"), "aValue"); assertFalse(remoteCache.remove("aKey", "aValue2")); assertTrue(remoteCache.containsKey("aKey")); assertTrue(remoteCache.remove("aKey", "aValue")); assertFalse(remoteCache.containsKey("aKey")); }
@Test public void testPut() throws Exception { assertNull(remoteCache.put("aKey", "aValue")); assertTrue(remoteCache.containsKey("aKey")); assertEquals(remoteCache.get("aKey"), "aValue"); }
@Test public void testIsEmpty() throws IOException { assertTrue(remoteCache.isEmpty()); assertNull(remoteCache.put("aKey", "aValue")); assertTrue(remoteCache.containsKey("aKey")); assertTrue(!remoteCache.isEmpty()); assertNull(remoteCache.remove("aKey")); assertTrue(!remoteCache.containsKey("aKey")); assertTrue(remoteCache.isEmpty()); }
@Test public void testRemove() throws IOException { assertNull(remoteCache.put("aKey", "aValue")); assertEquals(remoteCache.get("aKey"), "aValue"); assertNull(remoteCache.remove("aKey")); assertTrue(!remoteCache.containsKey("aKey")); }
@Test public void testWithFlags() throws IOException { assertNull(remoteCache.put("aKey", "aValue")); assertTrue(remoteCache.containsKey("aKey")); assertEquals("aValue", remoteCache.get("aKey")); // should not return return old value assertNull(remoteCache.put("aKey", "anotherValue")); assertEquals("anotherValue", remoteCache.get("aKey")); // now should return old value assertEquals("anotherValue", remoteCache.withFlags(Flag.FORCE_RETURN_VALUE).put("aKey", "yetAnotherValue")); }