public void testUnshareableConnections() throws Throwable {
unshareableResources.add(name);
mockComponent = new DefaultInterceptor() {
public Object invoke(InstanceContext newInstanceContext) throws Throwable {
MockConnection mockConnection1 = (MockConnection) connectionFactory.getConnection();
mockManagedConnection = mockConnection1.getManagedConnection();
MockConnection mockConnection2 = (MockConnection) connectionFactory.getConnection();
//the 2 cx are for the same RM, so tm will call commit only one one (the first)
//mockManagedConnection = mockConnection2.getManagedConnection();
assertNotNull("Expected non-null managedconnection 1", mockConnection1.getManagedConnection());
assertNotNull("Expected non-null managedconnection 2", mockConnection2.getManagedConnection());
assertTrue("Expected different managed connections for each unshared handle", mockConnection1.getManagedConnection() != mockConnection2.getManagedConnection());
mockConnection1.close();
mockConnection2.close();
return null;
}
};
TransactionContext transactionContext = transactionContextManager.newContainerTransactionContext();