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

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

?? testoscachejsp.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 JSPs distributed with the package. It checks that the
 * cache integration is OK.
 *
 * $Id: TestOscacheJsp.java 385 2006-10-07 06:57:10Z larst $
 * @version        $Revision: 385 $
 * @author <a href="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a>
 */
public final class TestOscacheJsp extends TestCase {
    // The instance of a webconversation to invoke pages
    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 FIRST_PAGE = "oscacheTest.jsp?";
    private final String FORCE_CACHE_USE = "forcecacheuse=yes&";
    private final String FORCE_REFRESH = "refresh=true";
    //private final String PAGE_SCOPE = "scope=page&";
    //private final String REQUEST_SCOPE = "scope=request&";
    private final String SECOND_PAGE = "oscacheTestMultipleTagNoKey.jsp?";
    private final String SESSION_SCOPE = "scope=session&";
    private final int CACHE_TAG_EXPIRATION = 2000;
    private final int HALF_CACHE_TAG_EXPIRATION = CACHE_TAG_EXPIRATION / 2;

    /**
     * Constructor required by JUnit
     * <p>
     * @param str Test name
     */
    public TestOscacheJsp(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(TestOscacheJsp.class);
    }

    /**
     * Setup method called before each testXXXX of the class
     */
    public void setUp() {
        // Create a web conversation to invoke our JSP
        if (wc == null) {
            wc = new WebConversation();
        }
    }

    /**
     * Test the cache module under load
     */
    public void testOscacheBasicForLoad() {
        String baseUrl = constructURL(FIRST_PAGE);

        // Connect to the JSP using the application scope
        String stringResponse = invokeJSP(baseUrl, CACHE_TAG_EXPIRATION);

        // 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);

        // Invoke the JSP page containing 2 cache tag
        baseUrl = constructURL(SECOND_PAGE);

        // Connect to the JSP using the application scope
        stringResponse = invokeJSP(baseUrl, CACHE_TAG_EXPIRATION);

        // 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);
    }

    /**
     * Test the cache module using a JSP
     */
    public void testOscacheJsp() {
        String baseUrl = constructURL(FIRST_PAGE);

        // Connect to a session scope to allow the JSP compilation
        compileJSP(baseUrl + SESSION_SCOPE);

        // Connect to the JSP using the application scope
        String stringResponse = invokeJSP(baseUrl, HALF_CACHE_TAG_EXPIRATION);

        // Connect again, we should have the same content since it expires
        // only each 2 seconds
        assertTrue(stringResponse.equals(invokeJSP(baseUrl, HALF_CACHE_TAG_EXPIRATION)));

        // Connect again, the content should be different
        String newResponse = invokeJSP(baseUrl, CACHE_TAG_EXPIRATION + (CACHE_TAG_EXPIRATION / 4));
        assertTrue(!stringResponse.equals(newResponse));
        stringResponse = newResponse;

        // Connect again, but request the cache content so no refresh should occur
        assertTrue(stringResponse.equals(invokeJSP(baseUrl, FORCE_CACHE_USE, 0)));

        // Connect again, the content should have changed
        newResponse = invokeJSP(baseUrl, HALF_CACHE_TAG_EXPIRATION);
        assertTrue(!stringResponse.equals(newResponse));
        stringResponse = newResponse;

        // Connect for the last time, force the cache
        // refresh so the content should have changed
        assertTrue(!stringResponse.equals(invokeJSP(baseUrl, FORCE_REFRESH, 0)));

        // Invoke the JSP page containing 2 cache tag
        baseUrl = constructURL(SECOND_PAGE);
        compileJSP(baseUrl + SESSION_SCOPE);
        stringResponse = invokeJSP(baseUrl, CACHE_TAG_EXPIRATION);

        // Invoke the same page en check if it's identical
        assertTrue(stringResponse.equals(invokeJSP(baseUrl, CACHE_TAG_EXPIRATION)));
    }

