亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? testoscacheservlet.java

?? oscache-2.4.1-full
?? JAVA
字號:
/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package com.opensymphony.oscache.web;

import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Test test the osCacheServlet distributed with the package. It checks that the
 * cache integration is OK.
 *
 * $Id: TestOscacheServlet.java 314 2005-10-16 18:30:25Z ltorunski $
 * @version        $Revision: 314 $
 * @author <a href="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a>
 */
public final class TestOscacheServlet extends TestCase {

    // The instance of a webconversation to invoke pages
    static WebConversation wc = null;
    private final String APPLICATION_SCOPE = "scope=application&";

    // Constants definition
    private final String BASE_URL_SYSTEM_PRP = "test.web.baseURL";
    private final String FORCE_CACHE_USE = "forcecacheuse=yes&";
    private final String FORCE_REFRESH = "forceRefresh=true&";
    private final String KEY = "key=ServletKeyItem&";
    private final String REFRESH_PERIOD = "refreshPeriod=";
    private final String SERVLET_URL = "/cacheServlet/?";
    private final int NO_REFRESH_WANTED = 2000;
    private final int REFRESH_WANTED = 0;

    /**
     * Constructor required by JUnit
     * <p>
     * @param str Test name
     */
    public TestOscacheServlet(String str) {
        super(str);
    }

    /**
     * Returns the test suite for the test class
     * <p>
     * @return   Test suite for the class
     */
    public static Test suite() {
        return new TestSuite(TestOscacheServlet.class);
    }

    /**
     * This method is invoked before each testXXXX methods of the
     * class. It set ups the variables required for each tests.
     */
    public void setUp() {
        // Create a web conversation on first run
        if (wc == null) {
            wc = new WebConversation();
        }
    }
    
    /**
     * Test the cache module using a servlet
     */
    public void testOscacheServlet() {
        // Make a first call just to initialize the servlet
        String newResponse = invokeServlet(NO_REFRESH_WANTED);

        // Connect to the servlet using the application scope
        String previousReponse = invokeServlet(NO_REFRESH_WANTED);

        // Call again an verify that the content hasn't changed
        newResponse = invokeServlet(NO_REFRESH_WANTED);
        assertTrue("new response " + newResponse + " should be the same to " + previousReponse, previousReponse.equals(newResponse));

        // Call again an verify that the content is updated
        newResponse = invokeServlet(REFRESH_WANTED);
        assertFalse("new response " + newResponse + " expected it to be different to last one.", previousReponse.equals(newResponse));
        previousReponse = newResponse;

        // Call short delay so content should be refresh, but it will not since
        // we ask to use the item already in cache
        newResponse = invokeServlet(REFRESH_WANTED, FORCE_CACHE_USE);
        assertTrue("new response " + newResponse + " should be the same to " + previousReponse, previousReponse.equals(newResponse));

        // Call with long delay so the item would not need refresh, but we'll ask
        // a refresh anyway
        newResponse = invokeServlet(NO_REFRESH_WANTED, FORCE_REFRESH);
        assertFalse("new response " + newResponse + " expected it to be different to last one.", previousReponse.equals(newResponse));

        // Verify that the cache key and the cache entry are present in the output and
        // that their values are correct
        assertTrue("response '" + previousReponse + "' does not contain oscache string", previousReponse.indexOf("oscache") != -1);

        assertTrue("response '" + previousReponse + "' does not contain /Test_key string", previousReponse.indexOf("/Test_key") != -1);
    }

    /**
     * Test the cache module using a servlet and basic load
     */
    public void testOscacheServletBasicForLoad() {
        // Call Servlet
        String stringResponse = invokeServlet(NO_REFRESH_WANTED);

        // Assert that a page was properly generated.
        // This does not ensure that the cache is working properly.
        // Though, it ensures that no exception or other weird problem occured
        assertTrue(stringResponse.indexOf("This is some cache content") > 0);

        // Call again
        stringResponse = invokeServlet(REFRESH_WANTED);

        // idem comment
        assertTrue(stringResponse.indexOf("This is some cache content") > 0);

        // Call again
        stringResponse = invokeServlet(REFRESH_WANTED, FORCE_CACHE_USE);

        // idem comment
        assertTrue(stringResponse.indexOf("This is some cache content") > 0);

        // Call again
        stringResponse = invokeServlet(NO_REFRESH_WANTED, FORCE_REFRESH);

        // idem comment
        assertTrue(stringResponse.indexOf("This is some cache content") > 0);
    }

