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

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

?? managedconnectiontestcase.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
字號:
/**
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided
 * that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright
 *    statements and notices.  Redistributions must also contain a
 *    copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions and the
 *    following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. The name "Exolab" must not be used to endorse or promote
 *    products derived from this Software without prior written
 *    permission of Exoffice Technologies.  For written permission,
 *    please contact info@exolab.org.
 *
 * 4. Products derived from this Software may not be called "Exolab"
 *    nor may "Exolab" appear in their names without prior written
 *    permission of Exoffice Technologies. Exolab is a registered
 *    trademark of Exoffice Technologies.
 *
 * 5. Due credit should be given to the Exolab Project
 *    (http://www.exolab.org/).
 *
 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2004-2005 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: ManagedConnectionTestCase.java,v 1.2 2005/05/03 13:46:00 tanderson Exp $
 */
package org.exolab.jms.net.connector;

import java.security.Principal;

import junit.framework.TestCase;


/**
 * Tests the {@link ManagedConnectionFactory} interface.
 *
 * @version     $Revision: 1.2 $ $Date: 2005/05/03 13:46:00 $
 * @author      <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 */
public abstract class ManagedConnectionTestCase extends TestCase {

    /**
     * The managed connection factory.
     */
    private ManagedConnectionFactory _factory;


    /**
     * Construct an instance of this class for a specific test case.
     *
     * @param name the name of test case
     */
    public ManagedConnectionTestCase(String name) {
        super(name);
    }

    /**
     * Tests {@link ManagedConnection#getConnection}.
     *
     * @throws Exception for any error
     */
    public void testGetConnection() throws Exception {
        Principal principal = null;

        // set up an acceptor to handle the connection request
        ManagedConnectionAcceptor acceptor = createAcceptor(principal);
        InvocationHandler handler = new TestInvocationHandler();
        TestAcceptorEventListener listener = new TestAcceptorEventListener(
            handler);
        acceptor.accept(listener);

        // create the managed connection
        ConnectionRequestInfo info = getManagedConnectionRequestInfo();
        ManagedConnection managed = _factory.createManagedConnection(
            principal, info);

        // verify that getConnection() fails if no InvocationHandler
        // is registered
        try {
            managed.getConnection();
            fail("Expected " + IllegalStateException.class.getName()
                 + " to be thrown");
        } catch (IllegalStateException exception) {
            // the expected behaviour
        } catch (Exception exception) {
            fail("Expected " + IllegalStateException.class.getName()
                 + " to be thrown, but got exception="
                 + exception.getClass().getName() 
                 + ", message=" + exception.getMessage());
        }

        // register an InvocationHandler and verify that getConnection()
        // succeeds
        managed.setInvocationHandler(new TestInvocationHandler());

        Connection connection = managed.getConnection();
        assertNotNull(connection);        

        // clean up
        managed.destroy();
        listener.destroy();
        acceptor.close();
    }

    /**
     * Verifies that an <code>InvocationHandler</code> can be registered,
     * and that <code>IllegalStateException</code> is thrown if
     * {@link ManagedConnection#setInvocationHandler} is invoked more
     * than once.
     *
     * @throws Exception for any error
     */
    public void testSetInvocationHandler() throws Exception {
        Principal principal = null;

        // set up an acceptor to handle the connection request
        ManagedConnectionAcceptor acceptor = createAcceptor(principal);
        InvocationHandler handler = new TestInvocationHandler();
        TestAcceptorEventListener listener = new TestAcceptorEventListener(
            handler);
        acceptor.accept(listener);

        // create the managed connection
        ManagedConnection managed = createConnection(principal);
        try {
            managed.setInvocationHandler(null);
            fail("Expected " + IllegalStateException.class.getName()
                 + " to be thrown");
        } catch (IllegalStateException exception) {
            // the expected behaviour
        } catch (Exception exception) {
            fail("Expected " + IllegalStateException.class.getName()
                 + " to be thrown, but got exception="
                 + exception.getClass().getName() 
                 + ", message=" + exception.getMessage());
        }

        try {
            managed.setInvocationHandler(new TestInvocationHandler());
            fail("Expected " + IllegalStateException.class.getName()
                 + " to be thrown");
        } catch (IllegalStateException exception) {
            // the expected behaviour
        } catch (Exception exception) {
            fail("Expected " + IllegalStateException.class.getName()
                 + " to be thrown, but got exception="
                 + exception.getClass().getName() 
                 + ", message=" + exception.getMessage());
        }

        // clean up
        managed.destroy();
        listener.destroy();
        acceptor.close();
    }

