1 package org.apache.maven.repository.reporting;
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.artifact.repository.metadata.RepositoryMetadata;
22 import java.util.ArrayList;
23 import java.util.Iterator;
24 import java.util.List;
27 * Mock implementation of the artifact reporter.
29 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
32 public class MockArtifactReporter
33 implements ArtifactReporter
35 private List artifactFailures = new ArrayList();
37 private List artifactSuccesses = new ArrayList();
39 private List artifactWarnings = new ArrayList();
41 private List metadataFailures = new ArrayList();
43 private List metadataSuccesses = new ArrayList();
45 private List metadataWarnings = new ArrayList();
47 public void addFailure( Artifact artifact, String reason )
49 artifactFailures.add( new ArtifactResult( artifact, reason ) );
52 public void addSuccess( Artifact artifact )
54 artifactSuccesses.add( new ArtifactResult( artifact ) );
57 public void addWarning( Artifact artifact, String reason )
59 artifactWarnings.add( new ArtifactResult( artifact, reason ) );
62 public void addFailure( RepositoryMetadata metadata, String reason )
64 metadataFailures.add( new RepositoryMetadataResult( metadata, reason ) );
67 public void addSuccess( RepositoryMetadata metadata )
69 metadataSuccesses.add( new RepositoryMetadataResult( metadata ) );
72 public void addWarning( RepositoryMetadata metadata, String reason )
74 metadataWarnings.add( new RepositoryMetadataResult( metadata, reason ) );
77 public Iterator getArtifactFailureIterator()
79 return artifactFailures.iterator();
82 public Iterator getArtifactSuccessIterator()
84 return artifactSuccesses.iterator();
87 public Iterator getArtifactWarningIterator()
89 return artifactWarnings.iterator();
92 public Iterator getRepositoryMetadataFailureIterator()
94 return metadataFailures.iterator();
97 public Iterator getRepositoryMetadataSuccessIterator()
99 return metadataSuccesses.iterator();
102 public Iterator getRepositoryMetadataWarningIterator()
104 return metadataWarnings.iterator();
107 public int getFailures()
109 return artifactFailures.size();
112 public int getSuccesses()
114 return artifactSuccesses.size();
117 public int getWarnings()
119 return artifactWarnings.size();