Java Code Examples for org.alfresco.service.cmr.repository.ContentReader#setMimetype()
The following examples show how to use
org.alfresco.service.cmr.repository.ContentReader#setMimetype() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PoiHssfContentTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public void testCsvOutput() throws Exception { File sourceFile = AbstractContentTransformerTest.loadQuickTestFile("xls"); ContentReader sourceReader = new FileContentReader(sourceFile); File targetFile = TempFileProvider.createTempFile( getClass().getSimpleName() + "_" + getName() + "_xls_", ".csv"); ContentWriter targetWriter = new FileContentWriter(targetFile); sourceReader.setMimetype(MimetypeMap.MIMETYPE_EXCEL); targetWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_CSV); transformer.transform(sourceReader, targetWriter); ContentReader targetReader = targetWriter.getReader(); String checkContent = targetReader.getContentString(); additionalContentCheck( MimetypeMap.MIMETYPE_EXCEL, MimetypeMap.MIMETYPE_TEXT_CSV, checkContent ); }
Example 2
Source File: TikaAutoMetadataExtracterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
private Map<String, Serializable> openAndCheck(String fileBase, String expMimeType) throws Throwable { // Get the mimetype via the MimeTypeMap // (Uses Tika internally for the detection) File file = open(fileBase); ContentReader detectReader = new FileContentReader(file); String mimetype = mimetypeMap.guessMimetype(fileBase, detectReader); assertEquals("Wrong mimetype for " + fileBase, mimetype, expMimeType); // Ensure the Tika Auto parser actually handles this assertTrue("Mimetype should be supported but isn't: " + mimetype, extracter.isSupported(mimetype)); // Now create our proper reader ContentReader sourceReader = new FileContentReader(file); sourceReader.setMimetype(mimetype); // And finally do the properties extraction return extracter.extractRaw(sourceReader); }
Example 3
Source File: MailContentTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test transforming a chinese non-unicode msg file to * text */ public void testNonUnicodeChineseMsgToText() throws Exception { File msgSourceFile = loadQuickTestFile("chinese.msg"); File txtTargetFile = TempFileProvider.createTempFile(getName() + "-target-2", ".txt"); ContentReader reader = new FileContentReader(msgSourceFile); reader.setMimetype(MimetypeMap.MIMETYPE_OUTLOOK_MSG); ContentWriter writer = new FileContentWriter(txtTargetFile); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); transformer.transform(reader, writer); ContentReader reader2 = new FileContentReader(txtTargetFile); reader2.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); // Check the quick text String text = reader2.getContentString(); assertTrue(text.contains(QUICK_CONTENT)); // Now check the non quick parts came out ok assertTrue(text.contains("(\u5f35\u6bd3\u502b)")); assertTrue(text.contains("\u683c\u5f0f\u6e2c\u8a66 )")); }
Example 4
Source File: MailContentTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test transforming a valid unicode msg file to text */ public void testUnicodeMsgToText() throws Exception { File msgSourceFile = loadQuickTestFile("unicode.msg"); File txtTargetFile = TempFileProvider.createTempFile(getName() + "-target-2", ".txt"); ContentReader reader = new FileContentReader(msgSourceFile); reader.setMimetype(MimetypeMap.MIMETYPE_OUTLOOK_MSG); ContentWriter writer = new FileContentWriter(txtTargetFile); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); transformer.transform(reader, writer); ContentReader reader2 = new FileContentReader(txtTargetFile); reader2.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); assertTrue(reader2.getContentString().contains(QUICK_CONTENT)); }
Example 5
Source File: MailContentTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test transforming a valid msg file to text */ public void testMsgToText() throws Exception { File msgSourceFile = loadQuickTestFile("msg"); File txtTargetFile = TempFileProvider.createTempFile(getName() + "-target-1", ".txt"); ContentReader reader = new FileContentReader(msgSourceFile); reader.setMimetype(MimetypeMap.MIMETYPE_OUTLOOK_MSG); ContentWriter writer = new FileContentWriter(txtTargetFile); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); transformer.transform(reader, writer); ContentReader reader2 = new FileContentReader(txtTargetFile); reader2.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); assertTrue(reader2.getContentString().contains(QUICK_CONTENT)); }
Example 6
Source File: EMLTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test transforming a valid eml with minetype multipart/alternative to text */ public void testRFC822AlternativeToText() throws Exception { File emlSourceFile = loadQuickTestFile("alternative.eml"); File txtTargetFile = TempFileProvider.createTempFile("test4", ".txt"); ContentReader reader = new FileContentReader(emlSourceFile); reader.setMimetype(MimetypeMap.MIMETYPE_RFC822); ContentWriter writer = new FileContentWriter(txtTargetFile); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); transformer.transform(reader, writer); ContentReader reader2 = new FileContentReader(txtTargetFile); reader2.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); String contentStr = reader2.getContentString(); assertTrue(contentStr.contains(QUICK_EML_ALTERNATIVE_CONTENT)); }
Example 7
Source File: EMLTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test transforming a valid eml with a html part containing html special characters to text */ public void testHtmlSpecialCharsToText() throws Exception { File emlSourceFile = loadQuickTestFile("htmlChars.eml"); File txtTargetFile = TempFileProvider.createTempFile("test6", ".txt"); ContentReader reader = new FileContentReader(emlSourceFile); reader.setMimetype(MimetypeMap.MIMETYPE_RFC822); ContentWriter writer = new FileContentWriter(txtTargetFile); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); transformer.transform(reader, writer); ContentReader reader2 = new FileContentReader(txtTargetFile); reader2.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); String contentStr = reader2.getContentString(); assertTrue(!contentStr.contains(HTML_SPACE_SPECIAL_CHAR)); }
Example 8
Source File: AbstractContentTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Writes the supplied text out to a temporary file, and opens * a content reader onto it. */ protected static ContentReader buildContentReader(String text, Charset encoding) throws IOException { File tmpFile = TempFileProvider.createTempFile("AlfrescoTest_", ".txt"); FileOutputStream out = new FileOutputStream(tmpFile); OutputStreamWriter wout = new OutputStreamWriter(out, encoding); wout.write(text); wout.close(); out.close(); ContentReader reader = new FileContentReader(tmpFile); reader.setEncoding(encoding.displayName()); reader.setMimetype("text/plain"); return reader; }
Example 9
Source File: PoiMetadataExtracterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test for MNT-577: Alfresco is running 100% CPU for over 10 minutes while extracting metadata for Word office document * * @throws Exception */ public void testFootnotesLimitParameterUsingDefault() throws Exception { PoiMetadataExtracter extractor = (PoiMetadataExtracter) getExtracter(); File sourceFile = AbstractContentTransformerTest.loadNamedQuickTestFile(PROBLEM_FOOTNOTES_DOCUMENT_NAME); ContentReader sourceReader = new FileContentReader(sourceFile); sourceReader.setMimetype(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING); Map<QName, Serializable> properties = new HashMap<QName, Serializable>(); long startTime = System.currentTimeMillis(); extractor.extract(sourceReader, properties); extractionTimeWithDefaultFootnotesLimit = System.currentTimeMillis() - startTime; assertExtractedProperties(properties); if (extractionTimeWithLargeFootnotesLimit != null) { assertTrue("The second metadata extraction operation must be longer!", extractionTimeWithLargeFootnotesLimit > extractionTimeWithDefaultFootnotesLimit); } }
Example 10
Source File: EMLTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test transforming a non-ascii eml file to text */ public void testNonAsciiRFC822ToText() throws Exception { File emlSourceFile = loadQuickTestFile("spanish.eml"); File txtTargetFile = TempFileProvider.createTempFile("test2", ".txt"); ContentReader reader = new FileContentReader(emlSourceFile); reader.setMimetype(MimetypeMap.MIMETYPE_RFC822); ContentWriter writer = new FileContentWriter(txtTargetFile); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); transformer.transform(reader, writer); ContentReader reader2 = new FileContentReader(txtTargetFile); reader2.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); String contentStr = reader2.getContentString(); assertTrue(contentStr.contains(QUICK_EML_CONTENT_SPANISH_UNICODE)); }
Example 11
Source File: DifferrentMimeTypeTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void testTypeAliasesMatch() throws Exception { File testFile = AbstractContentTransformerTest.loadNamedQuickTestFile("quick.xml"); ContentReader sourceReader = new FileContentReader(testFile); sourceReader.setMimetype(MimetypeMap.MIMETYPE_XML); // "text/xml" // Detected mimetype is "application/xml" assertNull(mimetypeService.getMimetypeIfNotMatches(sourceReader)); testFile = AbstractContentTransformerTest.loadNamedQuickTestFile("quick.bmp"); sourceReader = new FileContentReader(testFile); sourceReader.setMimetype("image/bmp"); // Detected mimetype is "image/x-ms-bmp" assertNull(mimetypeService.getMimetypeIfNotMatches(sourceReader)); }
Example 12
Source File: MetadataExtracterLimitsTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
protected Map<QName, Serializable> extractFromFile(File sourceFile, String mimetype) { Map<QName, Serializable> properties = new HashMap<QName, Serializable>(); // construct a reader onto the source file ContentReader sourceReader = new FileContentReader(sourceFile); sourceReader.setMimetype(mimetype); getExtracter().extract(sourceReader, properties); return properties; }
Example 13
Source File: FailoverUnsupportedSubtransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void testExcelToPdfConversion() throws Exception { String[] quickFiles = getQuickFilenames(sourceMimeType); for (String quickFile : quickFiles) { String sourceExtension = quickFile.substring(quickFile.lastIndexOf('.') + 1); // is there a test file for this conversion? File sourceFile = AbstractContentTransformerTest.loadNamedQuickTestFile(quickFile); if (sourceFile == null) { continue; // no test file available for that extension } ContentReader sourceReader = new FileContentReader(sourceFile); // make a writer for the target file File targetFile = TempFileProvider.createTempFile(getClass().getSimpleName() + "_" + getName() + "_" + sourceExtension + "_", ".pdf"); ContentWriter targetWriter = new FileContentWriter(targetFile); // do the transformation sourceReader.setMimetype(sourceMimeType); targetWriter.setMimetype(targetMimeType); try { transformer.transform(sourceReader.getReader(), targetWriter); } catch (ContentIOException e) { // all transformers expected to fail for password protected MS office document } if (transformer.getTriggered().getValue()) { org.junit.Assert.fail("final AbstractContentTransformer2.transform was called for html2pdf"); } } }
Example 14
Source File: PoiMetadataExtracterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Tests that metadata extraction from a somewhat corrupt file with several * thousand footnotes times out properly. * * @throws Exception */ public void testProblemFootnotes() throws Exception { long timeoutMs = 2000; MetadataExtracterLimits limits = new MetadataExtracterLimits(); limits.setTimeoutMs(timeoutMs); HashMap<String, MetadataExtracterLimits> mimetypeLimits = new HashMap<String, MetadataExtracterLimits>(1); mimetypeLimits.put(ALL_MIMETYPES_FILTER, limits); ((PoiMetadataExtracter) getExtracter()).setMimetypeLimits(mimetypeLimits); File sourceFile = AbstractContentTransformerTest.loadNamedQuickTestFile("problemFootnotes.docx"); Map<QName, Serializable> properties = new HashMap<QName, Serializable>(); // construct a reader onto the source file ContentReader sourceReader = new FileContentReader(sourceFile); sourceReader.setMimetype(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING); long startTime = System.currentTimeMillis(); getExtracter().extract(sourceReader, properties); long extractionTime = System.currentTimeMillis() - startTime; assertTrue("Metadata extraction took (" + extractionTime + "ms) " + "but should have failed with a timeout at " + timeoutMs + "ms", extractionTime < (timeoutMs + 100)); // bit of wiggle room for logging, cleanup, etc. assertFalse("Reader was not closed", sourceReader.isChannelOpen()); }
Example 15
Source File: StringExtractingContentTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Generate a large file and then transform it using the text extractor. * We are not creating super-large file (1GB) in order to test the transform * as it takes too long to create the file in the first place. Rather, * this test can be used during profiling to ensure that memory is not * being consumed. */ public void testLargeFileStreaming() throws Exception { File sourceFile = TempFileProvider.createTempFile(getName(), ".txt"); int chars = 1000000; // a million characters should do the trick Random random = new Random(); Writer charWriter = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(sourceFile))); for (int i = 0; i < chars; i++) { char next = (char)(random.nextDouble() * 93D + 32D); charWriter.write(next); } charWriter.close(); // get a reader and a writer ContentReader reader = new FileContentReader(sourceFile); reader.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); File outputFile = TempFileProvider.createTempFile(getName(), ".txt"); ContentWriter writer = new FileContentWriter(outputFile); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); // transform transformer.transform(reader, writer); // delete files sourceFile.delete(); outputFile.delete(); }
Example 16
Source File: AbstractContentReader.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Performs checks and copies required reader attributes */ public final ContentReader getReader() throws ContentIOException { ContentReader reader = createReader(); if (reader == null) { throw new AlfrescoRuntimeException("ContentReader failed to create new reader: \n" + " reader: " + this); } else if (reader.getContentUrl() == null || !reader.getContentUrl().equals(getContentUrl())) { throw new AlfrescoRuntimeException("ContentReader has different URL: \n" + " reader: " + this + "\n" + " new reader: " + reader); } // copy across common attributes reader.setMimetype(this.getMimetype()); reader.setEncoding(this.getEncoding()); reader.setLocale(this.getLocale()); // done if (logger.isDebugEnabled()) { logger.debug("Reader spawned new reader: \n" + " reader: " + this + "\n" + " new reader: " + reader); } return reader; }
Example 17
Source File: AbstractContentWriter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Performs checks and copies required reader attributes */ public final ContentReader getReader() throws ContentIOException { String contentUrl = getContentUrl(); if (!isClosed()) { return new EmptyContentReader(contentUrl); } ContentReader reader = createReader(); if (reader == null) { throw new AlfrescoRuntimeException("ContentReader failed to create new reader: \n" + " writer: " + this); } else if (reader.getContentUrl() == null || !reader.getContentUrl().equals(contentUrl)) { throw new AlfrescoRuntimeException("ContentReader has different URL: \n" + " writer: " + this + "\n" + " new reader: " + reader); } // copy across common attributes reader.setMimetype(this.getMimetype()); reader.setEncoding(this.getEncoding()); reader.setLocale(this.getLocale()); // done if (logger.isDebugEnabled()) { logger.debug("Writer spawned new reader: \n" + " writer: " + this + "\n" + " new reader: " + reader); } return reader; }
Example 18
Source File: AbstractLocalTransform.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
private void retryWithDifferentMimetype(ContentReader reader, ContentWriter writer, String targetMimetype, Map<String, String> transformOptions, String renditionName, NodeRef sourceNodeRef, Throwable e) { if (mimetypeService != null && localTransformServiceRegistry != null) { String differentType = mimetypeService.getMimetypeIfNotMatches(reader.getReader()); if (differentType == null) { transformerDebug.debug(" Failed", e); throw new ContentIOException("Content conversion failed: \n" + " reader: " + reader + "\n" + " writer: " + writer + "\n" + " options: " + transformOptions, e); } else { transformerDebug.debug(" Failed: Mimetype was '" + differentType + "'", e); String claimedMimetype = reader.getMimetype(); if (retryTransformOnDifferentMimeType) { reader = reader.getReader(); reader.setMimetype(differentType); long sourceSizeInBytes = reader.getSize(); LocalTransform localTransform = localTransformServiceRegistry.getLocalTransform( differentType, sourceSizeInBytes, targetMimetype, transformOptions, renditionName); if (localTransform == null) { transformerDebug.debug(" Failed", e); throw new ContentIOException("Content conversion failed: \n" + " reader: " + reader + "\n" + " writer: " + writer + "\n" + " options: " + transformOptions + "\n" + " claimed mime type: " + claimedMimetype + "\n" + " detected mime type: " + differentType + "\n" + " transformer not found" + "\n", e ); } localTransform.transform(reader, writer, transformOptions, renditionName, sourceNodeRef); } else { throw new ContentIOException("Content conversion failed: \n" + " reader: " + reader + "\n" + " writer: " + writer + "\n" + " options: " + transformOptions + "\n" + " claimed mime type: " + claimedMimetype + "\n" + " detected mime type: " + differentType, e ); } } } }
Example 19
Source File: EMLTransformerTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Test transforming a valid eml file to pdf using complex transformer ("Rfc822ToPdf") - eg. for HTML5 preview */ public void testRFC822ToPdf() throws Exception { String sourceMimetype = MimetypeMap.MIMETYPE_RFC822; String targetMimetype = MimetypeMap.MIMETYPE_PDF; // force Transformers subsystem to start (this will also load the ContentTransformerRegistry - including complex/dynamic pipelines) // note: a call to contentService.getTransformer would also do this .. even if transformer cannot be found (returned as null) ChildApplicationContextFactory transformersSubsystem = (ChildApplicationContextFactory) ctx.getBean("Transformers"); transformersSubsystem.start(); assertNotNull(registry.getTransformer("transformer.complex.Rfc822ToPdf")); // note: txt -> pdf currently uses OpenOffice/LibreOffice if (! isOpenOfficeWorkerAvailable()) { // no connection System.err.println("ooWorker available - skipping testRFC822ToPdf !!"); return; } AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); assertTrue(synchronousTransformClient.isSupported(sourceMimetype, -1, null, targetMimetype, Collections.emptyMap(), null, null)); String sourceExtension = mimetypeService.getExtension(sourceMimetype); String targetExtension = mimetypeService.getExtension(targetMimetype); File emlSourceFile = loadQuickTestFile("eml"); ContentReader sourceReader = new FileContentReader(emlSourceFile); // make a writer for the target file File targetFile = TempFileProvider.createTempFile(getClass().getSimpleName() + "_" + getName() + "_" + sourceExtension + "_", "." + targetExtension); ContentWriter targetWriter = new FileContentWriter(targetFile); // do the transformation sourceReader.setMimetype(sourceMimetype); targetWriter.setMimetype(targetMimetype); synchronousTransformClient.transform(sourceReader, targetWriter, Collections.emptyMap(), null, null); ContentReader targetReader = new FileContentReader(targetFile); assertTrue(targetReader.getSize() > 0); }
Example 20
Source File: TikaAutoMetadataExtracterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * We don't have explicit extractors for most image and video formats. * Instead, these will be handled by the Auto Tika Parser, and * this test ensures that they are */ @SuppressWarnings("deprecation") public void testImageVideo() throws Throwable { Map<String, Serializable> p; // Image p = openAndCheck(".jpg", "image/jpeg"); assertEquals("409 pixels", p.get("Image Width")); assertEquals("92 pixels", p.get("Image Height")); assertEquals("8 bits", p.get("Data Precision")); p = openAndCheck(".gif", "image/gif"); assertEquals("409", p.get("width")); assertEquals("92", p.get("height")); p = openAndCheck(".png", "image/png"); assertEquals("409", p.get("width")); assertEquals("92", p.get("height")); assertEquals("8 8 8", p.get("Data BitsPerSample")); assertEquals("none", p.get("Transparency Alpha")); p = openAndCheck(".bmp", "image/bmp"); assertEquals("409", p.get("width")); assertEquals("92", p.get("height")); assertEquals("8 8 8", p.get("Data BitsPerSample")); // Image with wrong tiff:Width property. see MNT-13920 p = openAndCheck("SizeSample.jpg", "image/jpeg"); // Check raw EXIF properties assertEquals("1535 pixels", p.get("Image Width")); assertEquals("367 pixels", p.get("Image Height")); // Map and check Map<QName, Serializable> propsJPG = new HashMap<QName, Serializable>(); ContentReader readerJPG = new FileContentReader(open("SizeSample.jpg")); readerJPG.setMimetype("image/jpeg"); extracter.extract(readerJPG, propsJPG); assertEquals(1535, propsJPG.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "pixelXDimension"))); assertEquals(367, propsJPG.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "pixelYDimension"))); // Geo tagged image p = openAndCheck("GEO.jpg", "image/jpeg"); // Check raw EXIF properties assertEquals("100 pixels", p.get("Image Width")); assertEquals("68 pixels", p.get("Image Height")); assertEquals("8 bits", p.get("Data Precision")); // Check regular Tika properties assertEquals(QUICK_TITLE, p.get(Metadata.COMMENT)); assertEquals("canon-55-250, moscow-birds, serbor", p.get(Metadata.SUBJECT)); assertTrue(Arrays.equals(new String[] { "canon-55-250", "moscow-birds", "serbor" }, (String[]) p.get("dc:subject"))); // Check namespace'd Tika properties assertEquals("12.54321", p.get("geo:lat")); assertEquals("-54.1234", p.get("geo:long")); assertEquals("100", p.get("tiff:ImageWidth")); assertEquals("68", p.get("tiff:ImageLength")); assertEquals("Canon", p.get("tiff:Make")); assertEquals("5.6", p.get("exif:FNumber")); // Map and check Map<QName, Serializable> properties = new HashMap<QName, Serializable>(); ContentReader reader = new FileContentReader(open("GEO.jpg")); reader.setMimetype("image/jpeg"); extracter.extract(reader, properties); // Check the geo bits assertEquals(12.54321, properties.get(ContentModel.PROP_LATITUDE)); assertEquals(-54.1234, properties.get(ContentModel.PROP_LONGITUDE)); // Check the exif bits assertEquals(100, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "pixelXDimension"))); assertEquals(68, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "pixelYDimension"))); assertEquals(0.000625, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "exposureTime"))); assertEquals(5.6, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "fNumber"))); assertEquals(false, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "flash"))); assertEquals(194.0, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "focalLength"))); assertEquals("400", properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "isoSpeedRatings"))); assertEquals("Canon", properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "manufacturer"))); assertEquals("Canon EOS 40D", properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "model"))); assertEquals("Adobe Photoshop CS3 Macintosh", properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "software"))); assertEquals(null, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "orientation"))); assertEquals(240.0, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "xResolution"))); assertEquals(240.0, properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "yResolution"))); assertEquals("Inch", properties.get(QName.createQName(NamespaceService.EXIF_MODEL_1_0_URI, "resolutionUnit"))); }