Search in sources :

Example 11 with AttachmentInfo

use of org.codice.ddf.attachment.AttachmentInfo in project ddf by codice.

the class AttachmentParserImplTest method testSimpleCase.

@Test
public void testSimpleCase() throws IOException {
    try (InputStream inputStream = createTestInputStream()) {
        AttachmentInfo attachmentInfo = attachmentParser.generateAttachmentInfo(inputStream, TEXT_PLAIN, FULL_FILENAME);
        assertThat(attachmentInfo.getFilename(), is(FULL_FILENAME));
        assertThat(attachmentInfo.getContentType(), is(TEXT_PLAIN));
        assertThat(attachmentInfo.getStream(), is(inputStream));
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) AttachmentInfo(org.codice.ddf.attachment.AttachmentInfo) Test(org.junit.Test)

Aggregations

AttachmentInfo (org.codice.ddf.attachment.AttachmentInfo)11 ByteArrayInputStream (java.io.ByteArrayInputStream)9 Test (org.junit.Test)9 Metacard (ddf.catalog.data.Metacard)8 CatalogFramework (ddf.catalog.CatalogFramework)6 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)6 CoreAttributes (ddf.catalog.data.impl.types.CoreAttributes)6 ArrayList (java.util.ArrayList)6 InputStream (java.io.InputStream)5 HashMap (java.util.HashMap)5 InputTransformer (ddf.catalog.transform.InputTransformer)4 Part (javax.servlet.http.Part)4 Attachment (org.apache.cxf.jaxrs.ext.multipart.Attachment)4 ContentDisposition (org.apache.cxf.jaxrs.ext.multipart.ContentDisposition)4 BundleContext (org.osgi.framework.BundleContext)4 ServiceReference (org.osgi.framework.ServiceReference)4 Map (java.util.Map)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 Attribute (ddf.catalog.data.Attribute)2 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)2