1 package org.apache.maven.archiva.reporting.processor;
4 * Copyright 2005-2006 The Apache Software Foundation.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 import org.apache.maven.artifact.Artifact;
20 import org.apache.maven.archiva.reporting.group.ReportGroup;
21 import org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor;
22 import org.apache.maven.archiva.reporting.AbstractRepositoryReportsTestCase;
23 import org.apache.maven.archiva.reporting.database.ReportingDatabase;
26 * This class tests the InvalidPomArtifactReportProcessor class.
28 public class InvalidPomArtifactReportProcessorTest
29 extends AbstractRepositoryReportsTestCase
31 private ArtifactReportProcessor artifactReportProcessor;
33 private ReportingDatabase reportDatabase;
39 artifactReportProcessor = (ArtifactReportProcessor) lookup( ArtifactReportProcessor.ROLE, "invalid-pom" );
41 ReportGroup reportGroup = (ReportGroup) lookup( ReportGroup.ROLE, "health" );
42 reportDatabase = new ReportingDatabase( reportGroup );
46 * Test the InvalidPomArtifactReportProcessor when the artifact is an invalid pom.
48 public void testInvalidPomArtifactReportProcessorFailure()
50 Artifact artifact = createArtifact( "org.apache.maven", "artifactId", "1.0-alpha-3", "pom" );
52 artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
53 assertEquals( 1, reportDatabase.getNumFailures() );
58 * Test the InvalidPomArtifactReportProcessor when the artifact is a valid pom.
60 public void testInvalidPomArtifactReportProcessorSuccess()
62 Artifact artifact = createArtifact( "groupId", "artifactId", "1.0-alpha-2", "pom" );
64 artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
65 assertEquals( 0, reportDatabase.getNumFailures() );
66 assertEquals( 0, reportDatabase.getNumWarnings() );
67 assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
72 * Test the InvalidPomArtifactReportProcessor when the artifact is not a pom.
74 public void testNotAPomArtifactReportProcessorSuccess()
76 Artifact artifact = createArtifact( "groupId", "artifactId", "1.0-alpha-1", "jar" );
78 artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
79 assertEquals( 0, reportDatabase.getNumFailures() );
80 assertEquals( 0, reportDatabase.getNumWarnings() );
81 assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );