Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 433DEDFEE for ; Thu, 28 Jun 2012 13:27:45 +0000 (UTC) Received: (qmail 7250 invoked by uid 500); 28 Jun 2012 13:27:44 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 7181 invoked by uid 500); 28 Jun 2012 13:27:44 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 7011 invoked by uid 99); 28 Jun 2012 13:27:44 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2012 13:27:44 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id C1C2E141BDA for ; Thu, 28 Jun 2012 13:27:43 +0000 (UTC) Date: Thu, 28 Jun 2012 13:27:43 +0000 (UTC) From: "Farrukh Najmi (JIRA)" To: issues@commons.apache.org Message-ID: <1545478482.66520.1340890063795.JavaMail.jiratomcat@issues-vm> In-Reply-To: <1291611470.58364.1340744204144.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Comment Edited] (IMAGING-85) Rename src/test/data directory to src/test/resources to comply with maven conventions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/IMAGING-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403075#comment-13403075 ] Farrukh Najmi edited comment on IMAGING-85 at 6/28/12 1:27 PM: --------------------------------------------------------------- Loading test resources from classpath is not uncommon. Consider the simplicity of the following code junit test that uses spring framework. Feel free to close the issue if you and other dev team members are still -1 on this. {code} @Test public void testGetImageMetadataCommonsImaging() { InputStream is = null; try { PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources = resolver.getResources("classpath:images/iptc/1/Oregon Scientific DS6639 - DSC_0307 - iptc added with irfanview.jpg"); Resource res = resources[0]; URL url = res.getURL(); is = url.openStream(); Map params = new HashMap(); JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(is, "Oregon Scientific DS6639 - DSC_0307 - iptc added with irfanview.jpg"); JpegPhotoshopMetadata psMetadata = metadata.getPhotoshop(); List oldRecords = psMetadata.photoshopApp13Data.getRecords(); for (int j = 0; j < oldRecords.size(); j++) { IptcRecord record = (IptcRecord) oldRecords.get(j); System.err.println("Key: " + record.iptcType.getName() + " (0x" + Integer.toHexString(record.iptcType.getType()) + "), value: " + record.value); } } catch (ImageReadException ex) { Logger.getLogger(ImageCatalogerTest.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ImageCatalogerTest.class.getName()).log(Level.SEVERE, null, ex); } finally { if (null != is) { try { is.close(); } catch (IOException ex) { Logger.getLogger(ImageCatalogerTest.class.getName()).log(Level.SEVERE, null, ex); } } } } {code} was (Author: farrukhnajmi): Loading test resources from classpath is not uncommon. Consider the simplicity of the following code junit test that uses spring framework. {code} @Test public void testGetImageMetadataCommonsImaging() { InputStream is = null; try { PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources = resolver.getResources("classpath:images/iptc/1/Oregon Scientific DS6639 - DSC_0307 - iptc added with irfanview.jpg"); Resource res = resources[0]; URL url = res.getURL(); is = url.openStream(); Map params = new HashMap(); JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(is, "Oregon Scientific DS6639 - DSC_0307 - iptc added with irfanview.jpg"); JpegPhotoshopMetadata psMetadata = metadata.getPhotoshop(); List oldRecords = psMetadata.photoshopApp13Data.getRecords(); for (int j = 0; j < oldRecords.size(); j++) { IptcRecord record = (IptcRecord) oldRecords.get(j); System.err.println("Key: " + record.iptcType.getName() + " (0x" + Integer.toHexString(record.iptcType.getType()) + "), value: " + record.value); } } catch (ImageReadException ex) { Logger.getLogger(ImageCatalogerTest.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ImageCatalogerTest.class.getName()).log(Level.SEVERE, null, ex); } finally { if (null != is) { try { is.close(); } catch (IOException ex) { Logger.getLogger(ImageCatalogerTest.class.getName()).log(Level.SEVERE, null, ex); } } } } {code} > Rename src/test/data directory to src/test/resources to comply with maven conventions > ------------------------------------------------------------------------------------- > > Key: IMAGING-85 > URL: https://issues.apache.org/jira/browse/IMAGING-85 > Project: Commons Imaging > Issue Type: Improvement > Reporter: Farrukh Najmi > Attachments: SANSELAN-83-patch.txt > > > Currently established maven convention is not being following because test resources being placed under src/test/data instead of src/test/resources directory. This causes problems is maven-jar-plugin and possibly other situations. Proposed patch for SANSELAN-82 will not work until the proposed fix for this issues is addressed. > The proposed fix is to rename src/test/data to src/test/resources and apply the following patch to fix test code that setsup path for test data files: > {code} > Index: src/test/java/org/apache/commons/imaging/ImagingTestConstants.java > =================================================================== > --- src/test/java/org/apache/commons/imaging/ImagingTestConstants.java (revision 1354112) > +++ src/test/java/org/apache/commons/imaging/ImagingTestConstants.java (working copy) > @@ -24,12 +24,12 @@ > > static final File PHIL_HARVEY_TEST_IMAGE_FOLDER = new File( > FilenameUtils > - .separatorsToSystem("src\\test\\data\\images\\exif\\philHarvey\\")); > + .separatorsToSystem("src\\test\\resources\\images\\exif\\philHarvey\\")); > > static final File SOURCE_FOLDER = new File("src"); > static final File TEST_SOURCE_FOLDER = new File(SOURCE_FOLDER, "test"); > static final File TEST_DATA_SOURCE_FOLDER = new File(TEST_SOURCE_FOLDER, > - "data"); > + "resources"); > static final File TEST_IMAGE_FOLDER = new File(TEST_DATA_SOURCE_FOLDER, > "images"); > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira