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/10/10 11:47:28 UTC
svn commit: r583412 [6/8] - in /maven/archiva/trunk:
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/
archiva-base...
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java?rev=583412&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java Wed Oct 10 02:47:20 2007
@@ -0,0 +1,301 @@
+package org.apache.maven.archiva.repository.content;
+
+/*
+ * 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.model.ArtifactReference;
+import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+/**
+ * LegacyPathParserTest
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class LegacyPathParserTest
+ extends AbstractRepositoryLayerTestCase
+{
+ public void testBadPathArtifactIdMissingA()
+ {
+ assertBadPath( "groupId/jars/-1.0.jar", "artifactId is missing" );
+ }
+
+ public void testBadPathArtifactIdMissingB()
+ {
+ assertBadPath( "groupId/jars/1.0.jar", "artifactId is missing" );
+ }
+
+ public void testBadPathMissingType()
+ {
+ assertBadPath( "invalid/invalid/1/invalid-1", "missing type" );
+ }
+
+ public void testBadPathTooShort()
+ {
+ // NEW
+ assertBadPath( "invalid/invalid-1.0.jar", "path is too short" );
+ }
+
+ public void testBadPathWrongPackageExtension()
+ {
+ assertBadPath( "org.apache.maven.test/jars/artifactId-1.0.war", "wrong package extension" );
+ }
+
+ /**
+ * [MRM-432] Oddball version spec.
+ * Example of an oddball / unusual version spec.
+ * @throws LayoutException
+ */
+ public void testGoodButOddVersionSpecGanymedSsh2()
+ throws LayoutException
+ {
+ String groupId = "ch.ethz.ganymed";
+ String artifactId = "ganymed-ssh2";
+ String version = "build210";
+ String type = "jar";
+ String path = "ch.ethz.ganymed/jars/ganymed-ssh2-build210.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ /**
+ * [MRM-432] Oddball version spec.
+ * Example of an oddball / unusual version spec.
+ * @throws LayoutException
+ */
+ public void testGoodButOddVersionSpecJavaxComm()
+ throws LayoutException
+ {
+ String groupId = "javax";
+ String artifactId = "comm";
+ String version = "3.0-u1";
+ String type = "jar";
+ String path = "javax/jars/comm-3.0-u1.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ /**
+ * [MRM-432] Oddball version spec.
+ * Example of an oddball / unusual version spec.
+ * @throws LayoutException
+ */
+ public void testGoodButOddVersionSpecJavaxPersistence()
+ throws LayoutException
+ {
+ String groupId = "javax.persistence";
+ String artifactId = "ejb";
+ String version = "3.0-public_review";
+ String type = "jar";
+ String path = "javax.persistence/jars/ejb-3.0-public_review.jar";
+
+ /*
+ * The version id of "public_review" can cause problems. is it part of
+ * the version spec? or the classifier?
+ */
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ public void testGoodCommonsLang()
+ throws LayoutException
+ {
+ String groupId = "commons-lang";
+ String artifactId = "commons-lang";
+ String version = "2.1";
+ String type = "jar";
+ String path = "commons-lang/jars/commons-lang-2.1.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ public void testGoodDerby()
+ throws LayoutException
+ {
+ String groupId = "org.apache.derby";
+ String artifactId = "derby";
+ String version = "10.2.2.0";
+ String type = "jar";
+ String path = "org.apache.derby/jars/derby-10.2.2.0.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ /**
+ * Test the ejb-client type spec.
+ * Type specs are not a 1 to 1 map to the extension.
+ * This tests that effect.
+ * @throws LayoutException
+ */
+ /* TODO: Re-enabled in the future.
+ public void testGoodFooEjbClient()
+ throws LayoutException
+ {
+ String groupId = "com.foo";
+ String artifactId = "foo-client";
+ String version = "1.0";
+ String type = "ejb"; // oddball type-spec (should result in jar extension)
+ String path = "com.foo/ejbs/foo-client-1.0.jar";
+
+ assertLayout( path, groupId, artifactId, version, classifier, type );
+ }
+ */
+
+ /**
+ * Test the classifier.
+ * @throws LayoutException
+ */
+ public void testGoodFooLibJavadoc()
+ throws LayoutException
+ {
+ String groupId = "com.foo.lib";
+ String artifactId = "foo-lib";
+ String version = "2.1-alpha-1-javadoc";
+ String type = "javadoc";
+ String path = "com.foo.lib/javadocs/foo-lib-2.1-alpha-1-javadoc.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ /**
+ * Test the classifier, and java-source type spec.
+ * @throws LayoutException
+ */
+ public void testGoodFooLibSources()
+ throws LayoutException
+ {
+ String groupId = "com.foo.lib";
+ String artifactId = "foo-lib";
+ String version = "2.1-alpha-1-sources";
+ String type = "java-source"; // oddball type-spec (should result in jar extension)
+ String path = "com.foo.lib/java-sources/foo-lib-2.1-alpha-1-sources.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ public void testGoodFooTool()
+ throws LayoutException
+ {
+ String groupId = "com.foo";
+ String artifactId = "foo-tool";
+ String version = "1.0";
+ String type = "jar";
+ String path = "com.foo/jars/foo-tool-1.0.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ public void testGoodGeronimoEjbSpec()
+ throws LayoutException
+ {
+ String groupId = "org.apache.geronimo.specs";
+ String artifactId = "geronimo-ejb_2.1_spec";
+ String version = "1.0.1";
+ String type = "jar";
+ String path = "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ public void testGoodLdapClientsPom()
+ throws LayoutException
+ {
+ String groupId = "directory-clients";
+ String artifactId = "ldap-clients";
+ String version = "0.9.1-SNAPSHOT";
+ String type = "pom";
+ String path = "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ /**
+ * A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory.
+ * @throws LayoutException
+ */
+ public void testGoodSnapshotMavenTest()
+ throws LayoutException
+ {
+ String groupId = "org.apache.archiva.test";
+ String artifactId = "redonkulous";
+ String version = "3.1-beta-1-20050831.101112-42";
+ String type = "jar";
+ String path = "org.apache.archiva.test/jars/redonkulous-3.1-beta-1-20050831.101112-42.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ /**
+ * [MRM-519] version identifiers within filename cause misidentification of version.
+ * Example uses "test" in artifact Id, which is also part of the versionKeyword list.
+ */
+ public void testGoodVersionKeywordInArtifactId()
+ throws LayoutException
+ {
+ String groupId = "maven";
+ String artifactId = "maven-test-plugin";
+ String version = "1.8.2";
+ String type = "jar";
+
+ String path = "maven/jars/maven-test-plugin-1.8.2.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+
+ /**
+ * Perform a path to artifact reference lookup, and verify the results.
+ */
+ private void assertLayout( String path, String groupId, String artifactId, String version, String type )
+ throws LayoutException
+ {
+ // Path to Artifact Reference.
+ ArtifactReference testReference = LegacyPathParser.toArtifactReference( path );
+ assertArtifactReference( testReference, groupId, artifactId, version, type );
+ }
+
+ private void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId,
+ String version, String type )
+ {
+ String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + type;
+
+ assertNotNull( expectedId + " - Should not be null.", actualReference );
+
+ assertEquals( expectedId + " - Group ID", groupId, actualReference.getGroupId() );
+ assertEquals( expectedId + " - Artifact ID", artifactId, actualReference.getArtifactId() );
+ assertEquals( expectedId + " - Version ID", version, actualReference.getVersion() );
+ assertEquals( expectedId + " - Type", type, actualReference.getType() );
+ // legacy has no classifier.
+ assertNull( expectedId + " - classifier", actualReference.getClassifier() );
+ }
+
+ protected void assertBadPath( String path, String reason )
+ {
+ try
+ {
+ LegacyPathParser.toArtifactReference( path );
+ fail( "Should have thrown a LayoutException on the invalid path [" + path + "] because of [" + reason + "]" );
+ }
+ catch ( LayoutException e )
+ {
+ /* expected path */
+ }
+ }
+}
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java?rev=583412&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java Wed Oct 10 02:47:20 2007
@@ -0,0 +1,206 @@
+package org.apache.maven.archiva.repository.content;
+
+/*
+ * 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.VersionComparator;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.ProjectReference;
+import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * ManagedDefaultRepositoryContentTest
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ManagedDefaultRepositoryContentTest
+ extends AbstractDefaultRepositoryContentTestCase
+{
+ private ManagedRepositoryContent repoContent;
+
+ public void testGetVersionsBadArtifact()
+ throws Exception
+ {
+ assertGetVersions( "bad_artifact", Collections.EMPTY_LIST );
+ }
+
+ public void testGetVersionsMissingMultipleVersions()
+ throws Exception
+ {
+ assertGetVersions( "missing_metadata_b", Arrays.asList( "1.0", "1.0.1", "2.0", "2.0.1", "2.0-20070821-dev" ) );
+ }
+
+ public void testGetVersionsSimple()
+ throws Exception
+ {
+ assertVersions( "proxied_multi", "2.1", new String[] { "2.1" } );
+ }
+
+ public void testGetVersionsSimpleYetIncomplete()
+ throws Exception
+ {
+ assertGetVersions( "incomplete_metadata_a", Collections.singletonList( "1.0" ) );
+ }
+
+ public void testGetVersionsSimpleYetMissing()
+ throws Exception
+ {
+ assertGetVersions( "missing_metadata_a", Collections.singletonList( "1.0" ) );
+ }
+
+ public void testGetVersionsSnapshotA()
+ throws Exception
+ {
+ assertVersions( "snap_shots_a", "1.0-alpha-11-SNAPSHOT", new String[] {
+ "1.0-alpha-11-SNAPSHOT",
+ "1.0-alpha-11-20070221.194724-2",
+ "1.0-alpha-11-20070302.212723-3",
+ "1.0-alpha-11-20070303.152828-4",
+ "1.0-alpha-11-20070305.215149-5",
+ "1.0-alpha-11-20070307.170909-6",
+ "1.0-alpha-11-20070314.211405-9",
+ "1.0-alpha-11-20070316.175232-11" } );
+ }
+
+ public void testToMetadataPathFromProjectReference()
+ {
+ ProjectReference reference = new ProjectReference();
+ reference.setGroupId( "com.foo" );
+ reference.setArtifactId( "foo-tool" );
+
+ assertEquals( "com/foo/foo-tool/maven-metadata.xml", repoContent.toMetadataPath( reference ) );
+ }
+
+ public void testToMetadataPathFromVersionReference()
+ {
+ VersionedReference reference = new VersionedReference();
+ reference.setGroupId( "com.foo" );
+ reference.setArtifactId( "foo-tool" );
+ reference.setVersion( "1.0" );
+
+ assertEquals( "com/foo/foo-tool/1.0/maven-metadata.xml", repoContent.toMetadataPath( reference ) );
+ }
+
+ public void testToPathOnNullArtifactReference()
+ {
+ try
+ {
+ ArtifactReference reference = null;
+ repoContent.toPath( reference );
+ fail( "Should have failed due to null artifact reference." );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ /* expected path */
+ }
+ }
+
+ private void assertGetVersions( String artifactId, List<String> expectedVersions )
+ throws Exception
+ {
+ ProjectReference reference = new ProjectReference();
+ reference.setGroupId( "org.apache.archiva.metadata.tests" );
+ reference.setArtifactId( artifactId );
+
+ // Use the test metadata-repository, which is already setup for
+ // These kind of version tests.
+ File repoDir = getTestFile( "src/test/repositories/metadata-repository" );
+ repoContent.getRepository().setLocation( repoDir.getAbsolutePath() );
+
+ // Request the versions.
+ Set<String> testedVersionSet = repoContent.getVersions( reference );
+
+ // Sort the list (for asserts)
+ List<String> testedVersions = new ArrayList<String>();
+ testedVersions.addAll( testedVersionSet );
+ Collections.sort( testedVersions, new VersionComparator() );
+
+ // Test the expected array of versions, to the actual tested versions
+ assertEquals( "available versions", expectedVersions, testedVersions );
+ }
+
+ private void assertVersions( String artifactId, String version, String[] expectedVersions )
+ throws Exception
+ {
+ VersionedReference reference = new VersionedReference();
+ reference.setGroupId( "org.apache.archiva.metadata.tests" );
+ reference.setArtifactId( artifactId );
+ reference.setVersion( version );
+
+ // Use the test metadata-repository, which is already setup for
+ // These kind of version tests.
+ File repoDir = getTestFile( "src/test/repositories/metadata-repository" );
+ repoContent.getRepository().setLocation( repoDir.getAbsolutePath() );
+
+ // Request the versions.
+ Set<String> testedVersionSet = repoContent.getVersions( reference );
+
+ // Sort the list (for asserts later)
+ List<String> testedVersions = new ArrayList<String>();
+ testedVersions.addAll( testedVersionSet );
+ Collections.sort( testedVersions, new VersionComparator() );
+
+ // Test the expected array of versions, to the actual tested versions
+ assertEquals( "Assert Versions: length/size", expectedVersions.length, testedVersions.size() );
+
+ for ( int i = 0; i < expectedVersions.length; i++ )
+ {
+ String actualVersion = testedVersions.get( i );
+ assertEquals( "Versions[" + i + "]", expectedVersions[i], actualVersion );
+ }
+ }
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ File repoDir = getTestFile( "src/test/repositories/default-repository" );
+
+ ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
+
+ repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "default" );
+ repoContent.setRepository( repository );
+ }
+
+ @Override
+ protected ArtifactReference toArtifactReference( String path )
+ throws LayoutException
+ {
+ return repoContent.toArtifactReference( path );
+ }
+
+ @Override
+ protected String toPath( ArtifactReference reference )
+ {
+ return repoContent.toPath( reference );
+ }
+}
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java?rev=583412&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java Wed Oct 10 02:47:20 2007
@@ -0,0 +1,192 @@
+package org.apache.maven.archiva.repository.content;
+
+/*
+ * 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.VersionComparator;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.ProjectReference;
+import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * ManagedLegacyRepositoryContentTest
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ManagedLegacyRepositoryContentTest
+ extends AbstractLegacyRepositoryContentTestCase
+{
+ private ManagedRepositoryContent repoContent;
+
+ public void testGetVersionsFromProjectReference()
+ throws Exception
+ {
+ assertVersions( "org.apache.maven", "testing", new String[] {
+ "UNKNOWN",
+ "1.0-javadoc",
+ "1.0-sources",
+ "1.0",
+ "1.0-20050611.112233-1" } );
+ }
+
+ public void testGetVersionsFromVersionedReference()
+ throws Exception
+ {
+ assertVersions( "org.apache.maven", "testing", "1.0", new String[] {
+ "1.0-javadoc",
+ "1.0-sources",
+ "1.0",
+ "1.0-20050611.112233-1" } );
+ }
+
+ private void assertVersions( String groupId, String artifactId, String[] expectedVersions )
+ throws Exception
+ {
+ ProjectReference reference = new ProjectReference();
+ reference.setGroupId( groupId );
+ reference.setArtifactId( artifactId );
+
+ // Request the versions.
+ Set<String> testedVersionSet = repoContent.getVersions( reference );
+
+ // Sort the list (for asserts later)
+ List<String> testedVersions = new ArrayList<String>();
+ testedVersions.addAll( testedVersionSet );
+ Collections.sort( testedVersions, new VersionComparator() );
+
+ // Test the expected array of versions, to the actual tested versions
+ assertEquals( "Assert (Project) Versions: length/size", expectedVersions.length, testedVersions.size() );
+
+ for ( int i = 0; i < expectedVersions.length; i++ )
+ {
+ String actualVersion = testedVersions.get( i );
+ assertEquals( "(Project) Versions[" + i + "]", expectedVersions[i], actualVersion );
+ }
+ }
+
+ private void assertVersions( String groupId, String artifactId, String version, String[] expectedVersions )
+ throws Exception
+ {
+ VersionedReference reference = new VersionedReference();
+ reference.setGroupId( groupId );
+ reference.setArtifactId( artifactId );
+ reference.setVersion( version );
+
+ // Request the versions.
+ Set<String> testedVersionSet = repoContent.getVersions( reference );
+
+ // Sort the list (for asserts later)
+ List<String> testedVersions = new ArrayList<String>();
+ testedVersions.addAll( testedVersionSet );
+ Collections.sort( testedVersions, new VersionComparator() );
+
+ // Test the expected array of versions, to the actual tested versions
+ assertEquals( "Assert (Project) Versions: length/size", expectedVersions.length, testedVersions.size() );
+
+ for ( int i = 0; i < expectedVersions.length; i++ )
+ {
+ String actualVersion = testedVersions.get( i );
+ assertEquals( "(Project) Versions[" + i + "]", expectedVersions[i], actualVersion );
+ }
+ }
+
+ public void testGetRelatedArtifacts()
+ throws Exception
+ {
+ ArtifactReference reference = createArtifact( "org.apache.maven", "testing", "1.0", "jar" );
+
+ Set<ArtifactReference> related = repoContent.getRelatedArtifacts( reference );
+ assertNotNull( related );
+
+ String expected[] = new String[] {
+ "org.apache.maven/jars/testing-1.0.jar",
+ "org.apache.maven/java-sources/testing-1.0-sources.jar",
+ "org.apache.maven/jars/testing-1.0-20050611.112233-1.jar",
+ "org.apache.maven/poms/testing-1.0.pom",
+ "org.apache.maven/javadocs/testing-1.0-javadoc.jar" };
+
+ StringBuffer relatedDebugString = new StringBuffer();
+ relatedDebugString.append( "[" );
+ for ( ArtifactReference ref : related )
+ {
+ String actualPath = repoContent.toPath( ref );
+ relatedDebugString.append( actualPath ).append( ":" );
+ }
+ relatedDebugString.append( "]" );
+
+ assertEquals( "Related <" + relatedDebugString + ">:", expected.length, related.size() );
+
+ for ( String expectedPath : expected )
+ {
+ boolean found = false;
+ for ( ArtifactReference actualRef : related )
+ {
+ String actualPath = repoContent.toPath( actualRef );
+ if ( actualPath.endsWith( expectedPath ) )
+ {
+ found = true;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ fail( "Unable to find expected artifact [" + expectedPath + "] in list of related artifacts. "
+ + "Related <" + relatedDebugString + ">" );
+ }
+ }
+ }
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ File repoDir = getTestFile( "src/test/repositories/legacy-repository" );
+
+ ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
+ repository.setLayout( "legacy" );
+
+ repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "legacy" );
+ repoContent.setRepository( repository );
+ }
+
+ @Override
+ protected ArtifactReference toArtifactReference( String path )
+ throws LayoutException
+ {
+ return repoContent.toArtifactReference( path );
+ }
+
+ @Override
+ protected String toPath( ArtifactReference reference )
+ {
+ return repoContent.toPath( reference );
+ }
+}
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java?rev=583412&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java Wed Oct 10 02:47:20 2007
@@ -0,0 +1,63 @@
+package org.apache.maven.archiva.repository.content;
+
+/*
+ * 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.configuration.RemoteRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.repository.RemoteRepositoryContent;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+/**
+ * RemoteDefaultRepositoryContentTest
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RemoteDefaultRepositoryContentTest
+ extends AbstractDefaultRepositoryContentTestCase
+{
+ private RemoteRepositoryContent repoContent;
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
+ "http://repo1.maven.org/maven2/" );
+
+ repoContent = (RemoteRepositoryContent) lookup( RemoteRepositoryContent.class, "default" );
+ repoContent.setRepository( repository );
+ }
+
+ @Override
+ protected ArtifactReference toArtifactReference( String path )
+ throws LayoutException
+ {
+ return repoContent.toArtifactReference( path );
+ }
+
+ @Override
+ protected String toPath( ArtifactReference reference )
+ {
+ return repoContent.toPath( reference );
+ }
+}
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java?rev=583412&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java Wed Oct 10 02:47:20 2007
@@ -0,0 +1,65 @@
+package org.apache.maven.archiva.repository.content;
+
+/*
+ * 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.configuration.RemoteRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.repository.RemoteRepositoryContent;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+/**
+ * RemoteLegacyRepositoryContentTest
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RemoteLegacyRepositoryContentTest
+ extends AbstractLegacyRepositoryContentTestCase
+{
+ private RemoteRepositoryContent repoContent;
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteLegacyRepo",
+ "Unit Test Remote Legacy Repo",
+ "http://repo1.maven.org/maven/" );
+ repository.setLayout( "legacy" );
+
+ repoContent = (RemoteRepositoryContent) lookup( RemoteRepositoryContent.class, "legacy" );
+ repoContent.setRepository( repository );
+ }
+
+ @Override
+ protected ArtifactReference toArtifactReference( String path )
+ throws LayoutException
+ {
+ return repoContent.toArtifactReference( path );
+ }
+
+ @Override
+ protected String toPath( ArtifactReference reference )
+ {
+ return repoContent.toPath( reference );
+ }
+}
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java?rev=583412&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java Wed Oct 10 02:47:20 2007
@@ -0,0 +1,266 @@
+package org.apache.maven.archiva.repository.content;
+
+/*
+ * 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.model.ArtifactReference;
+import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+/**
+ * RepositoryRequestTest
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryRequestTest
+ extends AbstractRepositoryLayerTestCase
+{
+ public void testInvalidRequestNoArtifactId()
+ {
+ assertInvalidRequest( "groupId/jars/-1.0.jar" );
+ }
+
+ public void testInvalidLegacyRequestBadLocation()
+ {
+ assertInvalidRequest( "org.apache.maven.test/jars/artifactId-1.0.war" );
+ }
+
+ public void testInvalidRequestTooShort()
+ {
+ assertInvalidRequest( "org.apache.maven.test/artifactId-2.0.jar" );
+ }
+
+ public void testInvalidDefaultRequestBadLocation()
+ {
+ assertInvalidRequest( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" );
+ }
+
+ public void testValidLegacyGanymed()
+ throws Exception
+ {
+ assertValid( "ch.ethz.ganymed/jars/ganymed-ssh2-build210.jar", "ch.ethz.ganymed", "ganymed-ssh2", "build210",
+ null, "jar" );
+ }
+
+ public void testValidDefaultGanymed()
+ throws Exception
+ {
+ assertValid( "ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar", "ch.ethz.ganymed",
+ "ganymed-ssh2", "build210", null, "jar" );
+ }
+
+ public void testValidLegacyJavaxComm()
+ throws Exception
+ {
+ assertValid( "javax/jars/comm-3.0-u1.jar", "javax", "comm", "3.0-u1", null, "jar" );
+ }
+
+ public void testValidDefaultJavaxComm()
+ throws Exception
+ {
+ assertValid( "javax/comm/3.0-u1/comm-3.0-u1.jar", "javax", "comm", "3.0-u1", null, "jar" );
+ }
+
+ public void testValidLegacyJavaxPersistence()
+ throws Exception
+ {
+ assertValid( "javax.persistence/jars/ejb-3.0-public_review.jar", "javax.persistence", "ejb",
+ "3.0-public_review", null, "jar" );
+ }
+
+ public void testValidDefaultJavaxPersistence()
+ throws Exception
+ {
+ assertValid( "javax/persistence/ejb/3.0-public_review/ejb-3.0-public_review.jar", "javax.persistence", "ejb",
+ "3.0-public_review", null, "jar" );
+ }
+
+ public void testValidLegacyMavenTestPlugin()
+ throws Exception
+ {
+ assertValid( "maven/jars/maven-test-plugin-1.8.2.jar", "maven", "maven-test-plugin", "1.8.2", null, "jar" );
+ }
+
+ public void testValidDefaultMavenTestPlugin()
+ throws Exception
+ {
+ assertValid( "maven/maven-test-plugin/1.8.2/maven-test-plugin-1.8.2.pom", "maven", "maven-test-plugin",
+ "1.8.2", null, "pom" );
+ }
+
+ public void testValidLegacyCommonsLangJavadoc()
+ throws Exception
+ {
+ assertValid( "commons-lang/jars/commons-lang-2.1-javadoc.jar", "commons-lang", "commons-lang", "2.1-javadoc",
+ null, "javadoc" );
+ }
+
+ public void testValidDefaultCommonsLangJavadoc()
+ throws Exception
+ {
+ assertValid( "commons-lang/commons-lang/2.1/commons-lang-2.1-javadoc.jar", "commons-lang", "commons-lang",
+ "2.1", "javadoc", "javadoc" );
+ }
+
+ public void testValidLegacyDerbyPom()
+ throws Exception
+ {
+ assertValid( "org.apache.derby/poms/derby-10.2.2.0.pom", "org.apache.derby", "derby", "10.2.2.0", null, "pom" );
+ }
+
+ public void testValidDefaultDerbyPom()
+ throws Exception
+ {
+ assertValid( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0.pom", "org.apache.derby", "derby", "10.2.2.0",
+ null, "pom" );
+ }
+
+ public void testValidLegacyGeronimoEjbSpec()
+ throws Exception
+ {
+ assertValid( "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar", "org.apache.geronimo.specs",
+ "geronimo-ejb_2.1_spec", "1.0.1", null, "jar" );
+ }
+
+ public void testValidDefaultGeronimoEjbSpec()
+ throws Exception
+ {
+ assertValid( "org/apache/geronimo/specs/geronimo-ejb_2.1_spec/1.0.1/geronimo-ejb_2.1_spec-1.0.1.jar",
+ "org.apache.geronimo.specs", "geronimo-ejb_2.1_spec", "1.0.1", null, "jar" );
+ }
+
+ public void testValidLegacyLdapSnapshot()
+ throws Exception
+ {
+ assertValid( "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom", "directory-clients", "ldap-clients",
+ "0.9.1-SNAPSHOT", null, "pom" );
+ }
+
+ public void testValidDefaultLdapSnapshot()
+ throws Exception
+ {
+ assertValid( "directory-clients/ldap-clients/0.9.1-SNAPSHOT/ldap-clients-0.9.1-SNAPSHOT.pom",
+ "directory-clients", "ldap-clients", "0.9.1-SNAPSHOT", null, "pom" );
+ }
+
+ public void testValidLegacyTestArchSnapshot()
+ throws Exception
+ {
+ assertValid( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom", "test.maven-arch", "test-arch",
+ "2.0.3-SNAPSHOT", null, "pom" );
+ }
+
+ public void testValidDefaultTestArchSnapshot()
+ throws Exception
+ {
+ assertValid( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.pom", "test.maven-arch",
+ "test-arch", "2.0.3-SNAPSHOT", null, "pom" );
+ }
+
+ public void testValidLegacyOddDottedArtifactId()
+ throws Exception
+ {
+ assertValid( "com.company.department/poms/com.company.department.project-0.2.pom", "com.company.department",
+ "com.company.department.project", "0.2", null, "pom" );
+ }
+
+ public void testValidDefaultOddDottedArtifactId()
+ throws Exception
+ {
+ assertValid(
+ "com/company/department/com.company.department.project/0.2/com.company.department.project-0.2.pom",
+ "com.company.department", "com.company.department.project", "0.2", null, "pom" );
+ }
+
+ public void testValidLegacyTimestampedSnapshot()
+ throws Exception
+ {
+ assertValid( "org.apache.archiva.test/jars/redonkulous-3.1-beta-1-20050831.101112-42.jar",
+ "org.apache.archiva.test", "redonkulous", "3.1-beta-1-20050831.101112-42", null, "jar" );
+ }
+
+ public void testValidDefaultTimestampedSnapshot()
+ throws Exception
+ {
+ assertValid(
+ "org/apache/archiva/test/redonkulous/3.1-beta-1-SNAPSHOT/redonkulous-3.1-beta-1-20050831.101112-42.jar",
+ "org.apache.archiva.test", "redonkulous", "3.1-beta-1-20050831.101112-42", null, "jar" );
+ }
+
+ public void testIsArtifact()
+ {
+ assertTrue( repoRequest.isArtifact( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) );
+ assertTrue( repoRequest.isArtifact( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) );
+ assertTrue( repoRequest.isArtifact( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz" ) );
+
+ assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.sha1" ));
+ assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.md5" ));
+ assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.asc" ));
+ assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/10.2.2.0/derby-10.2.2.0-bin.tar.gz.pgp" ));
+ assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/10.2.2.0/maven-metadata.xml" ));
+ assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/maven-metadata.xml" ));
+ }
+
+ private void assertValid( String path, String groupId, String artifactId, String version, String classifier,
+ String type )
+ throws Exception
+ {
+ String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":"
+ + ( classifier != null ? classifier + ":" : "" ) + type;
+
+ ArtifactReference reference = repoRequest.toArtifactReference( path );
+
+ assertNotNull( expectedId + " - Should not be null.", reference );
+
+ assertEquals( expectedId + " - Group ID", groupId, reference.getGroupId() );
+ assertEquals( expectedId + " - Artifact ID", artifactId, reference.getArtifactId() );
+ if ( StringUtils.isNotBlank( classifier ) )
+ {
+ assertEquals( expectedId + " - Classifier", classifier, reference.getClassifier() );
+ }
+ assertEquals( expectedId + " - Version ID", version, reference.getVersion() );
+ assertEquals( expectedId + " - Type", type, reference.getType() );
+ }
+
+ private void assertInvalidRequest( String path )
+ {
+ try
+ {
+ repoRequest.toArtifactReference( path );
+ fail( "Expected a LayoutException on an invalid path [" + path + "]" );
+ }
+ catch ( LayoutException e )
+ {
+ /* expected path */
+ }
+ }
+
+ private RepositoryRequest repoRequest;
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ repoRequest = (RepositoryRequest) lookup( RepositoryRequest.class );
+ }
+}
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java Wed Oct 10 02:47:20 2007
@@ -130,7 +130,24 @@
assertLayout( path, groupId, artifactId, version, classifier, type );
}
-
+
+ /**
+ * [MRM-519] version identifiers within filename cause misidentification of version.
+ * Example uses "test" in artifact Id, which is also part of the versionKeyword list.
+ */
+ public void testGoodVersionKeywordInArtifactId()
+ throws LayoutException
+ {
+ String groupId = "maven";
+ String artifactId = "maven-test-plugin";
+ String version = "1.8.2";
+ String classifier = null;
+ String type = "pom";
+ String path = "maven/maven-test-plugin/1.8.2/maven-test-plugin-1.8.2.pom";
+
+ assertLayout( path, groupId, artifactId, version, classifier, type );
+ }
+
/**
* [MRM-486] Can not deploy artifact test.maven-arch:test-arch due to "No ArtifactID Detected"
*/
@@ -143,10 +160,10 @@
String classifier = null;
String type = "pom";
String path = "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.pom";
-
+
assertLayout( path, groupId, artifactId, version, classifier, type );
}
-
+
/**
* It may seem odd, but this is a valid artifact.
*/
@@ -159,7 +176,7 @@
String classifier = null;
String type = "pom";
String path = "com/company/department/com.company.department/0.2/com.company.department-0.2.pom";
-
+
assertLayout( path, groupId, artifactId, version, classifier, type );
}
@@ -175,10 +192,10 @@
String classifier = null;
String type = "pom";
String path = "com/company/department/com.company.department.project/0.3/com.company.department.project-0.3.pom";
-
+
assertLayout( path, groupId, artifactId, version, classifier, type );
}
-
+
public void testGoodComFooTool()
throws LayoutException
{
Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java Wed Oct 10 02:47:20 2007
@@ -64,18 +64,17 @@
* Example of an oddball / unusual version spec.
* @throws LayoutException
*/
- /* TODO: Re-enabled in the future.
+ /*
public void testGoodButOddVersionSpecGanymedSsh2()
throws LayoutException
{
String groupId = "ch.ethz.ganymed";
String artifactId = "ganymed-ssh2";
String version = "build210";
- String classifier = null;
String type = "jar";
String path = "ch.ethz.ganymed/jars/ganymed-ssh2-build210.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
*/
@@ -84,18 +83,17 @@
* Example of an oddball / unusual version spec.
* @throws LayoutException
*/
- /* TODO: Re-enabled in the future.
+ /*
public void testGoodButOddVersionSpecJavaxComm()
throws LayoutException
{
String groupId = "javax";
String artifactId = "comm";
String version = "3.0-u1";
- String classifier = null;
String type = "jar";
String path = "javax/jars/comm-3.0-u1.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
*/
@@ -104,23 +102,36 @@
* Example of an oddball / unusual version spec.
* @throws LayoutException
*/
- /* TODO: Re-enabled in the future.
+ /*
public void testGoodButOddVersionSpecJavaxPersistence()
throws LayoutException
{
String groupId = "javax.persistence";
String artifactId = "ejb";
String version = "3.0-public_review";
- String classifier = null;
String type = "jar";
String path = "javax.persistence/jars/ejb-3.0-public_review.jar";
- /*
- * The version id of "public_review" can cause problems. is it part of
- * the version spec? or the classifier?
- * /
+ assertLayout( path, groupId, artifactId, version, type );
+ }
+ */
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ /**
+ * [MRM-519] version identifiers within filename cause misidentification of version.
+ * Example uses "test" in artifact Id, which is also part of the versionKeyword list.
+ */
+ /*
+ public void testGoodVersionKeywordInArtifactId()
+ throws LayoutException
+ {
+ String groupId = "maven";
+ String artifactId = "maven-test-plugin";
+ String version = "1.8.2";
+ String type = "jar";
+
+ String path = "maven/jars/maven-test-plugin-1.8.2.jar";
+
+ assertLayout( path, groupId, artifactId, version, type );
}
*/
@@ -130,11 +141,10 @@
String groupId = "commons-lang";
String artifactId = "commons-lang";
String version = "2.1";
- String classifier = null;
String type = "jar";
String path = "commons-lang/jars/commons-lang-2.1.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
public void testGoodDerby()
@@ -143,11 +153,10 @@
String groupId = "org.apache.derby";
String artifactId = "derby";
String version = "10.2.2.0";
- String classifier = null;
String type = "jar";
String path = "org.apache.derby/jars/derby-10.2.2.0.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
/**
@@ -156,52 +165,55 @@
* This tests that effect.
* @throws LayoutException
*/
+ /* TODO: Re-enabled in the future.
public void testGoodFooEjbClient()
throws LayoutException
{
String groupId = "com.foo";
String artifactId = "foo-client";
String version = "1.0";
- String classifier = null;
String type = "ejb"; // oddball type-spec (should result in jar extension)
String path = "com.foo/ejbs/foo-client-1.0.jar";
assertLayout( path, groupId, artifactId, version, classifier, type );
}
+ */
/**
* Test the classifier.
* @throws LayoutException
*/
+ /*
public void testGoodFooLibJavadoc()
throws LayoutException
{
String groupId = "com.foo.lib";
String artifactId = "foo-lib";
- String version = "2.1-alpha-1";
- String classifier = "javadoc";
+ String version = "2.1-alpha-1-javadoc";
String type = "javadoc.jar";
String path = "com.foo.lib/javadoc.jars/foo-lib-2.1-alpha-1-javadoc.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
+ */
/**
* Test the classifier, and java-source type spec.
* @throws LayoutException
*/
+ /*
public void testGoodFooLibSources()
throws LayoutException
{
String groupId = "com.foo.lib";
String artifactId = "foo-lib";
- String version = "2.1-alpha-1";
- String classifier = "sources";
+ String version = "2.1-alpha-1-sources";
String type = "java-source"; // oddball type-spec (should result in jar extension)
String path = "com.foo.lib/java-sources/foo-lib-2.1-alpha-1-sources.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
+ */
public void testGoodFooTool()
throws LayoutException
@@ -209,11 +221,10 @@
String groupId = "com.foo";
String artifactId = "foo-tool";
String version = "1.0";
- String classifier = null;
String type = "jar";
String path = "com.foo/jars/foo-tool-1.0.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
public void testGoodGeronimoEjbSpec()
@@ -222,11 +233,10 @@
String groupId = "org.apache.geronimo.specs";
String artifactId = "geronimo-ejb_2.1_spec";
String version = "1.0.1";
- String classifier = null;
String type = "jar";
String path = "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
public void testGoodLdapClientsPom()
@@ -235,11 +245,10 @@
String groupId = "directory-clients";
String artifactId = "ldap-clients";
String version = "0.9.1-SNAPSHOT";
- String classifier = null;
String type = "pom";
String path = "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
/**
@@ -252,21 +261,19 @@
String groupId = "org.apache.archiva.test";
String artifactId = "redonkulous";
String version = "3.1-beta-1-20050831.101112-42";
- String classifier = null;
String type = "jar";
String path = "org.apache.archiva.test/jars/redonkulous-3.1-beta-1-20050831.101112-42.jar";
- assertLayout( path, groupId, artifactId, version, classifier, type );
+ assertLayout( path, groupId, artifactId, version, type );
}
/**
* Perform a roundtrip through the layout routines to determine success.
*/
- private void assertLayout( String path, String groupId, String artifactId, String version, String classifier,
- String type )
+ private void assertLayout( String path, String groupId, String artifactId, String version, String type )
throws LayoutException
{
- ArchivaArtifact expectedArtifact = createArtifact( groupId, artifactId, version, classifier, type );
+ ArchivaArtifact expectedArtifact = createArtifact( groupId, artifactId, version, type );
// --- Artifact Tests.
// Artifact to Path
@@ -274,7 +281,7 @@
// Path to Artifact.
ArchivaArtifact testArtifact = layout.toArtifact( path );
- assertArtifact( testArtifact, groupId, artifactId, version, classifier, type );
+ assertArtifact( testArtifact, groupId, artifactId, version, type );
// And back again, using test Artifact from previous step.
assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, layout.toPath( testArtifact ) );
@@ -283,10 +290,44 @@
// Path to Artifact Reference.
ArtifactReference testReference = layout.toArtifactReference( path );
- assertArtifactReference( testReference, groupId, artifactId, version, classifier, type );
+ assertArtifactReference( testReference, groupId, artifactId, version, type );
// And back again, using test Reference from previous step.
assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, layout.toPath( testReference ) );
+ }
+
+ protected ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String type )
+ {
+ ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, version, null, type );
+ assertNotNull( artifact );
+ artifact.getModel().setRepositoryId( repository.getId() );
+ return artifact;
+ }
+
+ protected void assertArtifact( ArchivaArtifact actualArtifact, String groupId, String artifactId, String version,
+ String type )
+ {
+ String expectedId = groupId + ":" + artifactId + ":" + version + ":" + type;
+
+ assertNotNull( expectedId + " - Should not be null.", actualArtifact );
+
+ assertEquals( expectedId + " - Group ID", groupId, actualArtifact.getGroupId() );
+ assertEquals( expectedId + " - Artifact ID", artifactId, actualArtifact.getArtifactId() );
+ assertEquals( expectedId + " - Version ID", version, actualArtifact.getVersion() );
+ assertEquals( expectedId + " - Type", type, actualArtifact.getType() );
+ }
+
+ protected void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId,
+ String version, String type )
+ {
+ String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + type;
+
+ assertNotNull( expectedId + " - Should not be null.", actualReference );
+
+ assertEquals( expectedId + " - Group ID", groupId, actualReference.getGroupId() );
+ assertEquals( expectedId + " - Artifact ID", artifactId, actualReference.getArtifactId() );
+ assertEquals( expectedId + " - Version ID", version, actualReference.getVersion() );
+ assertEquals( expectedId + " - Type", type, actualReference.getType() );
}
protected void assertBadPath( String path, String reason )
Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java Wed Oct 10 02:47:20 2007
@@ -22,22 +22,21 @@
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.policies.DownloadPolicy;
import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.MockConfiguration;
+import org.apache.maven.archiva.repository.RemoteRepositoryContent;
import org.apache.maven.archiva.repository.layout.LayoutException;
import org.custommonkey.xmlunit.DetailedDiff;
import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLAssert;
import org.xml.sax.SAXException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -57,31 +56,6 @@
protected MockConfiguration config;
- public void testGatherAvailableVersionsBadArtifact()
- throws Exception
- {
- assertAvailableVersions( "bad_artifact", Collections.EMPTY_LIST );
- }
-
- public void testGatherAvailableVersionsMissingMultipleVersions()
- throws Exception
- {
- assertAvailableVersions( "missing_metadata_b", Arrays.asList( "1.0", "1.0.1", "2.0", "2.0.1",
- "2.0-20070821-dev" ) );
- }
-
- public void testGatherAvailableVersionsSimpleYetIncomplete()
- throws Exception
- {
- assertAvailableVersions( "incomplete_metadata_a", Collections.singletonList( "1.0" ) );
- }
-
- public void testGatherAvailableVersionsSimpleYetMissing()
- throws Exception
- {
- assertAvailableVersions( "missing_metadata_a", Collections.singletonList( "1.0" ) );
- }
-
public void testGatherSnapshotVersionsA()
throws Exception
{
@@ -118,12 +92,15 @@
}
public void testGetRepositorySpecificName()
+ throws Exception
{
- RemoteRepositoryConfiguration repoJavaNet = createRemoteRepository( "maven2-repository.dev.java.net",
- "Java.net Repository for Maven 2",
- "http://download.java.net/maven/2/" );
- RemoteRepositoryConfiguration repoCentral = createRemoteRepository( "central", "Central Global Repository",
- "http://repo1.maven.org/maven2/" );
+ RemoteRepositoryContent repoJavaNet = createRemoteRepositoryContent( "maven2-repository.dev.java.net",
+ "Java.net Repository for Maven 2",
+ "http://download.java.net/maven/2/",
+ "default" );
+ RemoteRepositoryContent repoCentral = createRemoteRepositoryContent( "central", "Central Global Repository",
+ "http://repo1.maven.org/maven2/",
+ "default" );
String convertedName = tools.getRepositorySpecificName( repoJavaNet,
"commons-lang/commons-lang/maven-metadata.xml" );
@@ -135,7 +112,7 @@
}
public void testUpdateProjectBadArtifact()
- throws LayoutException, SAXException, ParserConfigurationException, RepositoryMetadataException
+ throws Exception
{
try
{
@@ -156,7 +133,7 @@
"1.0.1",
"2.0",
"2.0.1",
- "2.0-20070821-dev" } );
+ "2.0-20070821-dev" }, "2.0-20070821-dev" , "2.0-20070821-dev" );
}
public void testUpdateProjectMissingMultipleVersionsWithProxies()
@@ -168,30 +145,30 @@
createProxyConnector( "test-repo", "central" );
createProxyConnector( "test-repo", "java.net" );
- assertUpdatedProjectMetadata( "proxied_multi", new String[] {
- "1.0-spec" /* in java.net */,
- "1.0" /* in managed, and central */,
- "1.0.1" /* in central */,
- "1.1" /* in managed */,
- "2.0-proposal-beta" /* in java.net */,
- "2.0-spec" /* in java.net */,
- "2.0" /* in central, and java.net */,
- "2.0.1" /* in java.net */,
- "2.1" /* in managed */,
- "3.0" /* in central */,
+ assertUpdatedProjectMetadata( "proxied_multi", new String[] {
+ "1.0-spec" /* in java.net */,
+ "1.0" /* in managed, and central */,
+ "1.0.1" /* in central */,
+ "1.1" /* in managed */,
+ "2.0-proposal-beta" /* in java.net */,
+ "2.0-spec" /* in java.net */,
+ "2.0" /* in central, and java.net */,
+ "2.0.1" /* in java.net */,
+ "2.1" /* in managed */,
+ "3.0" /* in central */,
"3.1" /* in central */}, "3.1", "3.1" );
}
public void testUpdateProjectSimpleYetIncomplete()
throws Exception
{
- assertUpdatedProjectMetadata( "incomplete_metadata_a", new String[] { "1.0" } );
+ assertUpdatedProjectMetadata( "incomplete_metadata_a", new String[] { "1.0" }, "1.0", "1.0" );
}
public void testUpdateProjectSimpleYetMissing()
throws Exception
{
- assertUpdatedProjectMetadata( "missing_metadata_a", new String[] { "1.0" } );
+ assertUpdatedProjectMetadata( "missing_metadata_a", new String[] { "1.0" }, "1.0", "1.0" );
}
public void testUpdateVersionSimple10()
@@ -328,29 +305,6 @@
assertEquals( "VersionedReference.version", version, reference.getVersion() );
}
- private void assertAvailableVersions( String artifactId, List<String> expectedVersions )
- throws Exception
- {
- File repoRootDir = new File( "src/test/repositories/metadata-repository" );
-
- ProjectReference reference = new ProjectReference();
- reference.setGroupId( "org.apache.archiva.metadata.tests" );
- reference.setArtifactId( artifactId );
-
- ManagedRepositoryConfiguration repo = createRepository( "test-repo", "Test Repository: "
- + getName(), repoRootDir );
-
- Set<String> testedVersionSet = tools.gatherAvailableVersions( repo, reference );
-
- // Sort the list (for asserts)
- List<String> testedVersions = new ArrayList<String>();
- testedVersions.addAll( testedVersionSet );
- Collections.sort( testedVersions, new VersionComparator() );
-
- // Test the expected array of versions, to the actual tested versions
- assertEquals( "available versions", expectedVersions, testedVersions );
- }
-
private void assertSnapshotVersions( String artifactId, String version, String[] expectedVersions )
throws Exception
{
@@ -361,10 +315,13 @@
reference.setArtifactId( artifactId );
reference.setVersion( version );
- ManagedRepositoryConfiguration repo = createRepository( "test-repo", "Test Repository: "
- + getName(), repoRootDir );
+ ManagedRepositoryConfiguration repo = createRepository( "test-repo", "Test Repository: " + getName(),
+ repoRootDir );
+ ManagedRepositoryContent repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class,
+ "default" );
+ repoContent.setRepository( repo );
- Set<String> testedVersionSet = tools.gatherSnapshotVersions( repo, reference );
+ Set<String> testedVersionSet = tools.gatherSnapshotVersions( repoContent, reference );
// Sort the list (for asserts)
List<String> testedVersions = new ArrayList<String>();
@@ -381,21 +338,26 @@
}
}
- private void assertMetadata( String expectedMetadata, ManagedRepositoryConfiguration repository,
+ private void assertMetadata( String expectedMetadata, ManagedRepositoryContent repository,
ProjectReference reference )
throws LayoutException, IOException, SAXException, ParserConfigurationException
{
- File metadataFile = new File( repository.getLocation(), tools.toPath( reference ) );
+ File metadataFile = new File( repository.getRepoRoot(), tools.toPath( reference ) );
String actualMetadata = FileUtils.readFileToString( metadataFile, null );
- XMLAssert.assertXMLEqual( expectedMetadata, actualMetadata );
+ DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
+ if ( !detailedDiff.similar() )
+ {
+ // If it isn't similar, dump the difference.
+ assertEquals( expectedMetadata, actualMetadata );
+ }
}
- private void assertMetadata( String expectedMetadata, ManagedRepositoryConfiguration repository,
+ private void assertMetadata( String expectedMetadata, ManagedRepositoryContent repository,
VersionedReference reference )
throws LayoutException, IOException, SAXException, ParserConfigurationException
{
- File metadataFile = new File( repository.getLocation(), tools.toPath( reference ) );
+ File metadataFile = new File( repository.getRepoRoot(), tools.toPath( reference ) );
String actualMetadata = FileUtils.readFileToString( metadataFile, null );
DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
@@ -412,16 +374,16 @@
}
private void assertUpdatedProjectMetadata( String artifactId, String[] expectedVersions )
- throws IOException, LayoutException, RepositoryMetadataException, SAXException, ParserConfigurationException
+ throws Exception
{
assertUpdatedProjectMetadata( artifactId, expectedVersions, null, null );
}
private void assertUpdatedProjectMetadata( String artifactId, String[] expectedVersions, String latestVersion,
String releaseVersion )
- throws IOException, LayoutException, RepositoryMetadataException, SAXException, ParserConfigurationException
+ throws Exception
{
- ManagedRepositoryConfiguration testRepo = createTestRepo();
+ ManagedRepositoryContent testRepo = createTestRepoContent();
ProjectReference reference = new ProjectReference();
reference.setGroupId( "org.apache.archiva.metadata.tests" );
reference.setArtifactId( artifactId );
@@ -462,9 +424,9 @@
}
private void assertUpdatedReleaseVersionMetadata( String artifactId, String version )
- throws IOException, LayoutException, RepositoryMetadataException, SAXException, ParserConfigurationException
+ throws Exception
{
- ManagedRepositoryConfiguration testRepo = createTestRepo();
+ ManagedRepositoryContent testRepo = createTestRepoContent();
VersionedReference reference = new VersionedReference();
reference.setGroupId( "org.apache.archiva.metadata.tests" );
reference.setArtifactId( artifactId );
@@ -486,9 +448,9 @@
private void assertUpdatedSnapshotVersionMetadata( String artifactId, String version, String expectedDate,
String expectedTime, String expectedBuildNumber )
- throws IOException, LayoutException, RepositoryMetadataException, SAXException, ParserConfigurationException
+ throws Exception
{
- ManagedRepositoryConfiguration testRepo = createTestRepo();
+ ManagedRepositoryContent testRepo = createTestRepoContent();
VersionedReference reference = new VersionedReference();
reference.setGroupId( "org.apache.archiva.metadata.tests" );
reference.setArtifactId( artifactId );
@@ -541,8 +503,8 @@
config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) );
}
- private ManagedRepositoryConfiguration createTestRepo()
- throws IOException
+ private ManagedRepositoryContent createTestRepoContent()
+ throws Exception
{
File repoRoot = new File( "target/metadata-tests/" + getName() );
if ( repoRoot.exists() )
@@ -552,10 +514,16 @@
repoRoot.mkdirs();
- return createRepository( "test-repo", "Test Repository: " + getName(), repoRoot );
+ ManagedRepositoryConfiguration repoConfig = createRepository( "test-repo", "Test Repository: " + getName(),
+ repoRoot );
+
+ ManagedRepositoryContent repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class,
+ "default" );
+ repoContent.setRepository( repoConfig );
+ return repoContent;
}
- private void prepTestRepo( ManagedRepositoryConfiguration repo, ProjectReference reference )
+ private void prepTestRepo( ManagedRepositoryContent repo, ProjectReference reference )
throws IOException
{
String groupDir = StringUtils.replaceChars( reference.getGroupId(), '.', '/' );
@@ -563,7 +531,7 @@
File srcRepoDir = new File( "src/test/repositories/metadata-repository" );
File srcDir = new File( srcRepoDir, path );
- File destDir = new File( repo.getLocation(), path );
+ File destDir = new File( repo.getRepoRoot(), path );
assertTrue( "Source Dir exists: " + srcDir, srcDir.exists() );
destDir.mkdirs();
@@ -571,7 +539,7 @@
FileUtils.copyDirectory( srcDir, destDir );
}
- private void prepTestRepo( ManagedRepositoryConfiguration repo, VersionedReference reference )
+ private void prepTestRepo( ManagedRepositoryContent repo, VersionedReference reference )
throws IOException
{
ProjectReference projectRef = new ProjectReference();
Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300ReaderTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300ReaderTest.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300ReaderTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300ReaderTest.java Wed Oct 10 02:47:20 2007
@@ -30,7 +30,7 @@
/**
* ProjectModel300ReaderTest
*
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
*/
public class ProjectModel300ReaderTest
Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java Wed Oct 10 02:47:20 2007
@@ -36,7 +36,7 @@
/**
* ProjectModel400WriterTest
*
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
*/
public class ProjectModel400WriterTest
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom?rev=583412&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom Wed Oct 10 02:47:20 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project>
+ <extend>../../project.xml</extend>
+ <pomVersion>3</pomVersion>
+ <groupId>maven</groupId>
+ <id>wagon-ssh</id>
+ <artifactId>wagon-ssh</artifactId>
+ <name>Wagon SSH provider</name>
+ <currentVersion>1.0-SNAPSHOT</currentVersion>
+ <description></description>
+ <shortDescription>Wagon Provider for protocols from SSH2 family based on JSCH</shortDescription>
+ <package>org.apache.maven.wagon.providers.ssh</package>
+ <inceptionYear>2003</inceptionYear>
+ <url>http://maven.apache.org/wagon/wagon-providers/ssh</url>
+ <issueTrackingUrl>http://jira.codehaus.org/BrowseProject.jspa?id=10319</issueTrackingUrl>
+ <siteDirectory>/www/maven.apache.org/wagon/wagon-providers/ssh</siteDirectory>
+ <repository>
+ <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-wagon/wagon-providers/ssh</connection>
+ <url>http://cvs.apache.org/viewcvs/maven-wagon/wagon-providers/ssh/</url>
+ </repository>
+
+ <developers>
+ <developer>
+ <name>Michal Maczka</name>
+ <id>michal</id>
+ <email>michal.maczka@dimatics.com</email>
+ <organization>Dimatics</organization>
+ <roles>
+ <role>Creator</role>
+ <role>Developer</role>
+ <role>Release Manager</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <dependencies>
+ <dependency>
+ <groupId>maven</groupId>
+ <artifactId>wagon-api</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>jsch</groupId>
+ <artifactId>jsch</artifactId>
+ <version>0.1.14</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/javadocs/testing-1.0-javadoc.jar
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/javadocs/testing-1.0-javadoc.jar?rev=583412&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/javadocs/testing-1.0-javadoc.jar
------------------------------------------------------------------------------
svn:mime-type = application/java-archive
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/poms/testing-1.0.pom
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/poms/testing-1.0.pom?rev=583412&view=auto
==============================================================================
(empty)
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/poms/testing-1.0.pom
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/poms/testing-1.0.pom
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/poms/testing-1.0.pom
------------------------------------------------------------------------------
svn:mime-type = text/xml