    /**
     * Tests {@link ManagedConnection#isAlive}, from the client perspective.
     *
     * @throws Exception for any error
     */
    public void testClientIsAlive() throws Exception {
        Principal principal = null;

        // set up an acceptor to handle the connection request
        ManagedConnectionAcceptor acceptor = createAcceptor(principal);
        InvocationHandler handler = new TestInvocationHandler();
        TestAcceptorEventListener listener = new TestAcceptorEventListener(
            handler);
        acceptor.accept(listener);

        // create the client connection
        ManagedConnection client = createConnection(principal);
        assertTrue(client.isAlive());

        // delay to enable the listener to get notified
        Thread.sleep(1000);

        // destroy the server connection, and verify its dead from the
        // client perspective
        ManagedConnection server = listener.getConnection();
        assertNotNull(server);
        server.destroy();
        assertFalse(client.isAlive());

        // destroy the client
        client.destroy();
        assertFalse(client.isAlive());

        // clean up
        acceptor.close();
    }

    /**
     * Tests {@link ManagedConnection#isAlive}, from the server perspective.
     *
     * @throws Exception for any error
     */
    public void testServerIsAlive() throws Exception {
        Principal principal = null;

        // set up an acceptor to handle the connection request
        ManagedConnectionAcceptor acceptor = createAcceptor(principal);
        InvocationHandler handler = new TestInvocationHandler();
        TestAcceptorEventListener listener = new TestAcceptorEventListener(
            handler);
        acceptor.accept(listener);

        // create the client connection
        ManagedConnection client = createConnection(principal);

        // delay to enable the listener to get notified
        Thread.sleep(1000);

        // get the server connection
        ManagedConnection server = listener.getConnection();
        assertNotNull(server);
        assertTrue(server.isAlive());
        
        // destroy the client connection, and verify its dead from the
        // server perspective
        client.destroy();
        assertFalse(server.isAlive());

        // destroy the server connection
        server.destroy();
        assertFalse(server.isAlive());

        // clean up
        acceptor.close();
    }

    /**
     * Sets up the test case.
     *
     * @throws Exception for any error
     */
    protected void setUp() throws Exception {
        _factory = createManagedConnectionFactory();
    }

    /**
     * Creates a managed connection factory.
     *
     * @return the new managed connection factory
     * @throws Exception for any error
     */
    protected abstract ManagedConnectionFactory
        createManagedConnectionFactory() throws Exception;

    /**
     * Returns connection request info suitable for creating a managed
     * connection.
     *
     * @return connection request info for creating a managed connection
     * @throws Exception for any error
     */
    protected abstract ConnectionRequestInfo getManagedConnectionRequestInfo()
        throws Exception;

    /**
     * Returns connection request info suitable for creating a managed
     * connection acceptor.
     *
     * @return connection request info for creating a managed connection
     * acceptor
     * @throws Exception for any error
     */
    protected abstract ConnectionRequestInfo getAcceptorConnectionRequestInfo()
        throws Exception;

    /**
     * Helper to return the cached managed connection factory
     *
     * @return the cached managed connection factory
     */
    protected ManagedConnectionFactory getManagedConnectionFactory() {
        return _factory;
    }

    /**
     * Helper to create a managed connection.
     *
     * @param principal the principal to use. May be <code>null</code>
     * @throws Exception for any error
     */
    protected ManagedConnection createConnection(Principal principal)
        throws Exception {
        ConnectionRequestInfo info = getManagedConnectionRequestInfo();
        ManagedConnection connection = _factory.createManagedConnection(
            principal, info);
        connection.setInvocationHandler(new TestInvocationHandler());
        return connection;
    }

