mirror of https://github.com/apache/archiva.git
some updates to the reports base and tests
- simplify the result classes - we need a factory component for the query layer, because the query layer needs a repository - added a mock implementation of the reporter (removed the "default" one which is the same) - added a default repository query interface that uses the file system - add a test for the metadata versions not matching the repo - add some comments git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@353954 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8f8b59ff02
commit
5c3468fad9
|
@ -1,43 +0,0 @@
|
|||
package org.apache.maven.repository;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class is used to ignore several files that may be present inside the repository so that the other classes
|
||||
* may not worry about them and then can concentrate on doing their tasks.
|
||||
*
|
||||
*/
|
||||
public class RepositoryFileFilter implements java.io.FileFilter
|
||||
{
|
||||
public boolean accept(java.io.File pathname)
|
||||
{
|
||||
if ( pathname.isDirectory() )
|
||||
{
|
||||
if ( ".svn".equals( pathname.getName() ) ) return false;
|
||||
if ( "CVS".equals( pathname.getName() ) ) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = pathname.getName();
|
||||
if ( name.endsWith( ".md5" ) ) return false;
|
||||
if ( name.endsWith( ".sha1" ) ) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -19,12 +19,14 @@ package org.apache.maven.repository.reporting;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* This interface is used by the single artifact processor.
|
||||
*
|
||||
* The initial implementation of this will just need to be a mock implementation in src/test/java, used to track the
|
||||
* failures and successes for checking assertions. Later, implementations will be made to present reports on the
|
||||
* web interface, send them via mail, and so on.
|
||||
* <p/>
|
||||
* The initial implementation of this will just need to be a mock implementation in src/test/java, used to track the
|
||||
* failures and successes for checking assertions. Later, implementations will be made to present reports on the
|
||||
* web interface, send them via mail, and so on.
|
||||
*/
|
||||
public interface ArtifactReporter
|
||||
{
|
||||
|
@ -35,10 +37,23 @@ public interface ArtifactReporter
|
|||
void addSuccess( Artifact artifact );
|
||||
|
||||
void addWarning( Artifact artifact, String message );
|
||||
|
||||
|
||||
void addFailure( RepositoryMetadata metadata, String reason );
|
||||
|
||||
void addSuccess( RepositoryMetadata metadata );
|
||||
|
||||
void addWarning( RepositoryMetadata metadata, String message );
|
||||
|
||||
Iterator getArtifactFailureIterator();
|
||||
|
||||
Iterator getArtifactSuccessIterator();
|
||||
|
||||
Iterator getArtifactWarningIterator();
|
||||
|
||||
Iterator getRepositoryMetadataFailureIterator();
|
||||
|
||||
Iterator getRepositoryMetadataSuccessIterator();
|
||||
|
||||
Iterator getRepositoryMetadataWarningIterator();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package org.apache.maven.repository.reporting.reports;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
|
@ -18,16 +16,30 @@ import org.apache.maven.artifact.Artifact;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
*/
|
||||
public class ReportResult
|
||||
{
|
||||
private Artifact artifact;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
public ReportResult( Artifact artifact )
|
||||
/**
|
||||
* A result of the report for a given artifact being processed.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ArtifactResult
|
||||
{
|
||||
private final Artifact artifact;
|
||||
|
||||
private final String reason;
|
||||
|
||||
public ArtifactResult( Artifact artifact )
|
||||
{
|
||||
this.artifact = artifact;
|
||||
this.reason = null;
|
||||
}
|
||||
|
||||
public ArtifactResult( Artifact artifact, String reason )
|
||||
{
|
||||
this.artifact = artifact;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public Artifact getArtifact()
|
||||
|
@ -35,8 +47,8 @@ public class ReportResult
|
|||
return artifact;
|
||||
}
|
||||
|
||||
public void setArtifact( Artifact artifact )
|
||||
public String getReason()
|
||||
{
|
||||
this.artifact = artifact;
|
||||
return reason;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ package org.apache.maven.repository.reporting;
|
|||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -17,9 +16,6 @@ package org.apache.maven.repository.reporting;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
@ -27,31 +23,39 @@ import org.apache.maven.artifact.repository.metadata.Plugin;
|
|||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
||||
import org.apache.maven.artifact.repository.metadata.Snapshot;
|
||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||
import org.apache.maven.repository.RepositoryFileFilter;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* This class will report on bad metadata files. These include invalid version declarations and incomplete version
|
||||
* information inside the metadata file. Plugin metadata will be checked for validity of the latest plugin artifacts.
|
||||
*
|
||||
*/
|
||||
public class BadMetadataReportProcessor implements MetadataReportProcessor
|
||||
public class BadMetadataReportProcessor
|
||||
implements MetadataReportProcessor
|
||||
{
|
||||
// plexus components
|
||||
private ArtifactFactory artifactFactory;
|
||||
private RepositoryQueryLayer repositoryQueryLayer;
|
||||
|
||||
|
||||
private RepositoryQueryLayerFactory repositoryQueryLayerFactory;
|
||||
|
||||
public void processMetadata( RepositoryMetadata metadata, ArtifactRepository repository, ArtifactReporter reporter )
|
||||
throws ReportProcessorException
|
||||
{
|
||||
boolean hasFailures = false;
|
||||
|
||||
|
||||
String lastUpdated = metadata.getMetadata().getVersioning().getLastUpdated();
|
||||
if ( lastUpdated == null || lastUpdated.length() == 0 )
|
||||
{
|
||||
reporter.addFailure( metadata, "Missing lastUpdated element inside the metadata." );
|
||||
hasFailures = true;
|
||||
}
|
||||
|
||||
|
||||
if ( metadata.storedInGroupDirectory() )
|
||||
{
|
||||
checkPluginMetadata( metadata, repository, reporter );
|
||||
|
@ -62,36 +66,53 @@ public class BadMetadataReportProcessor implements MetadataReportProcessor
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( !checkMetadataVersions( metadata, repository, reporter ) ) hasFailures = true;
|
||||
|
||||
if ( checkRepositoryVersions( metadata, repository, reporter ) ) hasFailures = true;
|
||||
if ( !checkMetadataVersions( metadata, repository, reporter ) )
|
||||
{
|
||||
hasFailures = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( checkRepositoryVersions( metadata, repository, reporter ) )
|
||||
{
|
||||
hasFailures = true;
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ReportProcessorException( "Error getting versions", e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !hasFailures )
|
||||
{
|
||||
reporter.addSuccess( metadata );
|
||||
}
|
||||
|
||||
if ( !hasFailures ) reporter.addSuccess( metadata );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks the plugin metadata
|
||||
*/
|
||||
public boolean checkPluginMetadata( RepositoryMetadata metadata, ArtifactRepository repository,
|
||||
ArtifactReporter reporter )
|
||||
ArtifactReporter reporter )
|
||||
{
|
||||
boolean hasFailures = false;
|
||||
|
||||
File metadataDir = new File ( repository.getBasedir() + File.pathSeparator + formatAsDirectory( metadata.getGroupId() ) );
|
||||
|
||||
|
||||
File metadataDir =
|
||||
new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( metadata ) ).getParentFile();
|
||||
|
||||
HashMap prefixes = new HashMap();
|
||||
for( Iterator plugins = metadata.getMetadata().getPlugins().iterator(); plugins.hasNext(); )
|
||||
for ( Iterator plugins = metadata.getMetadata().getPlugins().iterator(); plugins.hasNext(); )
|
||||
{
|
||||
Plugin plugin = (Plugin) plugins.next();
|
||||
|
||||
|
||||
String artifactId = plugin.getArtifactId();
|
||||
if ( artifactId == null || artifactId.length() == 0 )
|
||||
{
|
||||
reporter.addFailure( metadata, "Missing or empty artifactId in group metadata." );
|
||||
hasFailures = true;
|
||||
}
|
||||
|
||||
|
||||
String prefix = plugin.getPrefix();
|
||||
if ( prefix == null || prefix.length() == 0 )
|
||||
{
|
||||
|
@ -110,7 +131,7 @@ public class BadMetadataReportProcessor implements MetadataReportProcessor
|
|||
prefixes.put( prefix, plugin );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File pluginDir = new File( metadataDir, artifactId );
|
||||
if ( !pluginDir.exists() )
|
||||
{
|
||||
|
@ -118,23 +139,23 @@ public class BadMetadataReportProcessor implements MetadataReportProcessor
|
|||
hasFailures = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return hasFailures;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks the snapshot metadata
|
||||
*/
|
||||
public boolean checkSnapshotMetadata( RepositoryMetadata metadata, ArtifactRepository repository,
|
||||
ArtifactReporter reporter )
|
||||
private boolean checkSnapshotMetadata( RepositoryMetadata metadata, ArtifactRepository repository,
|
||||
ArtifactReporter reporter )
|
||||
{
|
||||
boolean hasFailures = false;
|
||||
|
||||
|
||||
Snapshot snapshot = metadata.getMetadata().getVersioning().getSnapshot();
|
||||
String timestamp = snapshot.getTimestamp();
|
||||
String buildNumber = String.valueOf( snapshot.getBuildNumber() );
|
||||
String artifactName = metadata.getArtifactId() + "-" + timestamp + "-" + buildNumber + ".pom";
|
||||
|
||||
|
||||
//@todo use wagon instead
|
||||
Artifact artifact = createArtifact( metadata );
|
||||
File artifactFile = new File( repository.pathOf( artifact ) );
|
||||
|
@ -144,83 +165,85 @@ public class BadMetadataReportProcessor implements MetadataReportProcessor
|
|||
reporter.addFailure( metadata, "Snapshot artifact " + artifactName + " does not exist." );
|
||||
hasFailures = true;
|
||||
}
|
||||
|
||||
|
||||
return hasFailures;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks the declared metadata versions if the artifacts are present in the repository
|
||||
*/
|
||||
public boolean checkMetadataVersions( RepositoryMetadata metadata, ArtifactRepository repository,
|
||||
ArtifactReporter reporter )
|
||||
private boolean checkMetadataVersions( RepositoryMetadata metadata, ArtifactRepository repository,
|
||||
ArtifactReporter reporter )
|
||||
{
|
||||
RepositoryQueryLayer repositoryQueryLayer =
|
||||
repositoryQueryLayerFactory.createRepositoryQueryLayer( repository );
|
||||
|
||||
boolean hasFailures = false;
|
||||
Versioning versioning = metadata.getMetadata().getVersioning();
|
||||
for ( Iterator versions = versioning.getVersions().iterator(); versions.hasNext(); )
|
||||
{
|
||||
String version = (String) versions.next();
|
||||
|
||||
|
||||
Artifact artifact = createArtifact( metadata, version );
|
||||
|
||||
|
||||
if ( !repositoryQueryLayer.containsArtifact( artifact ) )
|
||||
{
|
||||
reporter.addFailure( metadata, "Artifact version " + version + " is present in metadata but " +
|
||||
"missing in the repository." );
|
||||
if ( !hasFailures ) hasFailures = true;
|
||||
"missing in the repository." );
|
||||
if ( !hasFailures )
|
||||
{
|
||||
hasFailures = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hasFailures;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Searches the artifact repository directory for all versions and verifies that all of them are listed in the
|
||||
* metadata file.
|
||||
*/
|
||||
public boolean checkRepositoryVersions( RepositoryMetadata metadata, ArtifactRepository repository,
|
||||
ArtifactReporter reporter )
|
||||
private boolean checkRepositoryVersions( RepositoryMetadata metadata, ArtifactRepository repository,
|
||||
ArtifactReporter reporter )
|
||||
throws IOException
|
||||
{
|
||||
boolean hasFailures = false;
|
||||
Versioning versioning = metadata.getMetadata().getVersioning();
|
||||
String repositoryPath = repository.getBasedir();
|
||||
File versionsDir = new File( repositoryPath, formatAsDirectory( metadata.getGroupId() ) +
|
||||
File.pathSeparator + metadata.getArtifactId() );
|
||||
File[] versions = versionsDir.listFiles( new RepositoryFileFilter() );
|
||||
for( int idx=0; idx<versions.length; idx++ )
|
||||
// TODO: change this to look for repository artifacts. It needs to centre around that I think, currently this is hardwired to the default layout
|
||||
File versionsDir =
|
||||
new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( metadata ) ).getParentFile();
|
||||
List versions = FileUtils.getFileNames( versionsDir, "*/*.pom", null, false );
|
||||
for ( Iterator i = versions.iterator(); i.hasNext(); )
|
||||
{
|
||||
String version = versions[ idx ].getName();
|
||||
File path = new File( (String) i.next() );
|
||||
String version = path.getParentFile().getName();
|
||||
if ( !versioning.getVersions().contains( version ) )
|
||||
{
|
||||
reporter.addFailure( metadata, "Artifact version " + version + " found in the repository but " +
|
||||
"missing in the metadata." );
|
||||
if ( !hasFailures ) hasFailures = true;
|
||||
"missing in the metadata." );
|
||||
if ( !hasFailures )
|
||||
{
|
||||
hasFailures = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hasFailures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats an artifact groupId to the directory structure format used for storage in repositories
|
||||
*/
|
||||
private String formatAsDirectory( String directory )
|
||||
{
|
||||
return directory.replace( '.', File.pathSeparatorChar );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to create an artifact object from a metadata base version
|
||||
*/
|
||||
private Artifact createArtifact( RepositoryMetadata metadata )
|
||||
{
|
||||
return artifactFactory.createBuildArtifact( metadata.getGroupId(), metadata.getArtifactId(),
|
||||
metadata.getBaseVersion(), "pom" );
|
||||
metadata.getBaseVersion(), "pom" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to create an artifact object with a specified version
|
||||
*/
|
||||
private Artifact createArtifact( RepositoryMetadata metadata, String version )
|
||||
{
|
||||
return artifactFactory.createBuildArtifact( metadata.getGroupId(), metadata.getArtifactId(),
|
||||
version, "pom" );
|
||||
return artifactFactory.createBuildArtifact( metadata.getGroupId(), metadata.getArtifactId(), version, "pom" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
*/
|
||||
public class DefaultArtifactReporter
|
||||
implements ArtifactReporter
|
||||
{
|
||||
private List success;
|
||||
private List warnings;
|
||||
private List failures;
|
||||
|
||||
|
||||
public DefaultArtifactReporter()
|
||||
{
|
||||
success = new ArrayList();
|
||||
warnings = new ArrayList();
|
||||
failures = new ArrayList();
|
||||
}
|
||||
|
||||
public void addFailure( Artifact artifact, String reason )
|
||||
{
|
||||
}
|
||||
|
||||
public void addSuccess( Artifact artifact )
|
||||
{
|
||||
}
|
||||
|
||||
public void addWarning( Artifact artifact, String message )
|
||||
{
|
||||
}
|
||||
|
||||
public void addWarning(org.apache.maven.artifact.repository.metadata.RepositoryMetadata metadata, String message)
|
||||
{
|
||||
}
|
||||
|
||||
public void addFailure(org.apache.maven.artifact.repository.metadata.RepositoryMetadata metadata, String reason)
|
||||
{
|
||||
}
|
||||
|
||||
public void addSuccess(org.apache.maven.artifact.repository.metadata.RepositoryMetadata metadata)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package org.apache.maven.repository.reporting;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -10,7 +8,6 @@ import org.apache.maven.artifact.Artifact;
|
|||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -19,14 +16,27 @@ import org.apache.maven.artifact.Artifact;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
*/
|
||||
public class DefaultRepositoryQueryLayer
|
||||
implements RepositoryQueryLayer
|
||||
{
|
||||
private final ArtifactRepository repository;
|
||||
|
||||
public DefaultRepositoryQueryLayer( ArtifactRepository repository )
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
public boolean containsArtifact( Artifact artifact )
|
||||
{
|
||||
return true;
|
||||
File f = new File( repository.getBasedir(), repository.pathOf( artifact ) );
|
||||
return f.exists();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
package org.apache.maven.repository.reporting.reports;
|
||||
|
||||
import org.apache.maven.repository.reporting.reports.ReportResult;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
|
@ -11,7 +8,6 @@ import org.apache.maven.artifact.Artifact;
|
|||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -20,14 +16,19 @@ import org.apache.maven.artifact.Artifact;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
* Gets the default implementation of a repository query layer for the given repository.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Success
|
||||
extends ReportResult
|
||||
public class DefaultRepositoryQueryLayerFactory
|
||||
implements RepositoryQueryLayerFactory
|
||||
{
|
||||
public Success( Artifact artifact )
|
||||
public RepositoryQueryLayer createRepositoryQueryLayer( ArtifactRepository repository )
|
||||
{
|
||||
super( artifact );
|
||||
return new DefaultRepositoryQueryLayer( repository );
|
||||
}
|
||||
}
|
|
@ -27,5 +27,6 @@ public interface MetadataReportProcessor
|
|||
{
|
||||
String ROLE = MetadataReportProcessor.class.getName();
|
||||
|
||||
void processMetadata( RepositoryMetadata metadata, ArtifactRepository repository, ArtifactReporter reporter );
|
||||
void processMetadata( RepositoryMetadata metadata, ArtifactRepository repository, ArtifactReporter reporter )
|
||||
throws ReportProcessorException;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.apache.maven.repository.reporting;
|
|||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -17,13 +16,17 @@ package org.apache.maven.repository.reporting;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
|
||||
public class TestBadMetadataReportProcessor extends BadMetadataReportProcessor
|
||||
/**
|
||||
* Exception occurring during reporting.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ReportProcessorException
|
||||
extends Exception
|
||||
{
|
||||
public TestBadMetadataReportProcessor( ArtifactFactory factory, RepositoryQueryLayer layer )
|
||||
public ReportProcessorException( String msg, Throwable cause )
|
||||
{
|
||||
artifactFactory = factory ;
|
||||
repositoryQueryLayer = layer ;
|
||||
super( msg, cause );
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
package org.apache.maven.repository.reporting.reports;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
|
@ -18,27 +16,39 @@ import org.apache.maven.artifact.Artifact;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
*/
|
||||
public class ReportError
|
||||
extends ReportResult
|
||||
{
|
||||
String reason = "";
|
||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
||||
|
||||
public ReportError( Artifact artifact, String reason )
|
||||
/**
|
||||
* A result of the report for a given artifact being processed.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class RepositoryMetadataResult
|
||||
{
|
||||
private final RepositoryMetadata metadata;
|
||||
|
||||
private final String reason;
|
||||
|
||||
public RepositoryMetadataResult( RepositoryMetadata metadata )
|
||||
{
|
||||
super( artifact );
|
||||
this.metadata = metadata;
|
||||
this.reason = null;
|
||||
}
|
||||
|
||||
public RepositoryMetadataResult( RepositoryMetadata metadata, String reason )
|
||||
{
|
||||
this.metadata = metadata;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public RepositoryMetadata getMetadata()
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason( String reason )
|
||||
{
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
package org.apache.maven.repository.reporting.reports;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
|
@ -10,7 +8,6 @@ import org.apache.maven.artifact.Artifact;
|
|||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -19,14 +16,23 @@ import org.apache.maven.artifact.Artifact;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
* Gets the preferred implementation of a repository query layer for the given repository.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Failure
|
||||
extends ReportError
|
||||
public interface RepositoryQueryLayerFactory
|
||||
{
|
||||
public Failure( Artifact artifact, String reason )
|
||||
{
|
||||
super( artifact, reason );
|
||||
}
|
||||
String ROLE = RepositoryQueryLayerFactory.class.getName();
|
||||
|
||||
/**
|
||||
* Create or obtain a query interface.
|
||||
*
|
||||
* @param repository the repository to query
|
||||
* @return the obtained query layer
|
||||
*/
|
||||
RepositoryQueryLayer createRepositoryQueryLayer( ArtifactRepository repository );
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package org.apache.maven.repository.reporting.reports;
|
||||
|
||||
import org.apache.maven.repository.reporting.reports.ReportError;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
*/
|
||||
public class Warning
|
||||
extends ReportError
|
||||
{
|
||||
public Warning( Artifact artifact, String reason )
|
||||
{
|
||||
super( artifact, reason );
|
||||
}
|
||||
}
|
|
@ -1,24 +1,16 @@
|
|||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.repository.reporting.ArtifactReporter</role>
|
||||
<role-hint>default</role-hint>
|
||||
<implementation>org.apache.maven.repository.reporting.DefaultArtifactReporter</implementation>
|
||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||
<role>org.apache.maven.repository.reporting.RepositoryQueryLayerFactory</role>
|
||||
<implementation>org.apache.maven.repository.reporting.DefaultRepositoryQueryLayerFactory</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.repository.reporting.RepositoryQueryLayer</role>
|
||||
<role-hint>default</role-hint>
|
||||
<implementation>org.apache.maven.repository.reporting.DefaultRepositoryQueryLayer</implementation>
|
||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.repository.reporting.BadMetadataReporter</role>
|
||||
<role-hint>default</role-hint>
|
||||
<implementation>org.apache.maven.repository.reporting.BadMetadataReporter</implementation>
|
||||
<role>org.apache.maven.repository.reporting.MetadataReportProcessor</role>
|
||||
<role-hint>bad-metadata</role-hint>
|
||||
<implementation>org.apache.maven.repository.reporting.BadMetadataReportProcessor</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.repository.reporting.RepositoryQueryLayer</role>
|
||||
<role>org.apache.maven.repository.reporting.RepositoryQueryLayerFactory</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
|
|
|
@ -17,9 +17,12 @@ package org.apache.maven.repository.reporting;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
|
@ -27,54 +30,22 @@ import org.codehaus.plexus.util.FileUtils;
|
|||
public abstract class AbstractRepositoryReportsTestCase
|
||||
extends PlexusTestCase
|
||||
{
|
||||
private static String JAR = ".jar";
|
||||
|
||||
private static String basedir;
|
||||
|
||||
private static String[] directoryStructure;
|
||||
|
||||
public AbstractRepositoryReportsTestCase( String basedir, String[] directoryStructure )
|
||||
{
|
||||
this.basedir = basedir;
|
||||
this.directoryStructure = directoryStructure;
|
||||
}
|
||||
/**
|
||||
* This should only be used for the few that can't use the query layer.
|
||||
*/
|
||||
protected ArtifactRepository repository;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
buildTestRepoPath();
|
||||
File repositoryDirectory = getTestFile( "src/test/repository" );
|
||||
|
||||
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
|
||||
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
|
||||
|
||||
repository =
|
||||
factory.createArtifactRepository( "test", repositoryDirectory.toURL().toString(), layout, null, null );
|
||||
}
|
||||
|
||||
private void buildTestRepoPath()
|
||||
{
|
||||
for ( int i = 0; i < directoryStructure.length; i++ )
|
||||
{
|
||||
File dir = new File( basedir + directoryStructure[i] );
|
||||
if ( !dir.exists() )
|
||||
{
|
||||
dir.mkdirs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteTestRepoPath() throws Exception
|
||||
{
|
||||
FileUtils.deleteDirectory( basedir );
|
||||
}
|
||||
|
||||
protected boolean writeTestArtifact( String relativePath, String artifactId )
|
||||
throws Exception
|
||||
{
|
||||
File artifact = new File( basedir + relativePath + artifactId + JAR );
|
||||
System.out.println( "" + basedir + relativePath + artifactId );
|
||||
return artifact.createNewFile();
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
deleteTestRepoPath();
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.apache.maven.repository.reporting;
|
|||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -17,44 +16,55 @@ package org.apache.maven.repository.reporting;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
|
||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||
|
||||
public class BadMetadataReportProcessorTest extends PlexusTestCase
|
||||
import java.util.Iterator;
|
||||
|
||||
public class BadMetadataReportProcessorTest
|
||||
extends AbstractRepositoryReportsTestCase
|
||||
{
|
||||
protected ArtifactFactory artifactFactory;
|
||||
private BadMetadataReportProcessor badMetadataReportProcessor;
|
||||
|
||||
public BadMetadataReportProcessorTest(String testName)
|
||||
private MetadataReportProcessor badMetadataReportProcessor;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super(testName);
|
||||
super.setUp();
|
||||
|
||||
artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
|
||||
badMetadataReportProcessor = (MetadataReportProcessor) lookup( MetadataReportProcessor.ROLE );
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception
|
||||
public void testMetadataMissingADirectory()
|
||||
throws ReportProcessorException
|
||||
{
|
||||
artifactFactory = (ArtifactFactory) getContainer().lookup( ArtifactFactory.ROLE );
|
||||
|
||||
badMetadataReportProcessor = new TestBadMetadataReportProcessor( artifactFactory,
|
||||
new DefaultRepositoryQueryLayer() );
|
||||
}
|
||||
|
||||
protected RepositoryQueryLayer getRepositoryQueryLayer( List returnValues ) throws NoSuchMethodException
|
||||
{
|
||||
GenericMockObject mockObject = new GenericMockObject();
|
||||
Method method = RepositoryQueryLayer.class.getMethod( "containsArtifact", null );
|
||||
mockObject.setExpectedReturns( method, returnValues );
|
||||
RepositoryQueryLayer queryLayer = (RepositoryQueryLayer) Proxy.newProxyInstance( this.getClassLoader(),
|
||||
new Class[] { RepositoryQueryLayer.class },
|
||||
new GenericMockObject() );
|
||||
return queryLayer;
|
||||
}
|
||||
ArtifactReporter reporter = new MockArtifactReporter();
|
||||
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
release( artifactFactory );
|
||||
Artifact artifact = artifactFactory.createBuildArtifact( "groupId", "artifactId", "1.0-alpha-1", "type" );
|
||||
|
||||
Versioning versioning = new Versioning();
|
||||
versioning.addVersion( "1.0-alpha-1" );
|
||||
versioning.setLastUpdated( "20050611.202020" );
|
||||
|
||||
RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact, versioning );
|
||||
|
||||
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
|
||||
|
||||
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
|
||||
assertTrue( "check there is a failure", failures.hasNext() );
|
||||
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
|
||||
assertEquals( "check metadata", metadata, result.getMetadata() );
|
||||
// TODO: should be more robust
|
||||
assertEquals( "check reason",
|
||||
"Artifact version 1.0-alpha-2 found in the repository but missing in the metadata.",
|
||||
result.getReason() );
|
||||
assertFalse( "check no more failures", failures.hasNext() );
|
||||
}
|
||||
|
||||
public void testProcessMetadata()
|
||||
|
@ -76,5 +86,5 @@ public class BadMetadataReportProcessorTest extends PlexusTestCase
|
|||
public void testCheckRepositoryVersions()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.System;
|
||||
|
||||
/**
|
||||
* Test the artifact reporter.
|
||||
*
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
*/
|
||||
public class DefaultArtifactReporterTest
|
||||
extends AbstractRepositoryReportsTestCase
|
||||
{
|
||||
private static final String[] testRepoStructure = { "valid-poms/", "invalid-poms/" };
|
||||
|
||||
private ArtifactReporter reporter;
|
||||
|
||||
public DefaultArtifactReporterTest()
|
||||
{
|
||||
super( System.getProperty( "basedir" ) + "/src/test/repository/", testRepoStructure );
|
||||
}
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
reporter = (ArtifactReporter) lookup( ArtifactReporter.ROLE, "default" );
|
||||
}
|
||||
|
||||
public void testAddSuccess() throws Exception
|
||||
{
|
||||
assertTrue( writeTestArtifact( "valid-poms/", "test" ) );
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
reporter = null;
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
/**
|
||||
* Test the artifact reporter.
|
||||
*
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
*/
|
||||
public class DefaultRepositoryQueryLayerTest
|
||||
extends AbstractRepositoryReportsTestCase
|
||||
{
|
||||
private static final String[] testRepoStructure = { "valid-poms/", "invalid-poms/" };
|
||||
|
||||
private RepositoryQueryLayer queryLayer;
|
||||
|
||||
public DefaultRepositoryQueryLayerTest()
|
||||
{
|
||||
super( System.getProperty( "basedir" ) + "/src/test/repository/", testRepoStructure );
|
||||
}
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
queryLayer = (RepositoryQueryLayer) lookup( RepositoryQueryLayer.ROLE, "default" );
|
||||
}
|
||||
|
||||
public void testNonExistingArtifact()
|
||||
{
|
||||
assertTrue( queryLayer.containsArtifact( null ) );
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
queryLayer = null;
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package org.apache.maven.repository.reporting;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mock implementation of the artifact reporter.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MockArtifactReporter
|
||||
implements ArtifactReporter
|
||||
{
|
||||
private List artifactFailures = new ArrayList();
|
||||
|
||||
private List artifactSuccesses = new ArrayList();
|
||||
|
||||
private List artifactWarnings = new ArrayList();
|
||||
|
||||
private List metadataFailures = new ArrayList();
|
||||
|
||||
private List metadataSuccesses = new ArrayList();
|
||||
|
||||
private List metadataWarnings = new ArrayList();
|
||||
|
||||
public void addFailure( Artifact artifact, String reason )
|
||||
{
|
||||
artifactFailures.add( new ArtifactResult( artifact, reason ) );
|
||||
}
|
||||
|
||||
public void addSuccess( Artifact artifact )
|
||||
{
|
||||
artifactSuccesses.add( new ArtifactResult( artifact ) );
|
||||
}
|
||||
|
||||
public void addWarning( Artifact artifact, String reason )
|
||||
{
|
||||
artifactWarnings.add( new ArtifactResult( artifact, reason ) );
|
||||
}
|
||||
|
||||
public void addFailure( RepositoryMetadata metadata, String reason )
|
||||
{
|
||||
metadataFailures.add( new RepositoryMetadataResult( metadata, reason ) );
|
||||
}
|
||||
|
||||
public void addSuccess( RepositoryMetadata metadata )
|
||||
{
|
||||
metadataSuccesses.add( new RepositoryMetadataResult( metadata ) );
|
||||
}
|
||||
|
||||
public void addWarning( RepositoryMetadata metadata, String reason )
|
||||
{
|
||||
metadataWarnings.add( new RepositoryMetadataResult( metadata, reason ) );
|
||||
}
|
||||
|
||||
public Iterator getArtifactFailureIterator()
|
||||
{
|
||||
return artifactFailures.iterator();
|
||||
}
|
||||
|
||||
public Iterator getArtifactSuccessIterator()
|
||||
{
|
||||
return artifactSuccesses.iterator();
|
||||
}
|
||||
|
||||
public Iterator getArtifactWarningIterator()
|
||||
{
|
||||
return artifactWarnings.iterator();
|
||||
}
|
||||
|
||||
public Iterator getRepositoryMetadataFailureIterator()
|
||||
{
|
||||
return metadataFailures.iterator();
|
||||
}
|
||||
|
||||
public Iterator getRepositoryMetadataSuccessIterator()
|
||||
{
|
||||
return metadataSuccesses.iterator();
|
||||
}
|
||||
|
||||
public Iterator getRepositoryMetadataWarningIterator()
|
||||
{
|
||||
return metadataWarnings.iterator();
|
||||
}
|
||||
}
|
|
@ -18,9 +18,9 @@ package org.apache.maven.repository.reporting;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jtolentino@mergere.com">John Tolentino</a>
|
||||
|
@ -29,6 +29,7 @@ public class MockRepositoryQueryLayer
|
|||
implements RepositoryQueryLayer
|
||||
{
|
||||
private List queryConditions;
|
||||
|
||||
private Iterator iterator;
|
||||
|
||||
public MockRepositoryQueryLayer()
|
||||
|
@ -54,7 +55,7 @@ public class MockRepositoryQueryLayer
|
|||
|
||||
public void addReturnValue( boolean queryCondition )
|
||||
{
|
||||
queryConditions.add( new Boolean( queryCondition ) );
|
||||
queryConditions.add( Boolean.valueOf( queryCondition ) );
|
||||
}
|
||||
|
||||
public void clearList()
|
||||
|
|
Loading…
Reference in New Issue