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);