Search in sources :

Example 6 with Context

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

the class ListStreamShutdownPluginTest method testOnShutdown.

@Test
public void testOnShutdown() throws StreamShutdownException {
    Context context = mock(Context.class);
    StreamShutdownPlugin streamShutdownPlugin = mock(StreamShutdownPlugin.class);
    ListStreamShutdownPlugin listStreamShutdownPlugin = new ListStreamShutdownPlugin(Collections.singletonList(streamShutdownPlugin));
    listStreamShutdownPlugin.onShutdown(context);
    verify(streamShutdownPlugin).onShutdown(context);
}
Also used : Context(org.codice.alliance.video.stream.mpegts.Context) Test(org.junit.Test)

Example 7 with Context

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

the class LocationUpdateFieldTest method testWhenChildrenHaveEmptyLocation.

@Test
public void testWhenChildrenHaveEmptyLocation() {
    Metacard parentMetacard = mock(Metacard.class);
    Metacard childMetacard1 = mock(Metacard.class);
    when(childMetacard1.getLocation()).thenReturn("");
    Metacard childMetacard2 = mock(Metacard.class);
    when(childMetacard2.getLocation()).thenReturn("");
    Metacard childMetacard3 = mock(Metacard.class);
    when(childMetacard3.getLocation()).thenReturn("");
    LocationUpdateField locUpdateField = new LocationUpdateField(GeometryOperator.IDENTITY, GeometryOperator.IDENTITY);
    Context context = mock(Context.class);
    locUpdateField.updateField(parentMetacard, Collections.singletonList(childMetacard1), context);
    locUpdateField.updateField(parentMetacard, Arrays.asList(childMetacard2, childMetacard3), context);
    locUpdateField.end(parentMetacard, context);
    verify(parentMetacard, never()).setAttribute(any());
}
Also used : Context(org.codice.alliance.video.stream.mpegts.Context) Metacard(ddf.catalog.data.Metacard) Test(org.junit.Test)

Example 8 with Context

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

the class LocationUpdateFieldTest method testWhenChildrenAreMissingLocation.

@Test
public void testWhenChildrenAreMissingLocation() {
    Metacard parentMetacard = mock(Metacard.class);
    Metacard childMetacard1 = mock(Metacard.class);
    Metacard childMetacard2 = mock(Metacard.class);
    Metacard childMetacard3 = mock(Metacard.class);
    LocationUpdateField locUpdateField = new LocationUpdateField(GeometryOperator.IDENTITY, GeometryOperator.IDENTITY);
    Context context = mock(Context.class);
    locUpdateField.updateField(parentMetacard, Collections.singletonList(childMetacard1), context);
    locUpdateField.updateField(parentMetacard, Arrays.asList(childMetacard2, childMetacard3), context);
    locUpdateField.end(parentMetacard, context);
    verify(parentMetacard, never()).setAttribute(any());
}
Also used : Context(org.codice.alliance.video.stream.mpegts.Context) Metacard(ddf.catalog.data.Metacard) Test(org.junit.Test)

Example 9 with Context

use of org.codice.alliance.video.stream.mpegts.Context 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());
}
Also used : Context(org.codice.alliance.video.stream.mpegts.Context) UuidGenerator(org.codice.ddf.platform.util.uuidgenerator.UuidGenerator) MetacardUpdater(org.codice.alliance.video.stream.mpegts.metacard.MetacardUpdater) FilenameGenerator(org.codice.alliance.video.stream.mpegts.filename.FilenameGenerator) CatalogFramework(ddf.catalog.CatalogFramework) UdpStreamProcessor(org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor) Test(org.junit.Test)

Example 10 with Context

use of org.codice.alliance.video.stream.mpegts.Context 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);
}
Also used : Context(org.codice.alliance.video.stream.mpegts.Context) Timer(java.util.Timer) UdpStreamProcessor(org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor) Test(org.junit.Test)

Aggregations

Context (org.codice.alliance.video.stream.mpegts.Context)29 Test (org.junit.Test)24 Metacard (ddf.catalog.data.Metacard)19 UdpStreamProcessor (org.codice.alliance.video.stream.mpegts.netty.UdpStreamProcessor)10 GeometryOperator (org.codice.alliance.libs.klv.GeometryOperator)8 Attribute (ddf.catalog.data.Attribute)7 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)7 GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)6 CatalogFramework (ddf.catalog.CatalogFramework)5 Geometry (com.vividsolutions.jts.geom.Geometry)4 WKTReader (com.vividsolutions.jts.io.WKTReader)4 List (java.util.List)3 Timer (java.util.Timer)3 Before (org.junit.Before)3 WKTWriter (com.vividsolutions.jts.io.WKTWriter)2 MetacardType (ddf.catalog.data.MetacardType)2 CreateRequest (ddf.catalog.operation.CreateRequest)2 CreateResponse (ddf.catalog.operation.CreateResponse)2 Update (ddf.catalog.operation.Update)2 UpdateResponse (ddf.catalog.operation.UpdateResponse)2