1 package org.apache.maven.archiva.reporting.processor;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.maven.archiva.reporting.AbstractRepositoryReportsTestCase;
23 import org.apache.maven.archiva.reporting.database.ReportingDatabase;
24 import org.apache.maven.archiva.reporting.group.ReportGroup;
25 import org.apache.maven.artifact.Artifact;
28 * This class tests the InvalidPomArtifactReportProcessor class.
30 public class InvalidPomArtifactReportProcessorTest
31 extends AbstractRepositoryReportsTestCase
33 private ArtifactReportProcessor artifactReportProcessor;
35 private ReportingDatabase reportDatabase;
41 artifactReportProcessor = (ArtifactReportProcessor) lookup( ArtifactReportProcessor.ROLE, "invalid-pom" );
43 ReportGroup reportGroup = (ReportGroup) lookup( ReportGroup.ROLE, "health" );
44 reportDatabase = new ReportingDatabase( reportGroup );
48 * Test the InvalidPomArtifactReportProcessor when the artifact is an invalid pom.
50 public void testInvalidPomArtifactReportProcessorFailure()
52 Artifact artifact = createArtifact( "org.apache.maven", "artifactId", "1.0-alpha-3", "pom" );
54 artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
55 assertEquals( 1, reportDatabase.getNumFailures() );
60 * Test the InvalidPomArtifactReportProcessor when the artifact is a valid pom.
62 public void testInvalidPomArtifactReportProcessorSuccess()
64 Artifact artifact = createArtifact( "groupId", "artifactId", "1.0-alpha-2", "pom" );
66 artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
67 assertEquals( 0, reportDatabase.getNumFailures() );
68 assertEquals( 0, reportDatabase.getNumWarnings() );
69 assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );
74 * Test the InvalidPomArtifactReportProcessor when the artifact is not a pom.
76 public void testNotAPomArtifactReportProcessorSuccess()
78 Artifact artifact = createArtifact( "groupId", "artifactId", "1.0-alpha-1", "jar" );
80 artifactReportProcessor.processArtifact( artifact, null, reportDatabase );
81 assertEquals( 0, reportDatabase.getNumFailures() );
82 assertEquals( 0, reportDatabase.getNumWarnings() );
83 assertEquals( "Check no notices", 0, reportDatabase.getNumNotices() );