    /**
     * Helper to create a managed connection acceptor.
     *
     * @param principal the principal to use. May be <code>null</code>
     * @throws Exception for any error
     */
    protected ManagedConnectionAcceptor createAcceptor(Principal principal)
        throws Exception {
        ConnectionRequestInfo info = getAcceptorConnectionRequestInfo();
        Authenticator authenticator = new TestAuthenticator(principal);
        return _factory.createManagedConnectionAcceptor(authenticator, info);
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
懂色av一区二区三区免费观看| 日韩av一区二| 国产日韩影视精品| 精品日韩成人av| 精品日韩在线观看| 久久久精品天堂| 国产女人18毛片水真多成人如厕| 国产欧美日韩久久| 中文幕一区二区三区久久蜜桃| 亚洲国产精品v| 亚洲伦理在线精品| 亚洲风情在线资源站| 午夜精品视频一区| 免费高清在线一区| 国产一区二区三区视频在线播放| 极品美女销魂一区二区三区 | 欧美在线观看一区二区| 在线免费观看日本一区| 欧美日韩国产中文| 久久久精品黄色| 亚洲免费观看视频| 久久精品国内一区二区三区| 国产91精品在线观看| 在线观看一区不卡| 欧美成人bangbros| 综合色天天鬼久久鬼色| 亚洲成人免费av| 国产精品亚洲专一区二区三区 | 免费成人在线观看| 国产91综合一区在线观看| 欧洲日韩一区二区三区| 欧美不卡一区二区三区| 欧美激情在线观看视频免费| 亚洲夂夂婷婷色拍ww47| 美女看a上一区| 色综合欧美在线| 精品国产髙清在线看国产毛片 | 午夜一区二区三区视频| 国产专区综合网| 91久久免费观看| 久久久九九九九| 日韩av不卡一区二区| 91欧美一区二区| 2020国产精品久久精品美国| 亚洲在线视频一区| 精品一区二区在线播放| 欧美日韩三级在线| 成人免费小视频| 国产99久久久国产精品免费看| 欧美日韩二区三区| 一区二区三区四区乱视频| 国产高清不卡一区| 欧美zozo另类异族| 亚洲成人自拍网| 在线观看日韩av先锋影音电影院| 中日韩av电影| 国产乱对白刺激视频不卡| 日韩欧美在线123| 午夜精品福利一区二区三区av | 成人晚上爱看视频| 久久综合九色综合97婷婷女人| 亚洲成人资源在线| 色婷婷狠狠综合| 亚洲欧美偷拍另类a∨色屁股| 国产成人综合亚洲网站| 久久久www免费人成精品| 麻豆freexxxx性91精品| 日韩欧美一级二级| 午夜激情久久久| 91精品免费观看| 秋霞午夜av一区二区三区| 欧美肥妇bbw| 日本亚洲视频在线| 欧美一区二区久久| 麻豆视频观看网址久久| 日韩西西人体444www| 毛片基地黄久久久久久天堂| 精品伦理精品一区| 国产一区二区三区| 欧美国产日韩亚洲一区| av一区二区久久| 樱桃国产成人精品视频| 欧美日高清视频| 亚洲成人777| 日韩欧美一级二级| 国产精品一二三四区| 国产精品久久久久久妇女6080| 国产99久久久久久免费看农村| 国产精品色哟哟| 色综合久久88色综合天天| 亚洲一区二区三区国产| 欧美一区二区三区四区高清| 国产自产视频一区二区三区| 国产精品视频一区二区三区不卡| 99精品欧美一区二区三区小说 | 欧美成人性福生活免费看| 精品一区二区三区视频 | 亚洲成a天堂v人片| 精品福利一区二区三区| 成a人片国产精品| 午夜精品一区二区三区免费视频| 日韩三级在线观看| 99久久久久久99| 免费久久精品视频| 国产精品视频在线看| 欧美日韩在线三级| 国产精品69毛片高清亚洲| 亚洲乱码一区二区三区在线观看| 日韩午夜在线影院| 91色在线porny| 久久99国产精品免费网站| 国产精品久久一级| 欧美一级爆毛片| 91亚洲精品久久久蜜桃网站| 久久国内精品自在自线400部| ...中文天堂在线一区| 日韩视频一区二区在线观看| 99久久婷婷国产综合精品 | 中文字幕欧美区| 91麻豆精品国产91久久久| 不卡av电影在线播放| 日本亚洲天堂网| 亚洲一区二区在线视频| 欧美国产日本视频| 日韩久久免费av| 欧美日本精品一区二区三区| www.日韩大片| 国产精品1024| 精品中文字幕一区二区小辣椒| 亚洲欧美偷拍另类a∨色屁股| 国产午夜精品久久| 日韩精品一区二区三区四区| 欧美日韩久久久久久| 色激情天天射综合网| 成人听书哪个软件好| 国产在线精品免费| 老司机免费视频一区二区三区| 亚洲国产cao| 亚洲综合免费观看高清完整版在线| 欧美国产乱子伦| 国产亚洲自拍一区| 日韩欧美一二三四区| 欧美一区二区三区在线电影| 欧美日韩高清不卡| 欧美日韩你懂得| 欧美日韩精品三区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| bt欧美亚洲午夜电影天堂| 国产成人高清视频| 国产成人午夜精品影院观看视频| 久久国产精品72免费观看| 久久av中文字幕片| 捆绑变态av一区二区三区| 免费观看日韩电影| 精品在线一区二区| 国产精品一区二区你懂的| 国产一区福利在线| 国产激情91久久精品导航| 国产白丝精品91爽爽久久| 粉嫩蜜臀av国产精品网站| www.性欧美| 欧美丝袜丝nylons| 欧美一区二区免费观在线| 日韩欧美国产不卡| 国产午夜亚洲精品午夜鲁丝片| 久久精品欧美日韩| 亚洲人成7777| 亚洲不卡一区二区三区| 秋霞电影网一区二区| 国产乱人伦偷精品视频免下载 | 亚洲综合久久久久| 三级影片在线观看欧美日韩一区二区| 五月天久久比比资源色| 精品一区二区三区免费毛片爱| 国产成人精品亚洲777人妖| 97成人超碰视| 777久久久精品| 欧美激情一区不卡| 亚洲18女电影在线观看| 国产一区二区视频在线| 91毛片在线观看| 日韩三级在线免费观看| 国产精品美女久久久久久久久久久 | 日本aⅴ亚洲精品中文乱码| 国产又黄又大久久| 在线看国产日韩| 国产精品萝li| 一区二区三区四区不卡在线 | 色综合中文字幕| 欧美高清视频一二三区| 国产亚洲精久久久久久| 亚洲精品国产无套在线观| 黑人精品欧美一区二区蜜桃| 色狠狠一区二区三区香蕉| 久久亚洲欧美国产精品乐播| 亚洲最大的成人av| 国产99精品视频| 日韩一级片网站| 亚洲国产成人高清精品| 成人伦理片在线|