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

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

?? testobjectpool.java

?? Apache的通用池Jar包
?? JAVA
字號:
/*
 * Copyright 1999-2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.pool;

import junit.framework.TestCase;

/**
 * Abstract {@link TestCase} for {@link ObjectPool} implementations.
 * @author Rodney Waldhoff
 * @version $Revision: 1.7 $ $Date: 2004/02/28 11:46:11 $
 */
public abstract class TestObjectPool extends TestCase {
    public TestObjectPool(String testName) {
        super(testName);
    }

    /** 
     * Create an {@link ObjectPool} instance
     * that can contain at least <i>mincapacity</i>
     * idle and active objects, or
     * throw {@link IllegalArgumentException}
     * if such a pool cannot be created.
     */
    protected abstract ObjectPool makeEmptyPool(int mincapacity);

    /**
     * Return what we expect to be the n<sup>th</sup>
     * object (zero indexed) created by the _pool.
     */
    protected abstract Object getNthObject(int n);

    public void setUp() throws Exception {
    }
    
    public void tearDown() throws Exception {
        _pool = null;
    }
    
    public void testBaseBorrow() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        assertEquals(getNthObject(0),_pool.borrowObject());
        assertEquals(getNthObject(1),_pool.borrowObject());
        assertEquals(getNthObject(2),_pool.borrowObject());
    }

    public void testBaseAddObject() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        try {
            assertEquals(0,_pool.getNumIdle());
            assertEquals(0,_pool.getNumActive());
            _pool.addObject();
            assertEquals(1,_pool.getNumIdle());
            assertEquals(0,_pool.getNumActive());
            Object obj = _pool.borrowObject();
            assertEquals(getNthObject(0),obj);
            assertEquals(0,_pool.getNumIdle());
            assertEquals(1,_pool.getNumActive());
            _pool.returnObject(obj);
            assertEquals(1,_pool.getNumIdle());
            assertEquals(0,_pool.getNumActive());
        } catch(UnsupportedOperationException e) {
            return; // skip this test if one of those calls is unsupported
        }
    }
    
    public void testBaseBorrowReturn() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        Object obj0 = _pool.borrowObject();
        assertEquals(getNthObject(0),obj0);
        Object obj1 = _pool.borrowObject();
        assertEquals(getNthObject(1),obj1);
        Object obj2 = _pool.borrowObject();
        assertEquals(getNthObject(2),obj2);
        _pool.returnObject(obj2);
        obj2 = _pool.borrowObject();
        assertEquals(getNthObject(2),obj2);
        _pool.returnObject(obj1);
        obj1 = _pool.borrowObject();
        assertEquals(getNthObject(1),obj1);
        _pool.returnObject(obj0);
        _pool.returnObject(obj2);
        obj2 = _pool.borrowObject();
        assertEquals(getNthObject(2),obj2);
        obj0 = _pool.borrowObject();
        assertEquals(getNthObject(0),obj0);
    }

    public void testBaseNumActiveNumIdle() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        assertEquals(0,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        Object obj0 = _pool.borrowObject();
        assertEquals(1,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        Object obj1 = _pool.borrowObject();
        assertEquals(2,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        _pool.returnObject(obj1);
        assertEquals(1,_pool.getNumActive());
        assertEquals(1,_pool.getNumIdle());
        _pool.returnObject(obj0);
        assertEquals(0,_pool.getNumActive());
        assertEquals(2,_pool.getNumIdle());
    }

    public void testBaseClear() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        assertEquals(0,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        Object obj0 = _pool.borrowObject();
        Object obj1 = _pool.borrowObject();
        assertEquals(2,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        _pool.returnObject(obj1);
        _pool.returnObject(obj0);
        assertEquals(0,_pool.getNumActive());
        assertEquals(2,_pool.getNumIdle());
        _pool.clear();
        assertEquals(0,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        Object obj2 = _pool.borrowObject();
        assertEquals(getNthObject(2),obj2);
    }

    public void testBaseInvalidateObject() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        assertEquals(0,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        Object obj0 = _pool.borrowObject();
        Object obj1 = _pool.borrowObject();
        assertEquals(2,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        _pool.invalidateObject(obj0);
        assertEquals(1,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
        _pool.invalidateObject(obj1);
        assertEquals(0,_pool.getNumActive());
        assertEquals(0,_pool.getNumIdle());
    }
    
    public void testBaseClosePool() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        Object obj = _pool.borrowObject();
        _pool.returnObject(obj);
        
        _pool.close();
        try {
            _pool.borrowObject();
            fail("Expected IllegalStateException");
        } catch(IllegalStateException e) {
            // expected
        }
    }

    public void testBaseCantCloseTwice() throws Exception {
        try {
            _pool = makeEmptyPool(3);
        } catch(IllegalArgumentException e) {
            return; // skip this test if unsupported
        }
        Object obj = _pool.borrowObject();
        _pool.returnObject(obj);
        
        _pool.close();
        try {
            _pool.close();
            fail("Expected IllegalStateException");
        } catch(IllegalStateException e) {
            // expected
        }
    }

    private ObjectPool _pool = null;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久一牛影视| 亚洲国产精品久久久久秋霞影院| 欧美亚洲精品一区| 色呦呦国产精品| 99国产精品一区| av不卡在线播放| 99re视频精品| 日本精品视频一区二区三区| 99久久99精品久久久久久 | 亚洲一二三区视频在线观看| 成人免费一区二区三区在线观看| 亚洲国产精品成人综合色在线婷婷| 久久精品亚洲国产奇米99| 日本一区二区三区在线观看| 最新欧美精品一区二区三区| 亚洲另类在线一区| 天堂av在线一区| 激情深爱一区二区| 精品亚洲国内自在自线福利| 国产精品一区二区三区99| 国产·精品毛片| 97se亚洲国产综合在线| 91久久线看在观草草青青| 欧美一区二区不卡视频| 久久久亚洲精品一区二区三区| 国产日产欧美精品一区二区三区| 亚洲欧美一区二区久久| 麻豆精品一区二区三区| 成人黄页毛片网站| 欧美午夜电影在线播放| 精品粉嫩超白一线天av| 亚洲欧洲三级电影| 美女视频一区在线观看| 99久久精品国产一区| 日韩视频在线永久播放| 中文字幕亚洲一区二区va在线| 日韩一区精品字幕| 成人av电影免费观看| 在线电影欧美成精品| 中文字幕在线观看不卡视频| 久久电影网电视剧免费观看| 99久久精品国产网站| 欧美成人aa大片| 亚洲一区在线观看视频| 国产成人99久久亚洲综合精品| 欧美体内she精视频| 国产精品少妇自拍| 欧美aaaaaa午夜精品| 在线观看免费亚洲| 国产精品欧美综合在线| 久久av中文字幕片| 欧美美女一区二区三区| 亚洲欧洲国产日韩| 国产在线国偷精品免费看| 欧美一卡2卡三卡4卡5免费| 亚洲欧洲综合另类在线| 懂色中文一区二区在线播放| 精品国产青草久久久久福利| 日韩精品国产精品| 91福利精品视频| 中文字幕一区二区视频| 高清成人在线观看| 2022国产精品视频| 日韩av电影免费观看高清完整版| 在线视频欧美精品| 中文字幕一区二区三| caoporn国产一区二区| 欧美国产精品一区| 成人午夜视频在线观看| 国产欧美一区二区在线观看| 九一九一国产精品| 精品久久免费看| 国产自产视频一区二区三区| 日韩欧美电影一区| 九九精品视频在线看| 精品国产91洋老外米糕| 极品少妇一区二区| 精品精品国产高清一毛片一天堂| 美女一区二区三区| 精品欧美久久久| 国内精品嫩模私拍在线| 2023国产精品视频| 波多野结衣中文字幕一区二区三区| 国产日产精品1区| 国产·精品毛片| 亚洲视频免费在线观看| 91日韩精品一区| 亚洲制服丝袜av| 51精品秘密在线观看| 蜜桃久久av一区| 国产亚洲精品久| 99在线精品一区二区三区| 一区二区成人在线视频| 欧美无人高清视频在线观看| 日韩va亚洲va欧美va久久| 久久久影视传媒| 99视频精品全部免费在线| 亚洲精品国产精华液| 在线成人免费观看| 国产精品综合av一区二区国产馆| 国产精品素人视频| 欧美精品自拍偷拍动漫精品| 美女视频黄 久久| 中文字幕视频一区二区三区久| 在线观看日韩电影| 韩国v欧美v日本v亚洲v| 亚洲天堂2016| 日韩免费在线观看| 99国产精品久久久久久久久久 | 亚洲国产精品传媒在线观看| 91视视频在线观看入口直接观看www | 午夜电影一区二区| 久久一夜天堂av一区二区三区| 国产成人亚洲精品狼色在线| 一片黄亚洲嫩模| 国产喂奶挤奶一区二区三区| 欧洲色大大久久| 国产精品99久久久久久似苏梦涵| 一区二区三区欧美日韩| 精品国产第一区二区三区观看体验| 91视频.com| 国产黄色91视频| 美女网站视频久久| 亚洲综合一二三区| 久久九九99视频| 欧美日韩国产高清一区二区三区 | 久久er精品视频| 亚洲主播在线播放| 国产精品无遮挡| 日韩欧美高清dvd碟片| 精品1区2区3区| 成人激情动漫在线观看| 九九九精品视频| 三级影片在线观看欧美日韩一区二区| 中文字幕中文字幕在线一区 | 中文字幕一区二区三区四区| 久久丝袜美腿综合| 日韩欧美国产高清| 欧美一区二区三区在线电影| 欧美在线免费视屏| 91免费视频观看| 99re视频这里只有精品| 不卡欧美aaaaa| 国产99一区视频免费| 久久99热99| 久久99精品久久久久久| 蜜桃av一区二区在线观看| 五月综合激情婷婷六月色窝| 五月天欧美精品| 视频一区二区国产| 日韩精品五月天| 蜜桃av一区二区| 毛片不卡一区二区| 精品一区二区三区不卡 | 91免费国产在线| 91免费国产视频网站| 一本色道久久综合亚洲精品按摩| 91在线观看视频| 一本大道久久a久久精二百| 97国产精品videossex| 99久久精品情趣| 色94色欧美sute亚洲线路一久| 日本精品免费观看高清观看| 欧美性生活大片视频| 欧美日韩国产首页在线观看| 日韩三级精品电影久久久| 日韩午夜av电影| 久久色成人在线| 亚洲图片激情小说| 亚洲成人精品在线观看| 日韩av电影免费观看高清完整版在线观看 | 中文av字幕一区| 亚洲日本欧美天堂| 国产成人在线免费| 91色porny蝌蚪| 91麻豆精品国产91久久久更新时间| 日韩欧美专区在线| 国产丝袜在线精品| 亚洲在线中文字幕| 久久爱另类一区二区小说| 成人h精品动漫一区二区三区| 91福利视频在线| 日韩午夜av一区| 亚洲欧美综合色| 日韩影院精彩在线| 成人美女在线观看| 制服.丝袜.亚洲.中文.综合| 国产三区在线成人av| 一区二区三区精品在线| 精品在线免费视频| 色综合久久久久综合体桃花网| 5566中文字幕一区二区电影| 中文字幕欧美三区| 日韩黄色小视频| 91视频精品在这里| 2014亚洲片线观看视频免费| 亚洲午夜激情网页| 99精品黄色片免费大全| 日韩欧美高清在线| 亚洲一区在线观看视频|