/** * Adds a remove request to the remote cache. * <p> * @param key * @return whether or not it was removed, right now it return false. */ @Override public boolean remove( K key ) { try { for ( int i = 0; i < noWaits.length; i++ ) { noWaits[i].remove( key ); } } catch ( Exception ex ) { log.error( ex ); } return false; }
/** * Adds a remove request to the remote cache. * <p> * @param key * @return whether or not it was removed, right now it return false. */ @Override public boolean remove( K key ) { try { for (RemoteCacheNoWait<K, V> nw : noWaits) { nw.remove( key ); } } catch ( IOException ex ) { log.error( ex ); } return false; }
/** * Simply verify that the client gets updated via the no wait. * <p> * @throws Exception */ public void testRemove() throws Exception { // SETUP MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>(); RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client ); String input = "MyKey"; // DO WORK noWait.remove( input ); SleepUtil.sleepAtLeast( 10 ); // VERIFY assertEquals( "Wrong number updated.", 1, client.removeList.size() ); assertEquals( "Wrong key", input, client.removeList.get( 0 ) ); }
/** * Simply verify that the client gets updated via the no wait. * <p> * @throws Exception */ public void testRemove() throws Exception { // SETUP MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>(); RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client ); String input = "MyKey"; // DO WORK noWait.remove( input ); SleepUtil.sleepAtLeast( 10 ); // VERIFY assertEquals( "Wrong number updated.", 1, client.removeList.size() ); assertEquals( "Wrong key", input, client.removeList.get( 0 ) ); }