]> source.dussan.org Git - archiva.git/commitdiff
[MRM-60] add support for notices in addition to warnings and failures
authorBrett Porter <brett@apache.org>
Mon, 11 Sep 2006 04:55:27 +0000 (04:55 +0000)
committerBrett Porter <brett@apache.org>
Mon, 11 Sep 2006 04:55:27 +0000 (04:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@442098 13f79535-47bb-0310-9956-ffa450edef68

13 files changed:
archiva-converter/src/test/java/org/apache/maven/archiva/converter/RepositoryConverterTest.java
archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ReportingDatabase.java
archiva-reports-standard/src/main/mdo/reporting.mdo
archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/ChecksumArtifactReporterTest.java
archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/DefaultArtifactReporterTest.java
archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/DependencyArtifactReportProcessorTest.java
archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/DuplicateArtifactFileReportProcessorTest.java
archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/InvalidPomArtifactReportProcessorTest.java
archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/LocationArtifactReportProcessorTest.java
archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp
archiva-webapp/src/main/webapp/css/site.css
design/white-site/src/site/resources/css/site.css
design/white-site/src/site/xdoc/reports.xml

index 0f15f22fcea57618beaa3e7eb126e444727a68cb..3b345d36c3b09a358985f703b243e33ec197085b 100644 (file)
@@ -285,6 +285,7 @@ public class RepositoryConverterTest
         repositoryConverter.convert( artifact, targetRepository, reportingDatabase );
         assertEquals( "check no errors", 0, reportingDatabase.getNumFailures() );
         assertEquals( "check number of warnings", 2, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
 
         File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
         assertTrue( "Check artifact created", artifactFile.exists() );
@@ -454,8 +455,9 @@ public class RepositoryConverterTest
         Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" );
         repositoryConverter.convert( artifact, targetRepository, reportingDatabase );
         assertEquals( "check no errors", 0, reportingDatabase.getNumFailures() );
-        assertEquals( "check no warnings", 1, reportingDatabase.getNumWarnings() );
+        assertEquals( "check warnings", 1, reportingDatabase.getNumWarnings() );
         assertEquals( "check warning message", getI18nString( "warning.missing.pom" ), getWarning().getReason() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
 
         File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
         assertTrue( "Check artifact created", artifactFile.exists() );
@@ -734,6 +736,7 @@ public class RepositoryConverterTest
         repositoryConverter.convert( artifacts, targetRepository, reportingDatabase );
         assertEquals( "check no errors", 0, reportingDatabase.getNumFailures() );
         assertEquals( "check no warnings", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
 
         for ( Iterator i = artifacts.iterator(); i.hasNext(); )
         {
@@ -906,12 +909,14 @@ public class RepositoryConverterTest
     {
         assertEquals( "check no errors", 0, reportingDatabase.getNumFailures() );
         assertEquals( "check no warnings", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
     }
 
     private void checkFailure()
     {
         assertEquals( "check num errors", 1, reportingDatabase.getNumFailures() );
         assertEquals( "check no warnings", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
     }
 
     private String getI18nString( String key )
index e81d47faa10f2b53912fa915a1e29be8eb9487db..10fa41bd3bd4705a9bbaf2a8c520aeba18d4280a 100644 (file)
@@ -58,6 +58,8 @@ public class ReportingDatabase
 
     private Map filteredDatabases = new HashMap();
 
+    private int numNotices;
+
     public ReportingDatabase( ReportGroup reportGroup )
     {
         this( reportGroup, new Reporting() );
@@ -101,6 +103,21 @@ public class ReportingDatabase
         }
     }
 
+    public void addNotice( Artifact artifact, String processor, String problem, String reason )
+    {
+        ArtifactResults results = getArtifactResults( artifact );
+        results.addNotice( createResult( processor, problem, reason ) );
+        numNotices++;
+        updateTimings();
+
+        if ( filteredDatabases.containsKey( problem ) )
+        {
+            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
+
+            reportingDatabase.addNotice( artifact, processor, problem, reason );
+        }
+    }
+
     public void addWarning( Artifact artifact, String processor, String problem, String reason )
     {
         ArtifactResults results = getArtifactResults( artifact );
@@ -158,6 +175,7 @@ public class ReportingDatabase
 
             numFailures += result.getFailures().size();
             numWarnings += result.getWarnings().size();
+            numNotices += result.getNotices().size();
         }
         artifactMap = map;
     }
@@ -215,6 +233,25 @@ public class ReportingDatabase
         }
     }
 
+    public void addNotice( RepositoryMetadata metadata, String processor, String problem, String reason )
+    {
+        MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
+        if ( !metadataWithProblems.contains( results ) )
+        {
+            metadataWithProblems.add( results );
+        }
+        results.addNotice( createResult( processor, problem, reason ) );
+        numNotices++;
+        updateTimings();
+
+        if ( filteredDatabases.containsKey( problem ) )
+        {
+            ReportingDatabase reportingDatabase = (ReportingDatabase) filteredDatabases.get( problem );
+
+            reportingDatabase.addNotice( metadata, processor, problem, reason );
+        }
+    }
+
     public Set getMetadataWithProblems()
     {
         return metadataWithProblems;
@@ -235,8 +272,9 @@ public class ReportingDatabase
 
             numFailures += result.getFailures().size();
             numWarnings += result.getWarnings().size();
+            numNotices += result.getNotices().size();
 
-            if ( !result.getFailures().isEmpty() || !result.getWarnings().isEmpty() )
+            if ( !result.getFailures().isEmpty() || !result.getWarnings().isEmpty() || !result.getNotices().isEmpty() )
             {
                 problems.add( result );
             }
@@ -301,6 +339,9 @@ public class ReportingDatabase
         numWarnings -= results.getWarnings().size();
         results.getWarnings().clear();
 
+        numNotices -= results.getWarnings().size();
+        results.getNotices().clear();
+
         metadataWithProblems.remove( results );
     }
 
@@ -349,6 +390,7 @@ public class ReportingDatabase
 
             numFailures -= results.getFailures().size();
             numWarnings -= results.getWarnings().size();
+            numNotices -= results.getNotices().size();
 
             map.remove( key );
         }
@@ -378,6 +420,7 @@ public class ReportingDatabase
     {
         // clear the values rather than destroy the instance so that the "inProgress" indicator is in tact.
         numWarnings = 0;
+        numNotices = 0;
         numFailures = 0;
 
         artifactMap.clear();
@@ -465,6 +508,22 @@ public class ReportingDatabase
                         reportingDatabase.numWarnings++;
                     }
                 }
+                for ( Iterator j = results.getNotices().iterator(); j.hasNext(); )
+                {
+                    Result result = (Result) j.next();
+
+                    if ( filter.equals( result.getProcessor() ) )
+                    {
+                        if ( targetResults == null )
+                        {
+                            // lazily create so it is not added unless it has to be
+                            targetResults = createArtifactResults( reportingDatabase, results );
+                        }
+
+                        targetResults.addNotice( result );
+                        reportingDatabase.numNotices++;
+                    }
+                }
             }
             for ( Iterator i = this.reporting.getMetadata().iterator(); i.hasNext(); )
             {
@@ -502,6 +561,22 @@ public class ReportingDatabase
                         reportingDatabase.numWarnings++;
                     }
                 }
