Bug 6949 / Bug 6950 - Implementation of start-time and stop-time
[netconf.git] / restconf / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / RestconfImplTest.java
index 7c4b350c6cf622a3259dfe43b0d5c8d051991591..dc7e2e9e9fc7038d45b0db93bc2cd075080f3ca4 100644 (file)
@@ -16,7 +16,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
@@ -24,9 +23,12 @@ import com.google.common.util.concurrent.Futures;
 import java.io.FileNotFoundException;
 import java.net.URI;
 import java.text.ParseException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map.Entry;
 import java.util.Set;
 import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
 import org.junit.Before;
@@ -111,7 +113,8 @@ public class RestconfImplTest {
         doReturn(mount).when(iiCtx).getMountPoint();
         final DOMRpcService rpcService = mock(DOMRpcService.class);
         doReturn(Optional.of(rpcService)).when(mount).getService(DOMRpcService.class);
-        doReturn(Futures.immediateCheckedFuture(mock(DOMRpcResult.class))).when(rpcService).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class));
+        doReturn(Futures.immediateCheckedFuture(mock(DOMRpcResult.class))).when(rpcService)
+                .invokeRpc(any(SchemaPath.class), any(NormalizedNode.class));
         this.restconfImpl.invokeRpc("randomId", ctx, uriInfo);
         this.restconfImpl.invokeRpc("ietf-netconf", ctx, uriInfo);
         verify(rpcService, times(2)).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class));
@@ -174,13 +177,16 @@ public class RestconfImplTest {
         when(uriBuilder.build()).thenReturn(new URI(""));
         when(uriBuilder.scheme("ws")).thenReturn(uriBuilder);
         when(uriInfo.getAbsolutePathBuilder()).thenReturn(uriBuilder);
+        final MultivaluedMap<String, String> map = mock(MultivaluedMap.class);
+        final Set<Entry<String, List<String>>> set = new HashSet<>();
+        when(map.entrySet()).thenReturn(set);
+        when(uriInfo.getQueryParameters()).thenReturn(map);
 
         final BrokerFacade brokerFacade = mock(BrokerFacade.class);
         this.restconfImpl.setBroker(brokerFacade);
 
         // subscribe to stream and verify response
-        final Response response = this.restconfImpl.subscribeToStream(identifier, uriInfo);
-        assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+        final NormalizedNodeContext response = this.restconfImpl.subscribeToStream(identifier, uriInfo);
 
         // remove test notification stream
         Notificator.removeAllListeners();