use of ddf.catalog.data.Metacard in project ddf by codice.
the class TikaInputTransformerTest method testPng.
@Test
public void testPng() throws Exception {
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testPNG.png");
Metacard metacard = transform(stream);
assertNotNull(metacard);
assertNotNull(metacard.getMetadata());
assertThat(metacard.getMetadata(), containsString("<meta name=\"Compression Lossless\" content=\"true\"/>"));
assertThat(metacard.getContentTypeName(), is("image/png"));
assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(IMAGE));
}
use of ddf.catalog.data.Metacard in project ddf by codice.
the class TikaInputTransformerTest method testXml.
@Test
public void testXml() throws Exception {
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testXML.xml");
Metacard metacard = transform(stream);
assertNotNull(metacard);
assertThat(metacard.getTitle(), is("Test Document"));
assertThat(convertDate(metacard.getCreatedDate()), is("2000-12-01 00:00:00 UTC"));
assertNotNull(metacard.getMetadata());
assertThat(metacard.getMetadata(), containsString("John Smith"));
assertThat(metacard.getContentTypeName(), is("application/xml"));
assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(DOCUMENT));
}
use of ddf.catalog.data.Metacard in project ddf by codice.
the class TikaInputTransformerTest method testEmail.
@Test
public void testEmail() throws Exception {
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testEmail.eml");
Metacard metacard = transform(stream);
assertNotNull(metacard);
assertThat(metacard.getTitle(), is("Welcome"));
assertNotNull(metacard.getMetadata());
assertThat(metacard.getMetadata(), containsString("<meta name=\"Content-Type\" content=\"message/rfc822\"/>"));
assertThat(metacard.getContentTypeName(), is("message/rfc822"));
assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(DATASET));
}
use of ddf.catalog.data.Metacard in project ddf by codice.
the class TikaInputTransformerTest method testAudioMidi.
@Test
public void testAudioMidi() throws Exception {
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testMID.mid");
Metacard metacard = transform(stream);
assertNotNull(metacard);
assertNotNull(metacard.getMetadata());
assertThat(metacard.getMetadata(), containsString("PPQ"));
assertThat(metacard.getContentTypeName(), is("audio/midi"));
assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(SOUND));
}
use of ddf.catalog.data.Metacard in project ddf by codice.
the class TikaInputTransformerTest method testGeoTaggedJpeg.
@Test
public void testGeoTaggedJpeg() throws Exception {
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testJPEG_GEO.jpg");
/*
* The dates in testJPED_GEO.jpg do not contain timezones. If no timezone is specified,
* the Tika input transformer assumes the local time zone. Set the system timezone to UTC
* so we can do assertions.
*/
TimeZone defaultTimeZone = TimeZone.getDefault();
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
Metacard metacard = transform(stream);
assertNotNull(metacard);
assertNotNull(metacard.getMetadata());
assertThat(metacard.getMetadata(), containsString("<meta name=\"Model\" content=\"Canon EOS 40D\"/>"));
assertThat(metacard.getContentTypeName(), is("image/jpeg"));
assertThat(convertDate(metacard.getCreatedDate()), is("2009-08-11 09:09:45 UTC"));
assertThat(convertDate(metacard.getModifiedDate()), is("2009-10-02 23:02:49 UTC"));
assertThat(metacard.getAttribute(Metacard.GEOGRAPHY).getValue(), is("POINT(-54.1234 12.54321)"));
// Reset timezone back to local time zone.
TimeZone.setDefault(defaultTimeZone);
assertThat(metacard.getAttribute(Core.DATATYPE).getValue(), is(IMAGE));
assertThat(metacard.getContentTypeName(), is("image/jpeg"));
}
Aggregations