use of org.codice.alliance.video.stream.mpegts.Context 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();
}
use of org.codice.alliance.video.stream.mpegts.Context in project alliance by codice.
the class TimerTaskStreamCreationPluginTest method testOnCreate.
/**
* Use a real Timer instead of a mock timer to make sure the timer task is scheduled correctly and
* calls the checkRollover method.
*
* @throws StreamCreationException
* @throws InterruptedException
*/
@Test
public void testOnCreate() throws StreamCreationException, InterruptedException {
long period = 100;
Timer timer = new Timer();
try {
Context context = mock(Context.class);
UdpStreamProcessor udpStreamProcessor = mock(UdpStreamProcessor.class);
when(context.getUdpStreamProcessor()).thenReturn(udpStreamProcessor);
when(udpStreamProcessor.getTimer()).thenReturn(timer);
TimerTaskStreamCreationPlugin timerTaskStreamCreationPlugin = new TimerTaskStreamCreationPlugin(period);
timerTaskStreamCreationPlugin.onCreate(context);
verify(udpStreamProcessor, after((int) period * 2).atLeastOnce()).checkForRollover();
} finally {
timer.cancel();
}
}
use of org.codice.alliance.video.stream.mpegts.Context in project alliance by codice.
the class UpdateFieldListTest method testEnd.
@Test
public void testEnd() {
UpdateParent.UpdateField updateField = mock(UpdateParent.UpdateField.class);
UpdateFieldList updateFieldList = new UpdateFieldList(Collections.singletonList(updateField));
Metacard parent = mock(Metacard.class);
Context context = mock(Context.class);
updateFieldList.end(parent, context);
verify(updateField).end(parent, context);
}
use of org.codice.alliance.video.stream.mpegts.Context in project alliance by codice.
the class UpdateFieldListTest method testUpdateField.
@Test
public void testUpdateField() {
UpdateParent.UpdateField updateField = mock(UpdateParent.UpdateField.class);
UpdateFieldList updateFieldList = new UpdateFieldList(Collections.singletonList(updateField));
Metacard parent = mock(Metacard.class);
List<Metacard> children = mock(List.class);
Context context = mock(Context.class);
updateFieldList.updateField(parent, children, context);
verify(updateField).updateField(parent, children, context);
}
use of org.codice.alliance.video.stream.mpegts.Context in project alliance by codice.
the class UpdateParentTest method testHandle.
/**
* Test that #handle calls the UpdateField object
*/
@Test
public void testHandle() {
UpdateParent.UpdateField updateField = mock(UpdateParent.UpdateField.class);
UpdateParent updateParent = new UpdateParent(updateField);
Context context = mock(Context.class);
Metacard parent = mock(Metacard.class);
List<Metacard> children = mock(List.class);
updateParent.handle(context, parent, children);
verify(updateField).updateField(parent, children, context);
}
Aggregations