git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@442098 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-0.9-alpha-1
@@ -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 ) |
@@ -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; | |||
} | |||
} |
@@ -79,6 +79,14 @@ | |||
<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> | |||
@@ -150,6 +158,14 @@ | |||
<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> |
@@ -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() ); | |||
} | |||
/** |
@@ -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" ); |
@@ -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(); |
@@ -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() ); | |||
} | |||
@@ -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() ); | |||
} | |||
} |
@@ -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() ); | |||
} | |||
/** |
@@ -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 --%> | |||
@@ -106,6 +108,9 @@ | |||
<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"> | |||
@@ -166,6 +171,9 @@ | |||
<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"> |
@@ -104,3 +104,7 @@ | |||
.warningBullet { | |||
list-style-image: url( "../images/icon_warning_sml.gif" ); | |||
} | |||
.infoBullet { | |||
list-style-image: url( "../images/icon_info_sml.gif" ); | |||
} |
@@ -104,3 +104,7 @@ | |||
.warningBullet { | |||
list-style-image: url( "../images/icon_warning_sml.gif" ); | |||
} | |||
.infoBullet { | |||
list-style-image: url( "../images/icon_info_sml.gif" ); | |||
} |
@@ -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> | |||
@@ -134,6 +136,8 @@ | |||
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> | |||
@@ -165,6 +169,10 @@ | |||
<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"> |