Package javax.resource.spi

Examples of javax.resource.spi.ConnectionEventListener


    }

    public void testRemoveConnectionEventListener() 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);
View Full Code Here


        assertEquals("got back what we set", ri, mc.getConnectionRequestInfo());
    }

    public void testClose() throws Exception {
        final Object o = new Object();
        ConnectionEventListener listener = EasyMock.createMock(ConnectionEventListener.class);
        listener.connectionClosed(EasyMock.isA(ConnectionEvent.class));
        EasyMock.expectLastCall();
        EasyMock.replay(listener);
        mc.addConnectionEventListener(listener);
        mc.close(o);
        EasyMock.verify(listener);
View Full Code Here

        mc.close(o);
        EasyMock.verify(listener);
    }

    public void testError() throws Exception {
        ConnectionEventListener listener = EasyMock.createMock(ConnectionEventListener.class);
        mc.addConnectionEventListener(listener);
        listener.connectionErrorOccurred(EasyMock.isA(ConnectionEvent.class));
        EasyMock.expectLastCall();
        EasyMock.replay(listener);
        mc.error(new Exception(getName()));
        EasyMock.verify(listener);
    }
View Full Code Here

        EasyMock.verify(listener);
    }

    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);
    }
View Full Code Here

        EasyMock.verify(listener);
    }

    public void testSendEventTxStarted() throws Exception {
        ConnectionEvent event = new ConnectionEvent(mc, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
        ConnectionEventListener listener = EasyMock.createMock(ConnectionEventListener.class);
        mc.addConnectionEventListener(listener);
        listener.localTransactionStarted(EasyMock.isA(ConnectionEvent.class));
        EasyMock.expectLastCall();
        EasyMock.replay(listener);
        mc.sendEvent(event);
        EasyMock.verify(listener);
    }
View Full Code Here

        EasyMock.verify(listener);
    }

    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);
    }
View Full Code Here

        EasyMock.verify(listener);
    }

    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);
    }
View Full Code Here

    public void closedEvent(MockConnection mockConnection) {
        ConnectionEvent connectionEvent = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
        connectionEvent.setConnectionHandle(mockConnection);
        for (Iterator iterator = new ArrayList(connectionEventListeners).iterator(); iterator.hasNext();) {
            ConnectionEventListener connectionEventListener = (ConnectionEventListener) iterator.next();
            connectionEventListener.connectionClosed(connectionEvent);
        }
    }
View Full Code Here

    public void errorEvent(MockConnection mockConnection) {
        ConnectionEvent connectionEvent = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED);
        connectionEvent.setConnectionHandle(mockConnection);
        for (Iterator iterator = new ArrayList(connectionEventListeners).iterator(); iterator.hasNext();) {
            ConnectionEventListener connectionEventListener = (ConnectionEventListener) iterator.next();
            connectionEventListener.connectionErrorOccurred(connectionEvent);
        }
    }
View Full Code Here

    public void localTransactionStartedEvent(MockConnection mockConnection) {
        ConnectionEvent connectionEvent = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_STARTED);
        connectionEvent.setConnectionHandle(mockConnection);
        for (Iterator iterator = new ArrayList(connectionEventListeners).iterator(); iterator.hasNext();) {
            ConnectionEventListener connectionEventListener = (ConnectionEventListener) iterator.next();
            connectionEventListener.localTransactionStarted(connectionEvent);
        }
    }
View Full Code Here

TOP

Related Classes of javax.resource.spi.ConnectionEventListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.