maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r372728 - 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 04:48:30 GMT
Author: brett
Date: Thu Jan 26 20:48:19 2006
New Revision: 372728

URL: http://svn.apache.org/viewcvs?rev=372728&view=rev
Log:
[MRM-9] warn if no POM at source

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/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=372728&r1=372727&r2=372728&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 20:48:19 2006
@@ -278,6 +278,15 @@
                 }
             }
         }
+        else
+        {
+            reporter.addWarning( artifact, getI18NString( "warning.missing.pom" ) );
+        }
+    }
+
+    private String getI18NString( String key )
+    {
+        return i18n.getString( getClass().getName(), Locale.getDefault(), key );
     }
 
     private boolean testChecksums( Artifact artifact, File file, ArtifactReporter reporter
)
@@ -293,8 +302,7 @@
                 String checksum = FileUtils.fileRead( md5 );
                 if ( !digester.verifyChecksum( file, checksum, Digester.MD5 ) )
                 {
-                    reporter.addFailure( artifact, i18n.getString( getClass().getName(),
Locale.getDefault(),
-                                                                   "failure.incorrect.md5"
) );
+                    reporter.addFailure( artifact, getI18NString( "failure.incorrect.md5"
) );
                     result = false;
                 }
             }
@@ -305,8 +313,7 @@
                 String checksum = FileUtils.fileRead( sha1 );
                 if ( !digester.verifyChecksum( file, checksum, Digester.SHA1 ) )
                 {
-                    reporter.addFailure( artifact, i18n.getString( getClass().getName(),
Locale.getDefault(),
-                                                                   "failure.incorrect.sha1"
) );
+                    reporter.addFailure( artifact, getI18NString( "failure.incorrect.sha1"
) );
                     result = false;
                 }
             }

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=372728&r1=372727&r2=372728&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 20:48:19 2006
@@ -15,4 +15,5 @@
 #
 
 failure.incorrect.md5=The MD5 checksum value was incorrect.
-failure.incorrect.sha1=The SHA1 checksum value was incorrect.
\ No newline at end of file
+failure.incorrect.sha1=The SHA1 checksum value was incorrect.
+warning.missing.pom=The artifact had no POM in the source repository
\ 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=372728&r1=372727&r2=372728&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 20:48:19 2006
@@ -391,11 +391,14 @@
     public void testNoPomConvert()
         throws IOException, RepositoryConversionException
     {
-        // test that a POM is created when there was none at the source
+        // test that a POM is not created when there was none at the source
 
         Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" );
         repositoryConverter.convert( artifact, targetRepository, reporter );
-        checkSuccess();
+        assertEquals( "check no errors", 0, reporter.getFailures() );
+        assertEquals( "check no warnings", 1, reporter.getWarnings() );
+        assertEquals( "check success", 1, reporter.getSuccesses() );
+        assertEquals( "check warning message", getI18nString( "warning.missing.pom" ), getWarning().getReason()
);
 
         File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf(
artifact ) );
         assertTrue( "Check artifact created", artifactFile.exists() );
@@ -404,7 +407,7 @@
         artifact = createPomArtifact( artifact );
         File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf(
artifact ) );
         File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf(
artifact ) );
-        // TODO: should we fail? Warn?
+
         assertFalse( "Check no POM created", pomFile.exists() );
         assertFalse( "No source POM", sourcePomFile.exists() );
     }
@@ -420,8 +423,7 @@
 
         repositoryConverter.convert( artifact, targetRepository, reporter );
         checkFailure();
-        ArtifactResult failure = (ArtifactResult) reporter.getArtifactFailureIterator().next();
-        assertEquals( "check failure message", getI18nString( "failure.incorrect.md5" ),
failure.getReason() );
+        assertEquals( "check failure message", getI18nString( "failure.incorrect.md5" ),
getFailure().getReason() );
 
         assertFalse( "Check artifact not created", file.exists() );
     }
@@ -437,8 +439,7 @@
 
         repositoryConverter.convert( artifact, targetRepository, reporter );
         checkFailure();
-        ArtifactResult failure = (ArtifactResult) reporter.getArtifactFailureIterator().next();
-        assertEquals( "check failure message", getI18nString( "failure.incorrect.sha1" ),
failure.getReason() );
+        assertEquals( "check failure message", getI18nString( "failure.incorrect.sha1" ),
getFailure().getReason() );
 
         assertFalse( "Check artifact not created", file.exists() );
     }
@@ -725,6 +726,16 @@
     private String getI18nString( String key )
     {
         return i18n.getString( repositoryConverter.getClass().getName(), Locale.getDefault(),
key );
+    }
+
+    private ArtifactResult getFailure()
+    {
+        return (ArtifactResult) reporter.getArtifactFailureIterator().next();
+    }
+
+    private ArtifactResult getWarning()
+    {
+        return (ArtifactResult) reporter.getArtifactWarningIterator().next();
     }
 
 }



Mime
View raw message