+                for ( Iterator j = results.getNotices().iterator(); j.hasNext(); )
+                {
+                    Result result = (Result) j.next();
+
+                    if ( filter.equals( result.getProcessor() ) )
+                    {
+                        if ( targetResults == null )
+                        {
+                            // lazily create so it is not added unless it has to be
+                            targetResults = createMetadataResults( reportingDatabase, results );
+                        }
+
+                        targetResults.addNotice( result );
+                        reportingDatabase.numNotices++;
+                    }
+                }
             }
 
             filteredDatabases.put( filter, reportingDatabase );
@@ -525,4 +600,9 @@ public class ReportingDatabase
         return reportingDatabase.getArtifactResults( results.getGroupId(), results.getArtifactId(),
                                                      results.getVersion(), results.getType(), results.getClassifier() );
     }
+
+    public int getNumNotices()
+    {
+        return numNotices;
+    }
 }
index 74a75f4da1fc9e07da073ecc80d4d21974d327d4..a190f10ce3cd9f659ff308d058c42a4e7a95466e 100644 (file)
             <multiplicity>*</multiplicity>
           </association>
         </field>
+        <field>
+          <name>notices</name>
+          <version>1.0.0</version>
+          <association>
+            <type>Result</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
         <field xml.attribute="true">
           <name>groupId</name>
           <identity>true</identity>
             <multiplicity>*</multiplicity>
           </association>
         </field>
