return ci;
}
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);