[ 
https://issues.apache.org/jira/browse/RAT-237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16067146#comment-16067146
 ] 

Martin Gainty commented on RAT-237:
-----------------------------------

if that case the asf_logo_shortform.jpg passes and goes into the approved list 
which is verified by running testcase speaking of:

org.apache.rat.mp.RatCheckMojoTest.java:

now contains testReadImage in TestCase for reading the image and testing the 
metadata tag <rdf:li> for readImageValue text:

    @org.junit.Test
    public void testReadImage() throws Exception {
                log.debug("RatCheckMojoTest::testReadImage LINE 206 ");
                final RatCheckMojo mojo=newRatCheckMojo("testImages");

                log.debug("RatCheckMojoTest::testReadImage LINE 208 
mojo="+mojo);
                reportFile = getRatTxtFile(mojo);
                reportFile = new java.io.File("rat_test.html");

                log.debug("RatCheckMojoTest::testReadImage LINE 210 
reportFile="+reportFile.getAbsolutePath());
                setVariableValueToObject(mojo, "reportFile",mojo.reportFile);
                mojo.reportFile=reportFile;

//name of jpg Image file which contains metadata
                mojo.readImage="asf_logo_longform.jpg";
                setVariableValueToObject(mojo, "readImage",mojo.readImage);
                log.debug("RatCheckMojoTest::testReadImage LINE 212 
mojo.readImage="+mojo.readImage);

//key to interrograte License or Copyright clause in metadata of jpg
                mojo.readImageKey="rdf:li";
                setVariableValueToObject(mojo, 
"readImageKey",mojo.readImageKey);
                log.debug("RatCheckMojoTest::testReadImage LINE 212 
mojo.readImageKey="+mojo.readImageKey);

//contents of Copyright or License Clause inside Image
                mojo.readImageValue="Licensed to the Apache Software Foundation 
(ASF) under oneor more contributor license agreements.  See the NOTICE 
filedistributed with this work for additional informationregarding copyright 
ownership.  The ASF licenses this fileto you under the Apache License, Version 
2.0 (the&quot;License&quot;); you may not use this file except in 
compliancewith the License.  You may obtain a copy of the License at  
http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or 
agreed to in writing,software distributed under the License is distributed on 
an&quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either 
express or implied.  See the License for thespecific language governing 
permissions and limitationsunder the License.";
                setVariableValueToObject(mojo, 
"readImageValue",mojo.readImageValue);
                log.debug("RatCheckMojoTest::testReadImage LINE 217 
mojo.readImageValue="+mojo.readImageValue);

//filename of reportFile
                mojo.reportFile=new java.io.File("rat_test.txt");
                //mojo.reportFile=new java.io.File("rat_test.xml");
                //mojo.reportFile=new java.io.File("rat_test.html");
                setVariableValueToObject(mojo, "reportFile",mojo.reportFile);
                log.debug("RatCheckMojoTest::testReadImage LINE 219 
mojo.reportFile="+mojo.reportFile.getAbsolutePath());

//style can be plain, xml or html
                mojo.reportStyle="plain";
                //mojo.reportStyle="xml";
                //mojo.reportStyle="html";
                setVariableValueToObject(mojo, "reportStyle",mojo.reportStyle);
                log.debug("RatCheckMojoTest::testReadImage LINE 221 
mojo.reportStyle="+mojo.reportStyle);

//Number of Unapproved Licenses to NOT report (default is 0)
                mojo.numUnapprovedLicenses=23;
                setVariableValueToObject(mojo, 
"numUnapprovedLicenses",mojo.numUnapprovedLicenses);
                log.debug("RatCheckMojoTest::testReadImage LINE 223            
mojo.numUnapprovedLicenses="+mojo.numUnapprovedLicenses);

//should we add LicenseHeaders (default is false)
                mojo.addLicenseHeaders="false";
                setVariableValueToObject(mojo, 
"addLicenseHeaders",mojo.addLicenseHeaders);
                log.debug("RatCheckMojoTest::testReadImage LINE 225 
mojo.addLicenseHeaders="+mojo.addLicenseHeaders);

//default Copyright message
                mojo.copyrightMessage="Copyright 2017 ASF";
                setVariableValueToObject(mojo, 
"copyrightMessage",mojo.copyrightMessage);
                log.debug("RatCheckMojoTest::testReadImage LINE 227 
mojo.copyrightMessage="+mojo.copyrightMessage);

//should we ignore Errors and only report failures?
                mojo.ignoreErrors=true;
                setVariableValueToObject(mojo, 
"ignoreErrors",mojo.ignoreErrors);
                log.debug("RatCheckMojoTest::testReadImage LINE 229 
mojo.ignoreErrors="+mojo.ignoreErrors);

//output to Console?
                mojo.consoleOutput=false;
                setVariableValueToObject(mojo, 
"consoleOutput",mojo.consoleOutput);
                log.debug("RatCheckMojoTest::testReadImage LINE 231 
mojo.consoleOutput="+mojo.consoleOutput);

//supply excludes
                mojo.excludes=new 
String[]{"surefire",".xml",".jar",".plxarc",".properties","build.xml","pom.xml","errors.lst","rat.txt","src/it/it1/src.apt","src/test/resources/unit/it2/src.txt","src/test/resources/unit/it3/src.apt","src/test/resources/unit/it2/src.txt","src/test/resources/unit/it3/src.apt",".iml",".bzrignore"};
                setVariableValueToObject(mojo, "excludes",mojo.excludes);
                log.debug("RatCheckMojoTest::testReadImage LINE 233 
mojo.excludes="+mojo.excludes);

                //test
                try {
                        log.debug("RatCheckMojoTest::testReadImage LINE 234 
before mojo.execute() where mojo="+mojo);
                        mojo.execute();
                }
                catch(Throwable excp)
                {
        log.debug("RatCheckMojoTest::testReadImage LINE 237 mojo.execute() 
throws Exception message="+excp.getMessage());
                        //excp.printStackTrace();
                }
        }

produces rat_test.txt output:
RAT DOT TEXT violations for Date/Time:2017.06.28 AD at 16:08:19 EDT

0) /maven-rat-plugin/apache-rat-plugin/excludes.list
1) /maven-rat-plugin/apache-rat-plugin/Rat-Report-2017.06.25.jpg
2) /maven-rat-plugin/apache-rat-plugin/style.css
3) /maven-rat-plugin/apache-rat-plugin/tree.lst
4) /maven-rat-plugin/apache-rat-plugin/elements/Image.png.old
5) /maven-rat-plugin/apache-rat-plugin/elements/NoLicenseNoCopyright.jpg
6) /maven-rat-plugin/apache-rat-plugin/target/classes/jarit.bash
7) /maven-rat-plugin/apache-rat-plugin/target/classes/elements/Image.png.old
8) 
/maven-rat-plugin/apache-rat-plugin/target/classes/javadocs/ArchiveElement.html
9) /maven-rat-plugin/apache-rat-plugin/target/classes/javadocs/index.html
10) /maven-rat-plugin/apache-rat-plugin/target/classes/violations/FilterTest.cs
11) /maven-rat-plugin/apache-rat-plugin/rat_test.txt

Total Violations:12

WDYT?
Martin


> enable ability to read License/Copyright metadata from metadata-enabled Image
> -----------------------------------------------------------------------------
>
>                 Key: RAT-237
>                 URL: https://issues.apache.org/jira/browse/RAT-237
>             Project: Apache Rat
>          Issue Type: New Feature
>          Components: maven
>    Affects Versions: 0.12
>         Environment: any version maven
> any JDK
> <commercial/opensource> tool to create metadata-enabled Image is ?
>            Reporter: Martin Gainty
>            Priority: Minor
>             Fix For: 0.13
>
>         Attachments: asf_logo_longform.jpg, asf_logo_longform.png, 
> asf_logo_shortform.jpg, asf_logo_shortform.png, Rat-Report-2017.06.25.jpg
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> An Incubator discussion has started to ensure organisations can authenticate 
> proprietary image asset(s)..the first iteration will accomplish this 
> objective by verifying the Copyright and or License metadata tag from a 
> metadata enabled Image such as a XMP Image...a fork has been created from 
> existing apache-rat-plugin codebase and a patch is is ready to verify 
> copyright/license data in a metadata enabled Image. Currently seeking 
> <commercial/opensource> tool which will insert Copyright/License information 
> into Image metadata tag..Eval version photoshop File/FileInfo functionality 
> is crippled and will not work. Currently evaluating exiftool...Suggestions 
> are Welcome



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to