Package org.apache.geronimo.connector.outbound.connectiontracking.defaultimpl

Examples of org.apache.geronimo.connector.outbound.connectiontracking.defaultimpl.DefaultComponentContext


        key1 = null;
        key2 = null;
    }

    public void testSimpleComponentContextLifecyle() throws Exception {
        DefaultComponentContext componentContext = new DefaultComponentContext();
        TrackedConnectionAssociator.ConnectorContextInfo connectorContext = connectionTrackingCoordinator.enter(componentContext, unshareableResources);
        assertNull("Expected old component context to be null", connectorContext.getInstanceContext());
        //give the context a ConnectionInfo
        ManagedConnectionInfo managedConnectionInfo = new ManagedConnectionInfo(null, null);
        ConnectionInfo connectionInfo = new ConnectionInfo(managedConnectionInfo);
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo);
        connectionTrackingCoordinator.exit(connectorContext);
        Map connectionManagerMap = componentContext.getConnectionManagerMap();
        Set infos = (Set) connectionManagerMap.get(key1);
        assertEquals("Expected one connection for key1", 1, infos.size());
        assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());

        //Enter again, and close the handle
        connectorContext = connectionTrackingCoordinator.enter(componentContext, unshareableResources);
        assertNull("Expected old component context to be null", connectorContext.getInstanceContext());
        connectionTrackingCoordinator.handleReleased(key1, connectionInfo);
        connectionTrackingCoordinator.exit(connectorContext);
        connectionManagerMap = componentContext.getConnectionManagerMap();
        infos = (Set) connectionManagerMap.get(key1);
        assertEquals("Expected no connection set for key1", null, infos);
    }
View Full Code Here


        infos = (Set) connectionManagerMap.get(key1);
        assertEquals("Expected no connection set for key1", null, infos);
    }

    public void testNestedComponentContextLifecyle() throws Exception {
        DefaultComponentContext componentContext1 = new DefaultComponentContext();
        TrackedConnectionAssociator.ConnectorContextInfo oldConnectorContext1 = connectionTrackingCoordinator.enter(componentContext1, unshareableResources);
        assertNull("Expected old component context to be null", oldConnectorContext1.getInstanceContext());
        //give the context a ConnectionInfo
        ManagedConnectionInfo managedConnectionInfo1 = new ManagedConnectionInfo(null, null);
        ConnectionInfo connectionInfo1 = new ConnectionInfo(managedConnectionInfo1);
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo1);

        //Simulate calling another component
        DefaultComponentContext componentContext2 = new DefaultComponentContext();
        TrackedConnectionAssociator.ConnectorContextInfo oldConnectorContext2 = connectionTrackingCoordinator.enter(componentContext2, unshareableResources);
        assertTrue("Expected returned component context to be componentContext1", oldConnectorContext2.getInstanceContext() == componentContext1);
        //give the context a ConnectionInfo
        ManagedConnectionInfo managedConnectionInfo2 = new ManagedConnectionInfo(null, null);
        ConnectionInfo connectionInfo2 = new ConnectionInfo(managedConnectionInfo2);
        connectionTrackingCoordinator.handleObtained(key2, connectionInfo2);

        connectionTrackingCoordinator.exit(oldConnectorContext2);
        Map connectionManagerMap2 = componentContext2.getConnectionManagerMap();
        Set infos2 = (Set) connectionManagerMap2.get(key2);
        assertEquals("Expected one connection for key2", 1, infos2.size());
        assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo2 == infos2.iterator().next());
        assertEquals("Expected no connection for key1", null, connectionManagerMap2.get(key1));
View Full Code Here

                //name,
                realmBridge,
                connectionTrackingCoordinator);
        connectionManagerDeployment.doStart();
        connectionFactory = (MockConnectionFactory) connectionManagerDeployment.createConnectionFactory(mockManagedConnectionFactory);
        defaultComponentContext = new DefaultComponentContext();
        defaultComponentInterceptor = new DefaultComponentInterceptor(this, connectionTrackingCoordinator, unshareableResources);
    }
View Full Code Here

            if (TransactionContext.getContext() == null) {
                TransactionContext.setContext(new UnspecifiedTransactionContext());
            }
            try {
                oldConnectorContext = associator.enter(new DefaultComponentContext(), unshareableResources);
            } catch (ResourceException e) {
                throw new RuntimeException(e);
            }

            super.handle(pathInContext, pathParams, httpRequest, httpResponse);
View Full Code Here

                            }
                        }
                        localStartTime = System.currentTimeMillis();
                        for (int i = 0; i < repeatCount; i++) {
                            try {
                                defaultComponentInterceptor.invoke(new DefaultComponentContext());
                            } catch (Throwable throwable) {
                                throwable.printStackTrace();
                            }
                        }
                    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.geronimo.connector.outbound.connectiontracking.defaultimpl.DefaultComponentContext

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.