You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/12/30 05:38:29 UTC
svn commit: r359986 [2/3] - in /maven/repository-manager/trunk: ./
maven-repository-discovery/
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/
maven-repository-discovery/src/main/resources/META-INF/plexus/
maven-reposito...
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/BadMetadataReportProcessor.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/BadMetadataReportProcessor.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/BadMetadataReportProcessor.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/BadMetadataReportProcessor.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
@@ -46,14 +46,13 @@
private RepositoryQueryLayerFactory repositoryQueryLayerFactory;
-
+
/**
* Process the metadata encountered in the repository and report all errors found, if any.
*
* @param metadata the metadata to be processed.
* @param repository the repository where the metadata was encountered
* @param reporter the ArtifactReporter to receive processing results
- *
* @throws ReportProcessorException if an error was occurred while processing the metadata
*/
public void processMetadata( RepositoryMetadata metadata, ArtifactRepository repository, ArtifactReporter reporter )
@@ -105,7 +104,7 @@
}
}
}
-
+
if ( !hasFailures )
{
reporter.addSuccess( metadata );
@@ -120,7 +119,7 @@
* @param reporter the ArtifactReporter to receive processing results
*/
protected boolean checkPluginMetadata( RepositoryMetadata metadata, ArtifactRepository repository,
- ArtifactReporter reporter )
+ ArtifactReporter reporter )
throws IOException
{
boolean hasFailures = false;
@@ -144,7 +143,7 @@
String prefix = plugin.getPrefix();
if ( prefix == null || prefix.length() == 0 )
{
- reporter.addFailure( metadata, "Missing or empty plugin prefix for artifactId " + artifactId + ".");
+ reporter.addFailure( metadata, "Missing or empty plugin prefix for artifactId " + artifactId + "." );
hasFailures = true;
}
else
@@ -174,10 +173,10 @@
}
}
}
-
+
if ( pluginDirs.size() > 0 )
{
- for( Iterator plugins = pluginDirs.iterator(); plugins.hasNext(); )
+ for ( Iterator plugins = pluginDirs.iterator(); plugins.hasNext(); )
{
File plugin = (File) plugins.next();
reporter.addFailure( metadata, "Plugin " + plugin.getName() + " is present in the repository but " +
@@ -197,7 +196,7 @@
* @param reporter the ArtifactReporter to receive processing results
*/
protected boolean checkSnapshotMetadata( RepositoryMetadata metadata, ArtifactRepository repository,
- ArtifactReporter reporter )
+ ArtifactReporter reporter )
{
RepositoryQueryLayer repositoryQueryLayer =
repositoryQueryLayerFactory.createRepositoryQueryLayer( repository );
@@ -226,7 +225,7 @@
* @param reporter the ArtifactReporter to receive processing results
*/
protected boolean checkMetadataVersions( RepositoryMetadata metadata, ArtifactRepository repository,
- ArtifactReporter reporter )
+ ArtifactReporter reporter )
{
RepositoryQueryLayer repositoryQueryLayer =
repositoryQueryLayerFactory.createRepositoryQueryLayer( repository );
@@ -258,7 +257,7 @@
* @param reporter the ArtifactReporter to receive processing results
*/
protected boolean checkRepositoryVersions( RepositoryMetadata metadata, ArtifactRepository repository,
- ArtifactReporter reporter )
+ ArtifactReporter reporter )
throws IOException
{
boolean hasFailures = false;
@@ -297,7 +296,7 @@
{
return artifactFactory.createBuildArtifact( metadata.getGroupId(), metadata.getArtifactId(), version, "pom" );
}
-
+
/**
* Used to gather artifactIds from a groupId directory
*/
@@ -305,12 +304,12 @@
throws IOException
{
List artifactIdFiles = new ArrayList();
-
+
List fileArray = new ArrayList( Arrays.asList( groupIdDir.listFiles() ) );
- for( Iterator files=fileArray.iterator(); files.hasNext(); )
+ for ( Iterator files = fileArray.iterator(); files.hasNext(); )
{
File artifactDir = (File) files.next();
-
+
if ( artifactDir.isDirectory() )
{
List versions = FileUtils.getFileNames( artifactDir, "*/*.pom", null, false );
@@ -320,7 +319,7 @@
}
}
}
-
+
return artifactIdFiles;
}
}
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java Thu Dec 29 20:37:28 2005
@@ -1,14 +1,13 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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,
@@ -22,17 +21,19 @@
/**
* Class to implement caching
- *
*/
public class Cache
{
private Map cache;
private DblLinkedList mostRecent;
+
private double cacheHitRatio = 0;
+
private long cacheMaxSize = 0;
-
+
private long cacheHits = 0;
+
private long cacheMiss = 0;
/**
@@ -53,27 +54,26 @@
/**
* Caches all data and expires only the oldest data when either the specified cache hit rate is reached
- * or the maximum cache size is reached.
+ * or the maximum cache size is reached.
*/
public Cache( double cacheHitRatio, long cacheMaxSize )
{
this.cacheHitRatio = cacheHitRatio;
this.cacheMaxSize = cacheMaxSize;
-
+
cache = new HashMap();
}
-
+
/**
* Check if the specified key is already mapped to an object.
*
* @param key the key used to map the cached object
- *
* @returns true if the cache contains an object associated with the given key
*/
public boolean containsKey( Object key )
{
boolean contains = cache.containsKey( key );
-
+
if ( contains )
{
cacheHits++;
@@ -82,29 +82,28 @@
{
cacheMiss++;
}
-
+
return contains;
}
-
+
/**
* Check for a cached object and return it if it exists. Returns null when the keyed object is not found
*
* @param key the key used to map the cached object
- *
* @returns the object mapped to the given key, or null if no cache object is mapped to the given key
*/
public Object get( Object key )
{
Object retValue = null;
-
+
if ( cache.containsKey( key ) )
{
DblLinkedList cacheEntry = (DblLinkedList) cache.get( key );
-
+
makeMostRecent( cacheEntry );
-
+
retValue = cacheEntry.cacheValue;
-
+
cacheHits++;
}
else
@@ -147,7 +146,7 @@
{
return ( cacheHits == 0 && cacheMiss == 0 ) ? 0 : ( (double) cacheHits ) / (double) ( cacheHits + cacheMiss );
}
-
+
/**
* Get the total number of cache objects currently cached.
*/
@@ -155,14 +154,16 @@
{
return cache.size();
}
-
+
/**
* Empty the cache and reset the cache hit rate
*/
public void flush()
{
while ( cache.size() > 0 )
+ {
trimCache();
+ }
cacheHits = 0;
cacheMiss = 0;
cache = new HashMap();
@@ -186,10 +187,14 @@
private void removeFromLinks( DblLinkedList list )
{
if ( list.prev != null )
+ {
list.prev.next = list.next;
+ }
if ( list.next != null )
+ {
list.next.prev = list.prev;
-
+ }
+
list.prev = null;
list.next = null;
}
@@ -207,7 +212,7 @@
else if ( cache.size() > cacheMaxSize )
{
// maximum cache size is reached
- while( cache.size() > cacheMaxSize )
+ while ( cache.size() > cacheMaxSize )
{
trimCache();
}
@@ -236,23 +241,29 @@
mostRecent = null;
}
}
-
+
private DblLinkedList getLeastRecent()
{
DblLinkedList trail = mostRecent;
- while( trail.next != null )
+ while ( trail.next != null )
+ {
trail = trail.next;
+ }
return trail;
}
- private class DblLinkedList {
+ private class DblLinkedList
+ {
Object cacheKey;
+
Object cacheValue;
+
DblLinkedList prev;
+
DblLinkedList next;
-
+
public DblLinkedList( Object key, Object value )
{
this.cacheKey = key;
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/CachedRepositoryQueryLayer.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/CachedRepositoryQueryLayer.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/CachedRepositoryQueryLayer.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/CachedRepositoryQueryLayer.java Thu Dec 29 20:37:28 2005
@@ -1,14 +1,13 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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,
@@ -17,18 +16,12 @@
* limitations under the License.
*/
-import java.io.File;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.Snapshot;
-
/**
*
*/
@@ -37,23 +30,23 @@
{
private Cache cache;
-
+
public CachedRepositoryQueryLayer( ArtifactRepository repository )
{
this.repository = repository;
-
+
cache = new Cache( 0.5 );
}
-
+
public double getCacheHitRate()
{
return cache.getHitRate();
}
-
+
public boolean containsArtifact( Artifact artifact )
{
boolean artifactFound = true;
-
+
// @todo should check for snapshot artifacts
String artifactPath = repository.getBasedir() + "/" + repository.pathOf( artifact );
@@ -94,13 +87,13 @@
throws RepositoryQueryLayerException
{
Metadata metadata = (Metadata) cache.get( artifact.getId() );
-
+
if ( metadata == null )
{
metadata = super.getMetadata( artifact );
cache.put( artifact.getId(), metadata );
}
-
+
return metadata;
}
}
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ChecksumArtifactReporter.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ChecksumArtifactReporter.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ChecksumArtifactReporter.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ChecksumArtifactReporter.java Thu Dec 29 20:37:28 2005
@@ -1,22 +1,26 @@
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
- *
+/*
+ * Copyright 2005-2006 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.
+ *
+ * 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.ArtifactRepository;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
+import org.apache.maven.model.Model;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -27,13 +31,8 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import org.apache.maven.model.Model;
-import org.apache.maven.artifact.repository.*;
-
/**
- * This class reports invalid and mismatched checksums of artifacts and metadata files.
+ * This class reports invalid and mismatched checksums of artifacts and metadata files.
* It validates MD5 and SHA-1 checksums.
*/
public class ChecksumArtifactReporter
@@ -49,13 +48,14 @@
/**
* Validate the checksum of the specified artifact.
+ *
* @param model
* @param artifact
* @param reporter
* @param repository
*/
public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
- ArtifactRepository repository )
+ ArtifactRepository repository )
{
//System.out.println( " " );
//System.out
@@ -74,9 +74,9 @@
repositoryUrl = repository.getBasedir();
}
- artifactUrl = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/"
- + artifact.getBaseVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "."
- + artifact.getType();
+ artifactUrl = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/" +
+ artifact.getBaseVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "." +
+ artifact.getType();
//check if checksum files exist
boolean md5Exists = getMD5File( artifactUrl );
@@ -116,7 +116,7 @@
}
/**
- * Validate the checksums of the metadata. Get the metadata file from the
+ * Validate the checksums of the metadata. Get the metadata file from the
* repository then validate the checksum.
*/
public void processMetadata( RepositoryMetadata metadata, ArtifactRepository repository, ArtifactReporter reporter )
@@ -141,8 +141,8 @@
if ( metadata.storedInArtifactVersionDirectory() == true && metadata.storedInGroupDirectory() == false )
{
//version metadata
- metadataUrl = repositoryUrl + metadata.getGroupId() + "/" + metadata.getArtifactId() + "/"
- + metadata.getBaseVersion() + "/";
+ metadataUrl = repositoryUrl + metadata.getGroupId() + "/" + metadata.getArtifactId() + "/" +
+ metadata.getBaseVersion() + "/";
}
else if ( metadata.storedInArtifactVersionDirectory() == false && metadata.storedInGroupDirectory() == true )
{
@@ -198,6 +198,7 @@
/**
* Get the MD5 Checksum file. If not found, return false.
+ *
* @param filename The name of the artifact whose MD5 Checksum file will be retrieved.
* @return
*/
@@ -226,6 +227,7 @@
/**
* Get the SHA1 Checksum file. If not found, return false.
+ *
* @param filename The name of the artifact whose SHA-1 Checksum file will be retrieved.
* @return
*/
@@ -253,8 +255,9 @@
/**
* Validate the checksum of the file.
+ *
* @param fileUrl The file to be validated.
- * @param algo The checksum algorithm used.
+ * @param algo The checksum algorithm used.
* @return
*/
protected boolean validateChecksum( String fileUrl, String algo )
@@ -267,7 +270,9 @@
//Create checksum for jar file
String ext = ".md5";
if ( algo.equals( "SHA-1" ) )
+ {
ext = ".sha1";
+ }
chk1 = createChecksum( fileUrl, algo );
if ( chk1 != null )
{
@@ -320,8 +325,9 @@
/**
* Create a checksum from the specified metadata file.
+ *
* @param filename The file that will be created a checksum.
- * @param algo The algorithm to be used (MD5, SHA-1)
+ * @param algo The algorithm to be used (MD5, SHA-1)
* @return
* @throws FileNotFoundException
* @throws NoSuchAlgorithmException
@@ -364,6 +370,7 @@
/**
* Convert an incoming array of bytes into a string that represents each of
* the bytes as two hex characters.
+ *
* @param data
* @return
*/
@@ -383,7 +390,9 @@
//Append a leading 0 if necessary so that each hex string will contain 2 characters.
if ( tempStr.length() == 1 )
+ {
tempStr = "0" + tempStr;
+ }
//Concatenate the two characters to the output string.
output = output + tempStr;
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReportProcessor.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReportProcessor.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReportProcessor.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReportProcessor.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
@@ -16,14 +16,14 @@
* limitations under the License.
*/
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Dependency;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
-import java.util.List;
import java.util.Iterator;
+import java.util.List;
/**
*
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReporter.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReporter.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReporter.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReporter.java Thu Dec 29 20:37:28 2005
@@ -1,14 +1,13 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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,
@@ -20,9 +19,9 @@
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;
-import java.util.ArrayList;
/**
*
@@ -101,6 +100,7 @@
{
return metadataWarnings.iterator();
}
+
public int getFailures()
{
return artifactFailures.size() + metadataFailures.size();
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayer.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayer.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayer.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayer.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
@@ -16,17 +16,7 @@
* limitations under the License.
*/
-import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.Snapshot;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.List;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
/**
*
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayerFactory.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayerFactory.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayerFactory.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayerFactory.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/InvalidPomArtifactReportProcessor.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/InvalidPomArtifactReportProcessor.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/InvalidPomArtifactReportProcessor.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/InvalidPomArtifactReportProcessor.java Thu Dec 29 20:37:28 2005
@@ -1,22 +1,27 @@
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
- *
+/*
+ * Copyright 2005-2006 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.
+ *
+ * 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.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -26,70 +31,81 @@
import java.net.MalformedURLException;
import java.net.URL;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
/**
* This class validates well-formedness of pom xml file.
*/
public class InvalidPomArtifactReportProcessor
implements ArtifactReportProcessor
{
-
+
/**
* @param model
- * @param artifact The pom xml file to be validated, passed as an artifact object.
- * @param reporter The artifact reporter object.
+ * @param artifact The pom xml file to be validated, passed as an artifact object.
+ * @param reporter The artifact reporter object.
* @param repository the repository where the artifact is located.
*/
public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
- ArtifactRepository repository )
+ ArtifactRepository repository )
{
- InputStream is = null;
-
- if((artifact.getType().toLowerCase()).equals("pom")){
-
- if(repository.getProtocol().equals("file")){
- try{
- is = new FileInputStream(repository.getBasedir() + artifact.getGroupId() + "/" +
- artifact.getArtifactId() + "/" + artifact.getBaseVersion() + "/" +
- artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "." +
- artifact.getType());
- }catch(FileNotFoundException fe){
- reporter.addFailure(artifact, "Artifact not found.");
+ InputStream is = null;
+
+ if ( ( artifact.getType().toLowerCase() ).equals( "pom" ) )
+ {
+
+ if ( repository.getProtocol().equals( "file" ) )
+ {
+ try
+ {
+ is = new FileInputStream( repository.getBasedir() + artifact.getGroupId() + "/" +
+ artifact.getArtifactId() + "/" + artifact.getBaseVersion() + "/" + artifact.getArtifactId() +
+ "-" + artifact.getBaseVersion() + "." + artifact.getType() );
+ }
+ catch ( FileNotFoundException fe )
+ {
+ reporter.addFailure( artifact, "Artifact not found." );
}
- }else{
- try{
- URL url = new URL(repository.getUrl() + artifact.getGroupId() + "/" +
- artifact.getArtifactId() + "/" + artifact.getBaseVersion() + "/" +
- artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "." +
- artifact.getType());
+ }
+ else
+ {
+ try
+ {
+ URL url = new URL( repository.getUrl() + artifact.getGroupId() + "/" + artifact.getArtifactId() +
+ "/" + artifact.getBaseVersion() + "/" + artifact.getArtifactId() + "-" +
+ artifact.getBaseVersion() + "." + artifact.getType() );
is = url.openStream();
-
- }catch(MalformedURLException me){
- reporter.addFailure(artifact, "Error retrieving artifact from remote repository.");
- }catch(IOException ie){
- reporter.addFailure(artifact, "Error retrieving artifact from remote repository.");
+
+ }
+ catch ( MalformedURLException me )
+ {
+ reporter.addFailure( artifact, "Error retrieving artifact from remote repository." );
+ }
+ catch ( IOException ie )
+ {
+ reporter.addFailure( artifact, "Error retrieving artifact from remote repository." );
}
}
-
- Reader reader = new InputStreamReader(is);
+
+ Reader reader = new InputStreamReader( is );
MavenXpp3Reader pomReader = new MavenXpp3Reader();
-
- try{
- Model pomModel = pomReader.read(reader);
- reporter.addSuccess(artifact);
- }catch(XmlPullParserException xe){
- reporter.addFailure(artifact, "The pom xml file is not well-formed. Error while parsing.");
- }catch(IOException oe){
- reporter.addFailure(artifact, "Error while reading the pom xml file.");
+
+ try
+ {
+ Model pomModel = pomReader.read( reader );
+ reporter.addSuccess( artifact );
}
-
- }else{
- reporter.addWarning(artifact, "The artifact is not a pom xml file.");
+ catch ( XmlPullParserException xe )
+ {
+ reporter.addFailure( artifact, "The pom xml file is not well-formed. Error while parsing." );
+ }
+ catch ( IOException oe )
+ {
+ reporter.addFailure( artifact, "Error while reading the pom xml file." );
+ }
+
+ }
+ else
+ {
+ reporter.addWarning( artifact, "The artifact is not a pom xml file." );
}
}
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/LocationArtifactReportProcessor.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/LocationArtifactReportProcessor.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/LocationArtifactReportProcessor.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/LocationArtifactReportProcessor.java Thu Dec 29 20:37:28 2005
@@ -1,22 +1,27 @@
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
- *
+/*
+ * Copyright 2005-2006 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.
+ *
+ * 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.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.util.FileUtils;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -28,12 +33,6 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.util.FileUtils;
-
/**
* Validate the location of the artifact based on the values indicated
* in its pom (both the pom packaged with the artifact & the pom in the
@@ -49,18 +48,18 @@
/**
* Check whether the artifact is in its proper location. The location of the artifact
* is validated first against the groupId, artifactId and versionId in the specified model
- * object (pom in the file system). Then unpack the artifact (jar file) and get the model (pom)
- * included in the package. If a model exists inside the package, then check if the artifact's
+ * object (pom in the file system). Then unpack the artifact (jar file) and get the model (pom)
+ * included in the package. If a model exists inside the package, then check if the artifact's
* location is valid based on the location specified in the pom. Check if the both the location
* specified in the file system pom and in the pom included in the package is the same.
- *
- * @param model Represents the pom in the file system.
- * @param artifact
+ *
+ * @param model Represents the pom in the file system.
+ * @param artifact
* @param reporter
* @param repository
*/
public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
- ArtifactRepository repository )
+ ArtifactRepository repository )
{
boolean fsPomLocation = false, pkgPomLocation = false;
String repositoryUrl = "", modelArtifactLocation = "";
@@ -77,27 +76,27 @@
//check if the artifact is located in its proper location based on the info
//specified in the model object/pom
- modelArtifactLocation = repositoryUrl + model.getGroupId() + "/" + model.getArtifactId() + "/"
- + model.getVersion() + "/" + model.getArtifactId() + "-" + model.getVersion() + "." + model.getPackaging();
+ modelArtifactLocation = repositoryUrl + model.getGroupId() + "/" + model.getArtifactId() + "/" +
+ model.getVersion() + "/" + model.getArtifactId() + "-" + model.getVersion() + "." + model.getPackaging();
fsPomLocation = validateArtifactLocation( modelArtifactLocation );
//get the location of the artifact itself
- String artifactLocation = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/"
- + artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion() + "."
- + artifact.getType();
+ String artifactLocation = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/" +
+ artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion() + "." +
+ artifact.getType();
//unpack the artifact (using the groupId, artifactId & version specified in the artifact object itself
//check if the pom is included in the package
- Model extractedModel = unpackArtifact( artifactLocation, artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getVersion() );
+ Model extractedModel =
+ unpackArtifact( artifactLocation, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
if ( extractedModel != null )
{
- String pkgPomArtifactLocation = repositoryUrl + extractedModel.getGroupId() + "/"
- + extractedModel.getArtifactId() + "/" + extractedModel.getVersion() + "/"
- + extractedModel.getArtifactId() + "-" + extractedModel.getVersion() + "."
- + extractedModel.getPackaging();
+ String pkgPomArtifactLocation = repositoryUrl + extractedModel.getGroupId() + "/" +
+ extractedModel.getArtifactId() + "/" + extractedModel.getVersion() + "/" +
+ extractedModel.getArtifactId() + "-" + extractedModel.getVersion() + "." +
+ extractedModel.getPackaging();
pkgPomLocation = validateArtifactLocation( pkgPomArtifactLocation );
//check the conditions
@@ -143,7 +142,7 @@
/**
* Validate the if the artifact exists in the specified location.
- *
+ *
* @param filename
* @return
*/
@@ -172,7 +171,7 @@
/**
* Extract the contents of the artifact/jar file.
- *
+ *
* @param filename
* @param groupId
* @param artifactId
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/MetadataReportProcessor.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/MetadataReportProcessor.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/MetadataReportProcessor.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/MetadataReportProcessor.java Thu Dec 29 20:37:28 2005
@@ -1,20 +1,19 @@
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
- *
+/*
+ * Copyright 2005-2006 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.
+ *
+ * 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.repository.ArtifactRepository;
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ReportProcessorException.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ReportProcessorException.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ReportProcessorException.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ReportProcessorException.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryMetadataResult.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryMetadataResult.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryMetadataResult.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryMetadataResult.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayer.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayer.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayer.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayer.java Thu Dec 29 20:37:28 2005
@@ -1,26 +1,26 @@
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
- *
+/*
+ * Copyright 2005-2006 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.
+ *
+ * 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 java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.metadata.Snapshot;
+import java.util.List;
+
/**
* The transitive and metadata validation reports will need to query the repository for artifacts.
*/
@@ -29,11 +29,13 @@
String ROLE = RepositoryQueryLayer.class.getName();
public final static boolean ARTIFACT_FOUND = true;
+
public final static boolean ARTIFACT_NOT_FOUND = false;
boolean containsArtifact( Artifact artifact );
boolean containsArtifact( Artifact artifact, Snapshot snapshot );
-
- List getVersions( Artifact artifact ) throws RepositoryQueryLayerException;
+
+ List getVersions( Artifact artifact )
+ throws RepositoryQueryLayerException;
}
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerException.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerException.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerException.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerException.java Thu Dec 29 20:37:28 2005
@@ -1,14 +1,13 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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,
@@ -27,7 +26,7 @@
{
super( message, cause );
}
-
+
public RepositoryQueryLayerException( String message )
{
super( message );
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerFactory.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerFactory.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerFactory.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerFactory.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/resources/META-INF/plexus/components.xml?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/resources/META-INF/plexus/components.xml Thu Dec 29 20:37:28 2005
@@ -1,3 +1,19 @@
+<!--
+ ~ Copyright 2005-2006 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.
+ -->
+
<component-set>
<components>
<component>
@@ -18,28 +34,28 @@
</requirements>
</component>
<component>
- <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
- <role-hint>checksum</role-hint>
- <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- <component>
- <role>org.apache.maven.repository.reporting.MetadataReportProcessor</role>
- <role-hint>checksum-metadata</role-hint>
- <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- <component>
- <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
- <role-hint>artifact-location</role-hint>
- <implementation>org.apache.maven.repository.reporting.LocationArtifactReportProcessor</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- <component>
- <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
- <role-hint>invalid-pom</role-hint>
- <implementation>org.apache.maven.repository.reporting.InvalidPomArtifactReportProcessor</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
+ <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
+ <role-hint>checksum</role-hint>
+ <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+ <component>
+ <role>org.apache.maven.repository.reporting.MetadataReportProcessor</role>
+ <role-hint>checksum-metadata</role-hint>
+ <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+ <component>
+ <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
+ <role-hint>artifact-location</role-hint>
+ <implementation>org.apache.maven.repository.reporting.LocationArtifactReportProcessor</implementation>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+ <component>
+ <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
+ <role-hint>invalid-pom</role-hint>
+ <implementation>org.apache.maven.repository.reporting.InvalidPomArtifactReportProcessor</implementation>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
</components>
</component-set>
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java Thu Dec 29 20:37:28 2005
@@ -1,22 +1,23 @@
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
- *
+/*
+ * Copyright 2005-2006 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.
+ *
+ * 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.util.FileUtils;
+
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
@@ -32,7 +33,6 @@
import java.security.NoSuchAlgorithmException;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
-import org.codehaus.plexus.util.FileUtils;
/**
* This class creates the artifact and metadata files used for testing the ChecksumArtifactReporter.
@@ -41,9 +41,9 @@
public class AbstractChecksumArtifactReporterTest
extends AbstractRepositoryReportsTestCase
{
- protected static final String[] validArtifactChecksumJars = { "validArtifact-1.0" };
+ protected static final String[] validArtifactChecksumJars = {"validArtifact-1.0"};
- protected static final String[] invalidArtifactChecksumJars = { "invalidArtifact-1.0" };
+ protected static final String[] invalidArtifactChecksumJars = {"invalidArtifact-1.0"};
protected static final String metadataChecksumFilename = "maven-metadata-repository";
@@ -65,6 +65,7 @@
/**
* Create checksum files.
+ *
* @param type The type of checksum file to be created.
* @return
*/
@@ -101,6 +102,7 @@
/**
* Create checksum files for metadata.
+ *
* @param type The type of checksum to be created. (Valid or invalid)
* @return
*/
@@ -126,10 +128,11 @@
/**
* Create artifact together with its checksums.
+ *
* @param relativePath The groupId
- * @param filename The filename of the artifact to be created.
- * @param type The file type (JAR)
- * @param isValid Indicates whether the checksum to be created is valid or not.
+ * @param filename The filename of the artifact to be created.
+ * @param type The file type (JAR)
+ * @param isValid Indicates whether the checksum to be created is valid or not.
* @return
*/
private boolean writeChecksumFile( String relativePath, String filename, String type, boolean isValid )
@@ -182,9 +185,13 @@
OutputStream os = new FileOutputStream( file );
OutputStreamWriter osw = new OutputStreamWriter( os );
if ( !isValid )
+ {
osw.write( byteArrayToHexStr( md5chk ) + "1" );
+ }
else
+ {
osw.write( byteArrayToHexStr( md5chk ) );
+ }
osw.close();
}
@@ -194,9 +201,13 @@
OutputStream os = new FileOutputStream( file );
OutputStreamWriter osw = new OutputStreamWriter( os );
if ( !isValid )
+ {
osw.write( byteArrayToHexStr( sha1chk ) + "2" );
+ }
else
+ {
osw.write( byteArrayToHexStr( sha1chk ) );
+ }
osw.close();
}
}
@@ -210,10 +221,11 @@
/**
* Create metadata file together with its checksums.
+ *
* @param relativePath The groupId
- * @param filename The filename of the artifact to be created.
- * @param type The file type (JAR)
- * @param isValid Indicates whether the checksum to be created is valid or not.
+ * @param filename The filename of the artifact to be created.
+ * @param type The file type (JAR)
+ * @param isValid Indicates whether the checksum to be created is valid or not.
* @return
*/
private boolean writeMetadataFile( String relativePath, String filename, String type, boolean isValid )
@@ -242,9 +254,13 @@
OutputStream os = new FileOutputStream( file );
OutputStreamWriter osw = new OutputStreamWriter( os );
if ( !isValid )
+ {
osw.write( byteArrayToHexStr( md5chk ) + "1" );
+ }
else
+ {
osw.write( byteArrayToHexStr( md5chk ) );
+ }
osw.close();
}
@@ -254,9 +270,13 @@
OutputStream os = new FileOutputStream( file );
OutputStreamWriter osw = new OutputStreamWriter( os );
if ( !isValid )
+ {
osw.write( byteArrayToHexStr( sha1chk ) + "2" );
+ }
else
+ {
osw.write( byteArrayToHexStr( sha1chk ) );
+ }
osw.close();
}
}
@@ -271,6 +291,7 @@
/**
* Create the sample file that will be included in the jar.
+ *
* @param filename
* @return
*/
@@ -293,7 +314,7 @@
/**
* Create a checksum from the specified metadata file.
- *
+ *
* @param metadataUrl
* @return
* @throws FileNotFoundException
@@ -326,6 +347,7 @@
/**
* Convert an incoming array of bytes into a string that represents each of
* the bytes as two hex characters.
+ *
* @param data
* @return
*/
@@ -341,7 +363,9 @@
tempStr = Integer.toHexString( tempInt );
if ( tempStr.length() == 1 )
+ {
tempStr = "0" + tempStr;
+ }
output = output + tempStr;
}
@@ -350,6 +374,7 @@
/**
* Delete the test directory created in the repository.
+ *
* @param dirname The directory to be deleted.
* @return
*/
@@ -377,7 +402,6 @@
}
/**
- *
* @return
*/
protected boolean deleteChecksumFiles( String type )
@@ -388,29 +412,39 @@
//delete valid checksum files of artifacts created
for ( int i = 0; i < validArtifactChecksumJars.length; i++ )
{
- b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
- + "/" + validArtifactChecksumJars[i] + "." + type + ".md5" );
+ b = deleteFile( repository.getBasedir() + "checksumTest/" +
+ validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + validArtifactChecksumJars[i] + "." + type +
+ ".md5" );
if ( b == false )
+ {
return b;
+ }
- b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
- + "/" + validArtifactChecksumJars[i] + "." + type + ".sha1" );
+ b = deleteFile( repository.getBasedir() + "checksumTest/" +
+ validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + validArtifactChecksumJars[i] + "." + type +
+ ".sha1" );
if ( b == false )
+ {
return b;
+ }
}
//delete valid checksum files of metadata file
for ( int i = 0; i < validArtifactChecksumJars.length; i++ )
{
- b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
- + "/" + metadataChecksumFilename + ".xml.md5" );
+ b = deleteFile( repository.getBasedir() + "checksumTest/" +
+ validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + metadataChecksumFilename + ".xml.md5" );
if ( b == false )
+ {
return b;
+ }
- b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
- + "/" + metadataChecksumFilename + ".xml.sha1" );
+ b = deleteFile( repository.getBasedir() + "checksumTest/" +
+ validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + metadataChecksumFilename + ".xml.sha1" );
if ( b == false )
+ {
return b;
+ }
}
return b;
}
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryQueryLayerTest.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryQueryLayerTest.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryQueryLayerTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryQueryLayerTest.java Thu Dec 29 20:37:28 2005
@@ -1,14 +1,13 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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,
@@ -17,18 +16,17 @@
* limitations under the License.
*/
-import java.io.File;
-import java.util.List;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.metadata.Snapshot;
-
import org.codehaus.plexus.PlexusTestCase;
+import java.io.File;
+import java.util.List;
+
/**
*
*/
@@ -36,12 +34,13 @@
extends PlexusTestCase
{
protected ArtifactFactory artifactFactory;
-
+
protected ArtifactRepository repository;
-
+
protected CachedRepositoryQueryLayer queryLayer;
-
- protected void setUp() throws Exception
+
+ protected void setUp()
+ throws Exception
{
super.setUp();
File repositoryDirectory = getTestFile( "src/test/repository" );
@@ -57,14 +56,14 @@
public void testContainsArtifactTrue()
{
Artifact artifact = getArtifact( "groupId", "artifactId", "1.0-alpha-1" );
-
+
assertTrue( "check artifact", queryLayer.containsArtifact( artifact ) );
}
public void testContainsArtifactFalse()
{
Artifact artifact = getArtifact( "groupId", "artifactId", "1.0-beta-1" );
-
+
assertFalse( "check non-existent artifact", queryLayer.containsArtifact( artifact ) );
}
@@ -73,7 +72,7 @@
Snapshot snapshot = new Snapshot();
snapshot.setTimestamp( "20050611.202024" );
snapshot.setBuildNumber( 1 );
-
+
Artifact artifact = getArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT" );
assertTrue( "check for snapshot artifact", queryLayer.containsArtifact( artifact, snapshot ) );
}
@@ -83,18 +82,18 @@
Snapshot snapshot = new Snapshot();
snapshot.setTimestamp( "20050611.202024" );
snapshot.setBuildNumber( 2 );
-
+
Artifact artifact = getArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT" );
assertFalse( "check for non-existent snapshot artifact", queryLayer.containsArtifact( artifact, snapshot ) );
}
-
+
public void testArtifactVersionsTrue()
throws Exception
{
Artifact artifact = getArtifact( "groupId", "artifactId", "ignored" );
-
+
List versions = queryLayer.getVersions( artifact );
-
+
assertTrue( "check version 1.0-alpha-1", versions.contains( "1.0-alpha-1" ) );
assertTrue( "check version 1.0-alpha-2", versions.contains( "1.0-alpha-2" ) );
assertFalse( "check version 1.0-alpha-3", versions.contains( "1.0-alpha-3" ) );
@@ -104,18 +103,18 @@
throws Exception
{
Artifact artifact = getArtifact( "groupId", "artifactId", "ignored" );
-
+
List versions = queryLayer.getVersions( artifact );
-
+
assertTrue( "check version 1.0-alpha-1", versions.contains( "1.0-alpha-1" ) );
assertTrue( "check version 1.0-alpha-2", versions.contains( "1.0-alpha-2" ) );
assertFalse( "check version 1.0-alpha-3", versions.contains( "1.0-alpha-3" ) );
}
-
+
public void testArtifactVersionsError()
{
Artifact artifact = getArtifact( "groupId", "none", "ignored" );
-
+
try
{
queryLayer.getVersions( artifact );
@@ -132,7 +131,8 @@
return artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" );
}
- protected void tearDown() throws Exception
+ protected void tearDown()
+ throws Exception
{
release( artifactFactory );
super.tearDown();
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryReportsTestCase.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryReportsTestCase.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryReportsTestCase.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryReportsTestCase.java Thu Dec 29 20:37:28 2005
@@ -1,14 +1,13 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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,
@@ -48,7 +47,7 @@
protected static final String remoteArtifactType = "jar";
protected static final String remoteRepoId = "remote-repo";
-
+
protected void setUp()
throws Exception
{
@@ -58,8 +57,8 @@
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
- repository =
- factory.createArtifactRepository( "repository", repositoryDirectory.toURL().toString(), layout, null, null );
+ repository = factory.createArtifactRepository( "repository", repositoryDirectory.toURL().toString(), layout,
+ null, null );
}
}
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReportProcessorTest.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReportProcessorTest.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReportProcessorTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReportProcessorTest.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
@@ -16,9 +16,9 @@
* limitations under the License.
*/
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Dependency;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
import java.util.Iterator;
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReporterTest.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReporterTest.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReporterTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReporterTest.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.apache.maven.model.Model;
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/BadMetadataReportProcessorTest.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/BadMetadataReportProcessorTest.java?rev=359986&r1=359985&r2=359986&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/BadMetadataReportProcessorTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/BadMetadataReportProcessorTest.java Thu Dec 29 20:37:28 2005
@@ -1,7 +1,7 @@
package org.apache.maven.repository.reporting;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 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.
@@ -29,7 +29,7 @@
import java.util.Iterator;
/**
- * @todo??? should use MetadataXpp3Reader instead ?
+ * @todo??? should use MetadataXpp3Reader instead ?
*/
public class BadMetadataReportProcessorTest
extends AbstractRepositoryReportsTestCase
@@ -47,7 +47,7 @@
badMetadataReportProcessor = (MetadataReportProcessor) lookup( MetadataReportProcessor.ROLE );
}
-
+
public void testMetadataMissingLastUpdated()
throws ReportProcessorException
{
@@ -67,12 +67,10 @@
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
assertEquals( "check metadata", metadata, result.getMetadata() );
- assertEquals( "check reason",
- "Missing lastUpdated element inside the metadata.",
- result.getReason() );
+ assertEquals( "check reason", "Missing lastUpdated element inside the metadata.", result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
-
+
public void testMetadataValidVersions()
throws ReportProcessorException
{
@@ -118,7 +116,7 @@
result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
-
+
public void testMetadataInvalidArtifactVersion()
throws ReportProcessorException
{
@@ -146,7 +144,7 @@
result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
-
+
public void testMoreThanOneMetadataVersionErrors()
throws ReportProcessorException
{
@@ -188,13 +186,13 @@
RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default2" ) );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
-
+
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertFalse( "check there are no failures", failures.hasNext() );
}
-
+
public void testMissingMetadataPlugin()
throws ReportProcessorException
{
@@ -204,14 +202,15 @@
metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default2" ) );
metadata.getMetadata().addPlugin( createMetadataPlugin( "missing-plugin", "default3" ) );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
// TODO: should be more robust
- assertEquals( "check reason", "Metadata plugin missing-plugin not found in the repository", result.getReason() );
+ assertEquals( "check reason", "Metadata plugin missing-plugin not found in the repository",
+ result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
@@ -222,18 +221,19 @@
RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
// TODO: should be more robust
- assertEquals( "check reason", "Plugin snapshot-artifact is present in the repository but " +
- "missing in the metadata.", result.getReason() );
+ assertEquals( "check reason",
+ "Plugin snapshot-artifact is present in the repository but " + "missing in the metadata.",
+ result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
-
+
public void testInvalidPluginArtifactId()
throws ReportProcessorException
{
@@ -244,7 +244,7 @@
metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default2" ) );
metadata.getMetadata().addPlugin( createMetadataPlugin( null, "default3" ) );
metadata.getMetadata().addPlugin( createMetadataPlugin( "", "default4" ) );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
@@ -258,7 +258,7 @@
assertEquals( "check reason", "Missing or empty artifactId in group metadata.", result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
-
+
public void testInvalidPluginPrefix()
throws ReportProcessorException
{
@@ -267,7 +267,7 @@
RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", null ) );
metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "" ) );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
@@ -278,10 +278,11 @@
assertTrue( "check there is a 2nd failure", failures.hasNext() );
result = (RepositoryMetadataResult) failures.next();
// TODO: should be more robust
- assertEquals( "check reason", "Missing or empty plugin prefix for artifactId snapshot-artifact.", result.getReason() );
+ assertEquals( "check reason", "Missing or empty plugin prefix for artifactId snapshot-artifact.",
+ result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
-
+
public void testDuplicatePluginPrefixes()
throws ReportProcessorException
{
@@ -290,7 +291,7 @@
RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default" ) );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
@@ -305,18 +306,18 @@
throws ReportProcessorException
{
ArtifactReporter reporter = new MockArtifactReporter();
-
- Artifact artifact = artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact",
- "1.0-alpha-1-SNAPSHOT", "type" );
+
+ Artifact artifact =
+ artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT", "type" );
Snapshot snapshot = new Snapshot();
snapshot.setBuildNumber( 1 );
snapshot.setTimestamp( "20050611.202024" );
RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
-
+
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertFalse( "check there are no failures", failures.hasNext() );
}
@@ -325,18 +326,18 @@
throws ReportProcessorException
{
ArtifactReporter reporter = new MockArtifactReporter();
-
- Artifact artifact = artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact",
- "1.0-alpha-1-SNAPSHOT", "type" );
+
+ Artifact artifact =
+ artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT", "type" );
Snapshot snapshot = new Snapshot();
snapshot.setBuildNumber( 2 );
snapshot.setTimestamp( "20050611.202024" );
RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot );
-
+
badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
-
+
Iterator failures = reporter.getRepositoryMetadataFailureIterator();
assertTrue( "check there is a failure", failures.hasNext() );
RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
@@ -345,7 +346,7 @@
assertEquals( "check reason", "Snapshot artifact 20050611.202024-2 does not exist.", result.getReason() );
assertFalse( "check no more failures", failures.hasNext() );
}
-
+
private Plugin createMetadataPlugin( String artifactId, String prefix )
{
Plugin plugin = new Plugin();