Search in sources :

Example 1 with StreamEndPlugin

use of org.codice.alliance.video.stream.mpegts.plugins.StreamEndPlugin 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());
}
Also used : StreamEndPlugin(org.codice.alliance.video.stream.mpegts.plugins.StreamEndPlugin) StreamMonitor(org.codice.alliance.video.stream.mpegts.StreamMonitor) RolloverAction(org.codice.alliance.video.stream.mpegts.rollover.RolloverAction) RolloverCondition(org.codice.alliance.video.stream.mpegts.rollover.RolloverCondition) Test(org.junit.Test)

Aggregations

StreamMonitor (org.codice.alliance.video.stream.mpegts.StreamMonitor)1 StreamEndPlugin (org.codice.alliance.video.stream.mpegts.plugins.StreamEndPlugin)1 RolloverAction (org.codice.alliance.video.stream.mpegts.rollover.RolloverAction)1 RolloverCondition (org.codice.alliance.video.stream.mpegts.rollover.RolloverCondition)1 Test (org.junit.Test)1