maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r433615 - in /maven/components/trunk/maven-model-converter/src: main/java/org/apache/maven/model/converter/ test/java/org/apache/maven/model/converter/
Date Tue, 22 Aug 2006 12:43:01 GMT
Author: evenisse
Date: Tue Aug 22 05:43:00 2006
New Revision: 433615

URL: http://svn.apache.org/viewvc?rev=433615&view=rev
Log:
Add junit in all converted pom.

Modified:
    maven/components/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
    maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/PomV3ToV4TranslatorTest.java
    maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/V3PomRewriterTest.java

Modified: maven/components/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java?rev=433615&r1=433614&r2=433615&view=diff
==============================================================================
--- maven/components/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
(original)
+++ maven/components/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
Tue Aug 22 05:43:00 2006
@@ -492,6 +492,8 @@
 
         if ( notEmpty( v3Deps ) )
         {
+            boolean isJunitPresent = false;
+
             for ( Iterator it = v3Deps.iterator(); it.hasNext(); )
             {
                 org.apache.maven.model.v3_0_0.Dependency v3Dep = (org.apache.maven.model.v3_0_0.Dependency)
it.next();
@@ -523,6 +525,11 @@
                     }
                 }
 
+                if ( "junit".equals( groupId ) && "junit".equals( artifactId ) )
+                {
+                    isJunitPresent = true;
+                }
+
                 String type = v3Dep.getType();
                 if ( "plugin".equals( type ) )
                 {
@@ -581,6 +588,16 @@
 
                     deps.add( dep );
                 }
+            }
+
+            if ( !isJunitPresent )
+            {
+                Dependency junitDep = new Dependency();
+                junitDep.setGroupId( "junit" );
+                junitDep.setArtifactId( "junit" );
+                junitDep.setVersion( "3.8.2" );
+                junitDep.setScope( "test" );
+                deps.add( junitDep );
             }
         }
 

Modified: maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/PomV3ToV4TranslatorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/PomV3ToV4TranslatorTest.java?rev=433615&r1=433614&r2=433615&view=diff
==============================================================================
--- maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/PomV3ToV4TranslatorTest.java
(original)
+++ maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/PomV3ToV4TranslatorTest.java
Tue Aug 22 05:43:00 2006
@@ -128,7 +128,12 @@
         Assert.assertEquals( "testArtifact", plugin.getArtifactId() );
         Assert.assertEquals( "1.0", plugin.getVersion() );
 
-        Assert.assertEquals( "check no dependencies", 0, result.getDependencies().size()
);
+        Assert.assertEquals( "check one dependency", 1, result.getDependencies().size() );
+        Dependency dep = (Dependency) result.getDependencies().get( 0 );
+        Assert.assertEquals( "junit", dep.getGroupId() );
+        Assert.assertEquals( "junit", dep.getArtifactId() );
+        Assert.assertEquals( "3.8.2", dep.getVersion() );
+        Assert.assertEquals( "test", dep.getScope() );
     }
 
     public void testShouldConvertDependencyWithTypePluginAndGroupMavenToBuildPluginEntryWithOAMPluginsGroup()
@@ -149,7 +154,12 @@
         Assert.assertEquals( "testArtifact", plugin.getArtifactId() );
         Assert.assertEquals( "1.0", plugin.getVersion() );
 
-        Assert.assertEquals( "check no dependencies", 0, result.getDependencies().size()
);
+        Assert.assertEquals( "check one dependencies", 1, result.getDependencies().size()
);
+        Dependency dep = (Dependency) result.getDependencies().get( 0 );
+        Assert.assertEquals( "junit", dep.getGroupId() );
+        Assert.assertEquals( "junit", dep.getArtifactId() );
+        Assert.assertEquals( "3.8.2", dep.getVersion() );
+        Assert.assertEquals( "test", dep.getScope() );
     }
 
 }

Modified: maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/V3PomRewriterTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/V3PomRewriterTest.java?rev=433615&r1=433614&r2=433615&view=diff
==============================================================================
--- maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/V3PomRewriterTest.java
(original)
+++ maven/components/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/V3PomRewriterTest.java
Tue Aug 22 05:43:00 2006
@@ -53,7 +53,7 @@
         rewriter.rewrite( new StringReader( pom ), to, false, null, null, null, null );
 
         Xpp3Dom dom = Xpp3DomBuilder.build( new StringReader( to.toString() ) );
-        String version = dom.getChild( "dependencies" ).getChild( "dependency" ).getChild(
"version" ).getValue();
+        String version = dom.getChild( "dependencies" ).getChild( 0 ).getChild( "version"
).getValue();
         assertEquals( "check new version expression", "${project.version}", version );
     }
 



Mime
View raw message