Package org.apache.geronimo.connector.outbound

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


    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 = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);

        // exit component context
        connectionTrackingCoordinator.exit(oldConnectorInstanceContext);
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

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

        // simulate create connection
        ConnectionInfo connectionInfo1 = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo1, false);

        // enter another (nested) component context
        ConnectorInstanceContextImpl nextedComponentContext = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext2 = connectionTrackingCoordinator.enter(nextedComponentContext);
        assertTrue("Expected returned component context to be componentContext1", oldConnectorInstanceContext2 == componentContext1);

        // simulate create connection in nested context
        ConnectionInfo nestedConnectionInfo = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(nestedKey, nestedConnectionInfo, false);

        // exit nested component context
        connectionTrackingCoordinator.exit(oldConnectorInstanceContext2);
        Map nestedConnectionManagerMap = nextedComponentContext.getConnectionManagerMap();
View Full Code Here

                Set connections = (Set) entry.getValue();

                // release proxy connections
                if (lazyConnect) {
                    for (Iterator infoIterator = connections.iterator(); infoIterator.hasNext();) {
                        ConnectionInfo connectionInfo = (ConnectionInfo) infoIterator.next();
                        releaseProxyConnection(connectionInfo);
                    }
                }

                // use connection interceptor to dissociate connections that support disassociation
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

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.