+        <field>
+          <name>notices</name>
+          <version>1.0.0</version>
+          <association>
+            <type>Result</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
         <field xml.attribute="true">
           <name>groupId</name>
           <version>1.0.0</version>
index 03eb1387b0ef5d2b044ea9cea219d4fd089c0527..27b7c7ff3c046aa0fa07b99cd7488992ae959db1 100644 (file)
@@ -66,6 +66,7 @@ public class ChecksumArtifactReporterTest
         artifactReportProcessor.processArtifact( artifact, null, reportingDatabase );
         assertEquals( 0, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
     }
 
     /**
@@ -80,6 +81,7 @@ public class ChecksumArtifactReporterTest
         artifactReportProcessor.processArtifact( artifact, null, reportingDatabase );
         assertEquals( 1, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
     }
 
     /**
index 94154945c4357c6e41ea7abd1189bd489ef6cec6..07d44fdfe1055bee9b4255703975938f5c96f115 100644 (file)
@@ -16,6 +16,7 @@ package org.apache.maven.archiva.reporting;
  * limitations under the License.
  */
 
+import org.apache.maven.archiva.reporting.model.ArtifactResults;
 import org.apache.maven.archiva.reporting.model.MetadataResults;
 import org.apache.maven.archiva.reporting.model.Result;
 import org.apache.maven.artifact.Artifact;
@@ -40,10 +41,13 @@ public class DefaultArtifactReporterTest
 
     private static final String PROBLEM = "problem";
 
