use of org.codice.imaging.nitf.fluent.NitfSegmentsFlow in project alliance by codice.
the class RoutingSlipTest method testChannelImageTre.
@Test
public void testChannelImageTre() throws FileNotFoundException, NitfFormatException {
NitfSegmentsFlow parserInputFlow = new NitfParserInputFlowImpl().file(new File(IMAGE_TRE_NTF_FILENAME)).headerOnly();
String channel = routingSlip.channel(parserInputFlow);
assertThat(channel, is(RoutingSlip.IMAGE_ROUTE));
}
use of org.codice.imaging.nitf.fluent.NitfSegmentsFlow in project alliance by codice.
the class RoutingSlipTest method testChannelNoImageNoTre.
@Test
public void testChannelNoImageNoTre() throws FileNotFoundException, NitfFormatException {
NitfSegmentsFlow parserInputFlow = new NitfParserInputFlowImpl().file(new File(NO_IMAGE_NO_TRE_NTF_FILENAME)).headerOnly();
String channel = routingSlip.channel(parserInputFlow);
assertThat(channel, is(RoutingSlip.IMAGE_ROUTE));
}
use of org.codice.imaging.nitf.fluent.NitfSegmentsFlow in project alliance by codice.
the class RoutingSlipTest method testChannelImageNoTres.
@Test
public void testChannelImageNoTres() throws FileNotFoundException, NitfFormatException {
NitfSegmentsFlow parserInputFlow = new NitfParserInputFlowImpl().file(new File(IMAGE_NO_TRE_NTF_FILENAME)).headerOnly();
String channel = routingSlip.channel(parserInputFlow);
assertThat(channel, is(RoutingSlip.IMAGE_ROUTE));
}
use of org.codice.imaging.nitf.fluent.NitfSegmentsFlow in project alliance by codice.
the class RoutingSlipTest method testChannelNoImageTre.
@Test
public void testChannelNoImageTre() throws FileNotFoundException, NitfFormatException {
NitfSegmentsFlow parserInputFlow = new NitfParserInputFlowImpl().file(new File(NO_IMAGE_TRE_NTF_FILENAME)).headerOnly();
String channel = routingSlip.channel(parserInputFlow);
assertThat(channel, is(RoutingSlip.GMTI_ROUTE));
}
use of org.codice.imaging.nitf.fluent.NitfSegmentsFlow in project alliance by codice.
the class NitfHeaderTransformerTest method testValidationWarningsOnNitfAttributeTransformException.
@Test
public void testValidationWarningsOnNitfAttributeTransformException() throws Exception {
String originalNitfValue = "US";
NitfTestCommons.setupNitfUtilities(originalNitfValue, Arrays.asList("USA", "CAN"));
File nitfFile = temporaryFolder.newFile("nitf-attribute-header-test.ntf");
FileSecurityMetadata fileSecurityMetadata = TreUtilityTest.createSecurityMetadata();
when(fileSecurityMetadata.getSecurityClassificationSystem()).thenReturn(originalNitfValue);
Supplier<NitfHeader> nitfHeader = () -> TreUtilityTest.createFileHeader(fileSecurityMetadata);
new NitfCreationFlowImpl().fileHeader(nitfHeader).write(nitfFile.getAbsolutePath());
Metacard metacard;
try (InputStream inputStream = new FileInputStream(nitfFile)) {
metacard = metacardFactory.createMetacard("nitfHeaderTest");
NitfSegmentsFlow nitfSegmentsFlow = new NitfParserInputFlowImpl().inputStream(inputStream).headerOnly();
nitfHeaderTransformer.transform(nitfSegmentsFlow, metacard);
}
assertThat(metacard, is(not(nullValue())));
assertThat(metacard.getAttribute(Validation.VALIDATION_WARNINGS).getValues().size(), equalTo(1));
assertThat(metacard.getAttribute(Security.CLASSIFICATION_SYSTEM).getValue(), is(originalNitfValue));
}
Aggregations