protected <K, V> LateralCacheNoWait<K, V> createCacheNoWait( ITCPLateralCacheAttributes lca, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer ) { ICacheServiceNonLocal<K, V> lateralService = getCSNLInstance(lca); LateralCache<K, V> cache = new LateralCache<K, V>( lca, lateralService, this.monitor ); cache.setCacheEventLogger( cacheEventLogger ); cache.setElementSerializer( elementSerializer ); if ( log.isDebugEnabled() ) { log.debug( "Created cache for noWait, cache [" + cache + "]" ); } LateralCacheNoWait<K, V> lateralNoWait = new LateralCacheNoWait<K, V>( cache ); lateralNoWait.setCacheEventLogger( cacheEventLogger ); lateralNoWait.setElementSerializer( elementSerializer ); if ( log.isInfoEnabled() ) { log.info( "Created LateralCacheNoWait for [" + lca + "] LateralCacheNoWait = [" + lateralNoWait + "]" ); } return lateralNoWait; }
protected <K, V> LateralCacheNoWait<K, V> createCacheNoWait( ITCPLateralCacheAttributes lca, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer ) { ICacheServiceNonLocal<K, V> lateralService = getCSNLInstance(lca); LateralCache<K, V> cache = new LateralCache<K, V>( lca, lateralService, this.monitor ); cache.setCacheEventLogger( cacheEventLogger ); cache.setElementSerializer( elementSerializer ); if ( log.isDebugEnabled() ) { log.debug( "Created cache for noWait, cache [" + cache + "]" ); } LateralCacheNoWait<K, V> lateralNoWait = new LateralCacheNoWait<K, V>( cache ); lateralNoWait.setCacheEventLogger( cacheEventLogger ); lateralNoWait.setElementSerializer( elementSerializer ); if ( log.isInfoEnabled() ) { log.info( "Created LateralCacheNoWait for [" + lca + "] LateralCacheNoWait = [" + lateralNoWait + "]" ); } return lateralNoWait; }
/** * Remove a no wait from an unknown facade. */ public void testRemoveNoWait_FacadeNotInList() { // SETUP String cacheName = "testRemoveNoWaitFacade_FacadeNotInList"; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.removeNoWait( noWait ); // VERIFY assertFalse( "Should not have removed the no wait.", result ); }
/** * Add a no wait from an unknown facade. */ public void testAddNoWait_FacadeNotInList() { // SETUP String cacheName = "testAddNoWaitFacade_FacadeInList"; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.addNoWait( noWait ); // VERIFY assertFalse( "Should not have added the no wait.", result ); }
/** * Add a no wait from an unknown facade. */ public void testAddNoWait_FacadeNotInList() { // SETUP String cacheName = "testAddNoWaitFacade_FacadeInList"; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.addNoWait( noWait ); // VERIFY assertFalse( "Should not have added the no wait.", result ); }
/** * Remove a no wait from an unknown facade. */ public void testRemoveNoWait_FacadeNotInList() { // SETUP String cacheName = "testRemoveNoWaitFacade_FacadeNotInList"; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.removeNoWait( noWait ); // VERIFY assertFalse( "Should not have removed the no wait.", result ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_NotInList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertFalse( "Should not be in the list.", facade.containsNoWait( noWait ) ); } }
/** * Add a no wait to a known facade. */ public void testAddNoWait_FacadeInList() { // SETUP String cacheName = "testAddNoWaitFacade_FacadeInList"; @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); listener.addNoWaitFacade( cacheName, facade ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.addNoWait( noWait ); // VERIFY assertTrue( "Should have added the no wait.", result ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_NotInList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertFalse( "Should not be in the list.", facade.containsNoWait( noWait ) ); } }
/** * Remove a no wait from a known facade. */ public void testRemoveNoWait_FacadeInList_NoWaitNot() { // SETUP String cacheName = "testAddNoWaitFacade_FacadeInList"; @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); listener.addNoWaitFacade( cacheName, facade ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.removeNoWait( noWait ); // VERIFY assertFalse( "Should not have removed the no wait.", result ); }
/** * Remove a no wait from a known facade. */ public void testRemoveNoWait_FacadeInList_NoWaitNot() { // SETUP String cacheName = "testAddNoWaitFacade_FacadeInList"; @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); listener.addNoWaitFacade( cacheName, facade ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.removeNoWait( noWait ); // VERIFY assertFalse( "Should not have removed the no wait.", result ); }
/** * Add a no wait to a known facade. */ public void testAddNoWait_FacadeInList() { // SETUP String cacheName = "testAddNoWaitFacade_FacadeInList"; @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); listener.addNoWaitFacade( cacheName, facade ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK boolean result = listener.addNoWait( noWait ); // VERIFY assertTrue( "Should have added the no wait.", result ); }
/** * Remove a no wait from a known facade. */ public void testRemoveNoWait_FacadeInList_NoWaitIs() { // SETUP String cacheName = "testRemoveNoWaitFacade_FacadeInListNoWaitIs"; @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); listener.addNoWaitFacade( cacheName, facade ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); listener.addNoWait( noWait ); // DO WORK boolean result = listener.removeNoWait( noWait ); // VERIFY assertTrue( "Should have removed the no wait.", result ); }
/** * Remove a no wait from a known facade. */ public void testRemoveNoWait_FacadeInList_NoWaitIs() { // SETUP String cacheName = "testRemoveNoWaitFacade_FacadeInListNoWaitIs"; @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( cacheName ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); listener.addNoWaitFacade( cacheName, facade ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); listener.addNoWait( noWait ); // DO WORK boolean result = listener.removeNoWait( noWait ); // VERIFY assertTrue( "Should have removed the no wait.", result ); }
/** * Verify that we can remove an item. */ public void testAdd_InList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); facade.addNoWait( noWait ); // VERIFY assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); assertEquals( "Should only have 1", 1, facade.noWaits.length ); }
/** * Verify that we can remove an item. */ public void testAdd_InList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); facade.addNoWait( noWait ); // VERIFY assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); assertEquals( "Should only have 1", 1, facade.noWaits.length ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_InListSize2() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); LateralCacheNoWait<String, String> noWait2 = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); facade.addNoWait( noWait2 ); // VERIFY assertEquals( "Should have 2", 2, facade.noWaits.length ); assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); assertTrue( "Should be in the list.", facade.containsNoWait( noWait2 ) ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertEquals( "Should only have 1", 1, facade.noWaits.length ); assertFalse( "Should not be in the list. ", facade.containsNoWait( noWait ) ); assertTrue( "Should be in the list.", facade.containsNoWait( noWait2 ) ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_InListSize2() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); LateralCacheNoWait<String, String> noWait2 = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); facade.addNoWait( noWait2 ); // VERIFY assertEquals( "Should have 2", 2, facade.noWaits.length ); assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); assertTrue( "Should be in the list.", facade.containsNoWait( noWait2 ) ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertEquals( "Should only have 1", 1, facade.noWaits.length ); assertFalse( "Should not be in the list. ", facade.containsNoWait( noWait ) ); assertTrue( "Should be in the list.", facade.containsNoWait( noWait2 ) ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_InList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); // VERIFY assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertEquals( "Should have 0", 0, facade.noWaits.length ); assertFalse( "Should not be in the list. ", facade.containsNoWait( noWait ) ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_InList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); // VERIFY assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertEquals( "Should have 0", 0, facade.noWaits.length ); assertFalse( "Should not be in the list. ", facade.containsNoWait( noWait ) ); }