use of org.codice.imaging.nitf.core.common.DateTime in project alliance by codice.
the class ImageInputTransformerTest method testNitfWithDifferentImageDates.
@Test
public void testNitfWithDifferentImageDates() throws Exception {
File nitfFile = File.createTempFile("nitf-", ".ntf");
try {
final DateTime fileDateTime = NitfTestCommons.createNitfDateTime(2016, 1, 1, 0, 0, 0);
DateTime[] imageDateTimes = { NitfTestCommons.createNitfDateTime(2001, 1, 1, 0, 0, 0), NitfTestCommons.createNitfDateTime(2002, 1, 1, 0, 0, 0), NitfTestCommons.createNitfDateTime(2003, 1, 1, 0, 0, 0) };
createNitfWithDifferentImageDateTimes(nitfFile, fileDateTime, imageDateTimes);
try (InputStream inputStream = new FileInputStream(nitfFile)) {
Metacard metacard = metacardFactory.createMetacard("differentImageDateTimesTest");
NitfSegmentsFlow nitfSegmentsFlow = new NitfParserInputFlowImpl().inputStream(inputStream).headerOnly();
nitfSegmentsFlow = headerTransformer.transform(nitfSegmentsFlow, metacard);
metacard = transformer.transform(nitfSegmentsFlow, metacard);
assertNotNull(metacard);
validateDates(metacard, fileDateTime, imageDateTimes);
}
} finally {
nitfFile.delete();
}
}
use of org.codice.imaging.nitf.core.common.DateTime in project alliance by codice.
the class NitfAttributeConvertersTest method testConvertNitfDateWithNullZonedTime.
@Test
public void testConvertNitfDateWithNullZonedTime() {
// setup
DateTime mockDateTime = mock(DateTime.class);
doReturn(null).when(mockDateTime).getZonedDateTime();
// when
Date convertedDate = NitfAttributeConverters.nitfDate(mockDateTime);
// then
assertThat(convertedDate, is(nullValue()));
}
Aggregations