Package org.apache.geronimo.connector.outbound

Examples of org.apache.geronimo.connector.outbound.ConnectionInfo


    public void destroy() {
    }

    private ConnectionInfo createConnectionInfo() {
        ConnectionInfo ci = new ConnectionInfo(mci);
        ci.setConnectionHandle(connection);
        mci.addConnectionHandle(ci);
        return ci;
    }
View Full Code Here


    public void testSimpleComponentContextLifecyle() throws Exception {
        DefaultInstanceContext componentContext = new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources);
        InstanceContext oldInstanceContext = connectionTrackingCoordinator.enter(componentContext);
        assertNull("Expected old instance context to be null", oldInstanceContext);
        //give the context a ConnectionInfo
        ConnectionInfo connectionInfo = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo);
        connectionTrackingCoordinator.exit(oldInstanceContext);
        Map connectionManagerMap = componentContext.getConnectionManagerMap();
        Set infos = (Set) connectionManagerMap.get(key1);
        assertEquals("Expected one connection for key1", 1, infos.size());
View Full Code Here

    }

    private ConnectionInfo newConnectionInfo() {
        ManagedConnectionInfo mci = new ManagedConnectionInfo(null, null);
        mci.setConnectionEventListener(new GeronimoConnectionEventListener(this, mci));
        ConnectionInfo ci = new ConnectionInfo(mci);
        ci.setConnectionHandle(new Object());
        mci.addConnectionHandle(ci);
        return ci;
    }
View Full Code Here

    public void testNestedComponentContextLifecyle() throws Exception {
        DefaultInstanceContext componentContext1 = new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources);
        InstanceContext oldInstanceContext1 = connectionTrackingCoordinator.enter(componentContext1);
        assertNull("Expected old component context to be null", oldInstanceContext1);
        //give the context a ConnectionInfo
        ConnectionInfo connectionInfo1 = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo1);

        //Simulate calling another component
        DefaultInstanceContext componentContext2 = new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources);
        InstanceContext oldInstanceContext2 = connectionTrackingCoordinator.enter(componentContext2);
        assertTrue("Expected returned component context to be componentContext1", oldInstanceContext2 == componentContext1);
        //give the context a ConnectionInfo
        ConnectionInfo connectionInfo2 = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key2, connectionInfo2);

        connectionTrackingCoordinator.exit(oldInstanceContext2);
        Map connectionManagerMap2 = componentContext2.getConnectionManagerMap();
        Set infos2 = (Set) connectionManagerMap2.get(key2);
View Full Code Here

        ConnectorInstanceContextImpl componentContext = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext = connectionTrackingCoordinator.enter(componentContext);
        assertNull("Expected old instance context to be null", oldConnectorInstanceContext);

        // simulate create connection
        ConnectionInfo connectionInfo = createConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);

        // connection should be in component instance context
        Map connectionManagerMap = componentContext.getConnectionManagerMap();
        Set infos = (Set) connectionManagerMap.get(key1);
        assertNotNull("Expected one connections for key1", infos);
        assertEquals("Expected one connection for key1", 1, infos.size());
        assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());

        // verify handle
        Object handle = connectionInfo.getConnectionHandle();
        assertNotNull("Expected a handle from ConnectionInfo", handle);
        assertTrue("Expected handle to be an instance of ConnectionImpl", handle instanceof ConnectionImpl);
        ConnectionImpl connection = (ConnectionImpl) handle;
        assertEquals("connection.getString()", "ConnectionString", connection.getString());

        // verify proxy
        Object proxy = connectionInfo.getConnectionProxy();
        assertNotNull("Expected a proxy from ConnectionInfo", proxy);
        assertTrue("Expected proxy to be an instance of Connection", proxy instanceof Connection);
        Connection connectionProxy = (Connection) proxy;
        assertEquals("connection.getString()", "ConnectionString", connectionProxy.getString());
        assertSame("Expected connection.getUnmanaged() to be connectionImpl", connection, connectionProxy.getUnmanaged());
