]> source.dussan.org Git - archiva.git/commitdiff
merge artifact-converter into converter
authorBrett Porter <brett@apache.org>
Wed, 30 Jul 2014 01:37:49 +0000 (11:37 +1000)
committerBrett Porter <brett@apache.org>
Wed, 30 Jul 2014 01:46:30 +0000 (11:46 +1000)
Large amount of duplicated information and an unnecessary split package
caused duplicates in the produced bundle

102 files changed:
archiva-modules/archiva-base/archiva-artifact-converter/pom.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConversionException.java [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConverter.java [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyRepositoryLayout.java [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/Messages.java [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/main/resources/META-INF/spring-context.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/main/resources/org/apache/archiva/converter/artifact/messages.properties [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-one.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-three.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-two.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-snapshot.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-warnings.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/maven-foo-plugin-1.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/newversion-artifact-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-artifact-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-snapshot-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-version-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-artifact-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-snapshot-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-version-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/resources/spring-context.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5 [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1 [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/maven-foo-plugin-1.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar [deleted file]
archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom [deleted file]
archiva-modules/archiva-base/archiva-converter/pom.xml
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConversionException.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConverter.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyRepositoryLayout.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/Messages.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/archiva/converter/artifact/messages.properties [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java [new file with mode: 0644]
archiva-modules/archiva-base/pom.xml
pom.xml

diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
deleted file mode 100644 (file)
index 2aeae86..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.archiva</groupId>
-    <artifactId>archiva-base</artifactId>
-    <version>2.1.1-SNAPSHOT</version>
-  </parent>
-  <artifactId>archiva-artifact-converter</artifactId>
-  <packaging>bundle</packaging>
-  <name>Archiva Base :: Artifact Converter</name>
-  <description>Converts between Legacy and Modern Layout Artifacts.</description>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-repository-metadata</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
-      <!-- olamy : weird enforcer doesn't have it but failed IMHO issue in enforcer plugin !!
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.maven.wagon</groupId>
-          <artifactId>wagon-provider-api</artifactId>
-        </exclusion>
-      </exclusions>
-      -->
-    </dependency>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-plexus-bridge</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-transaction</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.shared</groupId>
-      <artifactId>maven-model-converter</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-simple</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-test-utils</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <configuration>
-          <instructions>
-            <Bundle-SymbolicName>org.apache.archiva.artifact.converter</Bundle-SymbolicName>
-            <Bundle-Version>${project.version}</Bundle-Version>
-            <Export-Package>
-              org.apache.archiva.converter.artifact*;version=${project.version};-split-package:=merge-first
-            </Export-Package>
-            <Import-Package>
-              javax.annotation,
-              javax.inject,
-              org.apache.archiva.common.plexusbridge;version=${project.version},
-              org.apache.archiva.transaction;version=${project.version},
-              org.apache.commons.io;version="[1.4,2)",
-              org.springframework*;version="[3,4)",
-              org.apache.maven.artifact*,
-              org.apache.maven.model*,
-              org.codehaus.plexus.digest,
-              org.codehaus.plexus.util*
-            </Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <basedir>${basedir}</basedir>
-          </systemPropertyVariables>
-        </configuration>
-      </plugin>
-    </plugins>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.apache.rat</groupId>
-          <artifactId>apache-rat-plugin</artifactId>
-          <configuration>
-            <excludes>
-              <exclude>src/test/source-repository/**</exclude>
-              <exclude>src/test/expected-files/**</exclude>
-            </excludes>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConversionException.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConversionException.java
deleted file mode 100644 (file)
index 0fe5dff..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.apache.archiva.converter.artifact;
-
-/*
- * 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.
- */
-
-/**
- * ArtifactConversionException 
- *
- *
- */
-public class ArtifactConversionException
-    extends Exception
-{
-
-    public ArtifactConversionException()
-    {
-    }
-
-    public ArtifactConversionException( String message )
-    {
-        super( message );
-    }
-
-    public ArtifactConversionException( Throwable cause )
-    {
-        super( cause );
-    }
-
-    public ArtifactConversionException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConverter.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConverter.java
deleted file mode 100644 (file)
index 842f01e..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.archiva.converter.artifact;
-
-/*
- * 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.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * ArtifactConverter 
- *
- *
- */
-public interface ArtifactConverter
-{
-    /**
-     * Convert an provided artifact, and place it into the destination repository.
-     * 
-     * @param artifact the artifact to convert.
-     * @param destinationRepository the respository to send the artifact to.
-     * @throws ArtifactConversionException 
-     */
-    void convert( Artifact artifact, ArtifactRepository destinationRepository )
-        throws ArtifactConversionException;
-
-    /**
-     * Get the map of accumulated warnings for the conversion.
-     * 
-     * @return the {@link Map}&lt;{@link Artifact}, {@link String}&gt; warning messages.
-     */
-    Map<Artifact, List<String>> getWarnings();
-
-    /**
-     * Clear the list of warning messages.
-     */
-    void clearWarnings();
-}
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyRepositoryLayout.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyRepositoryLayout.java
deleted file mode 100644 (file)
index 3101236..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.apache.archiva.converter.artifact;
-/*
- * 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.Artifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-
-/**
- * @author jdcasey
- */
-public class LegacyRepositoryLayout
-    implements ArtifactRepositoryLayout
-{
-
-    private static final String PATH_SEPARATOR = "/";
-
-    public String getId()
-    {
-        return "legacy";
-    }
-
-    @Override
-    public String pathOf( Artifact artifact )
-    {
-        ArtifactHandler artifactHandler = artifact.getArtifactHandler();
-
-        StringBuilder path = new StringBuilder( 128 );
-
-        path.append( artifact.getGroupId() ).append( '/' );
-        path.append( artifactHandler.getDirectory() ).append( '/' );
-        path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
-
-        if ( artifact.hasClassifier() )
-        {
-            path.append( '-' ).append( artifact.getClassifier() );
-        }
-
-        if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
-        {
-            path.append( '.' ).append( artifactHandler.getExtension() );
-        }
-
-        return path.toString();
-    }
-
-    @Override
-    public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
-    {
-        return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
-    }
-
-    private String pathOfRepositoryMetadata( ArtifactMetadata metadata, String filename )
-    {
-        StringBuilder path = new StringBuilder( 128 );
-
-        path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR );
-
-        path.append( filename );
-
-        return path.toString();
-    }
-
-    @Override
-    public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
-    {
-        return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
-    }
-
-}
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java
deleted file mode 100644 (file)
index ba8bf27..0000000
+++ /dev/null
@@ -1,742 +0,0 @@
-package org.apache.archiva.converter.artifact;
-
-/*
- * 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.archiva.common.plexusbridge.DigesterUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
-import org.apache.archiva.transaction.FileTransaction;
-import org.apache.archiva.transaction.TransactionException;
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.Snapshot;
-import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
-import org.apache.maven.model.DistributionManagement;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Relocation;
-import org.apache.maven.model.converter.ModelConverter;
-import org.apache.maven.model.converter.PomTranslationException;
-import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
-import org.codehaus.plexus.digest.Digester;
-import org.codehaus.plexus.digest.DigesterException;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-
-/**
- * LegacyToDefaultConverter
- */
-@Service("artifactConverter#legacy-to-default")
-public class LegacyToDefaultConverter
-    implements ArtifactConverter
-{
-    /**
-     * {@link List}&lt;{@link Digester}
-     */
-    private List<? extends Digester> digesters;
-
-    @Inject
-    private PlexusSisuBridge plexusSisuBridge;
-
-    @Inject
-    private DigesterUtils digesterUtils;
-
-    private ModelConverter translator;
-
-    private ArtifactFactory artifactFactory;
-
-    private ArtifactHandlerManager artifactHandlerManager;
-
-    private boolean force;
-
-    private boolean dryrun;
-
-    private Map<Artifact, List<String>> warnings = new HashMap<>();
-
-    @PostConstruct
-    public void initialize()
-        throws PlexusSisuBridgeException
-    {
-        this.digesters = digesterUtils.getAllDigesters();
-        translator = plexusSisuBridge.lookup( ModelConverter.class );
-        artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class );
-        artifactHandlerManager = plexusSisuBridge.lookup( ArtifactHandlerManager.class );
-    }
-
-    @Override
-    public void convert( Artifact artifact, ArtifactRepository targetRepository )
-        throws ArtifactConversionException
-    {
-        if ( artifact.getRepository().getUrl().equals( targetRepository.getUrl() ) )
-        {
-            throw new ArtifactConversionException( Messages.getString( "exception.repositories.match" ) ); //$NON-NLS-1$
-        }
-
-        if ( !validateMetadata( artifact ) )
-        {
-            addWarning( artifact, Messages.getString( "unable.to.validate.metadata" ) ); //$NON-NLS-1$
-            return;
-        }
-
-        FileTransaction transaction = new FileTransaction();
-
-        if ( !copyPom( artifact, targetRepository, transaction ) )
-        {
-            addWarning( artifact, Messages.getString( "unable.to.copy.pom" ) ); //$NON-NLS-1$
-            return;
-        }
-
-        if ( !copyArtifact( artifact, targetRepository, transaction ) )
-        {
-            addWarning( artifact, Messages.getString( "unable.to.copy.artifact" ) ); //$NON-NLS-1$
-            return;
-        }
-
-        Metadata metadata = createBaseMetadata( artifact );
-        Versioning versioning = new Versioning();
-        versioning.addVersion( artifact.getBaseVersion() );
-        metadata.setVersioning( versioning );
-        updateMetadata( new ArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction );
-
-        metadata = createBaseMetadata( artifact );
-        metadata.setVersion( artifact.getBaseVersion() );
-        versioning = new Versioning();
-
-        Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
-        if ( matcher.matches() )
-        {
-            Snapshot snapshot = new Snapshot();
-            snapshot.setBuildNumber( Integer.parseInt( matcher.group( 3 ) ) );
-            snapshot.setTimestamp( matcher.group( 2 ) );
-            versioning.setSnapshot( snapshot );
-        }
-
-        // TODO: merge latest/release/snapshot from source instead
-        metadata.setVersioning( versioning );
-        updateMetadata( new SnapshotArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction );
-
-        if ( !dryrun )
-        {
-            try
-            {
-                transaction.commit();
-            }
-            catch ( TransactionException e )
-            {
-                throw new ArtifactConversionException( Messages.getString( "transaction.failure", e.getMessage() ),
-                                                       e ); //$NON-NLS-1$
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private boolean copyPom( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
-        throws ArtifactConversionException
-    {
-        Artifact pom = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
-                                                              artifact.getVersion() );
-        pom.setBaseVersion( artifact.getBaseVersion() );
-        ArtifactRepository repository = artifact.getRepository();
-        File file = new File( repository.getBasedir(), repository.pathOf( pom ) );
-
-        boolean result = true;
-        if ( file.exists() )
-        {
-            File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pom ) );
-
-            String contents = null;
-            boolean checksumsValid = false;
-            try
-            {
-                if ( testChecksums( artifact, file ) )
-                {
-                    checksumsValid = true;
-                }
-
-                // Even if the checksums for the POM are invalid we should still convert the POM
-                contents = FileUtils.readFileToString( file, Charset.defaultCharset() );
-            }
-            catch ( IOException e )
-            {
-                throw new ArtifactConversionException(
-                    Messages.getString( "unable.to.read.source.pom", e.getMessage() ), e ); //$NON-NLS-1$
-            }
-
-            if ( checksumsValid && contents.indexOf( "modelVersion" ) >= 0 ) //$NON-NLS-1$
-            {
-                // v4 POM
-                try
-                {
-                    boolean matching = false;
-                    if ( !force && targetFile.exists() )
-                    {
-                        String targetContents = FileUtils.readFileToString( targetFile, Charset.defaultCharset() );
-                        matching = targetContents.equals( contents );
-                    }
-                    if ( force || !matching )
-                    {
-                        transaction.createFile( contents, targetFile, digesters );
-                    }
-                }
-                catch ( IOException e )
-                {
-                    throw new ArtifactConversionException(
-                        Messages.getString( "unable.to.write.target.pom", e.getMessage() ), e ); //$NON-NLS-1$
-                }
-            }
-            else
-            {
-                // v3 POM
-                try (StringReader stringReader = new StringReader( contents ))
-                {
-
-                    try (StringWriter writer = new StringWriter())
-                    {
-                        org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader v3Reader =
-                            new org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader();
-                        org.apache.maven.model.v3_0_0.Model v3Model = v3Reader.read( stringReader );
-
-                        if ( doRelocation( artifact, v3Model, targetRepository, transaction ) )
-                        {
-                            Artifact relocatedPom =
-                                artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
-                                                                       artifact.getVersion() );
-                            targetFile =
-                                new File( targetRepository.getBasedir(), targetRepository.pathOf( relocatedPom ) );
-                        }
-
-                        Model v4Model = translator.translate( v3Model );
-
-                        translator.validateV4Basics( v4Model, v3Model.getGroupId(), v3Model.getArtifactId(),
-                                                     v3Model.getVersion(), v3Model.getPackage() );
-
-                        MavenXpp3Writer xpp3Writer = new MavenXpp3Writer();
-                        xpp3Writer.write( writer, v4Model );
-
-                        transaction.createFile( writer.toString(), targetFile, digesters );
-
-                        List<String> warnings = translator.getWarnings();
-
-                        for ( String message : warnings )
-                        {
-                            addWarning( artifact, message );
-                        }
-                    }
-                    catch ( XmlPullParserException e )
-                    {
-                        addWarning( artifact,
-                                    Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$
-                        result = false;
-                    }
-                    catch ( IOException e )
-                    {
-                        throw new ArtifactConversionException( Messages.getString( "unable.to.write.converted.pom" ),
-                                                               e ); //$NON-NLS-1$
-                    }
-                    catch ( PomTranslationException e )
-                    {
-                        addWarning( artifact,
-                                    Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$
-                        result = false;
-                    }
-                }
-            }
-        }
-        else
-        {
-            addWarning( artifact, Messages.getString( "warning.missing.pom" ) ); //$NON-NLS-1$
-        }
-        return result;
-    }
-
-    private boolean testChecksums( Artifact artifact, File file )
-        throws IOException
-    {
-        boolean result = true;
-        for ( Digester digester : digesters )
-        {
-            result &= verifyChecksum( file, file.getName() + "." + getDigesterFileExtension( digester ), digester,
-                                      //$NON-NLS-1$
-                                      artifact,
-                                      "failure.incorrect." + getDigesterFileExtension( digester ) ); //$NON-NLS-1$
-        }
-        return result;
-    }
-
-    private boolean verifyChecksum( File file, String fileName, Digester digester, Artifact artifact, String key )
-        throws IOException
-    {
-        boolean result = true;
-
-        File checksumFile = new File( file.getParentFile(), fileName );
-        if ( checksumFile.exists() )
-        {
-            String checksum = FileUtils.readFileToString( checksumFile, Charset.defaultCharset() );
-            try
-            {
-                digester.verify( file, checksum );
-            }
-            catch ( DigesterException e )
-            {
-                addWarning( artifact, Messages.getString( key ) );
-                result = false;
-            }
-        }
-        return result;
-    }
-
-    /**
-     * File extension for checksums
-     * TODO should be moved to plexus-digester ?
-     */
-    private String getDigesterFileExtension( Digester digester )
-    {
-        return digester.getAlgorithm().toLowerCase().replaceAll( "-", "" ); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    private boolean copyArtifact( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
-        throws ArtifactConversionException
-    {
-        File sourceFile = artifact.getFile();
-
-        if ( sourceFile.getAbsolutePath().indexOf( "/plugins/" ) > -1 ) //$NON-NLS-1$
-        {
-            artifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "maven-plugin" ) ); //$NON-NLS-1$
-        }
-
-        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-
-        boolean result = true;
-        try
-        {
-            boolean matching = false;
-            if ( !force && targetFile.exists() )
-            {
-                matching = FileUtils.contentEquals( sourceFile, targetFile );
-                if ( !matching )
-                {
-                    addWarning( artifact, Messages.getString( "failure.target.already.exists" ) ); //$NON-NLS-1$
-                    result = false;
-                }
-            }
-            if ( result )
-            {
-                if ( force || !matching )
-                {
-                    if ( testChecksums( artifact, sourceFile ) )
-                    {
-                        transaction.copyFile( sourceFile, targetFile, digesters );
-                    }
-                    else
-                    {
-                        result = false;
-                    }
-                }
-            }
-        }
-        catch ( IOException e )
-        {
-            throw new ArtifactConversionException( Messages.getString( "error.copying.artifact" ), e ); //$NON-NLS-1$
-        }
-        return result;
-    }
-
-    private Metadata createBaseMetadata( Artifact artifact )
-    {
-        Metadata metadata = new Metadata();
-        metadata.setArtifactId( artifact.getArtifactId() );
-        metadata.setGroupId( artifact.getGroupId() );
-        return metadata;
-    }
-
-    private Metadata readMetadata( File file )
-        throws ArtifactConversionException
-    {
-        MetadataXpp3Reader reader = new MetadataXpp3Reader();
-
-        try (Reader fileReader = Files.newBufferedReader( file.toPath(), Charset.defaultCharset() ))
-        {
-            return reader.read( fileReader );
-        }
-        catch ( IOException | XmlPullParserException e )
-        {
-            throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ),
-                                                   e ); //$NON-NLS-1$
-        }
-    }
-
-    private boolean validateMetadata( Artifact artifact )
-        throws ArtifactConversionException
-    {
-        ArtifactRepository repository = artifact.getRepository();
-
-        boolean result = true;
-
-        RepositoryMetadata repositoryMetadata = new ArtifactRepositoryMetadata( artifact );
-        File file =
-            new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
-        if ( file.exists() )
-        {
-            Metadata metadata = readMetadata( file );
-            result = validateMetadata( metadata, repositoryMetadata, artifact );
-        }
-
-        repositoryMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        file = new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
-        if ( file.exists() )
-        {
-            Metadata metadata = readMetadata( file );
-            result = result && validateMetadata( metadata, repositoryMetadata, artifact );
-        }
-
-        return result;
-    }
-
-    @SuppressWarnings("unchecked")
-    private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact )
-    {
-        String groupIdKey;
-        String artifactIdKey = null;
-        String snapshotKey = null;
-        String versionKey = null;
-        String versionsKey = null;
-
-        if ( repositoryMetadata.storedInGroupDirectory() )
-        {
-            groupIdKey = "failure.incorrect.groupMetadata.groupId"; //$NON-NLS-1$
-        }
-        else if ( repositoryMetadata.storedInArtifactVersionDirectory() )
-        {
-            groupIdKey = "failure.incorrect.snapshotMetadata.groupId"; //$NON-NLS-1$
-            artifactIdKey = "failure.incorrect.snapshotMetadata.artifactId"; //$NON-NLS-1$
-            versionKey = "failure.incorrect.snapshotMetadata.version"; //$NON-NLS-1$
-            snapshotKey = "failure.incorrect.snapshotMetadata.snapshot"; //$NON-NLS-1$
-        }
-        else
-        {
-            groupIdKey = "failure.incorrect.artifactMetadata.groupId"; //$NON-NLS-1$
-            artifactIdKey = "failure.incorrect.artifactMetadata.artifactId"; //$NON-NLS-1$
-            versionsKey = "failure.incorrect.artifactMetadata.versions"; //$NON-NLS-1$
-        }
-
-        boolean result = true;
-
-        if ( metadata.getGroupId() == null || !metadata.getGroupId().equals( artifact.getGroupId() ) )
-        {
-            addWarning( artifact, Messages.getString( groupIdKey ) );
-            result = false;
-        }
-        if ( !repositoryMetadata.storedInGroupDirectory() )
-        {
-            if ( metadata.getGroupId() == null || !metadata.getArtifactId().equals( artifact.getArtifactId() ) )
-            {
-                addWarning( artifact, Messages.getString( artifactIdKey ) );
-                result = false;
-            }
-            if ( !repositoryMetadata.storedInArtifactVersionDirectory() )
-            {
-                // artifact metadata
-
-                boolean foundVersion = false;
-                if ( metadata.getVersioning() != null )
-                {
-                    for ( String version : (List<String>) metadata.getVersioning().getVersions() )
-                    {
-                        if ( version.equals( artifact.getBaseVersion() ) )
-                        {
-                            foundVersion = true;
-                            break;
-                        }
-                    }
-                }
-
-                if ( !foundVersion )
-                {
-                    addWarning( artifact, Messages.getString( versionsKey ) );
-                    result = false;
-                }
-            }
-            else
-            {
-                // snapshot metadata
-                if ( !artifact.getBaseVersion().equals( metadata.getVersion() ) )
-                {
-                    addWarning( artifact, Messages.getString( versionKey ) );
-                    result = false;
-                }
-
-                if ( artifact.isSnapshot() )
-                {
-                    Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
-                    if ( matcher.matches() )
-                    {
-                        boolean correct = false;
-                        if ( metadata.getVersioning() != null && metadata.getVersioning().getSnapshot() != null )
-                        {
-                            Snapshot snapshot = metadata.getVersioning().getSnapshot();
-                            int build = Integer.parseInt( matcher.group( 3 ) );
-                            String ts = matcher.group( 2 );
-                            if ( build == snapshot.getBuildNumber() && ts.equals( snapshot.getTimestamp() ) )
-                            {
-                                correct = true;
-                            }
-                        }
-
-                        if ( !correct )
-                        {
-                            addWarning( artifact, Messages.getString( snapshotKey ) );
-                            result = false;
-                        }
-                    }
-                }
-            }
-        }
-        return result;
-    }
-
-    private void updateMetadata( RepositoryMetadata artifactMetadata, ArtifactRepository targetRepository,
-                                 Metadata newMetadata, FileTransaction transaction )
-        throws ArtifactConversionException
-    {
-        File file = new File( targetRepository.getBasedir(),
-                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-
-        Metadata metadata;
-        boolean changed;
-
-        if ( file.exists() )
-        {
-            metadata = readMetadata( file );
-            changed = metadata.merge( newMetadata );
-        }
-        else
-        {
-            changed = true;
-            metadata = newMetadata;
-        }
-
-        if ( changed )
-        {
-
-            try (StringWriter writer = new StringWriter())
-            {
-                MetadataXpp3Writer mappingWriter = new MetadataXpp3Writer();
-
-                mappingWriter.write( writer, metadata );
-
-                transaction.createFile( writer.toString(), file, digesters );
-            }
-            catch ( IOException e )
-            {
-                throw new ArtifactConversionException( Messages.getString( "error.writing.target.metadata" ),
-                                                       e ); //$NON-NLS-1$
-            }
-        }
-    }
-
-    private boolean doRelocation( Artifact artifact, org.apache.maven.model.v3_0_0.Model v3Model,
-                                  ArtifactRepository repository, FileTransaction transaction )
-        throws IOException
-    {
-        Properties properties = v3Model.getProperties();
-        if ( properties.containsKey( "relocated.groupId" ) || properties.containsKey( "relocated.artifactId" )
-            //$NON-NLS-1$ //$NON-NLS-2$
-            || properties.containsKey( "relocated.version" ) ) //$NON-NLS-1$
-        {
-            String newGroupId = properties.getProperty( "relocated.groupId", v3Model.getGroupId() ); //$NON-NLS-1$
-            properties.remove( "relocated.groupId" ); //$NON-NLS-1$
-
-            String newArtifactId =
-                properties.getProperty( "relocated.artifactId", v3Model.getArtifactId() ); //$NON-NLS-1$
-            properties.remove( "relocated.artifactId" ); //$NON-NLS-1$
-
-            String newVersion = properties.getProperty( "relocated.version", v3Model.getVersion() ); //$NON-NLS-1$
-            properties.remove( "relocated.version" ); //$NON-NLS-1$
-
-            String message = properties.getProperty( "relocated.message", "" ); //$NON-NLS-1$ //$NON-NLS-2$
-            properties.remove( "relocated.message" ); //$NON-NLS-1$
-
-            if ( properties.isEmpty() )
-            {
-                v3Model.setProperties( null );
-            }
-
-            writeRelocationPom( v3Model.getGroupId(), v3Model.getArtifactId(), v3Model.getVersion(), newGroupId,
-                                newArtifactId, newVersion, message, repository, transaction );
-
-            v3Model.setGroupId( newGroupId );
-            v3Model.setArtifactId( newArtifactId );
-            v3Model.setVersion( newVersion );
-
-            artifact.setGroupId( newGroupId );
-            artifact.setArtifactId( newArtifactId );
-            artifact.setVersion( newVersion );
-
-            return true;
-        }
-        else
-        {
-            return false;
-        }
-    }
-
-    private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId,
-                                     String newArtifactId, String newVersion, String message,
-                                     ArtifactRepository repository, FileTransaction transaction )
-        throws IOException
-    {
-        Model pom = new Model();
-        pom.setGroupId( groupId );
-        pom.setArtifactId( artifactId );
-        pom.setVersion( version );
-
-        DistributionManagement dMngt = new DistributionManagement();
-
-        Relocation relocation = new Relocation();
-        relocation.setGroupId( newGroupId );
-        relocation.setArtifactId( newArtifactId );
-        relocation.setVersion( newVersion );
-        if ( message != null && message.length() > 0 )
-        {
-            relocation.setMessage( message );
-        }
-
-        dMngt.setRelocation( relocation );
-
-        pom.setDistributionManagement( dMngt );
-
-        Artifact artifact = artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" ); //$NON-NLS-1$
-        File pomFile = new File( repository.getBasedir(), repository.pathOf( artifact ) );
-
-        StringWriter strWriter = new StringWriter();
-        MavenXpp3Writer pomWriter = new MavenXpp3Writer();
-        pomWriter.write( strWriter, pom );
-
-        transaction.createFile( strWriter.toString(), pomFile, digesters );
-    }
-
-    private void addWarning( Artifact artifact, String message )
-    {
-        List<String> messages = warnings.get( artifact );
-        if ( messages == null )
-        {
-            messages = new ArrayList<>( 1 );
-        }
-        messages.add( message );
-        warnings.put( artifact, messages );
-    }
-
-    @Override
-    public void clearWarnings()
-    {
-        warnings.clear();
-    }
-
-    @Override
-    public Map<Artifact, List<String>> getWarnings()
-    {
-        return warnings;
-    }
-
-
-    public List<? extends Digester> getDigesters()
-    {
-        return digesters;
-    }
-
-    public void setDigesters( List<Digester> digesters )
-    {
-        this.digesters = digesters;
-    }
-
-    public ModelConverter getTranslator()
-    {
-        return translator;
-    }
-
-    public void setTranslator( ModelConverter translator )
-    {
-        this.translator = translator;
-    }
-
-    public ArtifactFactory getArtifactFactory()
-    {
-        return artifactFactory;
-    }
-
-    public void setArtifactFactory( ArtifactFactory artifactFactory )
-    {
-        this.artifactFactory = artifactFactory;
-    }
-
-    public ArtifactHandlerManager getArtifactHandlerManager()
-    {
-        return artifactHandlerManager;
-    }
-
-    public void setArtifactHandlerManager( ArtifactHandlerManager artifactHandlerManager )
-    {
-        this.artifactHandlerManager = artifactHandlerManager;
-    }
-
-    public boolean isForce()
-    {
-        return force;
-    }
-
-    public void setForce( boolean force )
-    {
-        this.force = force;
-    }
-
-    public boolean isDryrun()
-    {
-        return dryrun;
-    }
-
-    public void setDryrun( boolean dryrun )
-    {
-        this.dryrun = dryrun;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/Messages.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/java/org/apache/archiva/converter/artifact/Messages.java
deleted file mode 100644 (file)
index 0cec0fe..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.apache.archiva.converter.artifact;
-
-/*
- * 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.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Messages 
- *
- *
- */
-public class Messages
-{
-    private static final String BUNDLE_NAME = "org.apache.archiva.converter.artifact.messages"; //$NON-NLS-1$
-
-    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
-
-    private Messages()
-    {
-        // no op
-    }
-
-    public static String getString( String key )
-    {
-        try
-        {
-            return RESOURCE_BUNDLE.getString( key );
-        }
-        catch ( MissingResourceException e )
-        {
-            return '!' + key + '!';
-        }
-    }
-    
-    public static String getString( String key, Object argument )
-    {
-        return getString( key, new Object[] { argument } );
-    }
-    
-    public static String getString( String key, Object arguments[] )
-    {
-        try
-        {
-            String pattern = RESOURCE_BUNDLE.getString( key );
-            return MessageFormat.format( pattern, arguments );
-        }
-        catch ( MissingResourceException e )
-        {
-            return '!' + key + '!';
-        }
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/resources/META-INF/spring-context.xml
deleted file mode 100644 (file)
index fcc10b5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ 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.
-  -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-           http://www.springframework.org/schema/context 
-           http://www.springframework.org/schema/context/spring-context-3.0.xsd"
-       default-lazy-init="true">
-
-  <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.converter.artifact"/>
-
-</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/main/resources/org/apache/archiva/converter/artifact/messages.properties b/archiva-modules/archiva-base/archiva-artifact-converter/src/main/resources/org/apache/archiva/converter/artifact/messages.properties
deleted file mode 100644 (file)
index 5e5bc6d..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# 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.
-#
-
-unable.to.validate.metadata=Unable to validate metadata
-unable.to.copy.pom=Unable to copy pom.
-unable.to.copy.artifact=Unable to copy artifact
-unable.to.read.source.pom=Unable to read source POM: {0} 
-unable.to.write.target.pom=Unable to write target POM: {0}
-unable.to.write.converted.pom=Unable to write converted POM
-
-
-exception.repositories.match=Source repository of artifact, and target repository are the same.  No conversion needed.
-transaction.failure=Transaction failure: {0} 
-invalid.source.pom=Invalid source pom: {0}
-
-warning.missing.pom=The artifact had no POM in the source repository.
-
-error.copying.artifact=Error copying artifact
-error.reading.target.metadata=Error reading target metadata
-error.writing.target.metadata=Error writing target metadata
-
-failure.target.already.exists=The artifact could not be converted because it already exists.
-failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect.
-
-failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect.
-failure.incorrect.artifactMetadata.groupId=The group ID in the source artifact metadata is incorrect.
-failure.incorrect.artifactMetadata.versions=The version list in the source artifact metadata is incorrect.
-
-failure.incorrect.snapshotMetadata.artifactId=The artifact ID in the source artifact version metadata is incorrect.
-failure.incorrect.snapshotMetadata.groupId=The group ID in the source artifact version metadata is incorrect.
-failure.incorrect.snapshotMetadata.version=The version in the source artifact version metadata is incorrect.
-failure.incorrect.snapshotMetadata.snapshot=The snapshot information in the source artifact version metadata is incorrect.
-
-failure.incorrect.md5=The MD5 checksum value was incorrect.
-failure.incorrect.sha1=The SHA1 checksum value was incorrect.
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-one.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-one.pom
deleted file mode 100644 (file)
index cd3862d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>artifact-one</artifactId>
-  <version>1.0.0</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-three.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-three.pom
deleted file mode 100644 (file)
index 3432910..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>artifact-three</artifactId>
-  <version>1.0.0</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-two.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-artifact-two.pom
deleted file mode 100644 (file)
index 2274701..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>artifact-two</artifactId>
-  <version>1.0.0</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-snapshot.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-snapshot.pom
deleted file mode 100644 (file)
index f03b5a5..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <version>1.0.0-SNAPSHOT</version>
-  <scm>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </scm>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.2</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom
deleted file mode 100644 (file)
index 1c56340..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <version>1.0.0-20060105.130101-3</version>
-  <scm>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </scm>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.2</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-warnings.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3-warnings.pom
deleted file mode 100644 (file)
index bdd2276..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>v3-warnings-artifact</artifactId>
-  <version>1.0.0</version>
-  <scm>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </scm>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.2</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/converted-v3.pom
deleted file mode 100644 (file)
index df4700c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <version>1.0.0</version>
-  <scm>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </scm>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.2</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/maven-foo-plugin-1.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/maven-foo-plugin-1.0.pom
deleted file mode 100644 (file)
index 17095cc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven.plugins</groupId>
-  <artifactId>maven-foo-plugin</artifactId>
-  <version>1.0.0</version>
-  <packaging>maven-plugin</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/newversion-artifact-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/newversion-artifact-metadata.xml
deleted file mode 100644 (file)
index ecc7f09..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>newversion-artifact</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0</version>
-      <version>1.0.1</version>
-    </versions>
-  </versioning>
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml
deleted file mode 100644 (file)
index ebd9be9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<metadata>
-  <groupId>relocated-test</groupId>
-  <artifactId>relocated-v3artifact</artifactId>
-  <version>1.0.0</version>
-  <versioning />
-</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom
deleted file mode 100644 (file)
index 3f5df22..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>relocated-test</groupId>
-  <artifactId>relocated-v3artifact</artifactId>
-  <version>1.0.0</version>
-  <scm>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </scm>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.2</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml
deleted file mode 100644 (file)
index b4b1a86..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<metadata>
-  <groupId>relocated-test</groupId>
-  <artifactId>relocated-v3artifact</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0</version>
-    </versions>
-  </versioning>
-</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom
deleted file mode 100644 (file)
index 4efefb7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <groupId>test</groupId>
-  <artifactId>relocated-v3artifact</artifactId>
-  <version>1.0.0</version>
-  <distributionManagement>
-    <relocation>
-      <groupId>relocated-test</groupId>
-      <artifactId>relocated-v3artifact</artifactId>
-      <version>1.0.0</version>
-    </relocation>
-  </distributionManagement>
-</project>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-artifact-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-artifact-metadata.xml
deleted file mode 100644 (file)
index a8a7f37..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0</version>
-    </versions>
-  </versioning>
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml
deleted file mode 100644 (file)
index 24d25a0..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0-SNAPSHOT</version>
-    </versions>
-  </versioning>
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-snapshot-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-snapshot-metadata.xml
deleted file mode 100644 (file)
index b19c537..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <version>1.0.0-SNAPSHOT</version>
-  <versioning />
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml
deleted file mode 100644 (file)
index 602c38e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <version>1.0.0-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <timestamp>20060105.130101</timestamp>
-      <buildNumber>3</buildNumber>
-    </snapshot>
-  </versioning>
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-version-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v3-version-metadata.xml
deleted file mode 100644 (file)
index 3c89389..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v3artifact</artifactId>
-  <version>1.0.0</version>
-  <versioning />
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-artifact-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-artifact-metadata.xml
deleted file mode 100644 (file)
index c0cdbfd..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0</version>
-    </versions>
-  </versioning>
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml
deleted file mode 100644 (file)
index f8072b0..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0-SNAPSHOT</version>
-    </versions>
-  </versioning>
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-snapshot-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-snapshot-metadata.xml
deleted file mode 100644 (file)
index d5ecb7d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <version>1.0.0-SNAPSHOT</version>
-  <versioning />
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml
deleted file mode 100644 (file)
index 060a79c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <version>1.0.0-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <timestamp>20060111.120115</timestamp>
-      <buildNumber>1</buildNumber>
-    </snapshot>
-  </versioning>
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-version-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/expected-files/v4-version-metadata.xml
deleted file mode 100644 (file)
index 7cbd8ad..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <version>1.0.0</version>
-  <versioning />
-</metadata>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java
deleted file mode 100644 (file)
index a737e84..0000000
+++ /dev/null
@@ -1,1064 +0,0 @@
-package org.apache.archiva.converter.artifact;
-
-/*
- * 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.TestCase;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.utils.FileUtil;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.regex.Matcher;
-
-/**
- * LegacyToDefaultConverterTest
- */
-@RunWith (ArchivaSpringJUnit4ClassRunner.class)
-@ContextConfiguration (locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
-public class LegacyToDefaultConverterTest
-    extends TestCase
-{
-    private ArtifactRepository sourceRepository;
-
-    private ArtifactRepository targetRepository;
-
-    private ArtifactConverter artifactConverter;
-
-    private ArtifactFactory artifactFactory;
-
-    @Inject
-    private PlexusSisuBridge plexusSisuBridge;
-
-    @Inject
-    private ApplicationContext applicationContext;
-
-    private static final int SLEEP_MILLIS = 100;
-
-    @Before
-    public void init()
-        throws Exception
-    {
-        super.setUp();
-
-        ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
-
-        Map<String, ArtifactRepositoryLayout> layoutsMap = plexusSisuBridge.lookupMap( ArtifactRepositoryLayout.class );
-
-        System.out.println( "hints " + layoutsMap.keySet().toString() );
-
-        ArtifactRepositoryLayout layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "legacy" );
-
-        File sourceBase = getTestFile( "src/test/source-repository" );
-        sourceRepository =
-            factory.createArtifactRepository( "source", sourceBase.toURL().toString(), layout, null, null );
-
-        layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
-
-        File targetBase = getTestFile( "target/test-target-repository" );
-        copyDirectoryStructure( getTestFile( "src/test/target-repository" ), targetBase );
-
-        targetRepository =
-            factory.createArtifactRepository( "target", targetBase.toURL().toString(), layout, null, null );
-
-        artifactConverter =
-            applicationContext.getBean( "artifactConverter#legacy-to-default", ArtifactConverter.class );
-
-        artifactConverter.clearWarnings();
-        artifactFactory = (ArtifactFactory) plexusSisuBridge.lookup( ArtifactFactory.class );
-    }
-
-    public static File getTestFile( String path )
-    {
-        return new File( FileUtil.getBasedir(), path );
-    }
-
-    private void copyDirectoryStructure( File sourceDirectory, File destinationDirectory )
-        throws IOException
-    {
-        if ( !sourceDirectory.exists() )
-        {
-            throw new IOException( "Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ")." );
-        }
-
-        File[] files = sourceDirectory.listFiles();
-
-        String sourcePath = sourceDirectory.getAbsolutePath();
-
-        for ( int i = 0; i < files.length; i++ )
-        {
-            File file = files[i];
-
-            String dest = file.getAbsolutePath();
-
-            dest = dest.substring( sourcePath.length() + 1 );
-
-            File destination = new File( destinationDirectory, dest );
-
-            if ( file.isFile() )
-            {
-                destination = destination.getParentFile();
-
-                FileUtils.copyFileToDirectory( file, destination );
-            }
-            else if ( file.isDirectory() )
-            {
-                if ( !".svn".equals( file.getName() ) )
-                {
-                    if ( !destination.exists() && !destination.mkdirs() )
-                    {
-                        throw new IOException(
-                            "Could not create destination directory '" + destination.getAbsolutePath() + "'." );
-                    }
-                    copyDirectoryStructure( file, destination );
-                }
-            }
-            else
-            {
-                throw new IOException( "Unknown file type: " + file.getAbsolutePath() );
-            }
-        }
-    }
-
-    @Test
-    public void testV4PomConvert()
-        throws Exception
-    {
-        // test that it is copied as is
-
-        Artifact artifact = createArtifact( "test", "v4artifact", "1.0.0" );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        artifactMetadataFile.delete();
-
-        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File versionMetadataFile = new File( targetRepository.getBasedir(),
-                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
-        versionMetadataFile.delete();
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        artifactFile.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        assertTrue( "Check POM created", pomFile.exists() );
-
-        compareFiles( sourcePomFile, pomFile );
-
-        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
-
-        File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-artifact-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, artifactMetadataFile );
-
-        assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() );
-
-        expectedMetadataFile = getTestFile( "src/test/expected-files/v4-version-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, versionMetadataFile );
-    }
-
-    @Test
-    public void testV3PomConvert()
-        throws Exception
-    {
-        // test that the pom is coverted
-
-        Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0" );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        artifactMetadataFile.delete();
-
-        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File versionMetadataFile = new File( targetRepository.getBasedir(),
-                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
-        versionMetadataFile.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" );
-        assertTrue( "Check POM created", pomFile.exists() );
-
-        compareFiles( expectedPomFile, pomFile );
-
-        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
-
-        File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-artifact-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, artifactMetadataFile );
-
-        assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() );
-
-        expectedMetadataFile = getTestFile( "src/test/expected-files/v3-version-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, versionMetadataFile );
-    }
-
-    @Test
-    public void testV3PomConvertWithRelocation()
-        throws Exception
-    {
-        Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        artifactMetadataFile.delete();
-
-        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File versionMetadataFile = new File( targetRepository.getBasedir(),
-                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
-        versionMetadataFile.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        //checkSuccess();  --> commented until MNG-2100 is fixed
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check if relocated artifact created", artifactFile.exists() );
-        assertTrue( "Check if relocated artifact matches",
-                    FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-        Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
-        File pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) );
-        File testFile = getTestFile( "target/test-target-repository/" + targetRepository.pathOf( pomArtifact ) );
-        compareFiles( pomFile, testFile );
-
-        Artifact orig = createArtifact( "test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
-        artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( orig ) );
-        assertTrue( "Check if relocation artifact pom is created", artifactFile.exists() );
-        testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) );
-        compareFiles( artifactFile, testFile );
-    }
-
-    @Test
-    public void testV3PomWarningsOnConvert()
-        throws Exception
-    {
-        // test that the pom is converted but that warnings are reported
-
-        Artifact artifact = createArtifact( "test", "v3-warnings-artifact", "1.0.0" );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        artifactMetadataFile.delete();
-
-        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File versionMetadataFile = new File( targetRepository.getBasedir(),
-                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
-        versionMetadataFile.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" );
-        assertTrue( "Check POM created", pomFile.exists() );
-
-        compareFiles( expectedPomFile, pomFile );
-
-        // TODO: check 2 warnings (extend and versions) matched on i18n key
-    }
-
-    private void doTestV4SnapshotPomConvert( String version, String expectedMetadataFileName )
-        throws Exception
-    {
-        // test that it is copied as is
-
-        Artifact artifact = createArtifact( "test", "v4artifact", version );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        artifactMetadataFile.delete();
-
-        ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File snapshotMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
-        snapshotMetadataFile.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        assertTrue( "Check POM created", pomFile.exists() );
-
-        compareFiles( sourcePomFile, pomFile );
-
-        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
-
-        File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-snapshot-artifact-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, artifactMetadataFile );
-
-        assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() );
-
-        expectedMetadataFile = getTestFile( expectedMetadataFileName );
-
-        compareFiles( expectedMetadataFile, snapshotMetadataFile );
-    }
-
-    @Test
-    public void testV3SnapshotPomConvert()
-        throws Exception
-    {
-        // test that the pom is coverted
-
-        Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-SNAPSHOT" );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        artifactMetadataFile.delete();
-
-        ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File snapshotMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
-        snapshotMetadataFile.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-snapshot.pom" );
-        assertTrue( "Check POM created", pomFile.exists() );
-
-        compareFiles( expectedPomFile, pomFile );
-
-        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
-
-        File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, artifactMetadataFile );
-
-        assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() );
-
-        expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, snapshotMetadataFile );
-    }
-
-    @Test
-    public void testV4SnapshotPomConvert()
-        throws Exception
-    {
-        doTestV4SnapshotPomConvert( "1.0.0-SNAPSHOT", "src/test/expected-files/v4-snapshot-metadata.xml" );
-
-        assertTrue( true );
-    }
-
-    @Test
-    public void testV4TimestampedSnapshotPomConvert()
-        throws Exception
-    {
-        doTestV4SnapshotPomConvert( "1.0.0-20060111.120115-1",
-                                    "src/test/expected-files/v4-timestamped-snapshot-metadata.xml" );
-
-        assertTrue( true );
-    }
-
-    @Test
-    public void testMavenOnePluginConversion()
-        throws Exception
-    {
-        Artifact artifact =
-            createArtifact( "org.apache.maven.plugins", "maven-foo-plugin", "1.0", "1.0", "maven-plugin" );
-        artifact.setFile(
-            new File( FileUtil.getBasedir(), "src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar" ) );
-        artifactConverter.convert( artifact, targetRepository );
-        // There is a warning but I can't figure out how to look at it. Eyeballing the results it appears
-        // the plugin is being coverted correctly.
-        //checkSuccess();
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        /*
-         The POM isn't needed for Maven 1.x plugins but the raw conversion for  
-
-         artifact = createPomArtifact( artifact );
-         File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-         File expectedPomFile = getTestFile( "src/test/expected-files/maven-foo-plugin-1.0.pom" );
-         assertTrue( "Check POM created", pomFile.exists() );
-         compareFiles( expectedPomFile, pomFile );
-         */
-    }
-
-    @Test
-    public void testV3TimestampedSnapshotPomConvert()
-        throws Exception
-    {
-        // test that the pom is coverted
-
-        Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-20060105.130101-3" );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        artifactMetadataFile.delete();
-
-        ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File snapshotMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
-        snapshotMetadataFile.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-timestamped-snapshot.pom" );
-        assertTrue( "Check POM created", pomFile.exists() );
-
-        compareFiles( expectedPomFile, pomFile );
-
-        assertTrue( "Check artifact snapshotMetadata created", artifactMetadataFile.exists() );
-
-        File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, artifactMetadataFile );
-
-        assertTrue( "Check snapshot snapshotMetadata created", snapshotMetadataFile.exists() );
-
-        expectedMetadataFile = getTestFile( "src/test/expected-files/v3-timestamped-snapshot-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, snapshotMetadataFile );
-    }
-
-    @Test
-    public void testNoPomConvert()
-        throws Exception
-    {
-        // test that a POM is not created when there was none at the source
-
-        Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" );
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 1 );
-
-        assertHasWarningReason( artifactConverter, Messages.getString( "warning.missing.pom" ) );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-
-        assertFalse( "Check no POM created", pomFile.exists() );
-        assertFalse( "No source POM", sourcePomFile.exists() );
-    }
-
-    @Test
-    public void testIncorrectSourceChecksumMd5()
-        throws Exception
-    {
-        // test that it fails when the source md5 is wrong
-
-        Artifact artifact = createArtifact( "test", "incorrectMd5Artifact", "1.0.0" );
-        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        file.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.md5" ) );
-
-        assertFalse( "Check artifact not created", file.exists() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertFalse( "Check metadata not created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testIncorrectSourceChecksumSha1()
-        throws Exception
-    {
-        // test that it fails when the source sha1 is wrong
-
-        Artifact artifact = createArtifact( "test", "incorrectSha1Artifact", "1.0.0" );
-        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        file.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.sha1" ) );
-
-        assertFalse( "Check artifact not created", file.exists() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertFalse( "Check metadata not created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testUnmodifiedArtifact()
-        throws Exception, InterruptedException
-    {
-        // test the unmodified artifact is untouched
-
-        Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" );
-        Artifact pomArtifact = createPomArtifact( artifact );
-
-        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
-        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
-        assertTrue( "Check target file exists", targetFile.exists() );
-        assertTrue( "Check target POM exists", targetPomFile.exists() );
-
-        sourceFile.setLastModified( System.currentTimeMillis() );
-        sourcePomFile.setLastModified( System.currentTimeMillis() );
-
-        long origTime = targetFile.lastModified();
-        long origPomTime = targetPomFile.lastModified();
-
-        // Need to guarantee last modified is not equal
-        Thread.sleep( SLEEP_MILLIS );
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        compareFiles( sourceFile, targetFile );
-        compareFiles( sourcePomFile, targetPomFile );
-
-        assertEquals( "Check artifact unmodified", origTime, targetFile.lastModified() );
-        assertEquals( "Check POM unmodified", origPomTime, targetPomFile.lastModified() );
-    }
-
-    @Test
-    public void testModifedArtifactFails()
-        throws Exception
-    {
-        // test that it fails when the source artifact has changed and is different to the existing artifact in the
-        // target repository
-
-        Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" );
-        Artifact pomArtifact = createPomArtifact( artifact );
-
-        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
-        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
-        assertTrue( "Check target file exists", targetFile.exists() );
-        assertTrue( "Check target POM exists", targetPomFile.exists() );
-
-        sourceFile.setLastModified( System.currentTimeMillis() );
-        sourcePomFile.setLastModified( System.currentTimeMillis() );
-
-        long origTime = targetFile.lastModified();
-        long origPomTime = targetPomFile.lastModified();
-
-        // Need to guarantee last modified is not equal
-        Thread.sleep( SLEEP_MILLIS );
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        assertHasWarningReason( artifactConverter, Messages.getString( "failure.target.already.exists" ) );
-
-        assertEquals( "Check unmodified", origTime, targetFile.lastModified() );
-        assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertFalse( "Check metadata not created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testForcedUnmodifiedArtifact()
-        throws Exception
-    {
-        // test unmodified artifact is still converted when set to force
-
-        artifactConverter =
-            applicationContext.getBean( "artifactConverter#force-repository-converter", ArtifactConverter.class );
-
-        Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" );
-        Artifact pomArtifact = createPomArtifact( artifact );
-
-        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
-        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
-        SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault() );
-        long origTime = dateFormat.parse( "2006-03-03" ).getTime();
-        targetFile.setLastModified( origTime );
-        targetPomFile.setLastModified( origTime );
-
-        sourceFile.setLastModified( dateFormat.parse( "2006-01-01" ).getTime() );
-        sourcePomFile.setLastModified( dateFormat.parse( "2006-02-02" ).getTime() );
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        compareFiles( sourceFile, targetFile );
-        compareFiles( sourcePomFile, targetPomFile );
-
-        assertFalse( "Check modified", origTime == targetFile.lastModified() );
-        assertFalse( "Check modified", origTime == targetPomFile.lastModified() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertTrue( "Check metadata created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testDryRunSuccess()
-        throws Exception
-    {
-        // test dry run does nothing on a run that will be successful, and returns success
-
-        artifactConverter =
-            applicationContext.getBean( "artifactConverter#dryrun-repository-converter", ArtifactConverter.class );
-
-        Artifact artifact = createArtifact( "test", "dryrun-artifact", "1.0.0" );
-        Artifact pomArtifact = createPomArtifact( artifact );
-
-        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
-        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
-        // clear warning before test related to MRM-1638
-        artifactConverter.clearWarnings();
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        assertTrue( "Check source file exists", sourceFile.exists() );
-        assertTrue( "Check source POM exists", sourcePomFile.exists() );
-
-        assertFalse( "Check target file doesn't exist", targetFile.exists() );
-        assertFalse( "Check target POM doesn't exist", targetPomFile.exists() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertFalse( "Check metadata not created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testDryRunFailure()
-        throws Exception
-    {
-        // test dry run does nothing on a run that will fail, and returns failure
-
-        artifactConverter =
-            applicationContext.getBean( "artifactConverter#dryrun-repository-converter", ArtifactConverter.class );
-
-        Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" );
-        Artifact pomArtifact = createPomArtifact( artifact );
-
-        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
-        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
-        assertTrue( "Check target file exists", targetFile.exists() );
-        assertTrue( "Check target POM exists", targetPomFile.exists() );
-
-        sourceFile.setLastModified( System.currentTimeMillis() );
-        sourcePomFile.setLastModified( System.currentTimeMillis() );
-
-        long origTime = targetFile.lastModified();
-        long origPomTime = targetPomFile.lastModified();
-
-        // Need to guarantee last modified is not equal
-        Thread.sleep( SLEEP_MILLIS );
-
-        // clear warning before test related to MRM-1638
-        artifactConverter.clearWarnings();
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        assertHasWarningReason( artifactConverter, Messages.getString( "failure.target.already.exists" ) );
-
-        assertEquals( "Check unmodified", origTime, targetFile.lastModified() );
-        assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertFalse( "Check metadata not created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testRollbackArtifactCreated()
-        throws Exception
-    {
-        // test rollback can remove a created artifact, including checksums
-
-        Artifact artifact = createArtifact( "test", "rollback-created-artifact", "1.0.0" );
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        FileUtils.deleteDirectory( artifactMetadataFile.getParentFile() );
-
-        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
-        File versionMetadataFile = new File( targetRepository.getBasedir(),
-                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        boolean found = false;
-        String pattern = "^" + Messages.getString( "invalid.source.pom" ).replaceFirst( "\\{0\\}", ".*" ) + "$";
-        for ( List<String> messages : artifactConverter.getWarnings().values() )
-        {
-            for ( String message : messages )
-            {
-                if ( message.matches( pattern ) )
-                {
-                    found = true;
-                    break;
-                }
-            }
-
-            if ( found )
-            {
-                break;
-            }
-        }
-
-        assertTrue( "Check failure message.", found );
-
-        assertFalse( "check artifact rolled back", artifactFile.exists() );
-        assertFalse( "check metadata rolled back", artifactMetadataFile.exists() );
-        assertFalse( "check metadata rolled back", versionMetadataFile.exists() );
-    }
-
-    @Test
-    public void testMultipleArtifacts()
-        throws Exception
-    {
-        // test multiple artifacts are converted
-
-        List<Artifact> artifacts = new ArrayList<>();
-        artifacts.add( createArtifact( "test", "artifact-one", "1.0.0" ) );
-        artifacts.add( createArtifact( "test", "artifact-two", "1.0.0" ) );
-        artifacts.add( createArtifact( "test", "artifact-three", "1.0.0" ) );
-
-        for ( Artifact artifact : artifacts )
-        {
-            artifactConverter.convert( artifact, targetRepository );
-            checkSuccess( artifactConverter );
-        }
-
-        for ( Artifact artifact : artifacts )
-        {
-            File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-            assertTrue( "Check artifact created", artifactFile.exists() );
-            assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-            artifact = createPomArtifact( artifact );
-            File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-            File expectedPomFile =
-                getTestFile( "src/test/expected-files/converted-" + artifact.getArtifactId() + ".pom" );
-            assertTrue( "Check POM created", pomFile.exists() );
-
-            compareFiles( expectedPomFile, pomFile );
-        }
-    }
-
-    @Test
-    public void testInvalidSourceArtifactMetadata()
-        throws Exception
-    {
-        // test artifact is not converted when source metadata is invalid, and returns failure
-
-        createModernSourceRepository();
-
-        Artifact artifact = createArtifact( "test", "incorrectArtifactMetadata", "1.0.0" );
-        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        file.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        assertHasWarningReason( artifactConverter,
-                                Messages.getString( "failure.incorrect.artifactMetadata.versions" ) );
-
-        assertFalse( "Check artifact not created", file.exists() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertFalse( "Check metadata not created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testInvalidSourceSnapshotMetadata()
-        throws Exception
-    {
-        // test artifact is not converted when source snapshot metadata is invalid and returns failure
-
-        createModernSourceRepository();
-
-        Artifact artifact = createArtifact( "test", "incorrectSnapshotMetadata", "1.0.0-20060102.030405-6" );
-        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        file.delete();
-
-        artifactConverter.convert( artifact, targetRepository );
-        checkWarnings( artifactConverter, 2 );
-
-        assertHasWarningReason( artifactConverter,
-                                Messages.getString( "failure.incorrect.snapshotMetadata.snapshot" ) );
-
-        assertFalse( "Check artifact not created", file.exists() );
-
-        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
-        File metadataFile =
-            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
-        assertFalse( "Check metadata not created", metadataFile.exists() );
-    }
-
-    @Test
-    public void testMergeArtifactMetadata()
-        throws Exception
-    {
-        // test artifact level metadata is merged when it already exists on successful conversion
-
-        Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" );
-        artifactConverter.convert( artifact, targetRepository );
-        checkSuccess( artifactConverter );
-
-        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        assertTrue( "Check artifact created", artifactFile.exists() );
-        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
-
-        artifact = createPomArtifact( artifact );
-        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-        assertTrue( "Check POM created", pomFile.exists() );
-
-        compareFiles( sourcePomFile, pomFile );
-
-        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
-        File artifactMetadataFile = new File( targetRepository.getBasedir(),
-                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
-        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
-
-        File expectedMetadataFile = getTestFile( "src/test/expected-files/newversion-artifact-metadata.xml" );
-
-        compareFiles( expectedMetadataFile, artifactMetadataFile );
-    }
-
-    @Test
-    public void testSourceAndTargetRepositoriesMatch()
-        throws Exception
-    {
-        // test that it fails if the same
-
-        ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
-
-        sourceRepository =
-            factory.createArtifactRepository( "source", targetRepository.getUrl(), targetRepository.getLayout(), null,
-                                              null );
-
-        Artifact artifact = createArtifact( "test", "repository-artifact", "1.0" );
-
-        try
-        {
-            artifactConverter.convert( artifact, targetRepository );
-            fail( "Should have failed trying to convert within the same repository" );
-        }
-        catch ( ArtifactConversionException e )
-        {
-            // expected
-            assertEquals( "check message", Messages.getString( "exception.repositories.match" ), e.getMessage() );
-            assertNull( "Check no additional cause", e.getCause() );
-        }
-    }
-
-    private Artifact createArtifact( String groupId, String artifactId, String version )
-    {
-        Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( version );
-        String baseVersion;
-        if ( matcher.matches() )
-        {
-            baseVersion = matcher.group( 1 ) + "-SNAPSHOT";
-        }
-        else
-        {
-            baseVersion = version;
-        }
-        return createArtifact( groupId, artifactId, baseVersion, version, "jar" );
-    }
-
-    private Artifact createArtifact( String groupId, String artifactId, String baseVersion, String version,
-                                     String type )
-    {
-        Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, null, type );
-        artifact.setBaseVersion( baseVersion );
-        artifact.setRepository( sourceRepository );
-        artifact.setFile( new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ) );
-        return artifact;
-    }
-
-    private Artifact createPomArtifact( Artifact artifact )
-    {
-        return createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(),
-                               artifact.getVersion(), "pom" );
-    }
-
-    private static void compareFiles( File expectedPomFile, File pomFile )
-        throws IOException
-    {
-        String expectedContent = normalizeString(
-            org.apache.commons.io.FileUtils.readFileToString( expectedPomFile, Charset.defaultCharset() ) );
-        String targetContent =
-            normalizeString( org.apache.commons.io.FileUtils.readFileToString( pomFile, Charset.defaultCharset() ) );
-        assertEquals( "Check file match between " + expectedPomFile + " and " + pomFile, expectedContent,
-                      targetContent );
-    }
-
-    private static String normalizeString( String path )
-    {
-        return path.trim().replaceAll( "\r\n", "\n" ).replace( '\r', '\n' ).replaceAll( "<\\?xml .+\\?>",
-                                                                                        "" ).replaceAll( "^\\s+", "" );
-    }
-
-    private void checkSuccess( ArtifactConverter converter )
-    {
-        assertNotNull( "Warnings should never be null.", converter.getWarnings() );
-        assertEquals( "Should have no warnings. " + converter.getWarnings(), 0, countWarningMessages( converter ) );
-    }
-
-    private void checkWarnings( ArtifactConverter converter, int count )
-    {
-        assertNotNull( "Warnings should never be null.", converter.getWarnings() );
-        assertEquals( "Should have some warnings.", count, countWarningMessages( converter ) );
-    }
-
-    private int countWarningMessages( ArtifactConverter converter )
-    {
-        int count = 0;
-        for ( List<String> values : converter.getWarnings().values() )
-        {
-            count += values.size();
-        }
-        return count;
-    }
-
-    private void assertHasWarningReason( ArtifactConverter converter, String reason )
-    {
-        assertNotNull( "Warnings should never be null.", converter.getWarnings() );
-        assertTrue( "Expecting 1 or more Warnings", countWarningMessages( converter ) > 0 );
-
-        for ( List<String> messages : converter.getWarnings().values() )
-        {
-            if ( messages.contains( reason ) )
-            {
-                /* No need to check any further */
-                return;
-            }
-        }
-
-        /* didn't find it. */
-
-        for ( Map.Entry<Artifact, List<String>> entry : converter.getWarnings().entrySet() )
-        {
-            Artifact artifact = (Artifact) entry.getKey();
-            System.out.println(
-                "-Artifact: " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() );
-            List<String> messages = entry.getValue();
-            for ( String message : messages )
-            {
-                System.out.println( "  " + message );
-            }
-        }
-        fail( "Unable to find message <" + reason + "> in warnings." );
-    }
-
-    private void createModernSourceRepository()
-        throws Exception
-    {
-        ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
-
-        ArtifactRepositoryLayout layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
-
-        File sourceBase = getTestFile( "src/test/source-modern-repository" );
-        sourceRepository =
-            factory.createArtifactRepository( "source", sourceBase.toURL().toString(), layout, null, null );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/resources/spring-context.xml
deleted file mode 100644 (file)
index 4d89642..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-  ~ 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.
-  -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-           http://www.springframework.org/schema/context 
-           http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
-  <bean name="artifactConverter#force-repository-converter" class="org.apache.archiva.converter.artifact.LegacyToDefaultConverter">
-    <property name="force" value="true"/>
-    <property name="dryrun" value="false"/>
-  </bean>
-
-  <bean name="artifactConverter#dryrun-repository-converter" class="org.apache.archiva.converter.artifact.LegacyToDefaultConverter">
-    <property name="force" value="false"/>
-    <property name="dryrun" value="true"/>
-  </bean>
-
-</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar
deleted file mode 100644 (file)
index 72af4bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-incorrectMd5
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom
deleted file mode 100644 (file)
index b64e1d0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>incorrectArtifactMetadata</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml
deleted file mode 100644 (file)
index b393bcd..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>incorrectArtifactMetadata</artifactId>
-  <versioning>
-    <versions>
-      <version>0.9</version>
-    </versions>
-  </versioning>
-</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar
deleted file mode 100644 (file)
index 72af4bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-incorrectMd5
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom
deleted file mode 100644 (file)
index 929190a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>incorrectSnapshotMetadata</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0-20060102.030405-6</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml
deleted file mode 100644 (file)
index 5980278..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>incorrectSnapshotMetadata</artifactId>
-  <version>1.0.0-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <buildNumber>10</buildNumber>
-      <timestamp>20060102.040506</timestamp>
-    </snapshot>
-  </versioning>
-</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml
deleted file mode 100644 (file)
index 3f9a0ce..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>incorrectSnapshotMetadata</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0-SNAPSHOT</version>
-    </versions>
-  </versioning>
-</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar
deleted file mode 100644 (file)
index 5626abf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-one
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar
deleted file mode 100644 (file)
index 2bdf67a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-three
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar
deleted file mode 100644 (file)
index f719efd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-two
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar
deleted file mode 100644 (file)
index cbaf024..0000000
+++ /dev/null
@@ -1 +0,0 @@
-existing
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar
deleted file mode 100644 (file)
index cbaf024..0000000
+++ /dev/null
@@ -1 +0,0 @@
-existing
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar
deleted file mode 100644 (file)
index 72af4bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-incorrectMd5
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5
deleted file mode 100644 (file)
index 316d9a4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-379dcfcd1e6312cc859111f696047eb4
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar
deleted file mode 100644 (file)
index f5812f3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-incorrectSha1
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1
deleted file mode 100644 (file)
index cce322e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-52e07b82d944741f66bba5896d4cd74e9879e289
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar
deleted file mode 100644 (file)
index 2e09960..0000000
+++ /dev/null
@@ -1 +0,0 @@
-modified
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar
deleted file mode 100644 (file)
index c694117..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v4
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar
deleted file mode 100644 (file)
index 3d27acd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-noPom
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar
deleted file mode 100644 (file)
index 27597bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unmodified
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar
deleted file mode 100644 (file)
index 29ef827..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v3
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar
deleted file mode 100644 (file)
index c694117..0000000
+++ /dev/null
@@ -1 +0,0 @@
-v4
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5 b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5
deleted file mode 100644 (file)
index 1930bc6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-4289bbdd6fba75013b317b2f9a540736 *v4artifact-1.0.0.jar
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1 b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1
deleted file mode 100644 (file)
index 466f209..0000000
+++ /dev/null
@@ -1 +0,0 @@
-e3e4159da65a4257f0bffb7cac8e3e78241a4dca *v4artifact-1.0.0.jar
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar
deleted file mode 100644 (file)
index 5626abf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-one
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom
deleted file mode 100644 (file)
index cd3862d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>artifact-one</artifactId>
-  <version>1.0.0</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom
deleted file mode 100644 (file)
index 3432910..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>artifact-three</artifactId>
-  <version>1.0.0</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom
deleted file mode 100644 (file)
index 2274701..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>artifact-two</artifactId>
-  <version>1.0.0</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom
deleted file mode 100644 (file)
index 1953c55..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>dryrun-artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom
deleted file mode 100644 (file)
index 74d5e12..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>incorrectMd5Artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom
deleted file mode 100644 (file)
index fe3c7fd..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>incorrectSha1Artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/maven-foo-plugin-1.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/maven-foo-plugin-1.0.pom
deleted file mode 100644 (file)
index a5a02c4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>maven-foo-plugin</artifactId>
-  <groupId>org.apache.maven.plugins</groupId>
-  <currentVersion>1.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom
deleted file mode 100644 (file)
index fcfdaac..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>modified-artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom
deleted file mode 100644 (file)
index f441c9a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>newversoin-artifact</artifactId>
-  <version>1.0.1</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom
deleted file mode 100644 (file)
index ab112a2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>relocated-v3artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <properties>
-        <scope>test</scope>
-      </properties>
-    </dependency>
-  </dependencies>
-  <repository>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </repository>
-  <properties>
-    <relocated.groupId>relocated-test</relocated.groupId>
-  </properties>
-</project>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom
deleted file mode 100644 (file)
index 00692be..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>v3artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <properties>
-        <scope>test</scope>
-      </properties>
-    </dependency>
-  </dependencies>
-  <!-- deliberate parse error -->
-  <repository>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom
deleted file mode 100644 (file)
index a8428a8..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>unmodified-artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom
deleted file mode 100644 (file)
index 5f347f3..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <pomVersion>3</pomVersion>
-  <extend>../project.xml</extend>
-  <artifactId>v3-warnings-artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-  <versions>
-    <version>
-      <id>1.0</id>
-      <name>1.0</name>
-      <tag>1_0</tag>
-    </version>
-  </versions>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <properties>
-        <scope>test</scope>
-      </properties>
-    </dependency>
-  </dependencies>
-  <repository>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </repository>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom
deleted file mode 100644 (file)
index d7ae895..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>v3artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0-20060105.130101-3</currentVersion>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <properties>
-        <scope>test</scope>
-      </properties>
-    </dependency>
-  </dependencies>
-  <repository>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </repository>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom
deleted file mode 100644 (file)
index 3958a33..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>v3artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0-SNAPSHOT</currentVersion>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <properties>
-        <scope>test</scope>
-      </properties>
-    </dependency>
-  </dependencies>
-  <repository>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </repository>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom
deleted file mode 100644 (file)
index 5aed343..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<project>
-  <pomVersion>3</pomVersion>
-  <artifactId>v3artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-  <dependencies>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>artifactId</artifactId>
-      <version>version</version>
-    </dependency>
-    <dependency>
-      <groupId>groupId</groupId>
-      <artifactId>test-artifactId</artifactId>
-      <version>version</version>
-      <properties>
-        <scope>test</scope>
-      </properties>
-    </dependency>
-  </dependencies>
-  <repository>
-    <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
-  </repository>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom
deleted file mode 100644 (file)
index e4f3656..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <version>1.0.0-20060111.120115-1</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom
deleted file mode 100644 (file)
index be5b8b7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-  ~ Copyright 2005-2006 The Apache Software Foundation.
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <version>1.0.0-SNAPSHOT</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom
deleted file mode 100644 (file)
index fa6e82b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>test</groupId>
-  <artifactId>v4artifact</artifactId>
-  <version>1.0.0</version>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar
deleted file mode 100644 (file)
index 27597bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unmodified
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom
deleted file mode 100644 (file)
index d23afd0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>modified-artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar
deleted file mode 100644 (file)
index 27597bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unmodified
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom
deleted file mode 100644 (file)
index e21492e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>newversion-artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml
deleted file mode 100644 (file)
index 42537e4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>test</groupId>
-  <artifactId>newversion-artifact</artifactId>
-  <versioning>
-    <versions>
-      <version>1.0.0</version>
-    </versions>
-  </versioning>
-</metadata>
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar
deleted file mode 100644 (file)
index 27597bc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unmodified
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom
deleted file mode 100644 (file)
index a8428a8..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>unmodified-artifact</artifactId>
-  <groupId>test</groupId>
-  <currentVersion>1.0.0</currentVersion>
-</project>
index b9871de339f36f74015472ee98a7110dc240f1b1..99d8bc81904dbb11314101d2a73a10f5a72a0c1c 100644 (file)
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-artifact-converter</artifactId>
+      <artifactId>archiva-transaction</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-model-converter</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConversionException.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConversionException.java
new file mode 100644 (file)
index 0000000..0fe5dff
--- /dev/null
@@ -0,0 +1,49 @@
+package org.apache.archiva.converter.artifact;
+
+/*
+ * 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.
+ */
+
+/**
+ * ArtifactConversionException 
+ *
+ *
+ */
+public class ArtifactConversionException
+    extends Exception
+{
+
+    public ArtifactConversionException()
+    {
+    }
+
+    public ArtifactConversionException( String message )
+    {
+        super( message );
+    }
+
+    public ArtifactConversionException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ArtifactConversionException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/ArtifactConverter.java
new file mode 100644 (file)
index 0000000..842f01e
--- /dev/null
@@ -0,0 +1,56 @@
+package org.apache.archiva.converter.artifact;
+
+/*
+ * 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.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ArtifactConverter 
+ *
+ *
+ */
+public interface ArtifactConverter
+{
+    /**
+     * Convert an provided artifact, and place it into the destination repository.
+     * 
+     * @param artifact the artifact to convert.
+     * @param destinationRepository the respository to send the artifact to.
+     * @throws ArtifactConversionException 
+     */
+    void convert( Artifact artifact, ArtifactRepository destinationRepository )
+        throws ArtifactConversionException;
+
+    /**
+     * Get the map of accumulated warnings for the conversion.
+     * 
+     * @return the {@link Map}&lt;{@link Artifact}, {@link String}&gt; warning messages.
+     */
+    Map<Artifact, List<String>> getWarnings();
+
+    /**
+     * Clear the list of warning messages.
+     */
+    void clearWarnings();
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyRepositoryLayout.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyRepositoryLayout.java
new file mode 100644 (file)
index 0000000..3101236
--- /dev/null
@@ -0,0 +1,88 @@
+package org.apache.archiva.converter.artifact;
+/*
+ * 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.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+
+/**
+ * @author jdcasey
+ */
+public class LegacyRepositoryLayout
+    implements ArtifactRepositoryLayout
+{
+
+    private static final String PATH_SEPARATOR = "/";
+
+    public String getId()
+    {
+        return "legacy";
+    }
+
+    @Override
+    public String pathOf( Artifact artifact )
+    {
+        ArtifactHandler artifactHandler = artifact.getArtifactHandler();
+
+        StringBuilder path = new StringBuilder( 128 );
+
+        path.append( artifact.getGroupId() ).append( '/' );
+        path.append( artifactHandler.getDirectory() ).append( '/' );
+        path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
+
+        if ( artifact.hasClassifier() )
+        {
+            path.append( '-' ).append( artifact.getClassifier() );
+        }
+
+        if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
+        {
+            path.append( '.' ).append( artifactHandler.getExtension() );
+        }
+
+        return path.toString();
+    }
+
+    @Override
+    public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+    {
+        return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
+    }
+
+    private String pathOfRepositoryMetadata( ArtifactMetadata metadata, String filename )
+    {
+        StringBuilder path = new StringBuilder( 128 );
+
+        path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR );
+
+        path.append( filename );
+
+        return path.toString();
+    }
+
+    @Override
+    public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
+    {
+        return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
+    }
+
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverter.java
new file mode 100644 (file)
index 0000000..ba8bf27
--- /dev/null
@@ -0,0 +1,742 @@
+package org.apache.archiva.converter.artifact;
+
+/*
+ * 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.archiva.common.plexusbridge.DigesterUtils;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
+import org.apache.archiva.transaction.FileTransaction;
+import org.apache.archiva.transaction.TransactionException;
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Snapshot;
+import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Relocation;
+import org.apache.maven.model.converter.ModelConverter;
+import org.apache.maven.model.converter.PomTranslationException;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.codehaus.plexus.digest.Digester;
+import org.codehaus.plexus.digest.DigesterException;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+
+/**
+ * LegacyToDefaultConverter
+ */
+@Service("artifactConverter#legacy-to-default")
+public class LegacyToDefaultConverter
+    implements ArtifactConverter
+{
+    /**
+     * {@link List}&lt;{@link Digester}
+     */
+    private List<? extends Digester> digesters;
+
+    @Inject
+    private PlexusSisuBridge plexusSisuBridge;
+
+    @Inject
+    private DigesterUtils digesterUtils;
+
+    private ModelConverter translator;
+
+    private ArtifactFactory artifactFactory;
+
+    private ArtifactHandlerManager artifactHandlerManager;
+
+    private boolean force;
+
+    private boolean dryrun;
+
+    private Map<Artifact, List<String>> warnings = new HashMap<>();
+
+    @PostConstruct
+    public void initialize()
+        throws PlexusSisuBridgeException
+    {
+        this.digesters = digesterUtils.getAllDigesters();
+        translator = plexusSisuBridge.lookup( ModelConverter.class );
+        artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class );
+        artifactHandlerManager = plexusSisuBridge.lookup( ArtifactHandlerManager.class );
+    }
+
+    @Override
+    public void convert( Artifact artifact, ArtifactRepository targetRepository )
+        throws ArtifactConversionException
+    {
+        if ( artifact.getRepository().getUrl().equals( targetRepository.getUrl() ) )
+        {
+            throw new ArtifactConversionException( Messages.getString( "exception.repositories.match" ) ); //$NON-NLS-1$
+        }
+
+        if ( !validateMetadata( artifact ) )
+        {
+            addWarning( artifact, Messages.getString( "unable.to.validate.metadata" ) ); //$NON-NLS-1$
+            return;
+        }
+
+        FileTransaction transaction = new FileTransaction();
+
+        if ( !copyPom( artifact, targetRepository, transaction ) )
+        {
+            addWarning( artifact, Messages.getString( "unable.to.copy.pom" ) ); //$NON-NLS-1$
+            return;
+        }
+
+        if ( !copyArtifact( artifact, targetRepository, transaction ) )
+        {
+            addWarning( artifact, Messages.getString( "unable.to.copy.artifact" ) ); //$NON-NLS-1$
+            return;
+        }
+
+        Metadata metadata = createBaseMetadata( artifact );
+        Versioning versioning = new Versioning();
+        versioning.addVersion( artifact.getBaseVersion() );
+        metadata.setVersioning( versioning );
+        updateMetadata( new ArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction );
+
+        metadata = createBaseMetadata( artifact );
+        metadata.setVersion( artifact.getBaseVersion() );
+        versioning = new Versioning();
+
+        Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
+        if ( matcher.matches() )
+        {
+            Snapshot snapshot = new Snapshot();
+            snapshot.setBuildNumber( Integer.parseInt( matcher.group( 3 ) ) );
+            snapshot.setTimestamp( matcher.group( 2 ) );
+            versioning.setSnapshot( snapshot );
+        }
+
+        // TODO: merge latest/release/snapshot from source instead
+        metadata.setVersioning( versioning );
+        updateMetadata( new SnapshotArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction );
+
+        if ( !dryrun )
+        {
+            try
+            {
+                transaction.commit();
+            }
+            catch ( TransactionException e )
+            {
+                throw new ArtifactConversionException( Messages.getString( "transaction.failure", e.getMessage() ),
+                                                       e ); //$NON-NLS-1$
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private boolean copyPom( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
+        throws ArtifactConversionException
+    {
+        Artifact pom = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
+                                                              artifact.getVersion() );
+        pom.setBaseVersion( artifact.getBaseVersion() );
+        ArtifactRepository repository = artifact.getRepository();
+        File file = new File( repository.getBasedir(), repository.pathOf( pom ) );
+
+        boolean result = true;
+        if ( file.exists() )
+        {
+            File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pom ) );
+
+            String contents = null;
+            boolean checksumsValid = false;
+            try
+            {
+                if ( testChecksums( artifact, file ) )
+                {
+                    checksumsValid = true;
+                }
+
+                // Even if the checksums for the POM are invalid we should still convert the POM
+                contents = FileUtils.readFileToString( file, Charset.defaultCharset() );
+            }
+            catch ( IOException e )
+            {
+                throw new ArtifactConversionException(
+                    Messages.getString( "unable.to.read.source.pom", e.getMessage() ), e ); //$NON-NLS-1$
+            }
+
+            if ( checksumsValid && contents.indexOf( "modelVersion" ) >= 0 ) //$NON-NLS-1$
+            {
+                // v4 POM
+                try
+                {
+                    boolean matching = false;
+                    if ( !force && targetFile.exists() )
+                    {
+                        String targetContents = FileUtils.readFileToString( targetFile, Charset.defaultCharset() );
+                        matching = targetContents.equals( contents );
+                    }
+                    if ( force || !matching )
+                    {
+                        transaction.createFile( contents, targetFile, digesters );
+                    }
+                }
+                catch ( IOException e )
+                {
+                    throw new ArtifactConversionException(
+                        Messages.getString( "unable.to.write.target.pom", e.getMessage() ), e ); //$NON-NLS-1$
+                }
+            }
+            else
+            {
+                // v3 POM
+                try (StringReader stringReader = new StringReader( contents ))
+                {
+
+                    try (StringWriter writer = new StringWriter())
+                    {
+                        org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader v3Reader =
+                            new org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader();
+                        org.apache.maven.model.v3_0_0.Model v3Model = v3Reader.read( stringReader );
+
+                        if ( doRelocation( artifact, v3Model, targetRepository, transaction ) )
+                        {
+                            Artifact relocatedPom =
+                                artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
+                                                                       artifact.getVersion() );
+                            targetFile =
+                                new File( targetRepository.getBasedir(), targetRepository.pathOf( relocatedPom ) );
+                        }
+
+                        Model v4Model = translator.translate( v3Model );
+
+                        translator.validateV4Basics( v4Model, v3Model.getGroupId(), v3Model.getArtifactId(),
+                                                     v3Model.getVersion(), v3Model.getPackage() );
+
+                        MavenXpp3Writer xpp3Writer = new MavenXpp3Writer();
+                        xpp3Writer.write( writer, v4Model );
+
+                        transaction.createFile( writer.toString(), targetFile, digesters );
+
+                        List<String> warnings = translator.getWarnings();
+
+                        for ( String message : warnings )
+                        {
+                            addWarning( artifact, message );
+                        }
+                    }
+                    catch ( XmlPullParserException e )
+                    {
+                        addWarning( artifact,
+                                    Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$
+                        result = false;
+                    }
+                    catch ( IOException e )
+                    {
+                        throw new ArtifactConversionException( Messages.getString( "unable.to.write.converted.pom" ),
+                                                               e ); //$NON-NLS-1$
+                    }
+                    catch ( PomTranslationException e )
+                    {
+                        addWarning( artifact,
+                                    Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$
+                        result = false;
+                    }
+                }
+            }
+        }
+        else
+        {
+            addWarning( artifact, Messages.getString( "warning.missing.pom" ) ); //$NON-NLS-1$
+        }
+        return result;
+    }
+
+    private boolean testChecksums( Artifact artifact, File file )
+        throws IOException
+    {
+        boolean result = true;
+        for ( Digester digester : digesters )
+        {
+            result &= verifyChecksum( file, file.getName() + "." + getDigesterFileExtension( digester ), digester,
+                                      //$NON-NLS-1$
+                                      artifact,
+                                      "failure.incorrect." + getDigesterFileExtension( digester ) ); //$NON-NLS-1$
+        }
+        return result;
+    }
+
+    private boolean verifyChecksum( File file, String fileName, Digester digester, Artifact artifact, String key )
+        throws IOException
+    {
+        boolean result = true;
+
+        File checksumFile = new File( file.getParentFile(), fileName );
+        if ( checksumFile.exists() )
+        {
+            String checksum = FileUtils.readFileToString( checksumFile, Charset.defaultCharset() );
+            try
+            {
+                digester.verify( file, checksum );
+            }
+            catch ( DigesterException e )
+            {
+                addWarning( artifact, Messages.getString( key ) );
+                result = false;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * File extension for checksums
+     * TODO should be moved to plexus-digester ?
+     */
+    private String getDigesterFileExtension( Digester digester )
+    {
+        return digester.getAlgorithm().toLowerCase().replaceAll( "-", "" ); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    private boolean copyArtifact( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
+        throws ArtifactConversionException
+    {
+        File sourceFile = artifact.getFile();
+
+        if ( sourceFile.getAbsolutePath().indexOf( "/plugins/" ) > -1 ) //$NON-NLS-1$
+        {
+            artifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "maven-plugin" ) ); //$NON-NLS-1$
+        }
+
+        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+
+        boolean result = true;
+        try
+        {
+            boolean matching = false;
+            if ( !force && targetFile.exists() )
+            {
+                matching = FileUtils.contentEquals( sourceFile, targetFile );
+                if ( !matching )
+                {
+                    addWarning( artifact, Messages.getString( "failure.target.already.exists" ) ); //$NON-NLS-1$
+                    result = false;
+                }
+            }
+            if ( result )
+            {
+                if ( force || !matching )
+                {
+                    if ( testChecksums( artifact, sourceFile ) )
+                    {
+                        transaction.copyFile( sourceFile, targetFile, digesters );
+                    }
+                    else
+                    {
+                        result = false;
+                    }
+                }
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new ArtifactConversionException( Messages.getString( "error.copying.artifact" ), e ); //$NON-NLS-1$
+        }
+        return result;
+    }
+
+    private Metadata createBaseMetadata( Artifact artifact )
+    {
+        Metadata metadata = new Metadata();
+        metadata.setArtifactId( artifact.getArtifactId() );
+        metadata.setGroupId( artifact.getGroupId() );
+        return metadata;
+    }
+
+    private Metadata readMetadata( File file )
+        throws ArtifactConversionException
+    {
+        MetadataXpp3Reader reader = new MetadataXpp3Reader();
+
+        try (Reader fileReader = Files.newBufferedReader( file.toPath(), Charset.defaultCharset() ))
+        {
+            return reader.read( fileReader );
+        }
+        catch ( IOException | XmlPullParserException e )
+        {
+            throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ),
+                                                   e ); //$NON-NLS-1$
+        }
+    }
+
+    private boolean validateMetadata( Artifact artifact )
+        throws ArtifactConversionException
+    {
+        ArtifactRepository repository = artifact.getRepository();
+
+        boolean result = true;
+
+        RepositoryMetadata repositoryMetadata = new ArtifactRepositoryMetadata( artifact );
+        File file =
+            new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
+        if ( file.exists() )
+        {
+            Metadata metadata = readMetadata( file );
+            result = validateMetadata( metadata, repositoryMetadata, artifact );
+        }
+
+        repositoryMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        file = new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
+        if ( file.exists() )
+        {
+            Metadata metadata = readMetadata( file );
+            result = result && validateMetadata( metadata, repositoryMetadata, artifact );
+        }
+
+        return result;
+    }
+
+    @SuppressWarnings("unchecked")
+    private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact )
+    {
+        String groupIdKey;
+        String artifactIdKey = null;
+        String snapshotKey = null;
+        String versionKey = null;
+        String versionsKey = null;
+
+        if ( repositoryMetadata.storedInGroupDirectory() )
+        {
+            groupIdKey = "failure.incorrect.groupMetadata.groupId"; //$NON-NLS-1$
+        }
+        else if ( repositoryMetadata.storedInArtifactVersionDirectory() )
+        {
+            groupIdKey = "failure.incorrect.snapshotMetadata.groupId"; //$NON-NLS-1$
+            artifactIdKey = "failure.incorrect.snapshotMetadata.artifactId"; //$NON-NLS-1$
+            versionKey = "failure.incorrect.snapshotMetadata.version"; //$NON-NLS-1$
+            snapshotKey = "failure.incorrect.snapshotMetadata.snapshot"; //$NON-NLS-1$
+        }
+        else
+        {
+            groupIdKey = "failure.incorrect.artifactMetadata.groupId"; //$NON-NLS-1$
+            artifactIdKey = "failure.incorrect.artifactMetadata.artifactId"; //$NON-NLS-1$
+            versionsKey = "failure.incorrect.artifactMetadata.versions"; //$NON-NLS-1$
+        }
+
+        boolean result = true;
+
+        if ( metadata.getGroupId() == null || !metadata.getGroupId().equals( artifact.getGroupId() ) )
+        {
+            addWarning( artifact, Messages.getString( groupIdKey ) );
+            result = false;
+        }
+        if ( !repositoryMetadata.storedInGroupDirectory() )
+        {
+            if ( metadata.getGroupId() == null || !metadata.getArtifactId().equals( artifact.getArtifactId() ) )
+            {
+                addWarning( artifact, Messages.getString( artifactIdKey ) );
+                result = false;
+            }
+            if ( !repositoryMetadata.storedInArtifactVersionDirectory() )
+            {
+                // artifact metadata
+
+                boolean foundVersion = false;
+                if ( metadata.getVersioning() != null )
+                {
+                    for ( String version : (List<String>) metadata.getVersioning().getVersions() )
+                    {
+                        if ( version.equals( artifact.getBaseVersion() ) )
+                        {
+                            foundVersion = true;
+                            break;
+                        }
+                    }
+                }
+
+                if ( !foundVersion )
+                {
+                    addWarning( artifact, Messages.getString( versionsKey ) );
+                    result = false;
+                }
+            }
+            else
+            {
+                // snapshot metadata
+                if ( !artifact.getBaseVersion().equals( metadata.getVersion() ) )
+                {
+                    addWarning( artifact, Messages.getString( versionKey ) );
+                    result = false;
+                }
+
+                if ( artifact.isSnapshot() )
+                {
+                    Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
+                    if ( matcher.matches() )
+                    {
+                        boolean correct = false;
+                        if ( metadata.getVersioning() != null && metadata.getVersioning().getSnapshot() != null )
+                        {
+                            Snapshot snapshot = metadata.getVersioning().getSnapshot();
+                            int build = Integer.parseInt( matcher.group( 3 ) );
+                            String ts = matcher.group( 2 );
+                            if ( build == snapshot.getBuildNumber() && ts.equals( snapshot.getTimestamp() ) )
+                            {
+                                correct = true;
+                            }
+                        }
+
+                        if ( !correct )
+                        {
+                            addWarning( artifact, Messages.getString( snapshotKey ) );
+                            result = false;
+                        }
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    private void updateMetadata( RepositoryMetadata artifactMetadata, ArtifactRepository targetRepository,
+                                 Metadata newMetadata, FileTransaction transaction )
+        throws ArtifactConversionException
+    {
+        File file = new File( targetRepository.getBasedir(),
+                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+
+        Metadata metadata;
+        boolean changed;
+
+        if ( file.exists() )
+        {
+            metadata = readMetadata( file );
+            changed = metadata.merge( newMetadata );
+        }
+        else
+        {
+            changed = true;
+            metadata = newMetadata;
+        }
+
+        if ( changed )
+        {
+
+            try (StringWriter writer = new StringWriter())
+            {
+                MetadataXpp3Writer mappingWriter = new MetadataXpp3Writer();
+
+                mappingWriter.write( writer, metadata );
+
+                transaction.createFile( writer.toString(), file, digesters );
+            }
+            catch ( IOException e )
+            {
+                throw new ArtifactConversionException( Messages.getString( "error.writing.target.metadata" ),
+                                                       e ); //$NON-NLS-1$
+            }
+        }
+    }
+
+    private boolean doRelocation( Artifact artifact, org.apache.maven.model.v3_0_0.Model v3Model,
+                                  ArtifactRepository repository, FileTransaction transaction )
+        throws IOException
+    {
+        Properties properties = v3Model.getProperties();
+        if ( properties.containsKey( "relocated.groupId" ) || properties.containsKey( "relocated.artifactId" )
+            //$NON-NLS-1$ //$NON-NLS-2$
+            || properties.containsKey( "relocated.version" ) ) //$NON-NLS-1$
+        {
+            String newGroupId = properties.getProperty( "relocated.groupId", v3Model.getGroupId() ); //$NON-NLS-1$
+            properties.remove( "relocated.groupId" ); //$NON-NLS-1$
+
+            String newArtifactId =
+                properties.getProperty( "relocated.artifactId", v3Model.getArtifactId() ); //$NON-NLS-1$
+            properties.remove( "relocated.artifactId" ); //$NON-NLS-1$
+
+            String newVersion = properties.getProperty( "relocated.version", v3Model.getVersion() ); //$NON-NLS-1$
+            properties.remove( "relocated.version" ); //$NON-NLS-1$
+
+            String message = properties.getProperty( "relocated.message", "" ); //$NON-NLS-1$ //$NON-NLS-2$
+            properties.remove( "relocated.message" ); //$NON-NLS-1$
+
+            if ( properties.isEmpty() )
+            {
+                v3Model.setProperties( null );
+            }
+
+            writeRelocationPom( v3Model.getGroupId(), v3Model.getArtifactId(), v3Model.getVersion(), newGroupId,
+                                newArtifactId, newVersion, message, repository, transaction );
+
+            v3Model.setGroupId( newGroupId );
+            v3Model.setArtifactId( newArtifactId );
+            v3Model.setVersion( newVersion );
+
+            artifact.setGroupId( newGroupId );
+            artifact.setArtifactId( newArtifactId );
+            artifact.setVersion( newVersion );
+
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId,
+                                     String newArtifactId, String newVersion, String message,
+                                     ArtifactRepository repository, FileTransaction transaction )
+        throws IOException
+    {
+        Model pom = new Model();
+        pom.setGroupId( groupId );
+        pom.setArtifactId( artifactId );
+        pom.setVersion( version );
+
+        DistributionManagement dMngt = new DistributionManagement();
+
+        Relocation relocation = new Relocation();
+        relocation.setGroupId( newGroupId );
+        relocation.setArtifactId( newArtifactId );
+        relocation.setVersion( newVersion );
+        if ( message != null && message.length() > 0 )
+        {
+            relocation.setMessage( message );
+        }
+
+        dMngt.setRelocation( relocation );
+
+        pom.setDistributionManagement( dMngt );
+
+        Artifact artifact = artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" ); //$NON-NLS-1$
+        File pomFile = new File( repository.getBasedir(), repository.pathOf( artifact ) );
+
+        StringWriter strWriter = new StringWriter();
+        MavenXpp3Writer pomWriter = new MavenXpp3Writer();
+        pomWriter.write( strWriter, pom );
+
+        transaction.createFile( strWriter.toString(), pomFile, digesters );
+    }
+
+    private void addWarning( Artifact artifact, String message )
+    {
+        List<String> messages = warnings.get( artifact );
+        if ( messages == null )
+        {
+            messages = new ArrayList<>( 1 );
+        }
+        messages.add( message );
+        warnings.put( artifact, messages );
+    }
+
+    @Override
+    public void clearWarnings()
+    {
+        warnings.clear();
+    }
+
+    @Override
+    public Map<Artifact, List<String>> getWarnings()
+    {
+        return warnings;
+    }
+
+
+    public List<? extends Digester> getDigesters()
+    {
+        return digesters;
+    }
+
+    public void setDigesters( List<Digester> digesters )
+    {
+        this.digesters = digesters;
+    }
+
+    public ModelConverter getTranslator()
+    {
+        return translator;
+    }
+
+    public void setTranslator( ModelConverter translator )
+    {
+        this.translator = translator;
+    }
+
+    public ArtifactFactory getArtifactFactory()
+    {
+        return artifactFactory;
+    }
+
+    public void setArtifactFactory( ArtifactFactory artifactFactory )
+    {
+        this.artifactFactory = artifactFactory;
+    }
+
+    public ArtifactHandlerManager getArtifactHandlerManager()
+    {
+        return artifactHandlerManager;
+    }
+
+    public void setArtifactHandlerManager( ArtifactHandlerManager artifactHandlerManager )
+    {
+        this.artifactHandlerManager = artifactHandlerManager;
+    }
+
+    public boolean isForce()
+    {
+        return force;
+    }
+
+    public void setForce( boolean force )
+    {
+        this.force = force;
+    }
+
+    public boolean isDryrun()
+    {
+        return dryrun;
+    }
+
+    public void setDryrun( boolean dryrun )
+    {
+        this.dryrun = dryrun;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/Messages.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/artifact/Messages.java
new file mode 100644 (file)
index 0000000..0cec0fe
--- /dev/null
@@ -0,0 +1,71 @@
+package org.apache.archiva.converter.artifact;
+
+/*
+ * 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.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Messages 
+ *
+ *
+ */
+public class Messages
+{
+    private static final String BUNDLE_NAME = "org.apache.archiva.converter.artifact.messages"; //$NON-NLS-1$
+
+    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+    private Messages()
+    {
+        // no op
+    }
+
+    public static String getString( String key )
+    {
+        try
+        {
+            return RESOURCE_BUNDLE.getString( key );
+        }
+        catch ( MissingResourceException e )
+        {
+            return '!' + key + '!';
+        }
+    }
+    
+    public static String getString( String key, Object argument )
+    {
+        return getString( key, new Object[] { argument } );
+    }
+    
+    public static String getString( String key, Object arguments[] )
+    {
+        try
+        {
+            String pattern = RESOURCE_BUNDLE.getString( key );
+            return MessageFormat.format( pattern, arguments );
+        }
+        catch ( MissingResourceException e )
+        {
+            return '!' + key + '!';
+        }
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/archiva/converter/artifact/messages.properties b/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/archiva/converter/artifact/messages.properties
new file mode 100644 (file)
index 0000000..5e5bc6d
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+
+unable.to.validate.metadata=Unable to validate metadata
+unable.to.copy.pom=Unable to copy pom.
+unable.to.copy.artifact=Unable to copy artifact
+unable.to.read.source.pom=Unable to read source POM: {0} 
+unable.to.write.target.pom=Unable to write target POM: {0}
+unable.to.write.converted.pom=Unable to write converted POM
+
+
+exception.repositories.match=Source repository of artifact, and target repository are the same.  No conversion needed.
+transaction.failure=Transaction failure: {0} 
+invalid.source.pom=Invalid source pom: {0}
+
+warning.missing.pom=The artifact had no POM in the source repository.
+
+error.copying.artifact=Error copying artifact
+error.reading.target.metadata=Error reading target metadata
+error.writing.target.metadata=Error writing target metadata
+
+failure.target.already.exists=The artifact could not be converted because it already exists.
+failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect.
+
+failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect.
+failure.incorrect.artifactMetadata.groupId=The group ID in the source artifact metadata is incorrect.
+failure.incorrect.artifactMetadata.versions=The version list in the source artifact metadata is incorrect.
+
+failure.incorrect.snapshotMetadata.artifactId=The artifact ID in the source artifact version metadata is incorrect.
+failure.incorrect.snapshotMetadata.groupId=The group ID in the source artifact version metadata is incorrect.
+failure.incorrect.snapshotMetadata.version=The version in the source artifact version metadata is incorrect.
+failure.incorrect.snapshotMetadata.snapshot=The snapshot information in the source artifact version metadata is incorrect.
+
+failure.incorrect.md5=The MD5 checksum value was incorrect.
+failure.incorrect.sha1=The SHA1 checksum value was incorrect.
diff --git a/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java b/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java
new file mode 100644 (file)
index 0000000..a737e84
--- /dev/null
@@ -0,0 +1,1064 @@
+package org.apache.archiva.converter.artifact;
+
+/*
+ * 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.TestCase;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.utils.FileUtil;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Matcher;
+
+/**
+ * LegacyToDefaultConverterTest
+ */
+@RunWith (ArchivaSpringJUnit4ClassRunner.class)
+@ContextConfiguration (locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
+public class LegacyToDefaultConverterTest
+    extends TestCase
+{
+    private ArtifactRepository sourceRepository;
+
+    private ArtifactRepository targetRepository;
+
+    private ArtifactConverter artifactConverter;
+
+    private ArtifactFactory artifactFactory;
+
+    @Inject
+    private PlexusSisuBridge plexusSisuBridge;
+
+    @Inject
+    private ApplicationContext applicationContext;
+
+    private static final int SLEEP_MILLIS = 100;
+
+    @Before
+    public void init()
+        throws Exception
+    {
+        super.setUp();
+
+        ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
+
+        Map<String, ArtifactRepositoryLayout> layoutsMap = plexusSisuBridge.lookupMap( ArtifactRepositoryLayout.class );
+
+        System.out.println( "hints " + layoutsMap.keySet().toString() );
+
+        ArtifactRepositoryLayout layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "legacy" );
+
+        File sourceBase = getTestFile( "src/test/source-repository" );
+        sourceRepository =
+            factory.createArtifactRepository( "source", sourceBase.toURL().toString(), layout, null, null );
+
+        layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
+
+        File targetBase = getTestFile( "target/test-target-repository" );
+        copyDirectoryStructure( getTestFile( "src/test/target-repository" ), targetBase );
+
+        targetRepository =
+            factory.createArtifactRepository( "target", targetBase.toURL().toString(), layout, null, null );
+
+        artifactConverter =
+            applicationContext.getBean( "artifactConverter#legacy-to-default", ArtifactConverter.class );
+
+        artifactConverter.clearWarnings();
+        artifactFactory = (ArtifactFactory) plexusSisuBridge.lookup( ArtifactFactory.class );
+    }
+
+    public static File getTestFile( String path )
+    {
+        return new File( FileUtil.getBasedir(), path );
+    }
+
+    private void copyDirectoryStructure( File sourceDirectory, File destinationDirectory )
+        throws IOException
+    {
+        if ( !sourceDirectory.exists() )
+        {
+            throw new IOException( "Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ")." );
+        }
+
+        File[] files = sourceDirectory.listFiles();
+
+        String sourcePath = sourceDirectory.getAbsolutePath();
+
+        for ( int i = 0; i < files.length; i++ )
+        {
+            File file = files[i];
+
+            String dest = file.getAbsolutePath();
+
+            dest = dest.substring( sourcePath.length() + 1 );
+
+            File destination = new File( destinationDirectory, dest );
+
+            if ( file.isFile() )
+            {
+                destination = destination.getParentFile();
+
+                FileUtils.copyFileToDirectory( file, destination );
+            }
+            else if ( file.isDirectory() )
+            {
+                if ( !".svn".equals( file.getName() ) )
+                {
+                    if ( !destination.exists() && !destination.mkdirs() )
+                    {
+                        throw new IOException(
+                            "Could not create destination directory '" + destination.getAbsolutePath() + "'." );
+                    }
+                    copyDirectoryStructure( file, destination );
+                }
+            }
+            else
+            {
+                throw new IOException( "Unknown file type: " + file.getAbsolutePath() );
+            }
+        }
+    }
+
+    @Test
+    public void testV4PomConvert()
+        throws Exception
+    {
+        // test that it is copied as is
+
+        Artifact artifact = createArtifact( "test", "v4artifact", "1.0.0" );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        artifactMetadataFile.delete();
+
+        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File versionMetadataFile = new File( targetRepository.getBasedir(),
+                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
+        versionMetadataFile.delete();
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        artifactFile.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        assertTrue( "Check POM created", pomFile.exists() );
+
+        compareFiles( sourcePomFile, pomFile );
+
+        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
+
+        File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-artifact-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, artifactMetadataFile );
+
+        assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() );
+
+        expectedMetadataFile = getTestFile( "src/test/expected-files/v4-version-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, versionMetadataFile );
+    }
+
+    @Test
+    public void testV3PomConvert()
+        throws Exception
+    {
+        // test that the pom is coverted
+
+        Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0" );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        artifactMetadataFile.delete();
+
+        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File versionMetadataFile = new File( targetRepository.getBasedir(),
+                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
+        versionMetadataFile.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" );
+        assertTrue( "Check POM created", pomFile.exists() );
+
+        compareFiles( expectedPomFile, pomFile );
+
+        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
+
+        File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-artifact-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, artifactMetadataFile );
+
+        assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() );
+
+        expectedMetadataFile = getTestFile( "src/test/expected-files/v3-version-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, versionMetadataFile );
+    }
+
+    @Test
+    public void testV3PomConvertWithRelocation()
+        throws Exception
+    {
+        Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        artifactMetadataFile.delete();
+
+        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File versionMetadataFile = new File( targetRepository.getBasedir(),
+                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
+        versionMetadataFile.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        //checkSuccess();  --> commented until MNG-2100 is fixed
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check if relocated artifact created", artifactFile.exists() );
+        assertTrue( "Check if relocated artifact matches",
+                    FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+        Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
+        File pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) );
+        File testFile = getTestFile( "target/test-target-repository/" + targetRepository.pathOf( pomArtifact ) );
+        compareFiles( pomFile, testFile );
+
+        Artifact orig = createArtifact( "test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
+        artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( orig ) );
+        assertTrue( "Check if relocation artifact pom is created", artifactFile.exists() );
+        testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) );
+        compareFiles( artifactFile, testFile );
+    }
+
+    @Test
+    public void testV3PomWarningsOnConvert()
+        throws Exception
+    {
+        // test that the pom is converted but that warnings are reported
+
+        Artifact artifact = createArtifact( "test", "v3-warnings-artifact", "1.0.0" );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        artifactMetadataFile.delete();
+
+        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File versionMetadataFile = new File( targetRepository.getBasedir(),
+                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
+        versionMetadataFile.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" );
+        assertTrue( "Check POM created", pomFile.exists() );
+
+        compareFiles( expectedPomFile, pomFile );
+
+        // TODO: check 2 warnings (extend and versions) matched on i18n key
+    }
+
+    private void doTestV4SnapshotPomConvert( String version, String expectedMetadataFileName )
+        throws Exception
+    {
+        // test that it is copied as is
+
+        Artifact artifact = createArtifact( "test", "v4artifact", version );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        artifactMetadataFile.delete();
+
+        ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File snapshotMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
+        snapshotMetadataFile.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        assertTrue( "Check POM created", pomFile.exists() );
+
+        compareFiles( sourcePomFile, pomFile );
+
+        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
+
+        File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-snapshot-artifact-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, artifactMetadataFile );
+
+        assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() );
+
+        expectedMetadataFile = getTestFile( expectedMetadataFileName );
+
+        compareFiles( expectedMetadataFile, snapshotMetadataFile );
+    }
+
+    @Test
+    public void testV3SnapshotPomConvert()
+        throws Exception
+    {
+        // test that the pom is coverted
+
+        Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-SNAPSHOT" );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        artifactMetadataFile.delete();
+
+        ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File snapshotMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
+        snapshotMetadataFile.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-snapshot.pom" );
+        assertTrue( "Check POM created", pomFile.exists() );
+
+        compareFiles( expectedPomFile, pomFile );
+
+        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
+
+        File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, artifactMetadataFile );
+
+        assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() );
+
+        expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, snapshotMetadataFile );
+    }
+
+    @Test
+    public void testV4SnapshotPomConvert()
+        throws Exception
+    {
+        doTestV4SnapshotPomConvert( "1.0.0-SNAPSHOT", "src/test/expected-files/v4-snapshot-metadata.xml" );
+
+        assertTrue( true );
+    }
+
+    @Test
+    public void testV4TimestampedSnapshotPomConvert()
+        throws Exception
+    {
+        doTestV4SnapshotPomConvert( "1.0.0-20060111.120115-1",
+                                    "src/test/expected-files/v4-timestamped-snapshot-metadata.xml" );
+
+        assertTrue( true );
+    }
+
+    @Test
+    public void testMavenOnePluginConversion()
+        throws Exception
+    {
+        Artifact artifact =
+            createArtifact( "org.apache.maven.plugins", "maven-foo-plugin", "1.0", "1.0", "maven-plugin" );
+        artifact.setFile(
+            new File( FileUtil.getBasedir(), "src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar" ) );
+        artifactConverter.convert( artifact, targetRepository );
+        // There is a warning but I can't figure out how to look at it. Eyeballing the results it appears
+        // the plugin is being coverted correctly.
+        //checkSuccess();
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        /*
+         The POM isn't needed for Maven 1.x plugins but the raw conversion for  
+
+         artifact = createPomArtifact( artifact );
+         File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+         File expectedPomFile = getTestFile( "src/test/expected-files/maven-foo-plugin-1.0.pom" );
+         assertTrue( "Check POM created", pomFile.exists() );
+         compareFiles( expectedPomFile, pomFile );
+         */
+    }
+
+    @Test
+    public void testV3TimestampedSnapshotPomConvert()
+        throws Exception
+    {
+        // test that the pom is coverted
+
+        Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-20060105.130101-3" );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        artifactMetadataFile.delete();
+
+        ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File snapshotMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
+        snapshotMetadataFile.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-timestamped-snapshot.pom" );
+        assertTrue( "Check POM created", pomFile.exists() );
+
+        compareFiles( expectedPomFile, pomFile );
+
+        assertTrue( "Check artifact snapshotMetadata created", artifactMetadataFile.exists() );
+
+        File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, artifactMetadataFile );
+
+        assertTrue( "Check snapshot snapshotMetadata created", snapshotMetadataFile.exists() );
+
+        expectedMetadataFile = getTestFile( "src/test/expected-files/v3-timestamped-snapshot-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, snapshotMetadataFile );
+    }
+
+    @Test
+    public void testNoPomConvert()
+        throws Exception
+    {
+        // test that a POM is not created when there was none at the source
+
+        Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" );
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 1 );
+
+        assertHasWarningReason( artifactConverter, Messages.getString( "warning.missing.pom" ) );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+
+        assertFalse( "Check no POM created", pomFile.exists() );
+        assertFalse( "No source POM", sourcePomFile.exists() );
+    }
+
+    @Test
+    public void testIncorrectSourceChecksumMd5()
+        throws Exception
+    {
+        // test that it fails when the source md5 is wrong
+
+        Artifact artifact = createArtifact( "test", "incorrectMd5Artifact", "1.0.0" );
+        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        file.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.md5" ) );
+
+        assertFalse( "Check artifact not created", file.exists() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertFalse( "Check metadata not created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testIncorrectSourceChecksumSha1()
+        throws Exception
+    {
+        // test that it fails when the source sha1 is wrong
+
+        Artifact artifact = createArtifact( "test", "incorrectSha1Artifact", "1.0.0" );
+        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        file.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.sha1" ) );
+
+        assertFalse( "Check artifact not created", file.exists() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertFalse( "Check metadata not created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testUnmodifiedArtifact()
+        throws Exception, InterruptedException
+    {
+        // test the unmodified artifact is untouched
+
+        Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" );
+        Artifact pomArtifact = createPomArtifact( artifact );
+
+        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
+        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
+
+        assertTrue( "Check target file exists", targetFile.exists() );
+        assertTrue( "Check target POM exists", targetPomFile.exists() );
+
+        sourceFile.setLastModified( System.currentTimeMillis() );
+        sourcePomFile.setLastModified( System.currentTimeMillis() );
+
+        long origTime = targetFile.lastModified();
+        long origPomTime = targetPomFile.lastModified();
+
+        // Need to guarantee last modified is not equal
+        Thread.sleep( SLEEP_MILLIS );
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        compareFiles( sourceFile, targetFile );
+        compareFiles( sourcePomFile, targetPomFile );
+
+        assertEquals( "Check artifact unmodified", origTime, targetFile.lastModified() );
+        assertEquals( "Check POM unmodified", origPomTime, targetPomFile.lastModified() );
+    }
+
+    @Test
+    public void testModifedArtifactFails()
+        throws Exception
+    {
+        // test that it fails when the source artifact has changed and is different to the existing artifact in the
+        // target repository
+
+        Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" );
+        Artifact pomArtifact = createPomArtifact( artifact );
+
+        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
+        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
+
+        assertTrue( "Check target file exists", targetFile.exists() );
+        assertTrue( "Check target POM exists", targetPomFile.exists() );
+
+        sourceFile.setLastModified( System.currentTimeMillis() );
+        sourcePomFile.setLastModified( System.currentTimeMillis() );
+
+        long origTime = targetFile.lastModified();
+        long origPomTime = targetPomFile.lastModified();
+
+        // Need to guarantee last modified is not equal
+        Thread.sleep( SLEEP_MILLIS );
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        assertHasWarningReason( artifactConverter, Messages.getString( "failure.target.already.exists" ) );
+
+        assertEquals( "Check unmodified", origTime, targetFile.lastModified() );
+        assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertFalse( "Check metadata not created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testForcedUnmodifiedArtifact()
+        throws Exception
+    {
+        // test unmodified artifact is still converted when set to force
+
+        artifactConverter =
+            applicationContext.getBean( "artifactConverter#force-repository-converter", ArtifactConverter.class );
+
+        Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" );
+        Artifact pomArtifact = createPomArtifact( artifact );
+
+        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
+        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
+
+        SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault() );
+        long origTime = dateFormat.parse( "2006-03-03" ).getTime();
+        targetFile.setLastModified( origTime );
+        targetPomFile.setLastModified( origTime );
+
+        sourceFile.setLastModified( dateFormat.parse( "2006-01-01" ).getTime() );
+        sourcePomFile.setLastModified( dateFormat.parse( "2006-02-02" ).getTime() );
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        compareFiles( sourceFile, targetFile );
+        compareFiles( sourcePomFile, targetPomFile );
+
+        assertFalse( "Check modified", origTime == targetFile.lastModified() );
+        assertFalse( "Check modified", origTime == targetPomFile.lastModified() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertTrue( "Check metadata created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testDryRunSuccess()
+        throws Exception
+    {
+        // test dry run does nothing on a run that will be successful, and returns success
+
+        artifactConverter =
+            applicationContext.getBean( "artifactConverter#dryrun-repository-converter", ArtifactConverter.class );
+
+        Artifact artifact = createArtifact( "test", "dryrun-artifact", "1.0.0" );
+        Artifact pomArtifact = createPomArtifact( artifact );
+
+        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
+        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
+
+        // clear warning before test related to MRM-1638
+        artifactConverter.clearWarnings();
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        assertTrue( "Check source file exists", sourceFile.exists() );
+        assertTrue( "Check source POM exists", sourcePomFile.exists() );
+
+        assertFalse( "Check target file doesn't exist", targetFile.exists() );
+        assertFalse( "Check target POM doesn't exist", targetPomFile.exists() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertFalse( "Check metadata not created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testDryRunFailure()
+        throws Exception
+    {
+        // test dry run does nothing on a run that will fail, and returns failure
+
+        artifactConverter =
+            applicationContext.getBean( "artifactConverter#dryrun-repository-converter", ArtifactConverter.class );
+
+        Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" );
+        Artifact pomArtifact = createPomArtifact( artifact );
+
+        File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
+        File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
+
+        assertTrue( "Check target file exists", targetFile.exists() );
+        assertTrue( "Check target POM exists", targetPomFile.exists() );
+
+        sourceFile.setLastModified( System.currentTimeMillis() );
+        sourcePomFile.setLastModified( System.currentTimeMillis() );
+
+        long origTime = targetFile.lastModified();
+        long origPomTime = targetPomFile.lastModified();
+
+        // Need to guarantee last modified is not equal
+        Thread.sleep( SLEEP_MILLIS );
+
+        // clear warning before test related to MRM-1638
+        artifactConverter.clearWarnings();
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        assertHasWarningReason( artifactConverter, Messages.getString( "failure.target.already.exists" ) );
+
+        assertEquals( "Check unmodified", origTime, targetFile.lastModified() );
+        assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertFalse( "Check metadata not created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testRollbackArtifactCreated()
+        throws Exception
+    {
+        // test rollback can remove a created artifact, including checksums
+
+        Artifact artifact = createArtifact( "test", "rollback-created-artifact", "1.0.0" );
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        FileUtils.deleteDirectory( artifactMetadataFile.getParentFile() );
+
+        ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
+        File versionMetadataFile = new File( targetRepository.getBasedir(),
+                                             targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        boolean found = false;
+        String pattern = "^" + Messages.getString( "invalid.source.pom" ).replaceFirst( "\\{0\\}", ".*" ) + "$";
+        for ( List<String> messages : artifactConverter.getWarnings().values() )
+        {
+            for ( String message : messages )
+            {
+                if ( message.matches( pattern ) )
+                {
+                    found = true;
+                    break;
+                }
+            }
+
+            if ( found )
+            {
+                break;
+            }
+        }
+
+        assertTrue( "Check failure message.", found );
+
+        assertFalse( "check artifact rolled back", artifactFile.exists() );
+        assertFalse( "check metadata rolled back", artifactMetadataFile.exists() );
+        assertFalse( "check metadata rolled back", versionMetadataFile.exists() );
+    }
+
+    @Test
+    public void testMultipleArtifacts()
+        throws Exception
+    {
+        // test multiple artifacts are converted
+
+        List<Artifact> artifacts = new ArrayList<>();
+        artifacts.add( createArtifact( "test", "artifact-one", "1.0.0" ) );
+        artifacts.add( createArtifact( "test", "artifact-two", "1.0.0" ) );
+        artifacts.add( createArtifact( "test", "artifact-three", "1.0.0" ) );
+
+        for ( Artifact artifact : artifacts )
+        {
+            artifactConverter.convert( artifact, targetRepository );
+            checkSuccess( artifactConverter );
+        }
+
+        for ( Artifact artifact : artifacts )
+        {
+            File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+            assertTrue( "Check artifact created", artifactFile.exists() );
+            assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+            artifact = createPomArtifact( artifact );
+            File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+            File expectedPomFile =
+                getTestFile( "src/test/expected-files/converted-" + artifact.getArtifactId() + ".pom" );
+            assertTrue( "Check POM created", pomFile.exists() );
+
+            compareFiles( expectedPomFile, pomFile );
+        }
+    }
+
+    @Test
+    public void testInvalidSourceArtifactMetadata()
+        throws Exception
+    {
+        // test artifact is not converted when source metadata is invalid, and returns failure
+
+        createModernSourceRepository();
+
+        Artifact artifact = createArtifact( "test", "incorrectArtifactMetadata", "1.0.0" );
+        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        file.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        assertHasWarningReason( artifactConverter,
+                                Messages.getString( "failure.incorrect.artifactMetadata.versions" ) );
+
+        assertFalse( "Check artifact not created", file.exists() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertFalse( "Check metadata not created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testInvalidSourceSnapshotMetadata()
+        throws Exception
+    {
+        // test artifact is not converted when source snapshot metadata is invalid and returns failure
+
+        createModernSourceRepository();
+
+        Artifact artifact = createArtifact( "test", "incorrectSnapshotMetadata", "1.0.0-20060102.030405-6" );
+        File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        file.delete();
+
+        artifactConverter.convert( artifact, targetRepository );
+        checkWarnings( artifactConverter, 2 );
+
+        assertHasWarningReason( artifactConverter,
+                                Messages.getString( "failure.incorrect.snapshotMetadata.snapshot" ) );
+
+        assertFalse( "Check artifact not created", file.exists() );
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+        File metadataFile =
+            new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
+        assertFalse( "Check metadata not created", metadataFile.exists() );
+    }
+
+    @Test
+    public void testMergeArtifactMetadata()
+        throws Exception
+    {
+        // test artifact level metadata is merged when it already exists on successful conversion
+
+        Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" );
+        artifactConverter.convert( artifact, targetRepository );
+        checkSuccess( artifactConverter );
+
+        File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        assertTrue( "Check artifact created", artifactFile.exists() );
+        assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
+
+        artifact = createPomArtifact( artifact );
+        File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
+        File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
+        assertTrue( "Check POM created", pomFile.exists() );
+
+        compareFiles( sourcePomFile, pomFile );
+
+        ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
+        File artifactMetadataFile = new File( targetRepository.getBasedir(),
+                                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
+        assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
+
+        File expectedMetadataFile = getTestFile( "src/test/expected-files/newversion-artifact-metadata.xml" );
+
+        compareFiles( expectedMetadataFile, artifactMetadataFile );
+    }
+
+    @Test
+    public void testSourceAndTargetRepositoriesMatch()
+        throws Exception
+    {
+        // test that it fails if the same
+
+        ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
+
+        sourceRepository =
+            factory.createArtifactRepository( "source", targetRepository.getUrl(), targetRepository.getLayout(), null,
+                                              null );
+
+        Artifact artifact = createArtifact( "test", "repository-artifact", "1.0" );
+
+        try
+        {
+            artifactConverter.convert( artifact, targetRepository );
+            fail( "Should have failed trying to convert within the same repository" );
+        }
+        catch ( ArtifactConversionException e )
+        {
+            // expected
+            assertEquals( "check message", Messages.getString( "exception.repositories.match" ), e.getMessage() );
+            assertNull( "Check no additional cause", e.getCause() );
+        }
+    }
+
+    private Artifact createArtifact( String groupId, String artifactId, String version )
+    {
+        Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( version );
+        String baseVersion;
+        if ( matcher.matches() )
+        {
+            baseVersion = matcher.group( 1 ) + "-SNAPSHOT";
+        }
+        else
+        {
+            baseVersion = version;
+        }
+        return createArtifact( groupId, artifactId, baseVersion, version, "jar" );
+    }
+
+    private Artifact createArtifact( String groupId, String artifactId, String baseVersion, String version,
+                                     String type )
+    {
+        Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, null, type );
+        artifact.setBaseVersion( baseVersion );
+        artifact.setRepository( sourceRepository );
+        artifact.setFile( new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ) );
+        return artifact;
+    }
+
+    private Artifact createPomArtifact( Artifact artifact )
+    {
+        return createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(),
+                               artifact.getVersion(), "pom" );
+    }
+
+    private static void compareFiles( File expectedPomFile, File pomFile )
+        throws IOException
+    {
+        String expectedContent = normalizeString(
+            org.apache.commons.io.FileUtils.readFileToString( expectedPomFile, Charset.defaultCharset() ) );
+        String targetContent =
+            normalizeString( org.apache.commons.io.FileUtils.readFileToString( pomFile, Charset.defaultCharset() ) );
+        assertEquals( "Check file match between " + expectedPomFile + " and " + pomFile, expectedContent,
+                      targetContent );
+    }
+
+    private static String normalizeString( String path )
+    {
+        return path.trim().replaceAll( "\r\n", "\n" ).replace( '\r', '\n' ).replaceAll( "<\\?xml .+\\?>",
+                                                                                        "" ).replaceAll( "^\\s+", "" );
+    }
+
+    private void checkSuccess( ArtifactConverter converter )
+    {
+        assertNotNull( "Warnings should never be null.", converter.getWarnings() );
+        assertEquals( "Should have no warnings. " + converter.getWarnings(), 0, countWarningMessages( converter ) );
+    }
+
+    private void checkWarnings( ArtifactConverter converter, int count )
+    {
+        assertNotNull( "Warnings should never be null.", converter.getWarnings() );
+        assertEquals( "Should have some warnings.", count, countWarningMessages( converter ) );
+    }
+
+    private int countWarningMessages( ArtifactConverter converter )
+    {
+        int count = 0;
+        for ( List<String> values : converter.getWarnings().values() )
+        {
+            count += values.size();
+        }
+        return count;
+    }
+
+    private void assertHasWarningReason( ArtifactConverter converter, String reason )
+    {
+        assertNotNull( "Warnings should never be null.", converter.getWarnings() );
+        assertTrue( "Expecting 1 or more Warnings", countWarningMessages( converter ) > 0 );
+
+        for ( List<String> messages : converter.getWarnings().values() )
+        {
+            if ( messages.contains( reason ) )
+            {
+                /* No need to check any further */
+                return;
+            }
+        }
+
+        /* didn't find it. */
+
+        for ( Map.Entry<Artifact, List<String>> entry : converter.getWarnings().entrySet() )
+        {
+            Artifact artifact = (Artifact) entry.getKey();
+            System.out.println(
+                "-Artifact: " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() );
+            List<String> messages = entry.getValue();
+            for ( String message : messages )
+            {
+                System.out.println( "  " + message );
+            }
+        }
+        fail( "Unable to find message <" + reason + "> in warnings." );
+    }
+
+    private void createModernSourceRepository()
+        throws Exception
+    {
+        ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
+
+        ArtifactRepositoryLayout layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
+
+        File sourceBase = getTestFile( "src/test/source-modern-repository" );
+        sourceRepository =
+            factory.createArtifactRepository( "source", sourceBase.toURL().toString(), layout, null, null );
+    }
+}
index 52c960cb236ba4efb5aeaedac37e200b1afb538f..40abd8f8046ac1fbe5911f67584cd48f7573736e 100644 (file)
@@ -46,7 +46,6 @@
     <module>archiva-proxy-common</module>
     <module>archiva-proxy</module>
     <module>archiva-transaction</module>
-    <module>archiva-artifact-converter</module>
     <module>archiva-converter</module>
     <module>archiva-repository-scanner</module>
     <module>archiva-repository-admin</module>
diff --git a/pom.xml b/pom.xml
index 9c7a6e9b5f6732f7272952a8bf9a12f937d0ec03..a8b86041d89afb0c2680fb4b5d02e02828300ceb 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <groupId>org.apache.archiva</groupId>
         <artifactId>problem-reports</artifactId>
         <version>${project.version}</version>
+        <scope>runtime</scope>
       </dependency>
       <dependency>
         <groupId>org.apache.archiva</groupId>
         <artifactId>generic-metadata-support</artifactId>
         <version>${project.version}</version>
       </dependency>
-      <dependency>
-        <groupId>org.apache.archiva</groupId>
-        <artifactId>archiva-artifact-converter</artifactId>
-        <version>${project.version}</version>
-      </dependency>
       <dependency>
         <groupId>org.apache.archiva</groupId>
         <artifactId>archiva-checksum</artifactId>