Search in sources :

Example 1 with PacketBuffer

use of org.codice.alliance.video.stream.mpegts.netty.PacketBuffer in project alliance by codice.

the class FlushPacketBufferStreamShutdownPluginTest method testOnShutdown.

@Test
public void testOnShutdown() throws StreamShutdownException, IOException {
    Context context = mock(Context.class);
    UdpStreamProcessor udpStreamProcessor = mock(UdpStreamProcessor.class);
    PacketBuffer packetBuffer = mock(PacketBuffer.class);
    File file = mock(File.class);
    when(context.getUdpStreamProcessor()).thenReturn(udpStreamProcessor);
    when(udpStreamProcessor.getPacketBuffer()).thenReturn(packetBuffer);
    when(packetBuffer.flushAndRotate()).thenReturn(new RotateResult(file, false));
    FlushPacketBufferStreamShutdownPlugin flushPacketBufferStreamShutdownPlugin = new FlushPacketBufferStreamShutdownPlugin();
    flushPacketBufferStreamShutdownPlugin.onShutdown(context);
    verify(udpStreamProcessor).doRollover(file);
}
Also used : Context(org.codice.alliance.video.stream.mpegts.Context) UdpStreamProcessor(org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor) File(java.io.File) PacketBuffer(org.codice.alliance.video.stream.mpegts.netty.PacketBuffer) RotateResult(org.codice.alliance.video.stream.mpegts.netty.RotateResult) Test(org.junit.Test)

Example 2 with PacketBuffer

use of org.codice.alliance.video.stream.mpegts.netty.PacketBuffer in project alliance by codice.

the class ResetPacketBufferStreamShutdownPluginTest method testOnShutdown.

@Test
public void testOnShutdown() throws StreamShutdownException {
    PacketBuffer packetBuffer = mock(PacketBuffer.class);
    UdpStreamProcessor udpStreamProcessor = mock(UdpStreamProcessor.class);
    Context context = mock(Context.class);
    when(context.getUdpStreamProcessor()).thenReturn(udpStreamProcessor);
    when(udpStreamProcessor.getPacketBuffer()).thenReturn(packetBuffer);
    ResetPacketBufferStreamShutdownPlugin resetPacketBufferStreamShutdownPlugin = new ResetPacketBufferStreamShutdownPlugin();
    resetPacketBufferStreamShutdownPlugin.onShutdown(context);
    verify(packetBuffer).reset();
}
Also used : Context(org.codice.alliance.video.stream.mpegts.Context) UdpStreamProcessor(org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor) PacketBuffer(org.codice.alliance.video.stream.mpegts.netty.PacketBuffer) Test(org.junit.Test)

Aggregations

Context (org.codice.alliance.video.stream.mpegts.Context)2 PacketBuffer (org.codice.alliance.video.stream.mpegts.netty.PacketBuffer)2 UdpStreamProcessor (org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor)2 Test (org.junit.Test)2 File (java.io.File)1 RotateResult (org.codice.alliance.video.stream.mpegts.netty.RotateResult)1