Package com.volantis.cache.impl.notification

Examples of com.volantis.cache.impl.notification.RemovalListenerList


        });

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        RemovalListenerList list = new RemovalListenerList();
        list.addListener(listenerMock1);
        list.addListener(listenerMock2);

        list.dispatchRemovedEntryEvent(entryMock);
    }
View Full Code Here


    public void testAddTwice() throws Exception {

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        RemovalListenerList list = new RemovalListenerList();
        list.addListener(listenerMock1);
        try {
            list.addListener(listenerMock1);
            fail("Did not detect attempt to add same listener twice");
        } catch (IllegalStateException expected) {
            assertEquals("Listener " + listenerMock1 +
                    " has already been added", expected.getMessage());
        }
View Full Code Here

        });

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        RemovalListenerList list = new RemovalListenerList();
        list.addListener(listenerMock1);
        list.addListener(listenerMock2);
        list.addListener(listenerMock3);

        // Make sure that they have been added properly.
        list.dispatchRemovedEntryEvent(entryMock);

        // Remove the middle one and make sure that the content are correct.
        list.removeListener(listenerMock2);
        list.dispatchRemovedEntryEvent(entryMock);

        // Remove the last one and make sure that the content are correct.
        list.removeListener(listenerMock3);
        list.dispatchRemovedEntryEvent(entryMock);

        // Remove the remaining one and make sure that the content are correct.
        list.removeListener(listenerMock1);
        list.dispatchRemovedEntryEvent(entryMock);
    }
View Full Code Here

    public void testRemoveUnknown() throws Exception {

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        RemovalListenerList list = new RemovalListenerList();
        try {
            list.removeListener(listenerMock1);
            fail("Did not detect attempt to remove unknow listener");
        } catch (IllegalStateException expected) {
            assertEquals("Listener " + listenerMock1 +
                    " is not in the list", expected.getMessage());
        }
View Full Code Here

        });

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        final RemovalListenerList list = new RemovalListenerList();
        RemovalListener listener = new RemovalListener() {
            public void entryRemoved(CacheEntry entry) {
                list.removeListener(listenerMock1);
                list.removeListener(this);
                list.removeListener(listenerMock2);
            }
        };
        list.addListener(listenerMock1);
        list.addListener(listener);
        list.addListener(listenerMock2);

        list.dispatchRemovedEntryEvent(entryMock);
    }
View Full Code Here

                    "Max count must be > 0 but is " + maxCount);
        }
        this.maxCount = maxCount;
        this.clock = clock;
        entries = new CacheEntryList();
        removalListeners = new RemovalListenerList();

        purgeExcessEntriesAction = new PurgeExcessEntriesAction(this);
        gatherer = new StatisticsGatherer(clock);
    }
View Full Code Here

TOP

Related Classes of com.volantis.cache.impl.notification.RemovalListenerList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.