Search in sources :

Example 6 with DisconnectEventBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder in project openflowplugin by opendaylight.

the class SystemNotificationsListenerImplTest method testOnDisconnectEvent4.

/**
 * Broken scenario - connection is on but throws error on close.
 */
@Test
public void testOnDisconnectEvent4() throws Exception {
    Mockito.when(connectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.RIP);
    Mockito.when(connectionAdapter.isAlive()).thenReturn(false);
    DisconnectEvent disconnectNotification = new DisconnectEventBuilder().setInfo("testing disconnect").build();
    systemNotificationsListener.onDisconnectEvent(disconnectNotification);
    verifyCommonInvocationsSubSet();
    Mockito.verify(connectionContext).onConnectionClosed();
    Mockito.verify(connectionContext).getConnectionAdapter();
    Mockito.verify(connectionContext, Mockito.atLeastOnce()).getSafeNodeIdForLOG();
}
Also used : DisconnectEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder) DisconnectEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent) Test(org.junit.Test)

Example 7 with DisconnectEventBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder in project openflowplugin by opendaylight.

the class SystemNotificationsListenerImplTest method testOnDisconnectEvent1.

/**
 * Successful scenario - connection is on and closes without errors.
 */
@Test
public void testOnDisconnectEvent1() throws Exception {
    Mockito.when(connectionAdapter.isAlive()).thenReturn(true);
    Mockito.when(connectionAdapter.disconnect()).thenReturn(Futures.immediateFuture(Boolean.TRUE));
    DisconnectEvent disconnectNotification = new DisconnectEventBuilder().setInfo("testing disconnect").build();
    systemNotificationsListener.onDisconnectEvent(disconnectNotification);
    verifyCommonInvocationsSubSet();
    Mockito.verify(connectionContext).onConnectionClosed();
    Mockito.verify(connectionContext).getConnectionAdapter();
    Mockito.verify(connectionContext, Mockito.atLeastOnce()).getSafeNodeIdForLOG();
}
Also used : DisconnectEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder) DisconnectEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent) Test(org.junit.Test)

Aggregations

DisconnectEventBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder)7 Test (org.junit.Test)5 DisconnectEvent (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent)4 EchoRequestMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder)1 ErrorMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder)1 ExperimenterMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder)1 FlowRemovedMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder)1 HelloMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder)1 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)1 PacketInMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder)1 PortStatusMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder)1 SwitchIdleEventBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEventBuilder)1 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)1