@Test public void testExtractMetadataFromFlvVideo() { File file = flvFile; MetaData result = instance.extractMetadata(file); assertThat(result, is(notNullValue())); assertThat(result.getSilverId(), nullValue()); assertThat(result.getSilverName(), nullValue()); assertThat(result.getMemoryData().getSizeAsLong(), is(file.length())); assertThat(result.getDefinition(), is(Definition.of(1280, 720))); assertThat(result.getFramerate().intValue(), is(25)); assertThat(result.getDuration().getTimeAsLong(), is(6120l)); assertThat(result.getDuration().getFormattedDurationAsHMSM(), is("00:00:06.120")); assertThat(result.getDuration().getFormattedDurationAsHMS(), is("00:00:06")); }
/** Test of getSummaryInformation method, of class MetadataExtractor. */ @Test public void testExtractMetadataFromOLE2WordDocument() { File file = docFile; MetaData result = instance.extractMetadata(file); assertThat(result, is(notNullValue())); assertThat(result.getTitle(), is("Liste de taches")); assertThat(result.getSubject(), is("Modif sur WF ECCA")); assertThat(result.getAuthor(), is("Administrateur")); assertThat(result.getComments(), is(nullValue())); assertThat(result.getKeywords()[0], is("test formation SA")); assertThat(result.getSilverId(), is(nullValue())); assertThat(result.getSilverName(), is(nullValue())); assertThat(result.getCreationDate().getTime(), is(1122998040000L)); assertThat(result.getLastSaveDateTime().getTime(), is(1316063700000L)); assertThat(result.getMemoryData().getSizeAsLong(), is(file.length())); assertThat(result.getDefinition(), is(Definition.NULL)); assertThat(result.getFramerate(), nullValue()); assertThat(result.getDuration(), nullValue()); }
@Test public void testExtractMetadataFromOpenOfficeDocument() { File file = ooFile; MetaData result = instance.extractMetadata(file); assertThat(result, is(notNullValue())); assertThat(result.getTitle(), is("Test pour Tika")); assertThat(result.getSubject(), is("Document de test pour Tika")); assertThat(result.getAuthor(), is("Emmanuel Hugonnet")); assertThat(result.getComments(), is("Comments")); assertThat(result.getKeywords()[0], is("Tika Keywords Test")); assertThat(result.getSilverId(), is(nullValue())); assertThat(result.getSilverName(), is(nullValue())); assertThat(result.getCreationDate().getTime(), is(1239874322000L)); assertThat(result.getLastSaveDateTime(), is(nullValue())); assertThat(result.getMemoryData().getSizeAsLong(), is(file.length())); assertThat(result.getDefinition(), is(Definition.NULL)); assertThat(result.getFramerate(), nullValue()); assertThat(result.getDuration(), nullValue()); }
@Test public void testExtractMetadataFromMp3Audio() { File file = mp3File; MetaData result = instance.extractMetadata(file); assertThat(result, is(notNullValue())); assertThat(result.getTitle(), isEmptyString()); assertThat(result.getSubject(), nullValue()); assertThat(result.getAuthor(), is("sound fishing bruitages")); assertThat(result.getComments(), nullValue()); assertThat(result.getKeywords(), notNullValue()); assertThat(result.getKeywords().length, is(0)); assertThat(result.getSilverId(), nullValue()); assertThat(result.getSilverName(), nullValue()); assertThat(result.getMemoryData().getSizeAsLong(), is(file.length())); assertThat(result.getDefinition(), is(Definition.NULL)); assertThat(result.getFramerate(), nullValue()); assertThat(result.getDuration().getTimeAsLong(), is(4257l)); assertThat(result.getDuration().getFormattedDurationAsHMSM(), is("00:00:04.257")); assertThat(result.getDuration().getFormattedDurationAsHMS(), is("00:00:04")); }
/** Test of getSummaryInformation method, of class MetadataExtractor. */ @Test public void testExtractMetadataFromPdfWithoutMetadata() throws Exception { File file = emptyPdfFile; MetaData result = instance.extractMetadata(file); assertThat(result, is(notNullValue())); assertThat(result.getTitle(), is("Blank PDF Document")); assertThat(result.getSubject(), nullValue()); assertThat( result.getAuthor(), is("Department of Justice (Executive Office of Immigration Review)")); assertThat(result.getComments(), is(nullValue())); assertThat(result.getKeywords(), emptyArray()); assertThat(result.getSilverId(), is(nullValue())); assertThat(result.getSilverName(), is(nullValue())); assertThat(result.getCreationDate().getTime(), is(1141675593000L)); assertThat(result.getLastSaveDateTime().getTime(), is(1141672353000L)); assertThat(result.getMemoryData().getSizeAsLong(), is(file.length())); assertThat(result.getDefinition(), is(Definition.NULL)); assertThat(result.getFramerate(), nullValue()); assertThat(result.getDuration(), nullValue()); }
@Test public void testExtractMetadataFromTifImage() { File file = tifFile; MetaData result = instance.extractMetadata(file); assertThat(result, is(notNullValue())); assertThat(result.getTitle(), is("Logo Silverpeas")); assertThat(result.getSubject(), is("silverpeas")); assertThat(result.getAuthor(), is("AuroreAllibe")); assertThat(result.getComments(), is("Logo silverpeas txt noir")); assertThat(result.getKeywords(), is(notNullValue())); assertThat(result.getKeywords().length, is(2)); assertThat(result.getKeywords()[0], is("silverpeas")); assertThat(result.getKeywords()[1], is("logo")); assertThat(result.getSilverId(), is(nullValue())); assertThat(result.getSilverName(), is(nullValue())); assertThat(result.getCreationDate().getTime(), is(1340963223000L)); assertThat(result.getLastSaveDateTime(), is(nullValue())); assertThat(result.getMemoryData().getSizeAsLong(), is(file.length())); assertThat(result.getDefinition(), is(Definition.of(1942, 1309))); assertThat(result.getFramerate(), nullValue()); assertThat(result.getDuration(), nullValue()); }
@Test public void testExtractMetadataFrom2007WordDocument() { File file = docxFile; assertThat(file.exists(), is(true)); MetaData result = instance.extractMetadata(file); assertThat(result, is(notNullValue())); if (StringUtil.isDefined(result.getTitle())) { assertThat(result.getTitle(), is("Les donuts")); assertThat(result.getSubject(), is("Skateboard")); assertThat(result.getAuthor(), is("Bart Simpson")); assertThat(result.getComments(), is("Commentaires accentués")); assertThat(result.getKeywords()[0], is("mots clés du documents")); assertThat(result.getSilverId(), is(nullValue())); assertThat(result.getSilverName(), is(nullValue())); assertThat(result.getCreationDate(), is(new Date(1315916400000L))); assertThat(result.getLastSaveDateTime().getTime(), is(1316001900000L)); assertThat(result.getMemoryData().getSizeAsLong(), is(file.length())); assertThat(result.getDefinition(), is(Definition.NULL)); assertThat(result.getFramerate(), nullValue()); assertThat(result.getDuration(), nullValue()); } else { System.out.println("testExtractMetadataFrom2007WordDocument is not working correctly"); } }