use of org.codice.alliance.video.stream.mpegts.UdpStreamMonitor in project alliance by codice.
the class StreamMonitorHelperTest method setUp.
@Before
public void setUp() throws Exception {
bundleContext = mock(BundleContext.class);
uri = new URI(TEST_URL);
List<ServiceReference<StreamMonitor>> serviceReferences = new ArrayList<>();
udpStreamMonitor = mock(UdpStreamMonitor.class);
ServiceReference<StreamMonitor> streamMonitorServiceReference = mock(ServiceReference.class);
serviceReferences.add(streamMonitorServiceReference);
when(bundleContext.getServiceReferences(eq(StreamMonitor.class), anyString())).thenReturn(serviceReferences);
when(udpStreamMonitor.getTitle()).thenReturn(Optional.of("test"));
when(udpStreamMonitor.getStreamUri()).thenReturn(Optional.of(uri));
// when(udpStreamMonitor.startMonitoring()).thenReturn(Optional.of(uri));
doAnswer(invocation -> {
isMonitoring = true;
return null;
}).when(udpStreamMonitor).startMonitoring();
doAnswer(invocation -> {
isMonitoring = false;
return null;
}).when(udpStreamMonitor).stopMonitoring();
when(bundleContext.getService(any(ServiceReference.class))).thenReturn(udpStreamMonitor);
when(streamMonitorServiceReference.getProperty(anyString())).thenReturn(StreamMonitorHelper.SERVICE_PID);
stream = new StreamMonitorHelper();
stream.setContext(bundleContext);
}
Aggregations