Search in sources :

Example 21 with ConnectionEvent

use of javax.resource.spi.ConnectionEvent in project cxf by apache.

the class AbstractManagedConnectionImpl method close.

public void close(Object closingHandle) throws ResourceException {
    LOG.fine("Closing handle: " + closingHandle);
    ConnectionEvent coEvent = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    coEvent.setConnectionHandle(closingHandle);
    sendEvent(coEvent);
}
Also used : ConnectionEvent(javax.resource.spi.ConnectionEvent)

Example 22 with ConnectionEvent

use of javax.resource.spi.ConnectionEvent in project cxf by apache.

the class ManagedConnectionImplTest method testSendEventError.

@Test
public void testSendEventError() throws Exception {
    ConnectionEvent event = new ConnectionEvent(mc, ConnectionEvent.CONNECTION_ERROR_OCCURRED);
    ConnectionEventListener listener = EasyMock.createMock(ConnectionEventListener.class);
    mc.addConnectionEventListener(listener);
    listener.connectionErrorOccurred(EasyMock.isA(ConnectionEvent.class));
    EasyMock.expectLastCall();
    EasyMock.replay(listener);
    mc.sendEvent(event);
    EasyMock.verify(listener);
}
Also used : ConnectionEvent(javax.resource.spi.ConnectionEvent) ConnectionEventListener(javax.resource.spi.ConnectionEventListener) Test(org.junit.Test)

Example 23 with ConnectionEvent

use of javax.resource.spi.ConnectionEvent in project cxf by apache.

the class ManagedConnectionImplTest method testSendEventTxRolledBack.

@Test
public void testSendEventTxRolledBack() throws Exception {
    ConnectionEvent event = new ConnectionEvent(mc, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
    ConnectionEventListener listener = EasyMock.createMock(ConnectionEventListener.class);
    mc.addConnectionEventListener(listener);
    EasyMock.reset(listener);
    listener.localTransactionRolledback(EasyMock.isA(ConnectionEvent.class));
    EasyMock.expectLastCall();
    EasyMock.replay(listener);
    mc.sendEvent(event);
}
Also used : ConnectionEvent(javax.resource.spi.ConnectionEvent) ConnectionEventListener(javax.resource.spi.ConnectionEventListener) Test(org.junit.Test)

Example 24 with ConnectionEvent

use of javax.resource.spi.ConnectionEvent in project cxf by apache.

the class ManagedConnectionImplTest method testSendEventTxCommitted.

@Test
public void testSendEventTxCommitted() throws Exception {
    ConnectionEvent event = new ConnectionEvent(mc, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
    ConnectionEventListener listener = EasyMock.createMock(ConnectionEventListener.class);
    mc.addConnectionEventListener(listener);
    listener.localTransactionCommitted(EasyMock.isA(ConnectionEvent.class));
    EasyMock.expectLastCall();
    EasyMock.replay(listener);
    mc.sendEvent(event);
    EasyMock.verify(listener);
}
Also used : ConnectionEvent(javax.resource.spi.ConnectionEvent) ConnectionEventListener(javax.resource.spi.ConnectionEventListener) Test(org.junit.Test)

Aggregations

ConnectionEvent (javax.resource.spi.ConnectionEvent)24 ConnectionEventListener (javax.resource.spi.ConnectionEventListener)21 Test (org.junit.Test)5 BadConnectionEventListener (com.sun.appserv.connectors.internal.spi.BadConnectionEventListener)1 GFConnectionImpl (org.apache.geode.internal.ra.GFConnectionImpl)1