Search in sources :

Example 56 with Metacard

use of ddf.catalog.data.Metacard in project ddf by codice.

the class VideoInputTransformerTest method testMp4Video.

@Test
public void testMp4Video() throws Exception {
    InputStream stream = getVideoInputStream();
    Metacard metacard = transform(stream);
    assertThat(metacard, notNullValue());
    assertThat(convertDate(metacard.getModifiedDate()), is("2012-09-01 12:31:21 UTC"));
    String metadata = metacard.getMetadata();
    assertThat(metadata, notNullValue());
    assertThat(metadata, containsString("<meta name=\"tiff:ImageLength\" content=\"360\"/>"));
    assertThat(metadata, containsString("<meta name=\"tiff:ImageWidth\" content=\"480\"/>"));
    assertThat(metacard.getContentTypeName(), is("video/mp4"));
}
Also used : Metacard(ddf.catalog.data.Metacard) InputStream(java.io.InputStream) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 57 with Metacard

use of ddf.catalog.data.Metacard in project ddf by codice.

the class TikaInputTransformerTest method testMp3.

@Test
public void testMp3() throws Exception {
    InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testMP3id3v1_v2.mp3");
    Metacard metacard = transform(stream);
    assertNotNull(metacard);
    assertThat(metacard.getTitle(), is("Test Title"));
    assertNotNull(metacard.getMetadata());
    assertThat(metacard.getMetadata(), containsString("<meta name=\"xmpDM:artist\" content=\"Test Artist\"/>"));
    assertThat(metacard.getContentTypeName(), is("audio/mpeg"));
    assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(SOUND));
}
Also used : Metacard(ddf.catalog.data.Metacard) InputStream(java.io.InputStream) Test(org.junit.Test)

Example 58 with Metacard

use of ddf.catalog.data.Metacard in project ddf by codice.

the class TikaInputTransformerTest method testWordDoc.

@Test
public void testWordDoc() throws Exception {
    InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testWORD.docx");
    Metacard metacard = transform(stream);
    assertNotNull(metacard);
    assertThat(metacard.getTitle(), is("Sample Word Document"));
    assertThat(convertDate(metacard.getCreatedDate()), is("2008-12-11 16:04:00 UTC"));
    assertThat(convertDate(metacard.getModifiedDate()), is("2010-11-12 16:21:00 UTC"));
    assertNotNull(metacard.getMetadata());
    assertThat(metacard.getMetadata(), containsString("<p>This is a sample Microsoft Word Document.</p>"));
    assertThat(metacard.getContentTypeName(), is("application/vnd.openxmlformats-officedocument.wordprocessingml.document"));
    assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(DOCUMENT));
}
Also used : Metacard(ddf.catalog.data.Metacard) InputStream(java.io.InputStream) Test(org.junit.Test)

Example 59 with Metacard

use of ddf.catalog.data.Metacard in project ddf by codice.

the class TikaInputTransformerTest method testXls.

@Test
public void testXls() throws Exception {
    InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testEXCEL.xls");
    Metacard metacard = transform(stream);
    assertNotNull(metacard);
    assertThat(metacard.getTitle(), is("Simple Excel document"));
    assertThat(convertDate(metacard.getCreatedDate()), is("2007-10-01 16:13:56 UTC"));
    assertThat(convertDate(metacard.getModifiedDate()), is("2007-10-01 16:31:43 UTC"));
    assertNotNull(metacard.getMetadata());
    assertThat(metacard.getMetadata(), containsString("Written and saved in Microsoft Excel X for Mac Service Release 1."));
    assertThat(metacard.getContentTypeName(), is("application/vnd.ms-excel"));
    assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(DOCUMENT));
}
Also used : Metacard(ddf.catalog.data.Metacard) InputStream(java.io.InputStream) Test(org.junit.Test)

Example 60 with Metacard

use of ddf.catalog.data.Metacard in project ddf by codice.

the class TikaInputTransformerTest method testZip.

@Test
public void testZip() throws Exception {
    InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testZIP.zip");
    Metacard metacard = transform(stream);
    assertNotNull(metacard);
    assertThat(metacard.getTitle(), nullValue());
    assertNotNull(metacard.getMetadata());
    assertThat(metacard.getMetadata(), containsString("<meta name=\"Content-Type\" content=\"application/zip\"/>"));
    assertThat(metacard.getContentTypeName(), is("application/zip"));
    assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(COLLECTION));
}
Also used : Metacard(ddf.catalog.data.Metacard) InputStream(java.io.InputStream) Test(org.junit.Test)

Aggregations

Metacard (ddf.catalog.data.Metacard)746 Test (org.junit.Test)470 ArrayList (java.util.ArrayList)206 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)149 InputStream (java.io.InputStream)136 HashMap (java.util.HashMap)129 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)115 Result (ddf.catalog.data.Result)109 Serializable (java.io.Serializable)100 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)90 QueryRequest (ddf.catalog.operation.QueryRequest)84 QueryImpl (ddf.catalog.operation.impl.QueryImpl)80 QueryResponse (ddf.catalog.operation.QueryResponse)78 SourceResponse (ddf.catalog.operation.SourceResponse)76 IOException (java.io.IOException)75 List (java.util.List)74 Map (java.util.Map)67 Filter (org.opengis.filter.Filter)67 CreateResponse (ddf.catalog.operation.CreateResponse)66 HashSet (java.util.HashSet)65