Search in sources :

Example 1 with NitfParserInputFlowImpl

use of org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl in project alliance by codice.

the class NitfGmtiTransformerTest method testTre.

@Test
public void testTre() throws IOException, CatalogTransformerException, NitfFormatException {
    NitfSegmentsFlow nitfSegmentsFlow = new NitfParserInputFlowImpl().inputStream(getInputStream(GMTI_TEST_NITF)).allData();
    Metacard metacard = metacardFactory.createMetacard("101");
    nitfSegmentsFlow = nitfHeaderTransformer.transform(nitfSegmentsFlow, metacard);
    metacard = nitfGmtiTransformer.transform(nitfSegmentsFlow, metacard);
    assertNotNull(metacard);
    validateDate(metacard.getCreatedDate(), "2016-06-22 23:39:22");
    validateDate(metacard.getEffectiveDate(), "2016-06-22 23:39:22");
    validateDate(metacard.getModifiedDate(), "2016-06-22 23:39:22");
    assertThat(metacard.getMetacardType().getName(), is("isr.gmti"));
    Map<NitfAttribute, String> mtirpbAttributesMap = initMtirpbAttributes();
    assertMtirpbAttributes(metacard, mtirpbAttributesMap);
}
Also used : Metacard(ddf.catalog.data.Metacard) NitfSegmentsFlow(org.codice.imaging.nitf.fluent.NitfSegmentsFlow) NitfAttribute(org.codice.alliance.transformer.nitf.common.NitfAttribute) NitfParserInputFlowImpl(org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl) TreUtilityTest(org.codice.alliance.transformer.nitf.TreUtilityTest) Test(org.junit.Test)

Example 2 with NitfParserInputFlowImpl

use of org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl in project alliance by codice.

the class ImageInputTransformerTest method testPiaprd.

