⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testscopeeventlistenerimpl.java

📁 一个不错的cache
💻 JAVA
字号:
/* * Copyright (c) 2002-2003 by OpenSymphony * All rights reserved. */package com.opensymphony.oscache.extra;import com.opensymphony.oscache.base.events.ScopeEvent;import com.opensymphony.oscache.base.events.ScopeEventType;import junit.framework.Test;import junit.framework.TestCase;import junit.framework.TestSuite;import java.util.Date;/** * Test the scope event listener implementation * * $Id: TestScopeEventListenerImpl.java,v 1.1 2003/07/19 09:58:49 chris_miller Exp $ * @version        $Revision: 1.1 $ * @author <a href="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a> */public class TestScopeEventListenerImpl extends TestCase {    private static final int PAGE_SCOPE = 1;    /**     * Constructor     * <p>     * @param str The test name (required by JUnit)     */    public TestScopeEventListenerImpl(String str) {        super(str);    }    /**     * This methods returns the name of this test class to JUnit     * <p>     * @return The name of this class     */    public static Test suite() {        return new TestSuite(TestScopeEventListenerImpl.class);    }    /**     * Test the basic implementation of this listener     */    public void testScopeEventListenerImpl() {        // Construct the object we need for the test        ScopeEventListenerImpl listener = new ScopeEventListenerImpl();        // Generates events        listener.scopeFlushed(new ScopeEvent(ScopeEventType.ALL_SCOPES_FLUSHED, PAGE_SCOPE, new Date()));        listener.scopeFlushed(new ScopeEvent(ScopeEventType.SCOPE_FLUSHED, PAGE_SCOPE, new Date()));        // Assert the counters        assertEquals(listener.getApplicationScopeFlushCount(), 1);        assertEquals(listener.getPageScopeFlushCount(), 2);        assertEquals(listener.getRequestScopeFlushCount(), 1);        assertEquals(listener.getSessionScopeFlushCount(), 1);        assertEquals(listener.getTotalScopeFlushCount(), 5);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -