maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r372767 - in /maven/repository-manager/trunk/maven-repository-converter/src: main/java/org/apache/maven/repository/converter/ main/resources/org/apache/maven/repository/converter/ test/java/org/apache/maven/repository/converter/
Date Fri, 27 Jan 2006 06:24:56 GMT
Author: brett
Date: Thu Jan 26 22:24:45 2006
New Revision: 372767

URL: http://svn.apache.org/viewcvs?rev=372767&view=rev
Log:
[MRM-9] test identical source and target repositories

Modified:
    maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
    maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConversionException.java
    maven/repository-manager/trunk/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
    maven/repository-manager/trunk/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java

Modified: maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java?rev=372767&r1=372766&r2=372767&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
(original)
+++ maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
Thu Jan 26 22:24:45 2006
@@ -89,6 +89,11 @@
     public void convert( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter
reporter )
         throws RepositoryConversionException
     {
+        if ( artifact.getRepository().getUrl().equals( targetRepository.getUrl() ) )
+        {
+            throw new RepositoryConversionException( getI18NString( "exception.repositories.match"
) );
+        }
+
         if ( copyArtifact( artifact, targetRepository, reporter ) )
         {
             copyPom( artifact, targetRepository, reporter );

Modified: maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConversionException.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConversionException.java?rev=372767&r1=372766&r2=372767&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConversionException.java
(original)
+++ maven/repository-manager/trunk/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConversionException.java
Thu Jan 26 22:24:45 2006
@@ -24,6 +24,11 @@
 public class RepositoryConversionException
     extends Exception
 {
+    public RepositoryConversionException( String message )
+    {
+        super( message );
+    }
+
     public RepositoryConversionException( String message, Throwable cause )
     {
         super( message, cause );

Modified: maven/repository-manager/trunk/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties?rev=372767&r1=372766&r2=372767&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
(original)
+++ maven/repository-manager/trunk/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
Thu Jan 26 22:24:45 2006
@@ -17,4 +17,5 @@
 failure.incorrect.md5=The MD5 checksum value was incorrect.
 failure.incorrect.sha1=The SHA1 checksum value was incorrect.
 warning.missing.pom=The artifact had no POM in the source repository.
-failure.target.already.exists=The artifact could not be converted because it already exists.
\ No newline at end of file
+failure.target.already.exists=The artifact could not be converted because it already exists.
+exception.repositories.match=Source and target repositories are identical.
\ No newline at end of file

Modified: maven/repository-manager/trunk/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java?rev=372767&r1=372766&r2=372767&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java
(original)
+++ maven/repository-manager/trunk/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java
Thu Jan 26 22:24:45 2006
@@ -737,10 +737,28 @@
     }
 
     public void testSourceAndTargetRepositoriesMatch()
+        throws Exception
     {
-        // test that it fails if the same (initially - later we might allow this with extra
checks)
+        // test that it fails if the same
 
-        // TODO
+        ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE
);
+
+        sourceRepository = factory.createArtifactRepository( "source", targetRepository.getUrl(),
+                                                             targetRepository.getLayout(),
null, null );
+
+        Artifact artifact = createArtifact( "test", "repository-artifact", "1.0" );
+
+        try
+        {
+            repositoryConverter.convert( artifact, targetRepository, reporter );
+            fail( "Should have failed trying to convert within the same repository" );
+        }
+        catch ( RepositoryConversionException e )
+        {
+            // expected
+            assertEquals( "check message", getI18nString( "exception.repositories.match"
), e.getMessage() );
+            assertNull( "Check no additional cause", e.getCause() );
+        }
     }
 
     private Artifact createArtifact( String groupId, String artifactId, String version )



Mime
View raw message