    /**
     *  Reads the base url from the test.web.baseURL system property and
     *  append the given URL.
     *  <p>
     *  @param Url  Url to append to the base.
     *  @return Complete URL
     */
    private String constructURL(String Url) {
        String base = System.getProperty(BASE_URL_SYSTEM_PRP);
        String constructedUrl = null;

        if (base != null) {
            if (base.endsWith("/")) {
                base = base.substring(0, base.length() - 1);
            }

            constructedUrl = base + Url;
        } else {
            fail("System property test.web.baseURL needs to be set to the proper server to use.");
        }

        return constructedUrl;
    }

    /**
     * Utility method to invoke a servlet
     * <p>
     * @param refresh The time interval telling if the item needs refresh
     * @return The HTML page returned by the servlet
     */
    private String invokeServlet(int refresh) {
        // Invoke the servlet
        return invokeServlet(refresh, "");
    }

    /**
     * Utility method to invoke a servlet
     * <p>
     * @param refresh The time interval telling if the item needs refresh
     * @param URL The URL of the servlet
     * @return The HTML page returned by the servlet
     */
    private String invokeServlet(int refresh, String URL) {
        // wait 10 millis to change the time, see System.currentTimeMillis() in OscacheServlet
        try {
            Thread.sleep(10);
        } catch (InterruptedException ignore) {
        }

        // Invoke the servlet
        try {
            String request = constructURL(SERVLET_URL) + APPLICATION_SCOPE + KEY + REFRESH_PERIOD + refresh + "&" + URL;
            WebResponse resp = wc.getResponse(request);
            return resp.getText();
        } catch (Exception ex) {
            ex.printStackTrace();
            fail("Exception raised! " + ex.getMessage());
            return "";
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩美女主播在线视频一区二区三区 | 欧美综合天天夜夜久久| 欧美视频完全免费看| 国产日韩欧美精品在线| 一区二区三区四区乱视频| 久草中文综合在线| 欧美中文字幕亚洲一区二区va在线| 久久综合久久99| 亚洲高清不卡在线观看| av网站一区二区三区| 久久久久久一二三区| 婷婷丁香激情综合| 91麻豆免费观看| 国产亲近乱来精品视频| 麻豆精品精品国产自在97香蕉| 在线影视一区二区三区| 国产精品美女久久久久av爽李琼| 激情综合网激情| 欧美一级一区二区| 午夜欧美电影在线观看| 色婷婷精品大视频在线蜜桃视频 | 欧美性一二三区| ...中文天堂在线一区| 国产一区二区三区精品欧美日韩一区二区三区 | 波多野结衣中文字幕一区二区三区 | 亚洲色图制服诱惑| eeuss鲁片一区二区三区在线看| 精品福利一二区| 日本中文字幕一区二区视频 | 97se狠狠狠综合亚洲狠狠| 国产欧美一区二区三区在线老狼| 国产剧情av麻豆香蕉精品| 精品黑人一区二区三区久久| 久久精工是国产品牌吗| 精品欧美一区二区三区精品久久| 日韩电影网1区2区| 日韩一区二区视频| 国产在线视视频有精品| 久久久久久久久免费| 风间由美一区二区av101| 国产精品人人做人人爽人人添| 高清不卡在线观看av| 国产精品久久久久影院老司| 成人听书哪个软件好| 国产精品福利一区二区| 一本大道综合伊人精品热热| 亚洲黄色尤物视频| 欧美日韩精品欧美日韩精品 | 国产一区二区三区四| 国产精品午夜电影| 色婷婷香蕉在线一区二区| 一区二区三区在线观看视频| 欧美日韩国产高清一区二区三区| 蜜桃传媒麻豆第一区在线观看| 欧美sm美女调教| 国产福利电影一区二区三区| 亚洲日韩欧美一区二区在线| 欧美精品日日鲁夜夜添| 激情综合色综合久久综合| 国产精品久久免费看| 欧美在线一二三| 国内国产精品久久| 亚洲视频香蕉人妖| 日韩欧美一区中文| 不卡的av电影在线观看| 五月天欧美精品| 国产日韩精品一区二区三区| 欧美日韩视频不卡| 国产成人午夜99999| 一区二区国产视频| 精品国产乱码久久| 色素色在线综合| 国产精品一线二线三线精华| 亚洲欧美成aⅴ人在线观看| 日韩亚洲欧美一区二区三区| 成人h精品动漫一区二区三区| 午夜电影一区二区| 亚洲视频电影在线| 久久久久免费观看| 欧美欧美欧美欧美首页| 成人激情黄色小说| 欧美a级理论片| 亚洲精品v日韩精品| 国产片一区二区三区| 日韩一区国产二区欧美三区| 91免费视频观看| 国产精品一区二区91| 天天av天天翘天天综合网| 中文字幕日本乱码精品影院| 日韩一级精品视频在线观看| 欧美午夜不卡视频| 不卡的av在线播放| 国产精品亚洲人在线观看| 天使萌一区二区三区免费观看| ●精品国产综合乱码久久久久| 久久久久九九视频| 精品国一区二区三区| 欧美精品久久一区二区三区| 91网址在线看| youjizz国产精品| 国产iv一区二区三区| 激情综合网激情| 免费人成网站在线观看欧美高清| 一区二区三区日韩欧美精品| 国产精品电影院| 欧美激情综合网| 国产精品欧美一区二区三区| 久久久美女毛片| 精品粉嫩aⅴ一区二区三区四区| 欧美视频在线观看一区| 色婷婷国产精品综合在线观看| 99久久伊人网影院| 99精品热视频| 99久久99久久综合| 91免费精品国自产拍在线不卡| 99国产精品久久久久| 91影院在线免费观看| 91麻豆免费在线观看| 91福利在线看| 欧美日韩综合在线| 欧美日韩国产免费| 欧美高清视频不卡网| 777午夜精品视频在线播放| 欧美精品久久99久久在免费线| 久久人人超碰精品| 久久久久久免费网| 最新国产精品久久精品| 亚洲日穴在线视频| 五月天激情小说综合| 日韩高清在线一区| 国产在线精品一区二区| 国产精品99久久久久| 国产成人综合视频| av欧美精品.com| 欧美在线观看视频一区二区| 欧美精三区欧美精三区| 欧美电影免费观看高清完整版在线观看| 日韩美女视频在线| 国产欧美日韩三级| 亚洲综合网站在线观看| 丝袜美腿亚洲一区二区图片| 国内精品国产成人国产三级粉色 | 亚洲大片精品永久免费| 六月丁香综合在线视频| 国产一区二区三区最好精华液| 成人动漫精品一区二区| 欧美人动与zoxxxx乱| 国产午夜三级一区二区三| 亚洲精品一二三四区| 免费观看成人鲁鲁鲁鲁鲁视频| 国产成人免费视频网站 | 99国产一区二区三精品乱码| 欧美丰满高潮xxxx喷水动漫| 日韩精品一区二区三区在线| 国产精品日韩成人| 欧美a级一区二区| 99精品视频在线观看| 9191成人精品久久| 亚洲欧洲精品天堂一级| 日本aⅴ免费视频一区二区三区 | 亚洲欧美日本韩国| 精品无码三级在线观看视频| 91在线小视频| 精品成人a区在线观看| 一区二区久久久| 高清在线成人网| 91精品国产综合久久久久久漫画 | 亚洲国产日韩av| 国产精品自拍av| 日韩片之四级片| 一级特黄大欧美久久久| 国产成a人无v码亚洲福利| 欧美精品在线观看播放| 亚洲免费观看高清| 粉嫩av一区二区三区在线播放| 欧美电影免费观看高清完整版在线 | 欧美国产一区视频在线观看| 日本aⅴ免费视频一区二区三区| 色八戒一区二区三区| 一区二区三区中文字幕在线观看| 国产黑丝在线一区二区三区| 日韩丝袜美女视频| 亚洲www啪成人一区二区麻豆| 99re热视频精品| 国产精品青草久久| 国产一区二区三区电影在线观看 | 免费观看久久久4p| 91精品国产一区二区三区蜜臀| 一区二区三区四区av| 一本色道亚洲精品aⅴ| 亚洲人午夜精品天堂一二香蕉| 丁香天五香天堂综合| 国产日韩v精品一区二区| 精品一区二区三区免费观看| 欧美一区二区三区四区视频| 亚洲一区二区五区| 8x8x8国产精品| 奇米影视在线99精品| 日韩免费电影一区| 另类小说欧美激情|