    /**
     * Compile a JSP page by invoking it. We compile the page first to avoid
     * the compilation delay when testing since the time is a crucial factor
     * <p>
     * @param URL The JSP url to invoke
     */
    private void compileJSP(String URL) {
        try {
            // Invoke the JSP
            wc.getResponse(URL);
        } catch (Exception ex) {
            ex.printStackTrace();
            fail("Exception raised!!");
        }
    }

    /**
     *  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 + "/";
            }

            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 JSP page and then sleep some time before returning
     * <p>
     * @param baseUrl     The URL of the JSP to invoke
     * @param sleepTime   THe time to sleep before returning
     * @return The text value of the reponse (HTML code)
     */
    private String invokeJSP(String baseUrl, int sleepTime) {
        return invokeJSP(baseUrl, "", sleepTime);
    }

    /**
     * Utility method to invoke a JSP page and then sleep some time before returning
     * <p>
     * @param baseUrl     The URL of the JSP to invoke
     * @param URLparam    The URL parameters of the JSP to invoke
     * @param sleepTime   The time to sleep before returning
     * @return The text value of the reponse (HTML code)
     */
    private String invokeJSP(String baseUrl, String URLparam, int sleepTime) {
        try {
            // Invoke the JSP and wait the specified sleepTime
            WebResponse resp = wc.getResponse(baseUrl + APPLICATION_SCOPE + URLparam);
            Thread.sleep(sleepTime);

            return resp.getText();
        } catch (Exception ex) {
            ex.printStackTrace();
            fail("Exception raised!!");

            return null;
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩系列| 久久久国产午夜精品| 成人丝袜视频网| 国产综合一区二区| 狠狠色狠狠色综合日日91app| 秋霞影院一区二区| 久久99国产精品久久99果冻传媒| 日本特黄久久久高潮| 视频一区在线播放| 理论电影国产精品| 国产精品一区二区视频| 国产成人在线视频播放| 国产成人免费在线观看| 成人午夜免费视频| 在线视频中文字幕一区二区| 在线观看日产精品| 91精品久久久久久久91蜜桃| 337p日本欧洲亚洲大胆色噜噜| 精品国产91乱码一区二区三区 | 国产精品丝袜一区| 1000部国产精品成人观看| 亚洲男人天堂av| 三级不卡在线观看| 国产99一区视频免费| 91免费版在线| 欧美一区二区在线免费观看| 久久久精品天堂| 1024成人网| 毛片一区二区三区| 成人免费观看视频| 欧美日韩卡一卡二| 国产日韩欧美不卡| 亚洲影院在线观看| 激情综合五月天| 91免费版pro下载短视频| 欧美精品久久久久久久多人混战 | 亚洲日本一区二区| 天堂久久一区二区三区| 国产精品一区二区免费不卡| 色综合天天综合网国产成人综合天| 欧美色电影在线| 久久网站热最新地址| 亚洲尤物视频在线| 成人免费的视频| 欧美草草影院在线视频| 一区二区三区在线播| 韩国女主播一区二区三区| 色偷偷久久一区二区三区| 亚洲精品一区二区三区99| 一区二区在线观看免费| 国产精品一区三区| 日韩亚洲欧美在线观看| 亚洲黄色免费网站| 国产成+人+日韩+欧美+亚洲| 日韩欧美国产午夜精品| 亚洲一二三级电影| 99视频一区二区三区| 久久众筹精品私拍模特| 视频一区国产视频| 在线视频国内一区二区| 日韩美女精品在线| 丁香婷婷综合激情五月色| 精品美女一区二区| 蜜桃视频一区二区三区| 欧美日韩国产大片| 亚洲尤物在线视频观看| 色噜噜偷拍精品综合在线| 欧美激情在线免费观看| 国产精品99久| 久久久久久久久岛国免费| 久久狠狠亚洲综合| 日韩一区和二区| 免费精品视频在线| 日韩三级高清在线| 秋霞午夜av一区二区三区| 91精品国产手机| 久久精品99国产精品| 26uuu国产电影一区二区| 久久国产生活片100| 欧美成人aa大片| 国产一区二区三区日韩 | 99久久99久久综合| 中文字幕中文字幕在线一区 | 久久伊99综合婷婷久久伊| 久久精品免费观看| 久久―日本道色综合久久| 国产真实乱偷精品视频免| 精品久久五月天| 国产精品影视网| 国产精品黄色在线观看| 色视频一区二区| 亚洲高清视频中文字幕| 欧美一区二区三区婷婷月色| 精品一区二区三区欧美| 国产农村妇女毛片精品久久麻豆 | 亚洲成av人片在线观看无码| 9191久久久久久久久久久| 日韩av电影天堂| 精品少妇一区二区三区日产乱码 | 国产精品白丝av| 亚洲免费毛片网站| 日韩一区二区三区四区| 国产精品一区二区你懂的| 亚洲精品乱码久久久久| 精品少妇一区二区三区免费观看 | 视频一区中文字幕| 国产午夜精品美女毛片视频| 一本久道中文字幕精品亚洲嫩| 天堂成人国产精品一区| 国产偷v国产偷v亚洲高清| 91九色最新地址| 激情综合色丁香一区二区| 亚洲男同性恋视频| 欧美精品一区二区三区高清aⅴ | 激情五月婷婷综合网| 综合亚洲深深色噜噜狠狠网站| 欧美久久婷婷综合色| 国产成人一区在线| 蜜臀av一级做a爰片久久| 综合久久给合久久狠狠狠97色 | 日本久久一区二区三区| 精品一区二区三区视频在线观看| 亚洲人被黑人高潮完整版| 久久久久国产精品麻豆ai换脸| 欧美性大战久久久| www.欧美日韩| 久久99精品久久久久久国产越南 | 日韩综合小视频| 国产精品色一区二区三区| 欧美狂野另类xxxxoooo| 91亚洲精品久久久蜜桃网站| 国内精品国产成人国产三级粉色| 亚洲国产色一区| 亚洲日本在线a| 国产精品久久久久久久久免费桃花| 日韩一级完整毛片| 5858s免费视频成人| 色一情一乱一乱一91av| www.成人网.com| 高清免费成人av| 国产盗摄精品一区二区三区在线 | 一区二区三区四区蜜桃| 国产欧美一区二区精品忘忧草| 日韩一区二区不卡| 日韩欧美精品在线视频| 欧美一区二区三区在线观看| 欧美三级乱人伦电影| 一本到高清视频免费精品| 91在线看国产| caoporm超碰国产精品| 国产福利一区二区三区视频在线| 国产一区激情在线| 国产一区二区精品久久99| 美腿丝袜亚洲综合| 另类成人小视频在线| 久久99久国产精品黄毛片色诱| 蜜桃久久精品一区二区| 麻豆freexxxx性91精品| 日本va欧美va欧美va精品| 六月丁香婷婷色狠狠久久| 免费高清不卡av| 韩国理伦片一区二区三区在线播放 | 国产高清不卡一区| 成人免费高清在线| 91小视频在线免费看| 91久久精品日日躁夜夜躁欧美| 在线观看区一区二| 日韩欧美一级片| 久久欧美一区二区| 国产精品电影一区二区| 亚洲伦理在线精品| 亚洲成人午夜电影| 精品亚洲porn| 91亚洲资源网| 91麻豆精品国产91久久久久久| 日韩西西人体444www| 欧美经典三级视频一区二区三区| 国产调教视频一区| 亚洲激情自拍偷拍| 精品一区二区在线免费观看| 成人性生交大片免费| 欧美日韩精品电影| 久久精品在这里| 亚洲自拍都市欧美小说| 国产综合色视频| 欧美午夜不卡视频| 久久精品一区二区| 亚洲成人资源网| 国产福利精品导航| 欧美高清视频www夜色资源网| 亚洲精品一线二线三线| 亚洲成va人在线观看| 国产超碰在线一区| 日韩欧美精品三级| 亚洲图片自拍偷拍| 成人午夜又粗又硬又大| 欧美日韩国产一级| 1000部国产精品成人观看| 久久国产夜色精品鲁鲁99| 91国模大尺度私拍在线视频|