You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by jo...@apache.org on 2007/02/17 18:04:45 UTC
svn commit: r508779 [2/4] - in /maven/archiva/branches/archiva-MRM-239: ./
archiva-cli/ archiva-cli/src/main/java/org/apache/maven/archiva/cli/
archiva-common/ archiva-common/src/main/java/org/apache/maven/archiva/common/
archiva-common/src/main/java/o...
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AbstractArchivaCommonTestCase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AbstractArchivaCommonTestCase.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AbstractArchivaCommonTestCase.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AbstractArchivaCommonTestCase.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,191 @@
+package org.apache.maven.archiva.common;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.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;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * AbstractArchivaCommonTestCase
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractArchivaCommonTestCase
+ extends PlexusTestCase
+{
+ protected ArtifactRepository getLegacyRepository()
+ throws Exception
+ {
+ File repoBaseDir = new File( getBasedir(), "src/test/legacy-repository" );
+ ArtifactRepository repository = createRepository( repoBaseDir, "legacy" );
+ resetRepositoryState( repository );
+ return repository;
+ }
+
+ protected ArtifactRepository getDefaultRepository()
+ throws Exception
+ {
+ File repoBaseDir = new File( getBasedir(), "src/test/repository" );
+ ArtifactRepository repository = createRepository( repoBaseDir, "default" );
+ resetRepositoryState( repository );
+ return repository;
+ }
+
+ private void resetRepositoryState( ArtifactRepository repository )
+ throws IOException
+ {
+ File repoBaseDir = new File( repository.getBasedir() );
+
+ List tmpfiles = FileUtils.getFiles( repoBaseDir, ".*", "" );
+ for ( Iterator it = tmpfiles.iterator(); it.hasNext(); )
+ {
+ File hit = (File) it.next();
+ if ( hit.exists() )
+ {
+ if ( hit.isFile() )
+ {
+ hit.delete();
+ }
+
+ if ( hit.isDirectory() )
+ {
+ FileUtils.deleteDirectory( hit );
+ }
+ }
+ }
+ }
+
+ protected ArtifactRepository createRepository( File basedir, String layout )
+ throws Exception
+ {
+ ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
+
+ ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, layout );
+
+ return factory.createArtifactRepository( "discoveryRepo", "file://" + basedir, repoLayout, null, null );
+ }
+
+ public List getLegacyLayoutArtifactPaths()
+ {
+ List files = new ArrayList();
+
+ files.add( "invalid/jars/1.0/invalid-1.0.jar" );
+ files.add( "invalid/jars/invalid-1.0.rar" );
+ files.add( "invalid/jars/invalid.jar" );
+ files.add( "invalid/invalid-1.0.jar" );
+ files.add( "javax.sql/jars/jdbc-2.0.jar" );
+ files.add( "org.apache.maven/jars/some-ejb-1.0-client.jar" );
+ files.add( "org.apache.maven/jars/testing-1.0.jar" );
+ files.add( "org.apache.maven/jars/testing-1.0-sources.jar" );
+ files.add( "org.apache.maven/jars/testing-UNKNOWN.jar" );
+ files.add( "org.apache.maven/jars/testing-1.0.zip" );
+ files.add( "org.apache.maven/jars/testing-1.0-20050611.112233-1.jar" );
+ files.add( "org.apache.maven/jars/testing-1.0.tar.gz" );
+ files.add( "org.apache.maven.update/jars/test-not-updated-1.0.jar" );
+ files.add( "org.apache.maven.update/jars/test-updated-1.0.jar" );
+
+ return files;
+ }
+
+ public List getDefaultLayoutArtifactPaths()
+ {
+ List files = new ArrayList();
+
+ files.add( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" );
+ files.add( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar" );
+ files.add( "invalid/invalid/1.0/invalid-1.0b.jar" );
+ files.add( "invalid/invalid/1.0/invalid-2.0.jar" );
+ files.add( "invalid/invalid-1.0.jar" );
+ files.add( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar" );
+ files.add( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar" );
+ files.add( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar" );
+ files.add( "org/apache/maven/A/1.0/A-1.0.war" );
+ files.add( "org/apache/maven/A/1.0/A-1.0.pom" );
+ files.add( "org/apache/maven/B/2.0/B-2.0.pom" );
+ files.add( "org/apache/maven/B/1.0/B-1.0.pom" );
+ files.add( "org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar" );
+ files.add( "org/apache/maven/C/1.0/C-1.0.war" );
+ files.add( "org/apache/maven/C/1.0/C-1.0.pom" );
+ files.add( "org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.pom" );
+ files.add( "org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.jar" );
+ files.add( "org/apache/maven/update/test-updated/1.0/test-updated-1.0.pom" );
+ files.add( "org/apache/maven/update/test-updated/1.0/test-updated-1.0.jar" );
+ files.add( "org/apache/maven/discovery/1.0/discovery-1.0.pom" );
+ files.add( "org/apache/maven/testing/1.0/testing-1.0-test-sources.jar" );
+ files.add( "org/apache/maven/testing/1.0/testing-1.0.jar" );
+ files.add( "org/apache/maven/testing/1.0/testing-1.0-sources.jar" );
+ files.add( "org/apache/maven/testing/1.0/testing-1.0.zip" );
+ files.add( "org/apache/maven/testing/1.0/testing-1.0.tar.gz" );
+ files.add( "org/apache/maven/samplejar/2.0/samplejar-2.0.pom" );
+ files.add( "org/apache/maven/samplejar/2.0/samplejar-2.0.jar" );
+ files.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.pom" );
+ files.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.jar" );
+ files.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
+ files.add( "javax/sql/jdbc/2.0/jdbc-2.0.jar" );
+
+ return files;
+ }
+
+ public List getDefaultLayoutMetadataPaths()
+ {
+ List files = new ArrayList();
+
+ files.add( "org/apache/maven/some-ejb/1.0/maven-metadata.xml" );
+ files.add( "org/apache/maven/update/test-not-updated/maven-metadata.xml" );
+ files.add( "org/apache/maven/update/test-updated/maven-metadata.xml" );
+ files.add( "org/apache/maven/maven-metadata.xml" );
+ files.add( "org/apache/testgroup/discovery/1.0/maven-metadata.xml" );
+ files.add( "org/apache/testgroup/discovery/maven-metadata.xml" );
+ files.add( "javax/sql/jdbc/2.0/maven-metadata-repository.xml" );
+ files.add( "javax/sql/jdbc/maven-metadata-repository.xml" );
+ files.add( "javax/sql/maven-metadata-repository.xml" );
+ files.add( "javax/maven-metadata.xml" );
+
+ return files;
+ }
+
+ public List getDefaultLayoutModelPaths()
+ {
+ List files = new ArrayList();
+
+ files.add( "org/apache/maven/A/1.0/A-1.0.pom" );
+ files.add( "org/apache/maven/B/2.0/B-2.0.pom" );
+ files.add( "org/apache/maven/B/1.0/B-1.0.pom" );
+ files.add( "org/apache/maven/C/1.0/C-1.0.pom" );
+ files.add( "org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.pom" );
+ files.add( "org/apache/maven/update/test-updated/1.0/test-updated-1.0.pom" );
+ files.add( "org/apache/maven/discovery/1.0/discovery-1.0.pom" );
+ files.add( "org/apache/maven/samplejar/2.0/samplejar-2.0.pom" );
+ files.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.pom" );
+ files.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
+
+ return files;
+ }
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AbstractArchivaCommonTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AbstractArchivaCommonTestCase.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AbstractArchivaCommonTestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AllTests.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AllTests.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AllTests.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,45 @@
+package org.apache.maven.archiva.common;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.common" );
+ //$JUnit-BEGIN$
+ suite.addTest( org.apache.maven.archiva.common.artifact.builder.AllTests.suite() );
+ suite.addTest( org.apache.maven.archiva.common.consumers.AllTests.suite() );
+ suite.addTest( org.apache.maven.archiva.common.utils.AllTests.suite() );
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AllTests.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/AllTests.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AbstractLayoutArtifactBuilderTestCase.java (from r507719, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/AbstractLayoutArtifactBuilderTestCase.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AbstractLayoutArtifactBuilderTestCase.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/AbstractLayoutArtifactBuilderTestCase.java&r1=507719&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AbstractLayoutArtifactBuilderTestCase.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/AbstractLayoutArtifactBuilderTestCase.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AbstractLayoutArtifactBuilderTestCase.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer.builders;
+package org.apache.maven.archiva.common.artifact.builder;
/*
* Licensed to the Apache Software Foundation (ASF) under one
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AllTests.java (from r507719, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/AllTests.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AllTests.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/AllTests.java&r1=507719&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AllTests.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/AllTests.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/AllTests.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer.builders;
+package org.apache.maven.archiva.common.artifact.builder;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -35,8 +35,8 @@
{
TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.discoverer.builders" );
//$JUnit-BEGIN$
- suite.addTestSuite( DefaultLayoutArtifactBuilderTest.class );
suite.addTestSuite( LegacyLayoutArtifactBuilderTest.class );
+ suite.addTestSuite( DefaultLayoutArtifactBuilderTest.class );
//$JUnit-END$
return suite;
}
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/DefaultLayoutArtifactBuilderTest.java (from r507550, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/DefaultLayoutArtifactBuilderTest.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/DefaultLayoutArtifactBuilderTest.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/DefaultLayoutArtifactBuilderTest.java&r1=507550&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/DefaultLayoutArtifactBuilderTest.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/DefaultLayoutArtifactBuilderTest.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/DefaultLayoutArtifactBuilderTest.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer.builders;
+package org.apache.maven.archiva.common.artifact.builder;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,8 +19,6 @@
* under the License.
*/
-import org.apache.maven.archiva.discoverer.DiscovererException;
-
/**
* DefaultLayoutArtifactBuilderTest
*
@@ -53,7 +51,7 @@
}
public void testPathDistributionArtifacts()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
assertArtifact( "org.apache.maven", "testing", "1.0", "distribution-tgz", null, builder
.build( "org/apache/maven/testing/1.0/testing-1.0.tar.gz" ) );
@@ -63,7 +61,7 @@
}
public void testPathNormal()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
assertArtifact( "org.apache.maven.wagon", "wagon", "1.0", "jar", null, builder
.build( "/org/apache/maven/wagon/wagon/1.0/wagon-1.0.jar" ) );
@@ -76,7 +74,7 @@
}
public void testPathSnapshots()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
assertArtifact( "org.apache.maven", "test", "1.0-SNAPSHOT", "jar", null, builder
.build( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar" ) );
@@ -86,28 +84,27 @@
}
public void testPathSnapshotWithClassifier()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
assertArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", "javadoc", builder
.build( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar" ) );
}
public void testPathWithClassifier()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
assertArtifact( "org.apache.maven", "some-ejb", "1.0", "jar", "client", builder
.build( "org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar" ) );
}
public void testPathWithJavaSourceInclusion()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
assertArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources", builder
.build( "org/apache/maven/testing/1.0/testing-1.0-sources.jar" ) );
}
public void testProblemMissingType()
- throws DiscovererException
{
try
{
@@ -122,7 +119,6 @@
}
public void testProblemNonSnapshotInSnapshotDir()
- throws DiscovererException
{
try
{
@@ -137,7 +133,6 @@
}
public void testProblemPathTooShort()
- throws DiscovererException
{
try
{
@@ -152,7 +147,6 @@
}
public void testProblemTimestampSnapshotNotInSnapshotDir()
- throws DiscovererException
{
try
{
@@ -169,7 +163,6 @@
}
public void testProblemVersionPathMismatch()
- throws DiscovererException
{
try
{
@@ -184,7 +177,6 @@
}
public void testProblemVersionPathMismatchAlt()
- throws DiscovererException
{
try
{
@@ -199,7 +191,6 @@
}
public void testProblemWrongArtifactId()
- throws DiscovererException
{
try
{
@@ -212,5 +203,4 @@
assertEquals( "Path filename does not correspond to an artifact.", e.getMessage() );
}
}
-
}
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/LegacyLayoutArtifactBuilderTest.java (from r507550, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/LegacyLayoutArtifactBuilderTest.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/LegacyLayoutArtifactBuilderTest.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/LegacyLayoutArtifactBuilderTest.java&r1=507550&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/LegacyLayoutArtifactBuilderTest.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/builders/LegacyLayoutArtifactBuilderTest.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/artifact/builder/LegacyLayoutArtifactBuilderTest.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer.builders;
+package org.apache.maven.archiva.common.artifact.builder;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,7 +19,6 @@
* under the License.
*/
-import org.apache.maven.archiva.discoverer.DiscovererException;
import org.apache.maven.artifact.Artifact;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@@ -54,7 +53,7 @@
}
public void testPathNormal()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
Artifact artifact = builder.build( "javax.sql/jars/jdbc-2.0.jar" );
@@ -62,7 +61,7 @@
}
public void testPathFinal()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
Artifact artifact = builder.build( "org.apache.maven.test/jars/maven-model-1.0-final-20060606.jar" );
@@ -70,7 +69,7 @@
}
public void testPathSnapshot()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
Artifact artifact = builder.build( "org.apache.maven.test/jars/maven-model-1.0-SNAPSHOT.jar" );
@@ -78,7 +77,7 @@
}
public void testPathJavadoc()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
Artifact artifact = builder.build( "javax.sql/javadoc.jars/jdbc-2.0-javadoc.jar" );
@@ -86,7 +85,7 @@
}
public void testPathSources()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
Artifact artifact = builder.build( "javax.sql/java-sources/jdbc-2.0-sources.jar" );
@@ -94,7 +93,7 @@
}
public void testPathPlugin()
- throws BuilderException, DiscovererException
+ throws BuilderException
{
Artifact artifact = builder.build( "maven/plugins/maven-test-plugin-1.8.jar" );
@@ -109,7 +108,7 @@
fail( "Should have detected no type." );
}
- catch ( DiscovererException e )
+ catch ( BuilderException e )
{
/* expected path */
assertEquals( "Path does not match a legacy repository path for an artifact", e.getMessage() );
@@ -117,7 +116,7 @@
}
public void testProblemWrongArtifactPackaging()
- throws ComponentLookupException, DiscovererException
+ throws ComponentLookupException
{
try
{
@@ -125,7 +124,7 @@
fail( "Should have detected wrong package extension." );
}
- catch ( DiscovererException e )
+ catch ( BuilderException e )
{
/* expected path */
assertEquals( "Path type does not match the extension", e.getMessage() );
@@ -133,7 +132,6 @@
}
public void testProblemNoArtifactId()
- throws DiscovererException
{
try
{
@@ -141,7 +139,7 @@
fail( "Should have detected artifactId is missing" );
}
- catch ( DiscovererException e )
+ catch ( BuilderException e )
{
/* expected path */
assertEquals( "Path filename artifactId is empty", e.getMessage() );
@@ -153,7 +151,7 @@
fail( "Should have detected artifactId is missing" );
}
- catch ( DiscovererException e )
+ catch ( BuilderException e )
{
/* expected path */
assertEquals( "Path filename artifactId is empty", e.getMessage() );
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AbstractGenericConsumerTestCase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AbstractGenericConsumerTestCase.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AbstractGenericConsumerTestCase.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AbstractGenericConsumerTestCase.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,52 @@
+package org.apache.maven.archiva.common.consumers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.archiva.common.AbstractArchivaCommonTestCase;
+
+/**
+ * AbstractGenericConsumerTestCase
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractGenericConsumerTestCase
+ extends AbstractArchivaCommonTestCase
+{
+ protected ConsumerFactory consumerFactory;
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ consumerFactory = (ConsumerFactory) lookup( ConsumerFactory.ROLE );
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ if ( consumerFactory != null )
+ {
+ release( consumerFactory );
+ }
+ super.tearDown();
+ }
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AbstractGenericConsumerTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AbstractGenericConsumerTestCase.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AbstractGenericConsumerTestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AllTests.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AllTests.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AllTests.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,43 @@
+package org.apache.maven.archiva.common.consumers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.common.consumers" );
+ //$JUnit-BEGIN$
+ suite.addTestSuite( GenericArtifactConsumerTest.class );
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AllTests.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/AllTests.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/FileProblemsTracker.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/FileProblemsTracker.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/FileProblemsTracker.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/FileProblemsTracker.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,112 @@
+package org.apache.maven.archiva.common.consumers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.archiva.common.utils.BaseFile;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * FileProblemsTracker
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class FileProblemsTracker
+{
+ private Map problemMap = new HashMap();
+
+ public void addProblem( BaseFile file, String message )
+ {
+ String path = file.getRelativePath();
+ addProblem( path, message );
+ }
+
+ private void addProblem( String path, String message )
+ {
+ List problems = getProblems( path );
+ problems.add( message );
+ problemMap.put( path, problems );
+ }
+
+ public void addProblem( ConsumerException e )
+ {
+ if ( e.getFile() != null )
+ {
+ this.addProblem( e.getFile(), e.getMessage() );
+ }
+ else
+ {
+ this.addProblem( "|fatal|", e.getMessage() );
+ }
+ }
+
+ public boolean hasProblems( String path )
+ {
+ if ( !problemMap.containsKey( path ) )
+ {
+ // No tracking of path at all.
+ return false;
+ }
+
+ List problems = (List) problemMap.get( path );
+ if ( problems == null )
+ {
+ // found path, but no list.
+ return false;
+ }
+
+ return !problems.isEmpty();
+ }
+
+ public Set getPaths()
+ {
+ return problemMap.keySet();
+ }
+
+ public List getProblems( String path )
+ {
+ List problems = (List) problemMap.get( path );
+ if ( problems == null )
+ {
+ problems = new ArrayList();
+ }
+
+ return problems;
+ }
+
+ public int getProblemCount()
+ {
+ int count = 0;
+ for ( Iterator it = problemMap.values().iterator(); it.hasNext(); )
+ {
+ List problems = (List) it.next();
+ count += problems.size();
+ }
+
+ return count;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/FileProblemsTracker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/FileProblemsTracker.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/FileProblemsTracker.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,220 @@
+package org.apache.maven.archiva.common.consumers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.lang.StringUtils;
+import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * GenericArtifactConsumerTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class GenericArtifactConsumerTest
+ extends AbstractGenericConsumerTestCase
+{
+ private MockArtifactConsumer getMockArtifactConsumer()
+ throws Exception
+ {
+ return (MockArtifactConsumer) consumerFactory.createConsumer( "mock-artifact" );
+ }
+
+ public void testScanLegacy()
+ throws Exception
+ {
+ ArtifactRepository repository = getLegacyRepository();
+ List consumers = new ArrayList();
+
+ MockArtifactConsumer mockConsumer = getMockArtifactConsumer();
+ mockConsumer.init( repository );
+
+ consumers.add( mockConsumer );
+
+ List files = getLegacyLayoutArtifactPaths();
+ for ( Iterator it = files.iterator(); it.hasNext(); )
+ {
+ String path = (String) it.next();
+ try
+ {
+ mockConsumer.processFile( new BaseFile( repository.getBasedir(), path ) );
+ }
+ catch ( ConsumerException e )
+ {
+ mockConsumer.getProblemsTracker().addProblem( e );
+ }
+ }
+
+ assertNotNull( consumers );
+
+ FileProblemsTracker tracker = mockConsumer.getProblemsTracker();
+
+ assertTracker( tracker, 16 );
+
+ assertHasFailureMessage( "Path does not match a legacy repository path for an artifact",
+ "invalid/invalid-1.0.jar", tracker );
+ assertHasFailureMessage( "Path filename version is empty", "invalid/jars/invalid.jar", tracker );
+ assertHasFailureMessage( "Path does not match a legacy repository path for an artifact",
+ "invalid/jars/1.0/invalid-1.0.jar", tracker );
+
+ assertEquals( 10, mockConsumer.getArtifactMap().size() );
+ }
+
+ public void testScanDefault()
+ throws Exception
+ {
+ ArtifactRepository repository = getDefaultRepository();
+ List consumers = new ArrayList();
+
+ MockArtifactConsumer mockConsumer = getMockArtifactConsumer();
+ mockConsumer.init( repository );
+
+ consumers.add( mockConsumer );
+
+ List files = getDefaultLayoutArtifactPaths();
+ for ( Iterator it = files.iterator(); it.hasNext(); )
+ {
+ String path = (String) it.next();
+ try
+ {
+ mockConsumer.processFile( new BaseFile( repository.getBasedir(), path ) );
+ }
+ catch ( ConsumerException e )
+ {
+ mockConsumer.getProblemsTracker().addProblem( e );
+ }
+ }
+
+ // Test gathered information from Mock consumer.
+
+ assertNotNull( consumers );
+
+ FileProblemsTracker tracker = mockConsumer.getProblemsTracker();
+
+ assertTracker( tracker, 21 );
+
+ assertHasFailureMessage( "Failed to create a snapshot artifact: invalid:invalid:jar:1.0:runtime",
+ "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar", tracker );
+ assertHasFailureMessage( "Path is too short to build an artifact from.", "invalid/invalid-1.0.jar", tracker );
+ assertHasFailureMessage( "Built artifact version does not match path version",
+ "invalid/invalid/1.0/invalid-2.0.jar", tracker );
+
+ assertEquals( 25, mockConsumer.getArtifactMap().size() );
+
+ // Test for known include artifacts
+
+ Collection artifacts = mockConsumer.getArtifactMap().values();
+ assertHasArtifact( "org.apache.maven", "testing", "1.0", "jar", null, artifacts );
+ assertHasArtifact( "org.apache.maven", "some-ejb", "1.0", "jar", "client", artifacts );
+ assertHasArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources", artifacts );
+ assertHasArtifact( "org.apache.maven", "testing", "1.0", "java-source", "test-sources", artifacts );
+ assertHasArtifact( "org.apache.maven", "testing", "1.0", "distribution-zip", null, artifacts );
+ assertHasArtifact( "org.apache.maven", "testing", "1.0", "distribution-tgz", null, artifacts );
+ assertHasArtifact( "javax.sql", "jdbc", "2.0", "jar", null, artifacts );
+ assertHasArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", null, artifacts );
+ assertHasArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", "javadoc", artifacts );
+
+ // Test for known excluded files and dirs to validate exclusions.
+
+ Iterator it = mockConsumer.getArtifactMap().values().iterator();
+ while ( it.hasNext() )
+ {
+ Artifact a = (Artifact) it.next();
+ assertTrue( "Artifact " + a + " should have it's .getFile() set.", a.getFile() != null );
+ assertTrue( "Artifact " + a + " should have it's .getRepository() set.", a.getRepository() != null );
+ assertTrue( "Artifact " + a + " should have non-null repository url.", a.getRepository().getUrl() != null );
+ assertFalse( "Check not CVS", a.getFile().getPath().indexOf( "CVS" ) >= 0 );
+ assertFalse( "Check not .svn", a.getFile().getPath().indexOf( ".svn" ) >= 0 );
+ }
+ }
+
+ private void dumpProblems( FileProblemsTracker tracker )
+ {
+ int problemNum = 0;
+ System.out.println( "-- ProblemTracker dump -------------------------" );
+ for ( Iterator itPaths = tracker.getPaths().iterator(); itPaths.hasNext(); )
+ {
+ String path = (String) itPaths.next();
+ System.out.println( " [" + problemNum + "]: " + path );
+
+ int messageNum = 0;
+ for ( Iterator itProblems = tracker.getProblems( path ).iterator(); itProblems.hasNext(); )
+ {
+ String message = (String) itProblems.next();
+ System.out.println( " [" + messageNum + "]: " + message );
+ messageNum++;
+ }
+
+ problemNum++;
+ }
+ }
+
+ private void assertTracker( FileProblemsTracker tracker, int expectedProblemCount )
+ {
+ assertNotNull( "ProblemsTracker should not be null.", tracker );
+
+ int actualProblemCount = tracker.getProblemCount();
+ if ( expectedProblemCount != actualProblemCount )
+ {
+ dumpProblems( tracker );
+ fail( "Problem count (across all paths) expected:<" + expectedProblemCount + ">, actual:<"
+ + actualProblemCount + ">" );
+ }
+ }
+
+ private void assertHasFailureMessage( String message, String path, FileProblemsTracker tracker )
+ {
+ if ( !tracker.hasProblems( path ) )
+ {
+ fail( "There are no messages for expected path [" + path + "]" );
+ }
+
+ assertTrue( "Unable to find message [" + message + "] in path [" + path + "]", tracker.getProblems( path )
+ .contains( message ) );
+ }
+
+ private void assertHasArtifact( String groupId, String artifactId, String version, String type, String classifier,
+ Collection collection )
+ {
+ for ( Iterator it = collection.iterator(); it.hasNext(); )
+ {
+ Artifact artifact = (Artifact) it.next();
+ if ( StringUtils.equals( groupId, artifact.getGroupId() )
+ && StringUtils.equals( artifactId, artifact.getArtifactId() )
+ && StringUtils.equals( version, artifact.getVersion() )
+ && StringUtils.equals( type, artifact.getType() )
+ && StringUtils.equals( classifier, artifact.getClassifier() ) )
+ {
+ // Found it!
+ return;
+ }
+ }
+
+ fail( "Was unable to find artifact " + groupId + ":" + artifactId + ":" + version + ":" + type + ":"
+ + classifier );
+ }
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockArtifactConsumer.java (from r507550, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockArtifactConsumer.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockArtifactConsumer.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockArtifactConsumer.java&r1=507550&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockArtifactConsumer.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockArtifactConsumer.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockArtifactConsumer.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer.consumers;
+package org.apache.maven.archiva.common.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,10 +19,10 @@
* under the License.
*/
-import org.apache.maven.archiva.discoverer.PathUtil;
+import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.artifact.Artifact;
-import java.io.File;
import java.util.HashMap;
import java.util.Map;
@@ -32,7 +32,7 @@
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.discoverer.DiscovererConsumers"
+ * @plexus.component role="org.apache.maven.archiva.common.consumers.Consumers"
* role-hint="mock-artifact"
* instantiation-strategy="per-lookup"
*/
@@ -41,18 +41,17 @@
{
private Map artifactMap = new HashMap();
- private Map failureMap = new HashMap();
+ private FileProblemsTracker problemsTracker = new FileProblemsTracker();
- public void processArtifact( Artifact artifact, File file )
+ public void processArtifact( Artifact artifact, BaseFile file )
{
String relpath = PathUtil.getRelative( repository.getBasedir(), file );
artifactMap.put( relpath, artifact );
}
- public void processArtifactBuildFailure( File path, String message )
+ public void processFileProblem( BaseFile file, String message )
{
- String relpath = PathUtil.getRelative( repository.getBasedir(), path );
- failureMap.put( relpath, message );
+ problemsTracker.addProblem( file, message );
}
public Map getArtifactMap()
@@ -60,8 +59,13 @@
return artifactMap;
}
- public Map getFailureMap()
+ public String getName()
{
- return failureMap;
+ return "Mock Artifact Consumer (Testing Only)";
+ }
+
+ public FileProblemsTracker getProblemsTracker()
+ {
+ return problemsTracker;
}
}
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockModelConsumer.java (from r507550, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockModelConsumer.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockModelConsumer.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockModelConsumer.java&r1=507550&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockModelConsumer.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockModelConsumer.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockModelConsumer.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer.consumers;
+package org.apache.maven.archiva.common.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,10 +19,9 @@
* under the License.
*/
-import org.apache.maven.archiva.discoverer.PathUtil;
+import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.model.Model;
-import java.io.File;
import java.util.HashMap;
import java.util.Map;
@@ -32,7 +31,7 @@
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.discoverer.DiscovererConsumers"
+ * @plexus.component role="org.apache.maven.archiva.common.consumers.Consumers"
* role-hint="mock-model"
* instantiation-strategy="per-lookup"
*/
@@ -41,14 +40,31 @@
{
private Map modelMap = new HashMap();
- public void processModel( Model model, File file )
+ private FileProblemsTracker problemsTracker = new FileProblemsTracker();
+
+ public void processModel( Model model, BaseFile file )
+ {
+ modelMap.put( file.getRelativePath(), model );
+ }
+
+ public void processFileProblem( BaseFile file, String message )
{
- String relpath = PathUtil.getRelative( repository.getBasedir(), file );
- modelMap.put( relpath, model );
+ problemsTracker.addProblem( file, message );
}
public Map getModelMap()
{
return modelMap;
}
+
+ public String getName()
+ {
+ return "Mock Model Consumer (Testing Only)";
+ }
+
+ public FileProblemsTracker getProblemsTracker()
+ {
+ return problemsTracker;
+ }
+
}
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockRepositoryMetadataConsumer.java (from r507550, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockRepositoryMetadataConsumer.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockRepositoryMetadataConsumer.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockRepositoryMetadataConsumer.java&r1=507550&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockRepositoryMetadataConsumer.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/consumers/MockRepositoryMetadataConsumer.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/consumers/MockRepositoryMetadataConsumer.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer.consumers;
+package org.apache.maven.archiva.common.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,10 +19,9 @@
* under the License.
*/
-import org.apache.maven.archiva.discoverer.PathUtil;
+import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import java.io.File;
import java.util.HashMap;
import java.util.Map;
@@ -32,7 +31,7 @@
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.discoverer.DiscovererConsumers"
+ * @plexus.component role="org.apache.maven.archiva.common.consumers.Consumers"
* role-hint="mock-metadata"
* instantiation-strategy="per-lookup"
*/
@@ -41,14 +40,30 @@
{
private Map repositoryMetadataMap = new HashMap();
- public void processRepositoryMetadata( RepositoryMetadata metadata, File file )
+ private FileProblemsTracker problemsTracker = new FileProblemsTracker();
+
+ public void processRepositoryMetadata( RepositoryMetadata metadata, BaseFile file )
{
- String relpath = PathUtil.getRelative( repository.getBasedir(), file );
- repositoryMetadataMap.put( relpath, metadata );
+ repositoryMetadataMap.put( file.getRelativePath(), metadata );
+ }
+
+ public void processFileProblem( BaseFile file, String message )
+ {
+ problemsTracker.addProblem( file, message );
}
public Map getRepositoryMetadataMap()
{
return repositoryMetadataMap;
+ }
+
+ public String getName()
+ {
+ return "Mock RepositoryMetadata Consumer (Testing Only)";
+ }
+
+ public FileProblemsTracker getProblemsTracker()
+ {
+ return problemsTracker;
}
}
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/AllTests.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/AllTests.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/AllTests.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,44 @@
+package org.apache.maven.archiva.common.utils;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.common.utils" );
+ //$JUnit-BEGIN$
+ suite.addTestSuite( PathUtilTest.class );
+ suite.addTestSuite( BaseFileTest.class );
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/AllTests.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/AllTests.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,115 @@
+package org.apache.maven.archiva.common.utils;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * BaseFileTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class BaseFileTest
+ extends TestCase
+{
+ public void testFileString()
+ {
+ File repoDir = new File( "/home/user/foo/repository" );
+ String pathFile = "path/to/resource.xml";
+ BaseFile file = new BaseFile( repoDir, pathFile );
+
+ assertEquals( "/home/user/foo/repository/path/to/resource.xml", file.getAbsolutePath() );
+ assertEquals( "path/to/resource.xml", file.getRelativePath() );
+ assertEquals( new File( "/home/user/foo/repository" ), file.getBaseDir() );
+ }
+
+ public void testFileFile()
+ {
+ File repoDir = new File( "/home/user/foo/repository" );
+ File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+ BaseFile file = new BaseFile( repoDir, pathFile );
+
+ assertEquals( "/home/user/foo/repository/path/to/resource.xml", file.getAbsolutePath() );
+ assertEquals( "path/to/resource.xml", file.getRelativePath() );
+ assertEquals( new File( "/home/user/foo/repository" ), file.getBaseDir() );
+ }
+
+ public void testStringFile()
+ {
+ String repoDir = "/home/user/foo/repository";
+ File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+ BaseFile file = new BaseFile( repoDir, pathFile );
+
+ assertEquals( "/home/user/foo/repository/path/to/resource.xml", file.getAbsolutePath() );
+ assertEquals( "path/to/resource.xml", file.getRelativePath() );
+ assertEquals( new File( "/home/user/foo/repository" ), file.getBaseDir() );
+ }
+
+ public void testFileThenSetBaseString()
+ {
+ String repoDir = "/home/user/foo/repository";
+ File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+ BaseFile file = new BaseFile( pathFile );
+ file.setBaseDir( repoDir );
+
+ assertEquals( "/home/user/foo/repository/path/to/resource.xml", file.getAbsolutePath() );
+ assertEquals( "path/to/resource.xml", file.getRelativePath() );
+ assertEquals( new File( "/home/user/foo/repository" ), file.getBaseDir() );
+ }
+
+ public void testFileThenSetBaseFile()
+ {
+ File repoDir = new File( "/home/user/foo/repository" );
+ File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+ BaseFile file = new BaseFile( pathFile );
+ file.setBaseDir( repoDir );
+
+ assertEquals( "/home/user/foo/repository/path/to/resource.xml", file.getAbsolutePath() );
+ assertEquals( "path/to/resource.xml", file.getRelativePath() );
+ assertEquals( new File( "/home/user/foo/repository" ), file.getBaseDir() );
+ }
+
+ public void testStringThenSetBaseString()
+ {
+ String repoDir = "/home/user/foo/repository";
+ String pathFile = "/home/user/foo/repository/path/to/resource.xml";
+ BaseFile file = new BaseFile( pathFile );
+ file.setBaseDir( repoDir );
+
+ assertEquals( "/home/user/foo/repository/path/to/resource.xml", file.getAbsolutePath() );
+ assertEquals( "path/to/resource.xml", file.getRelativePath() );
+ assertEquals( new File( "/home/user/foo/repository" ), file.getBaseDir() );
+ }
+
+ public void testStringThenSetBaseFile()
+ {
+ File repoDir = new File( "/home/user/foo/repository" );
+ String pathFile = "/home/user/foo/repository/path/to/resource.xml";
+ BaseFile file = new BaseFile( pathFile );
+ file.setBaseDir( repoDir );
+
+ assertEquals( "/home/user/foo/repository/path/to/resource.xml", file.getAbsolutePath() );
+ assertEquals( "path/to/resource.xml", file.getRelativePath() );
+ assertEquals( new File( "/home/user/foo/repository" ), file.getBaseDir() );
+ }
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java (from r507719, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/PathUtilTest.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/PathUtilTest.java&r1=507719&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/PathUtilTest.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java Sat Feb 17 09:04:40 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.discoverer;
+package org.apache.maven.archiva.common.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -18,6 +18,8 @@
* specific language governing permissions and limitations
* under the License.
*/
+
+import org.apache.maven.archiva.common.utils.PathUtil;
import junit.framework.TestCase;
Copied: maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/resources/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.xml (from r507550, maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericArtifactConsumerTest.xml)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/resources/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.xml?view=diff&rev=508779&p1=maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericArtifactConsumerTest.xml&r1=507550&p2=maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/resources/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.xml&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-discoverer/src/test/resources/org/apache/maven/archiva/discoverer/consumers/GenericArtifactConsumerTest.xml (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-common/src/test/resources/org/apache/maven/archiva/common/consumers/GenericArtifactConsumerTest.xml Sat Feb 17 09:04:40 2007
@@ -21,9 +21,9 @@
<component-set>
<components>
<component>
- <role>org.apache.maven.archiva.discoverer.DiscovererConsumer</role>
+ <role>org.apache.maven.archiva.common.consumers.Consumer</role>
<role-hint>mock-artifact</role-hint>
- <implementation>org.apache.maven.archiva.discoverer.consumers.MockArtifactConsumer</implementation>
+ <implementation>org.apache.maven.archiva.common.consumers.MockArtifactConsumer</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
Modified: maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/main/mdo/configuration.mdo?view=diff&rev=508779&r1=508778&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/main/mdo/configuration.mdo (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/main/mdo/configuration.mdo Sat Feb 17 09:04:40 2007
@@ -85,12 +85,13 @@
</description>
</field>
<field>
- <name>indexerCronExpression</name>
+ <name>dataRefreshCronExpression</name>
<version>1.0.0</version>
<type>String</type>
- <description>When to run the indexing mechanism. Default is every 0 and 30 mins of any hour.</description>
+ <description>When to run the data refresh task. Default is every 30 mins (translated as every 0 and 30 minute reading of every hour)</description>
<defaultValue>0 0,30 * * * ?</defaultValue>
- </field>
+ </field>
+ <!--
<field>
<name>globalBlackListPatterns</name>
<version>1.0.0</version>
@@ -99,7 +100,8 @@
<type>String</type>
<multiplicity>*</multiplicity>
</association>
- </field>
+ </field>
+ -->
<field>
<name>proxy</name>
<version>1.0.0</version>
Modified: maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java?view=diff&rev=508779&r1=508778&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java Sat Feb 17 09:04:40 2007
@@ -43,7 +43,7 @@
// check default configuration
assertNotNull( "check configuration returned", configuration );
assertEquals( "check configuration has default elements", "0 0,30 * * * ?",
- configuration.getIndexerCronExpression() );
+ configuration.getDataRefreshCronExpression() );
assertNull( "check configuration has default elements", configuration.getIndexPath() );
assertTrue( "check configuration has default elements", configuration.getRepositories().isEmpty() );
}
Modified: maven/archiva/branches/archiva-MRM-239/archiva-converter/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-converter/pom.xml?view=diff&rev=508779&r1=508778&r2=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-converter/pom.xml (original)
+++ maven/archiva/branches/archiva-MRM-239/archiva-converter/pom.xml Sat Feb 17 09:04:40 2007
@@ -30,6 +30,10 @@
<name>Archiva Repository Converter</name>
<dependencies>
<dependency>
+ <groupId>org.apache.maven.archiva</groupId>
+ <artifactId>archiva-discoverer</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -46,8 +50,8 @@
<artifactId>maven-model-converter</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.maven.archiva</groupId>
- <artifactId>archiva-reports-standard</artifactId>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-digest</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Added: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionEvent.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionEvent.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionEvent.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionEvent.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,128 @@
+package org.apache.maven.archiva.converter;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.archiva.converter.legacy.LegacyRepositoryConverter;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+/**
+ * ConversionEvent
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ConversionEvent
+{
+ public static final int STARTED = 0;
+
+ public static final int PROCESSED = 1;
+
+ public static final int WARNING = 2;
+
+ public static final int ERROR = 3;
+
+ public static final int FINISHED = 4;
+
+ private int type;
+
+ private String message;
+
+ private Artifact artifact;
+
+ private ArtifactRepository repository;
+
+ private Exception exception;
+
+ public ConversionEvent( ArtifactRepository repository, int type )
+ {
+ this.repository = repository;
+ this.type = type;
+ }
+
+ public ConversionEvent( ArtifactRepository repository, int type, Artifact artifact )
+ {
+ this( repository, type );
+ this.artifact = artifact;
+ }
+
+ public ConversionEvent( ArtifactRepository repository, int type, Artifact artifact, String message )
+ {
+ this( repository, type );
+ this.artifact = artifact;
+ this.message = message;
+ }
+
+ public ConversionEvent( ArtifactRepository repository, int type, Artifact artifact, Exception exception )
+ {
+ this( repository, type );
+ this.artifact = artifact;
+ this.exception = exception;
+ }
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public ArtifactRepository getRepository()
+ {
+ return repository;
+ }
+
+ /**
+ * <p>
+ * The type of event.
+ * </p>
+ *
+ * <p>
+ * Can be one of the following ...
+ * </p>
+ *
+ * <ul>
+ * <li>{@link #STARTED} - the whole repository conversion process has started.
+ * only seen when using the whole repository conversion technique with the
+ * {@link LegacyRepositoryConverter#convertLegacyRepository(java.io.File, java.io.File, java.util.List, boolean)}
+ * method.</li>
+ * <li>{@link #PROCESSED} - a specific artifact has been processed.</li>
+ * <li>{@link #WARNING} - a warning has been detected for a specific artifact during the conversion process.</li>
+ * <li>{@link #ERROR} - an error in the processing of an artifact has been detected.</li>
+ * <li>{@link #FINISHED} - the whole repository conversion process has finished.
+ * only seen when using the whole repository conversion technique with the
+ * {@link LegacyRepositoryConverter#convertLegacyRepository(java.io.File, java.io.File, java.util.List, boolean)}
+ * method.</li>
+ * </ul>
+ * @return
+ */
+ public int getType()
+ {
+ return type;
+ }
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionEvent.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionEvent.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionListener.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionListener.java?view=auto&rev=508779
==============================================================================
--- maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionListener.java (added)
+++ maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionListener.java Sat Feb 17 09:04:40 2007
@@ -0,0 +1,31 @@
+package org.apache.maven.archiva.converter;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * ConversionListener
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface ConversionListener
+{
+ public void conversionEvent( ConversionEvent event );
+}
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionListener.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-MRM-239/archiva-converter/src/main/java/org/apache/maven/archiva/converter/ConversionListener.java
------------------------------------------------------------------------------
svn:mime-type = text/plain