use of org.codice.alliance.video.stream.mpegts.rollover.RolloverCondition in project alliance by codice.
the class UdpStreamProcessorTest method testSetStreamEndPlugin.
@Test
public void testSetStreamEndPlugin() throws InterruptedException {
StreamMonitor streamMonitor = mock(StreamMonitor.class);
UdpStreamProcessor udpStreamProcessor = new UdpStreamProcessor(streamMonitor);
RolloverCondition rolloverCondition = mock(RolloverCondition.class);
when(rolloverCondition.isRolloverReady(any())).thenReturn(true);
StreamEndPlugin streamEndPlugin = mock(StreamEndPlugin.class);
udpStreamProcessor.setStreamEndPlugin(streamEndPlugin);
udpStreamProcessor.setRolloverCondition(rolloverCondition);
udpStreamProcessor.setRolloverAction(mock(RolloverAction.class));
udpStreamProcessor.getPacketBuffer().write(new byte[] { 0x00 });
Thread.sleep(1000);
udpStreamProcessor.checkForRollover();
verify(streamEndPlugin).streamEnded(any());
}
use of org.codice.alliance.video.stream.mpegts.rollover.RolloverCondition in project alliance by codice.
the class UdpStreamProcessorTest method testCreateChannelHandlers.
@Test
public void testCreateChannelHandlers() {
StreamMonitor streamMonitor = mock(StreamMonitor.class);
when(streamMonitor.getTitle()).thenReturn(Optional.of("title"));
when(streamMonitor.getStreamUri()).thenReturn(Optional.of(URI.create("udp://127.0.0.1:80")));
RolloverCondition rolloverCondition = mock(RolloverCondition.class);
String filenameTemplate = "template";
FilenameGenerator filenameGenerator = mock(FilenameGenerator.class);
List<MetacardType> metacardTypeList = Collections.singletonList(mock(MetacardType.class));
CatalogFramework catalogFramework = mock(CatalogFramework.class);
UdpStreamProcessor udpStreamProcessor = new UdpStreamProcessor(streamMonitor);
udpStreamProcessor.setRolloverCondition(rolloverCondition);
udpStreamProcessor.setFilenameTemplate(filenameTemplate);
udpStreamProcessor.setFilenameGenerator(filenameGenerator);
udpStreamProcessor.setMetacardTypeList(metacardTypeList);
udpStreamProcessor.setCatalogFramework(catalogFramework);
udpStreamProcessor.setStreamCreationPlugin(context -> {
});
udpStreamProcessor.setStreamShutdownPlugin(mock(StreamShutdownPlugin.class));
udpStreamProcessor.setStreamCreationSubject(new SimpleSubject());
udpStreamProcessor.setParentMetacardUpdater(mock(MetacardUpdater.class));
udpStreamProcessor.init();
try {
assertThat(udpStreamProcessor.createChannelHandlers(), notNullValue());
} finally {
udpStreamProcessor.shutdown();
}
}
Aggregations