Search in sources :

Example 1 with TransactionManagerImpl

use of org.apache.geronimo.transaction.manager.TransactionManagerImpl in project tomee by apache.

the class GeronimoConnectionManagerFactoryTest method evictionNotAllEquals.

@Test
public void evictionNotAllEquals() throws Exception {
    final MyMcf mcf = new MyMcf();
    final GeronimoConnectionManagerFactory factory = new GeronimoConnectionManagerFactory();
    factory.setValidationInterval(new Duration("1 second"));
    factory.setTransactionSupport("local");
    factory.setMcf(mcf);
    factory.setPooling(true);
    factory.setPartitionStrategy("none");
    factory.setTransactionManager(new TransactionManagerImpl());
    factory.setPoolMinSize(1);
    factory.setAllConnectionsEqual(false);
    final GenericConnectionManager mgr = factory.create();
    mgr.doStart();
    try {
        mgr.allocateConnection(mcf, new // just to use it
        ConnectionRequestInfo() {
        });
        sleep(2500);
        assertTrue(mcf.evicted.get());
        assertTrue(mcf.destroyed.get());
    } finally {
        mgr.doStop();
    }
}
Also used : GenericConnectionManager(org.apache.geronimo.connector.outbound.GenericConnectionManager) TransactionManagerImpl(org.apache.geronimo.transaction.manager.TransactionManagerImpl) Duration(org.apache.openejb.util.Duration) Test(org.junit.Test)

Example 2 with TransactionManagerImpl

use of org.apache.geronimo.transaction.manager.TransactionManagerImpl in project tomee by apache.

the class GeronimoConnectionManagerFactoryTest method eviction.

// ensure we don't have an exception TOMEE-1806
@Test
public void eviction() throws Exception {
    final MyMcf mcf = new MyMcf();
    final GeronimoConnectionManagerFactory factory = new GeronimoConnectionManagerFactory();
    factory.setValidationInterval(new Duration("1 second"));
    factory.setTransactionSupport("local");
    factory.setMcf(mcf);
    factory.setPooling(true);
    factory.setPartitionStrategy("none");
    factory.setTransactionManager(new TransactionManagerImpl());
    factory.setPoolMinSize(1);
    factory.setAllConnectionsEqual(true);
    final GenericConnectionManager mgr = factory.create();
    mgr.doStart();
    try {
        mgr.allocateConnection(mcf, new // just to use it
        ConnectionRequestInfo() {
        });
        sleep(2500);
        assertTrue(mcf.evicted.get());
        assertTrue(mcf.destroyed.get());
    } finally {
        mgr.doStop();
    }
}
Also used : GenericConnectionManager(org.apache.geronimo.connector.outbound.GenericConnectionManager) TransactionManagerImpl(org.apache.geronimo.transaction.manager.TransactionManagerImpl) Duration(org.apache.openejb.util.Duration) Test(org.junit.Test)

Aggregations

GenericConnectionManager (org.apache.geronimo.connector.outbound.GenericConnectionManager)2 TransactionManagerImpl (org.apache.geronimo.transaction.manager.TransactionManagerImpl)2 Duration (org.apache.openejb.util.Duration)2 Test (org.junit.Test)2