You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2007/07/27 14:25:17 UTC

svn commit: r560212 - in /maven/shared/trunk/maven-model-converter/src: main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java test/resources/PCCTaglistTest2.properties

Author: dennisl
Date: Fri Jul 27 05:25:15 2007
New Revision: 560212

URL: http://svn.apache.org/viewvc?view=rev&rev=560212
Log:
[MONE-15] Property configuration conversion for tasklist plugin is wrong

o Also add a test for an empty property.

Added:
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCTaglistTest2.properties
Modified:
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java

Modified: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java?view=diff&rev=560212&r1=560211&r2=560212
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java (original)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java Fri Jul 27 05:25:15 2007
@@ -20,6 +20,7 @@
  */
 
 import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 
 import java.util.Properties;
@@ -52,6 +53,13 @@
                                        Properties projectProperties )
         throws ProjectConverterException
     {
-        addConfigurationChild( configuration, projectProperties, "maven.tasklist.taskTag", "tags" );
+        final String propertyName = "maven.tasklist.taskTag";
+        
+        String value = projectProperties.getProperty( propertyName );
+        if( StringUtils.isNotEmpty( value ) ) {
+            Xpp3Dom tags = new Xpp3Dom( "tags" );
+            addConfigurationChild( tags, projectProperties, propertyName, "tag" );
+            configuration.addChild( tags );
+        }
     }
 }

Modified: maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java?view=diff&rev=560212&r1=560211&r2=560212
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java (original)
+++ maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java Fri Jul 27 05:25:15 2007
@@ -21,6 +21,7 @@
 
 import junit.framework.Assert;
 import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
 
 import java.io.IOException;
 
@@ -47,8 +48,29 @@
 
             pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
 
-            String value = configuration.getChild( "tags" ).getValue();
-            Assert.assertEquals( "check tags value", "@fixme", value );
+            String value = configuration.getChild( "tags" ).getChild( "tag" ).getValue();
+            Assert.assertEquals( "check specified tags value", "@fixme", value );
+        }
+        catch ( ProjectConverterException e )
+        {
+            Assert.fail();
+        }
+        catch ( IOException e )
+        {
+            Assert.fail( "Unable to find the requested resource." );
+        }
+    }
+
+    public void testBuildConfiguration2()
+    {
+        try
+        {
+            projectProperties.load( getClassLoader().getResourceAsStream( "PCCTaglistTest2.properties" ) );
+
+            pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
+
+            Xpp3Dom tags = configuration.getChild( "tags" );
+            Assert.assertEquals( "check unspecified tags value", null, tags );
         }
         catch ( ProjectConverterException e )
         {

Added: maven/shared/trunk/maven-model-converter/src/test/resources/PCCTaglistTest2.properties
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/test/resources/PCCTaglistTest2.properties?view=auto&rev=560212
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/test/resources/PCCTaglistTest2.properties (added)
+++ maven/shared/trunk/maven-model-converter/src/test/resources/PCCTaglistTest2.properties Fri Jul 27 05:25:15 2007
@@ -0,0 +1,18 @@
+# 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.
+
+maven.tasklist.taskTag=