Merge "Fix channelInactive event handling in the netty pipeline for netconf."
[controller.git] / opendaylight / netconf / netconf-impl / src / test / java / org / opendaylight / controller / netconf / impl / NetconfMonitoringServiceImplTest.java
index a188550d40be72ab9b16e363d81627378c8f7bb9..0d296c5f5269c0662f9b27db9d6ef1973038d8c8 100644 (file)
@@ -8,6 +8,17 @@
 
 package org.opendaylight.controller.netconf.impl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
@@ -18,8 +29,6 @@ import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.netconf.api.monitoring.NetconfManagementSession;
-import org.opendaylight.controller.netconf.impl.NetconfServerSession;
-import org.opendaylight.controller.netconf.impl.NetconfServerSessionListener;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfMonitoringServiceImpl;
 import org.opendaylight.controller.netconf.mapping.api.Capability;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationProvider;
@@ -27,11 +36,6 @@ import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceSnapshot;
 import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.*;
-
 public class NetconfMonitoringServiceImplTest {
 
     private NetconfMonitoringServiceImpl service;
@@ -73,8 +77,8 @@ public class NetconfMonitoringServiceImplTest {
     public void testGetSchemas3() throws Exception {
         doReturn("").when(managementSession).toString();
         Capability cap = mock(Capability.class);
-        Set caps = Sets.newHashSet(cap);
-        Set services = Sets.newHashSet(operationService);
+        Set<Capability> caps = Sets.newHashSet(cap);
+        Set<NetconfOperationService> services = Sets.newHashSet(operationService);
         doReturn(snapshot).when(operationProvider).openSnapshot(anyString());
         doReturn(services).when(snapshot).getServices();
         doReturn(caps).when(operationService).getCapabilities();
@@ -94,6 +98,7 @@ public class NetconfMonitoringServiceImplTest {
 
         NetconfServerSessionListener sessionListener = mock(NetconfServerSessionListener.class);
         Channel channel = mock(Channel.class);
+        doReturn("mockChannel").when(channel).toString();
         NetconfHelloMessageAdditionalHeader header = new NetconfHelloMessageAdditionalHeader("name", "addr", "2", "tcp", "id");
         NetconfServerSession sm = new NetconfServerSession(sessionListener, channel, 10, header);
         doNothing().when(sessionListener).onSessionUp(any(NetconfServerSession.class));