+    private Artifact artifact;
+
     public void testEmptyArtifactReporter()
     {
         assertEquals( "No failures", 0, reportingDatabase.getNumFailures() );
         assertEquals( "No warnings", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
         assertFalse( "No artifact failures", reportingDatabase.getArtifactIterator().hasNext() );
         assertFalse( "No metadata failures", reportingDatabase.getMetadataIterator().hasNext() );
     }
@@ -53,6 +57,7 @@ public class DefaultArtifactReporterTest
         reportingDatabase.addFailure( metadata, PROCESSOR, PROBLEM, "Single Failure Reason" );
         assertEquals( "failures count", 1, reportingDatabase.getNumFailures() );
         assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
 
         Iterator failures = reportingDatabase.getMetadataIterator();
         assertTrue( "check there is a failure", failures.hasNext() );
@@ -80,6 +85,7 @@ public class DefaultArtifactReporterTest
         reportingDatabase.addFailure( metadata, PROCESSOR, PROBLEM, "Second Failure Reason" );
         assertEquals( "failures count", 2, reportingDatabase.getNumFailures() );
         assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
 
         Iterator failures = reportingDatabase.getMetadataIterator();
         assertTrue( "check there is a failure", failures.hasNext() );
@@ -104,6 +110,7 @@ public class DefaultArtifactReporterTest
         reportingDatabase.addWarning( metadata, PROCESSOR, PROBLEM, "Single Warning Message" );
         assertEquals( "warnings count", 0, reportingDatabase.getNumFailures() );
         assertEquals( "warnings count", 1, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
 
         Iterator warnings = reportingDatabase.getMetadataIterator();
         assertTrue( "check there is a failure", warnings.hasNext() );
@@ -124,6 +131,7 @@ public class DefaultArtifactReporterTest
         reportingDatabase.addWarning( metadata, PROCESSOR, PROBLEM, "Second Warning" );
         assertEquals( "warnings count", 0, reportingDatabase.getNumFailures() );
         assertEquals( "warnings count", 2, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
 
         Iterator warnings = reportingDatabase.getMetadataIterator();
         assertTrue( "check there is a failure", warnings.hasNext() );
@@ -143,13 +151,207 @@ public class DefaultArtifactReporterTest
         assertFalse( "no more warnings", warnings.hasNext() );
     }
 
+    public void testMetadataSingleNotice()
+    {
+        reportingDatabase.addNotice( metadata, PROCESSOR, PROBLEM, "Single Notice Message" );
+        assertEquals( "failure count", 0, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check notices", 1, reportingDatabase.getNumNotices() );
+
+        Iterator warnings = reportingDatabase.getMetadataIterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        MetadataResults results = (MetadataResults) warnings.next();
+        warnings = results.getNotices().iterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        Result result = (Result) warnings.next();
+        assertMetadata( results );
+        assertEquals( "check failure reason", "Single Notice Message", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more warnings", warnings.hasNext() );
+    }
+
+    public void testMetadataMultipleNotices()
+    {
+        reportingDatabase.addNotice( metadata, PROCESSOR, PROBLEM, "First Notice" );
+        reportingDatabase.addNotice( metadata, PROCESSOR, PROBLEM, "Second Notice" );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 2, reportingDatabase.getNumNotices() );
+
+        Iterator warnings = reportingDatabase.getMetadataIterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        MetadataResults results = (MetadataResults) warnings.next();
+        warnings = results.getNotices().iterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        Result result = (Result) warnings.next();
+        assertMetadata( results );
+        assertEquals( "check failure reason", "First Notice", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertTrue( "must have 2nd warning", warnings.hasNext() );
+        result = (Result) warnings.next();
+        assertEquals( "check failure reason", "Second Notice", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more warnings", warnings.hasNext() );
+    }
+
+    public void testArtifactSingleFailure()
+    {
+        reportingDatabase.addFailure( artifact, PROCESSOR, PROBLEM, "Single Failure Reason" );
+        assertEquals( "failures count", 1, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
+
+        Iterator failures = reportingDatabase.getArtifactIterator();
+        assertTrue( "check there is a failure", failures.hasNext() );
+        ArtifactResults results = (ArtifactResults) failures.next();
+        failures = results.getFailures().iterator();
+        assertTrue( "check there is a failure", failures.hasNext() );
+        Result result = (Result) failures.next();
+        assertArtifact( results );
+        assertEquals( "check failure reason", "Single Failure Reason", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more failures", failures.hasNext() );
+    }
+
+    private void assertArtifact( ArtifactResults results )
+    {
+        assertEquals( "check failure cause", artifact.getGroupId(), results.getGroupId() );
+        assertEquals( "check failure cause", artifact.getArtifactId(), results.getArtifactId() );
+        assertEquals( "check failure cause", artifact.getVersion(), results.getVersion() );
+        assertEquals( "check failure cause", artifact.getClassifier(), results.getClassifier() );
+        assertEquals( "check failure cause", artifact.getType(), results.getType() );
+    }
+
+    public void testArtifactMultipleFailures()
+    {
+        reportingDatabase.addFailure( artifact, PROCESSOR, PROBLEM, "First Failure Reason" );
+        reportingDatabase.addFailure( artifact, PROCESSOR, PROBLEM, "Second Failure Reason" );
+        assertEquals( "failures count", 2, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
+
+        Iterator failures = reportingDatabase.getArtifactIterator();
+        assertTrue( "check there is a failure", failures.hasNext() );
+        ArtifactResults results = (ArtifactResults) failures.next();
+        failures = results.getFailures().iterator();
+        assertTrue( "check there is a failure", failures.hasNext() );
+        Result result = (Result) failures.next();
+        assertArtifact( results );
+        assertEquals( "check failure reason", "First Failure Reason", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertTrue( "must have 2nd failure", failures.hasNext() );
+        result = (Result) failures.next();
+        assertEquals( "check failure reason", "Second Failure Reason", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more failures", failures.hasNext() );
+    }
+
+    public void testArtifactSingleWarning()
+    {
+        reportingDatabase.addWarning( artifact, PROCESSOR, PROBLEM, "Single Warning Message" );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 1, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
+
+        Iterator warnings = reportingDatabase.getArtifactIterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        ArtifactResults results = (ArtifactResults) warnings.next();
+        warnings = results.getWarnings().iterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        Result result = (Result) warnings.next();
+        assertArtifact( results );
+        assertEquals( "check failure reason", "Single Warning Message", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more warnings", warnings.hasNext() );
+    }
+
+    public void testArtifactMultipleWarnings()
+    {
+        reportingDatabase.addWarning( artifact, PROCESSOR, PROBLEM, "First Warning" );
+        reportingDatabase.addWarning( artifact, PROCESSOR, PROBLEM, "Second Warning" );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 2, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 0, reportingDatabase.getNumNotices() );
+
+        Iterator warnings = reportingDatabase.getArtifactIterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        ArtifactResults results = (ArtifactResults) warnings.next();
+        warnings = results.getWarnings().iterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        Result result = (Result) warnings.next();
+        assertArtifact( results );
+        assertEquals( "check failure reason", "First Warning", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertTrue( "must have 2nd warning", warnings.hasNext() );
+        result = (Result) warnings.next();
+        assertEquals( "check failure reason", "Second Warning", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more warnings", warnings.hasNext() );
+    }
+
+    public void testArtifactSingleNotice()
+    {
+        reportingDatabase.addNotice( artifact, PROCESSOR, PROBLEM, "Single Notice Message" );
+        assertEquals( "failure count", 0, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check notices", 1, reportingDatabase.getNumNotices() );
+
+        Iterator warnings = reportingDatabase.getArtifactIterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        ArtifactResults results = (ArtifactResults) warnings.next();
+        warnings = results.getNotices().iterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        Result result = (Result) warnings.next();
+        assertArtifact( results );
+        assertEquals( "check failure reason", "Single Notice Message", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more warnings", warnings.hasNext() );
+    }
+
+    public void testArtifactMultipleNotices()
+    {
+        reportingDatabase.addNotice( artifact, PROCESSOR, PROBLEM, "First Notice" );
+        reportingDatabase.addNotice( artifact, PROCESSOR, PROBLEM, "Second Notice" );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumFailures() );
+        assertEquals( "warnings count", 0, reportingDatabase.getNumWarnings() );
+        assertEquals( "check no notices", 2, reportingDatabase.getNumNotices() );
+
+        Iterator warnings = reportingDatabase.getArtifactIterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        ArtifactResults results = (ArtifactResults) warnings.next();
+        warnings = results.getNotices().iterator();
+        assertTrue( "check there is a failure", warnings.hasNext() );
+        Result result = (Result) warnings.next();
+        assertArtifact( results );
+        assertEquals( "check failure reason", "First Notice", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertTrue( "must have 2nd warning", warnings.hasNext() );
+        result = (Result) warnings.next();
+        assertEquals( "check failure reason", "Second Notice", result.getReason() );
+        assertEquals( "check failure parameters", PROCESSOR, result.getProcessor() );
+        assertEquals( "check failure parameters", PROBLEM, result.getProblem() );
+        assertFalse( "no more warnings", warnings.hasNext() );
+    }
+
     protected void setUp()
         throws Exception
     {
         super.setUp();
 
         ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-        Artifact artifact = artifactFactory.createBuildArtifact( "groupId", "artifactId", "1.0-alpha-1", "type" );
+
+        artifact = artifactFactory.createBuildArtifact( "groupId", "artifactId", "1.0-alpha-1", "type" );
 
         Versioning versioning = new Versioning();
         versioning.addVersion( "1.0-alpha-1" );
index 1f94e276d870cdb5e1fd990f0d59defdb8e4d64d..50e58fda0d4a602ab3401dbc65d252ae27ffd827 100644 (file)
@@ -66,6 +66,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 0, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
     }
 
     private Artifact createValidArtifact()
@@ -83,6 +84,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 1, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
         Iterator failures = reportingDatabase.getArtifactIterator();
         ArtifactResults results = (ArtifactResults) failures.next();
         assertFalse( failures.hasNext() );
@@ -101,6 +103,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 0, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
     }
 
     private Dependency createValidDependency()
@@ -118,6 +121,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 0, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
     }
 
     public void testValidArtifactWithValidMultipleDependencies()
@@ -133,6 +137,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 0, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
     }
 
     public void testValidArtifactWithAnInvalidDependency()
@@ -148,6 +153,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 1, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
 
         Iterator failures = reportingDatabase.getArtifactIterator();
         ArtifactResults results = (ArtifactResults) failures.next();
@@ -168,6 +174,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 1, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
 
         Iterator failures = reportingDatabase.getArtifactIterator();
         ArtifactResults results = (ArtifactResults) failures.next();
@@ -196,6 +203,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 1, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
 
         Iterator failures = reportingDatabase.getArtifactIterator();
         ArtifactResults results = (ArtifactResults) failures.next();
@@ -234,6 +242,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 1, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
 
         Iterator failures = reportingDatabase.getArtifactIterator();
         ArtifactResults results = (ArtifactResults) failures.next();
@@ -253,6 +262,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 0, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
     }
 
     public void testValidArtifactWithMissingDependencyVersion()
@@ -265,6 +275,7 @@ public class DependencyArtifactReportProcessorTest
         processor.processArtifact( artifact, model, reportingDatabase );
         assertEquals( 1, reportingDatabase.getNumFailures() );
         assertEquals( 0, reportingDatabase.getNumWarnings() );
+        assertEquals( 0, reportingDatabase.getNumNotices() );
 
         Iterator failures = reportingDatabase.getArtifactIterator();
         ArtifactResults results = (ArtifactResults) failures.next();
index 69f155717e3aedb2ecb1ed995f72e7f91709cda0..3ad4bad881ea2c438d642c12242c15f62633c81a 100644 (file)
@@ -80,6 +80,7 @@ public class DuplicateArtifactFileReportProcessorTest
 
         processor.processArtifact( artifact, model, reportDatabase );
 
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
         assertEquals( "Check warnings", 1, reportDatabase.getNumWarnings() );
         assertEquals( "Check no failures", 0, reportDatabase.getNumFailures() );
     }
@@ -89,6 +90,7 @@ public class DuplicateArtifactFileReportProcessorTest
     {
         processor.processArtifact( artifact, model, reportDatabase );
 
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
         assertEquals( "Check warnings", 0, reportDatabase.getNumWarnings() );
         assertEquals( "Check no failures", 0, reportDatabase.getNumFailures() );
     }
@@ -99,6 +101,7 @@ public class DuplicateArtifactFileReportProcessorTest
         artifact.setGroupId( "different.groupId" );
         processor.processArtifact( artifact, model, reportDatabase );
 
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
         assertEquals( "Check warnings", 0, reportDatabase.getNumWarnings() );
         assertEquals( "Check no failures", 0, reportDatabase.getNumFailures() );
     }
@@ -110,6 +113,7 @@ public class DuplicateArtifactFileReportProcessorTest
 
         processor.processArtifact( newArtifact, model, reportDatabase );
 
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
         assertEquals( "Check warnings", 0, reportDatabase.getNumWarnings() );
         assertEquals( "Check no failures", 0, reportDatabase.getNumFailures() );
     }
@@ -124,6 +128,7 @@ public class DuplicateArtifactFileReportProcessorTest
         processor.processArtifact( duplicate, model, reportDatabase );
 
         assertEquals( "Check warnings", 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
         assertEquals( "Check no failures", 1, reportDatabase.getNumFailures() );
     }
 
index c71a06f9e2e9ce6c3a627f55b606cc56a4a00e41..afea3474a8844d9e4a634638cf1016ba6fed1ef6 100644 (file)
@@ -60,6 +60,7 @@ public class InvalidPomArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 
 
@@ -73,5 +74,6 @@ public class InvalidPomArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 }
index 9a332bdca29f6060533fa370c5afe96fae634c46..e00e447fc4cbef244e161fbc89c24c9b87079fd2 100644 (file)
@@ -58,6 +58,7 @@ public class LocationArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 
     /**
@@ -74,6 +75,7 @@ public class LocationArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( artifact, model, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 
     /**
@@ -89,6 +91,7 @@ public class LocationArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( pomArtifact, model, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 
     /**
@@ -105,6 +108,7 @@ public class LocationArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( artifact, model, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 
     /**
@@ -122,6 +126,7 @@ public class LocationArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( artifact, model, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 
     /**
@@ -139,6 +144,7 @@ public class LocationArtifactReportProcessorTest
         artifactReportProcessor.processArtifact( artifact, model, reportDatabase );
         assertEquals( 0, reportDatabase.getNumFailures() );
         assertEquals( 0, reportDatabase.getNumWarnings() );
+        assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
     }
 
     /**
index 713c47bd11b7ee050909597f1a17690a319aa98b..948e322e807231ef7d7817c95d86e9ab8da63d98 100644 (file)
@@ -77,6 +77,8 @@
       ${database.numFailures}
       <img src="<c:url value="/images/icon_warning_sml.gif"/>" width="15" height="15" alt=""/>
       ${database.numWarnings}
+      <img src="<c:url value="/images/icon_info_sml.gif"/>" width="15" height="15" alt=""/>
+      ${database.numNotices}
 
       <span style="font-size: x-small">
         <%-- TODO! use better formatting here --%>
       <c:forEach items="${artifact.warnings}" var="result">
         <li class="warningBullet">${result.reason}</li>
       </c:forEach>
+      <c:forEach items="${artifact.notices}" var="result">
+        <li class="infoBullet">${result.reason}</li>
+      </c:forEach>
     </ul>
     <p style="text-indent: 3em;">
           <span style="font-size: x-small">
       <c:forEach items="${metadata.warnings}" var="result">
         <li class="warningBullet">${result.reason}</li>
       </c:forEach>
+      <c:forEach items="${metadata.notices}" var="result">
+        <li class="infoBullet">${result.reason}</li>
+      </c:forEach>
     </ul>
     <p style="text-indent: 3em;">
           <span style="font-size: x-small">
index bb03df7830f0fd27f628af552571e65fa30b917c..5c6faeabd3b22edbcb800a4b3027fd09b3e4400f 100644 (file)
 .warningBullet {
     list-style-image: url( "../images/icon_warning_sml.gif" );
 }
+
+.infoBullet {
+    list-style-image: url( "../images/icon_info_sml.gif" );
+}
index bb03df7830f0fd27f628af552571e65fa30b917c..5c6faeabd3b22edbcb800a4b3027fd09b3e4400f 100644 (file)
 .warningBullet {
     list-style-image: url( "../images/icon_warning_sml.gif" );
 }
+
+.infoBullet {
+    list-style-image: url( "../images/icon_info_sml.gif" );
+}
index 82dd9405c70e56bb5f08f8f45d86b473b019ea0e..f0d95f5f2281e6c64f666bf02adcf308b24d8e7a 100644 (file)
@@ -65,6 +65,8 @@
           2
           <img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
           1
+          <img src="images/icon_info_sml.gif" width="15" height="15" alt=""/>
+          0
           <span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
           </span>
         </p>
           2
           <img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
           0
+          <img src="images/icon_info_sml.gif" width="15" height="15" alt=""/>
+          1
           <span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
           </span>
         </p>
             <a href="#">Repair</a>
             )
           </li>
+          <li class="infoBullet">Your coffee is ready (
+            <a href="#">Pick up</a>
+            )
+          </li>
         </ul>
         <p>
           <span style="font-size: x-small; text-indent: 3em">