1 5 package com.opensymphony.oscache.extra; 6 7 import com.opensymphony.oscache.base.events.ScopeEvent; 8 import com.opensymphony.oscache.base.events.ScopeEventType; 9 10 import junit.framework.Test; 11 import junit.framework.TestCase; 12 import junit.framework.TestSuite; 13 14 import java.util.Date ; 15 16 23 public class TestScopeEventListenerImpl extends TestCase { 24 private static final int PAGE_SCOPE = 1; 25 26 31 public TestScopeEventListenerImpl(String str) { 32 super(str); 33 } 34 35 40 public static Test suite() { 41 return new TestSuite(TestScopeEventListenerImpl.class); 42 } 43 44 47 public void testScopeEventListenerImpl() { 48 ScopeEventListenerImpl listener = new ScopeEventListenerImpl(); 50 51 listener.scopeFlushed(new ScopeEvent(ScopeEventType.ALL_SCOPES_FLUSHED, PAGE_SCOPE, new Date ())); 53 listener.scopeFlushed(new ScopeEvent(ScopeEventType.SCOPE_FLUSHED, PAGE_SCOPE, new Date ())); 54 55 assertEquals(listener.getApplicationScopeFlushCount(), 1); 57 assertEquals(listener.getPageScopeFlushCount(), 2); 58 assertEquals(listener.getRequestScopeFlushCount(), 1); 59 assertEquals(listener.getSessionScopeFlushCount(), 1); 60 assertEquals(listener.getTotalScopeFlushCount(), 5); 61 } 62 } 63 | Popular Tags |