Merge "BUG-4117: preparation for FlowCapableNode notification impl."
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / connection / listener / SystemNotificationsListenerImplTest.java
index e2cb7224d3ce0fdffd39fefdddb013de88166399..a361d61ac9ca60eeda8a1d0ea438a5ec88f60382 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 public class SystemNotificationsListenerImplTest {
 
     public static final int SAFE_TIMEOUT = 1000;
+    private final static int ECHO_REPLY_TIMEOUT = 2000;
     @Mock
     private org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter connectionAdapter;
     @Mock
@@ -55,16 +56,17 @@ public class SystemNotificationsListenerImplTest {
         connectionContextGolem = new ConnectionContextImpl(connectionAdapter);
         connectionContextGolem.changeStateToWorking();
         connectionContextGolem.setNodeId(nodeId);
+        connectionContext = Mockito.spy(connectionContextGolem);
 
         Mockito.when(connectionAdapter.getRemoteAddress()).thenReturn(
                 InetSocketAddress.createUnresolved("unit-odl.example.org", 4242));
-        connectionContext = Mockito.spy(connectionContextGolem);
+
         Mockito.when(features.getAuxiliaryId()).thenReturn((short) 0);
 
         Mockito.when(connectionContext.getConnectionAdapter()).thenReturn(connectionAdapter);
         Mockito.when(connectionContext.getFeatures()).thenReturn(features);
 
-        systemNotificationsListener = new SystemNotificationsListenerImpl(connectionContext);
+        systemNotificationsListener = new SystemNotificationsListenerImpl(connectionContext, ECHO_REPLY_TIMEOUT);
     }
 
     @After
@@ -87,6 +89,8 @@ public class SystemNotificationsListenerImplTest {
 
         verifyCommonInvocationsSubSet();
         Mockito.verify(connectionContext).onConnectionClosed();
+        Mockito.verify(connectionContext).getConnectionAdapter();
+        Mockito.verify(connectionContext).getNodeId();
     }
 
     /**
@@ -104,6 +108,8 @@ public class SystemNotificationsListenerImplTest {
 
         verifyCommonInvocationsSubSet();
         Mockito.verify(connectionContext).onConnectionClosed();
+        Mockito.verify(connectionContext).getConnectionAdapter();
+        Mockito.verify(connectionContext).getNodeId();
     }
 
     /**
@@ -123,6 +129,8 @@ public class SystemNotificationsListenerImplTest {
 
         verifyCommonInvocationsSubSet();
         Mockito.verify(connectionContext).onConnectionClosed();
+        Mockito.verify(connectionContext).getConnectionAdapter();
+        Mockito.verify(connectionContext).getNodeId();
     }
 
     /**
@@ -140,6 +148,8 @@ public class SystemNotificationsListenerImplTest {
 
         verifyCommonInvocationsSubSet();
         Mockito.verify(connectionContext).onConnectionClosed();
+        Mockito.verify(connectionContext).getConnectionAdapter();
+        Mockito.verify(connectionContext).getNodeId();
     }
 
     /**
@@ -189,6 +199,8 @@ public class SystemNotificationsListenerImplTest {
         Mockito.verify(connectionAdapter).disconnect();
         Mockito.verify(connectionContext).changeStateToTimeouting();
         Mockito.verify(connectionContext).closeConnection(true);
+        Mockito.verify(connectionContext).getNodeId();
+
     }
 
     private void verifyCommonInvocations() {