use of org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor in project alliance by codice.
the class FindChildrenStreamEndPluginTest method setup.
@Before
public void setup() throws UnsupportedQueryException, SourceUnavailableException, FederationException {
catalogFramework = mock(CatalogFramework.class);
parentMetacard = mock(Metacard.class);
metacard1 = mock(Metacard.class);
metacard2 = mock(Metacard.class);
Result result1 = mock(Result.class);
when(result1.getMetacard()).thenReturn(metacard1);
Result result2 = mock(Result.class);
when(result2.getMetacard()).thenReturn(metacard2);
queryResponse1 = mock(QueryResponse.class);
when(queryResponse1.getHits()).thenReturn(2L);
when(queryResponse1.getResults()).thenReturn(Collections.singletonList(result1));
queryResponse2 = mock(QueryResponse.class);
when(queryResponse2.getHits()).thenReturn(2L);
when(queryResponse2.getResults()).thenReturn(Collections.singletonList(result2));
when(catalogFramework.query(any())).thenReturn(queryResponse1, queryResponse2);
UdpStreamProcessor udpStreamProcessor = mock(UdpStreamProcessor.class);
when(udpStreamProcessor.getCatalogFramework()).thenReturn(catalogFramework);
context = new Context(udpStreamProcessor);
context.setParentMetacard(parentMetacard);
handler = mock(FindChildrenStreamEndPlugin.Handler.class);
FindChildrenStreamEndPlugin.Factory factory = mock(FindChildrenStreamEndPlugin.Factory.class);
when(factory.build()).thenReturn(handler);
findChildrenStreamEndPlugin = new FindChildrenStreamEndPlugin(new GeotoolsFilterBuilder(), factory);
}
use of org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor 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);
}
use of org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor in project alliance by codice.
the class RolloverStreamCreationPluginTest method testOnCreate.
@Test
public void testOnCreate() throws StreamCreationException {
Context context = mock(Context.class);
UdpStreamProcessor udpStreamProcessor = mock(UdpStreamProcessor.class);
when(context.getUdpStreamProcessor()).thenReturn(udpStreamProcessor);
when(udpStreamProcessor.getFilenameGenerator()).thenReturn(mock(FilenameGenerator.class));
when(udpStreamProcessor.getFilenameTemplate()).thenReturn("template");
when(udpStreamProcessor.getCatalogFramework()).thenReturn(mock(CatalogFramework.class));
when(udpStreamProcessor.getParentMetacardUpdater()).thenReturn(mock(MetacardUpdater.class));
UuidGenerator uuidGenerator = mock(UuidGenerator.class);
when(uuidGenerator.generateUuid()).thenReturn("anId");
when(udpStreamProcessor.getUuidGenerator()).thenReturn(uuidGenerator);
RolloverStreamCreationPlugin rolloverStreamCreationPlugin = new RolloverStreamCreationPlugin();
rolloverStreamCreationPlugin.onCreate(context);
verify(udpStreamProcessor).setRolloverAction(any());
}
use of org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor in project alliance by codice.
the class TimerStreamCreationPluginTest method testOnCreate.
@Test
public void testOnCreate() throws StreamCreationException {
Context context = mock(Context.class);
UdpStreamProcessor udpStreamProcessor = mock(UdpStreamProcessor.class);
Supplier<Timer> timerSupplier = mock(Supplier.class);
Timer timer = mock(Timer.class);
when(context.getUdpStreamProcessor()).thenReturn(udpStreamProcessor);
when(timerSupplier.get()).thenReturn(timer);
TimerStreamCreationPlugin timerStreamCreationPlugin = new TimerStreamCreationPlugin(timerSupplier);
timerStreamCreationPlugin.onCreate(context);
verify(udpStreamProcessor).setTimer(timer);
}
use of org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor in project alliance by codice.
the class TimerStreamShutdownPluginTest method testOnShutdown.
@Test
public void testOnShutdown() throws StreamShutdownException {
Context context = mock(Context.class);
UdpStreamProcessor udpStreamProcessor = mock(UdpStreamProcessor.class);
Timer timer = mock(Timer.class);
when(context.getUdpStreamProcessor()).thenReturn(udpStreamProcessor);
when(udpStreamProcessor.getTimer()).thenReturn(timer);
TimerStreamShutdownPlugin timerStreamShutdownPlugin = new TimerStreamShutdownPlugin();
timerStreamShutdownPlugin.onShutdown(context);
verify(timer).cancel();
}
Aggregations