[jira] [Comment Edited] (IMAGING-85) Rename src/test/data directory to src/test/resources to comply with maven conventions
[ 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 cause
[jira] [Comment Edited] (IMAGING-85) Rename src/test/data directory to src/test/resources to comply with maven conventions
[ 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:02 PM: --- 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} 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 SAN