@Test
public void testPiaprd() throws IOException, NitfFormatException {
    File nitfFile = File.createTempFile("nitf-", ".ntf");
    try {
        Map<NitfAttribute, NitfValue> treMap = createNitfWithPiaprd(nitfFile);
        try (InputStream inputStream = new FileInputStream(nitfFile)) {
            Metacard metacard = metacardFactory.createMetacard("piaprdTest");
            NitfSegmentsFlow nitfSegmentsFlow = new NitfParserInputFlowImpl().inputStream(inputStream).headerOnly();
            headerTransformer.transform(nitfSegmentsFlow, metacard);
            transformer.transform(nitfSegmentsFlow, metacard);
            assertAttributesMap(metacard, treMap);
        }
    } finally {
        nitfFile.delete();
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) NitfSegmentsFlow(org.codice.imaging.nitf.fluent.NitfSegmentsFlow) NitfAttribute(org.codice.alliance.transformer.nitf.common.NitfAttribute) NitfParserInputFlowImpl(org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl) File(java.io.File) FileInputStream(java.io.FileInputStream) TreUtilityTest(org.codice.alliance.transformer.nitf.TreUtilityTest) Test(org.junit.Test)

Example 3 with NitfParserInputFlowImpl

use of org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl in project alliance by codice.

the class ImageInputTransformerTest method testCsexra.

private void testCsexra(Consumer<Metacard> consumer) throws IOException, NitfFormatException {
    File nitfFile = File.createTempFile("nitf-", ".ntf");
    try {
        createNitfWithCsexra(nitfFile);
        try (InputStream inputStream = new FileInputStream(nitfFile)) {
            Metacard metacard = metacardFactory.createMetacard("csexraTest");
            NitfSegmentsFlow nitfSegmentsFlow = new NitfParserInputFlowImpl().inputStream(inputStream).headerOnly();
            transformer.transform(nitfSegmentsFlow, metacard);
            consumer.accept(metacard);
        }
    } finally {
        nitfFile.delete();
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) NitfSegmentsFlow(org.codice.imaging.nitf.fluent.NitfSegmentsFlow) NitfParserInputFlowImpl(org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 4 with NitfParserInputFlowImpl

use of org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl in project alliance by codice.

the class ImageInputTransformerTest method testCsdida.

@Test
public void testCsdida() throws IOException, NitfFormatException {
    File nitfFile = File.createTempFile("nitf-", ".ntf");
    try {
        createNitfWithCsdida(nitfFile);
        try (InputStream inputStream = new FileInputStream(nitfFile)) {
            Metacard metacard = metacardFactory.createMetacard("csexraTest");
            NitfSegmentsFlow nitfSegmentsFlow = new NitfParserInputFlowImpl().inputStream(inputStream).headerOnly();
            headerTransformer.transform(nitfSegmentsFlow, metacard);
            assertThat(metacard.getAttribute(Isr.PLATFORM_ID).getValue(), is("XY01"));
        }
    } finally {
        nitfFile.delete();
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) NitfSegmentsFlow(org.codice.imaging.nitf.fluent.NitfSegmentsFlow) NitfParserInputFlowImpl(org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl) File(java.io.File) FileInputStream(java.io.FileInputStream) TreUtilityTest(org.codice.alliance.transformer.nitf.TreUtilityTest) Test(org.junit.Test)

Example 5 with NitfParserInputFlowImpl

use of org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl in project alliance by codice.

the class ImageInputTransformerTest method testAimidb.

@Test
public void testAimidb() throws IOException, NitfFormatException {
    File nitfFile = File.createTempFile("nitf-", ".ntf");
    try {
        Map<NitfAttribute, NitfValue> treMap = createNitfWithAimidb(nitfFile);
        try (InputStream inputStream = new FileInputStream(nitfFile)) {
            Metacard metacard = metacardFactory.createMetacard("aimidbTest");
            NitfSegmentsFlow nitfSegmentsFlow = new NitfParserInputFlowImpl().inputStream(inputStream).headerOnly();
            headerTransformer.transform(nitfSegmentsFlow, metacard);
            transformer.transform(nitfSegmentsFlow, metacard);
            assertAttributesMap(metacard, treMap);
        }
    } finally {
        nitfFile.delete();
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) NitfSegmentsFlow(org.codice.imaging.nitf.fluent.NitfSegmentsFlow) NitfAttribute(org.codice.alliance.transformer.nitf.common.NitfAttribute) NitfParserInputFlowImpl(org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl) File(java.io.File) FileInputStream(java.io.FileInputStream) TreUtilityTest(org.codice.alliance.transformer.nitf.TreUtilityTest) Test(org.junit.Test)

Aggregations

NitfParserInputFlowImpl (org.codice.imaging.nitf.fluent.impl.NitfParserInputFlowImpl)23 NitfSegmentsFlow (org.codice.imaging.nitf.fluent.NitfSegmentsFlow)22 Test (org.junit.Test)20 File (java.io.File)13 Metacard (ddf.catalog.data.Metacard)12 InputStream (java.io.InputStream)12 FileInputStream (java.io.FileInputStream)10 TreUtilityTest (org.codice.alliance.transformer.nitf.TreUtilityTest)10 BufferedImage (java.awt.image.BufferedImage)6 BinaryContent (ddf.catalog.data.BinaryContent)5 NitfAttribute (org.codice.alliance.transformer.nitf.common.NitfAttribute)5 ImageSegment (org.codice.imaging.nitf.core.image.ImageSegment)4 DateTime (org.codice.imaging.nitf.core.common.DateTime)3 NitfFormatException (org.codice.imaging.nitf.core.common.NitfFormatException)3 NitfHeader (org.codice.imaging.nitf.core.header.NitfHeader)3 FileSecurityMetadata (org.codice.imaging.nitf.core.security.FileSecurityMetadata)3 J2KImageWriteParam (com.github.jaiimageio.jpeg2000.J2KImageWriteParam)1 J2KImageReaderSpi (com.github.jaiimageio.jpeg2000.impl.J2KImageReaderSpi)1 J2KImageWriter (com.github.jaiimageio.jpeg2000.impl.J2KImageWriter)1 J2KImageWriterSpi (com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi)1