Search in sources :

Example 11 with LazyConnection

use of org.jboss.as.test.integration.jca.lazyconnectionmanager.rar.LazyConnection in project wildfly by wildfly.

the class LazyAssociationSharableFalseTestCase method verifyDisabledLazyAssociation.

@Test
public void verifyDisabledLazyAssociation() {
    assertNotNull(lcf);
    LazyConnection lc1 = null;
    LazyConnection lc2 = null;
    try {
        lc1 = lcf.getConnection();
        assertTrue(lc1.isManagedConnectionSet());
        try {
            lc2 = lcf.getConnection();
            fail("Exception should have been thrown");
        } catch (ResourceException re) {
        // expected
        }
    } catch (Throwable t) {
        logger.error(t.getMessage(), t);
        fail("Throwable:" + t.getLocalizedMessage());
    } finally {
        if (lc1 != null) {
            lc1.close();
        }
        if (lc2 != null) {
            lc2.close();
        }
    }
}
Also used : LazyConnection(org.jboss.as.test.integration.jca.lazyconnectionmanager.rar.LazyConnection) ResourceException(javax.resource.ResourceException) Test(org.junit.Test)

Example 12 with LazyConnection

use of org.jboss.as.test.integration.jca.lazyconnectionmanager.rar.LazyConnection in project wildfly by wildfly.

the class LazyAssociationSharableFalseTestCase method testDefaultBehaviorWithoutLazyAssociation.

@Test
public void testDefaultBehaviorWithoutLazyAssociation() {
    assertNotNull(lcf);
    LazyConnection lc1 = null;
    LazyConnection lc2 = null;
    try {
        lc1 = lcf.getConnection();
        assertTrue(lc1.isManagedConnectionSet());
        lc1.close();
        lc2 = lcf.getConnection();
        assertTrue(lc2.isManagedConnectionSet());
        lc2.close();
    } catch (Throwable t) {
        logger.error(t.getMessage(), t);
        fail("Throwable:" + t.getLocalizedMessage());
    } finally {
        if (lc1 != null) {
            lc1.close();
        }
        if (lc2 != null) {
            lc2.close();
        }
    }
}
Also used : LazyConnection(org.jboss.as.test.integration.jca.lazyconnectionmanager.rar.LazyConnection) Test(org.junit.Test)

Aggregations

LazyConnection (org.jboss.as.test.integration.jca.lazyconnectionmanager.rar.LazyConnection)12 Test (org.junit.Test)12 ResourceException (javax.resource.ResourceException)1 ManagedConnectionPool (org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool)1