View Full Code Here

        ConnectorInstanceContextImpl componentContext = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext1 = connectionTrackingCoordinator.enter(componentContext);
        assertNull("Expected old component context to be null", oldConnectorInstanceContext1);

        // simulate create connection
        ConnectionInfo connectionInfo = createConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);

        // connection should be in component instance context
        Map connectionManagerMap = componentContext.getConnectionManagerMap();
        Set infos = (Set) connectionManagerMap.get(key1);
        assertNotNull("Expected one connections for key1", infos);
        assertEquals("Expected one connection for key1", 1, infos.size());
        assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());

        // verify handle
        Object handle = connectionInfo.getConnectionHandle();
        assertNotNull("Expected a handle from ConnectionInfo", handle);
        assertTrue("Expected handle to be an instance of ConnectionImpl", handle instanceof ConnectionImpl);
        ConnectionImpl connection = (ConnectionImpl) handle;
        assertEquals("connection.getString()", "ConnectionString", connection.getString());

        // verify proxy
        Object proxy = connectionInfo.getConnectionProxy();
        assertNotNull("Expected a proxy from ConnectionInfo", proxy);
        assertTrue("Expected proxy to be an instance of Connection", proxy instanceof Connection);
        Connection connectionProxy = (Connection) proxy;
        assertEquals("connection.getString()", "ConnectionString", connectionProxy.getString());
        assertSame("Expected connection.getUnmanaged() to be connectionImpl", connection, connectionProxy.getUnmanaged());
View Full Code Here

        ConnectorInstanceContextImpl componentContext = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext1 = connectionTrackingCoordinator.enter(componentContext);
        assertNull("Expected old component context to be null", oldConnectorInstanceContext1);

        // simulate create connection
        ConnectionInfo connectionInfo = createConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);

        // connection should be in component instance context
        Map connectionManagerMap = componentContext.getConnectionManagerMap();
        Set infos = (Set) connectionManagerMap.get(key1);
        assertNotNull("Expected one connections for key1", infos);
        assertEquals("Expected one connection for key1", 1, infos.size());
        assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());

        // verify handle
        Object handle = connectionInfo.getConnectionHandle();
        assertNotNull("Expected a handle from ConnectionInfo", handle);
        assertTrue("Expected handle to be an instance of ConnectionImpl", handle instanceof ConnectionImpl);
        ConnectionImpl connection = (ConnectionImpl) handle;
        assertEquals("connection.getString()", "ConnectionString", connection.getString());

        // verify proxy
        Object proxy = connectionInfo.getConnectionProxy();
        assertNotNull("Expected a proxy from ConnectionInfo", proxy);
        assertTrue("Expected proxy to be an instance of Connection", proxy instanceof Connection);
        Connection connectionProxy = (Connection) proxy;
        assertEquals("connection.getString()", "ConnectionString", connectionProxy.getString());
        assertSame("Expected connection.getUnmanaged() to be connectionImpl", connection, connectionProxy.getUnmanaged());
View Full Code Here

    public void destroy() {
    }

    private ConnectionInfo createConnectionInfo() {
        ConnectionInfo ci = new ConnectionInfo(mci);
        ci.setConnectionHandle(connection);
        mci.addConnectionHandle(ci);
        return ci;
    }
View Full Code Here

        ProxyPhantomReference reference = (ProxyPhantomReference) referenceQueue.poll();
        while (reference != null) {
            reference.clear();
            references.remove(reference.managedConnectionInfo);

            ConnectionInfo released = new ConnectionInfo(reference.managedConnectionInfo);
            reference.interceptor.returnConnection(released, ConnectionReturnAction.DESTROY);
            reference = (ProxyPhantomReference) referenceQueue.poll();
        }
    }
View Full Code Here

    public void testSimpleComponentContextLifecyle() throws Exception {
        ConnectorInstanceContextImpl componentContext = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext = connectionTrackingCoordinator.enter(componentContext);
        assertNull("Expected old instance context to be null", oldConnectorInstanceContext);
        //give the context a ConnectionInfo
        ConnectionInfo connectionInfo = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo);
        connectionTrackingCoordinator.exit(oldConnectorInstanceContext);
        Map connectionManagerMap = componentContext.getConnectionManagerMap();
        Set infos = (Set) connectionManagerMap.get(key1);
        assertEquals("Expected one connection for key1", 1, infos.size());
View Full Code Here

TOP

Related Classes of org.apache.geronimo.connector.outbound.ConnectionInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.