You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2006/06/01 00:21:09 UTC
svn commit: r410688 - in /maven/sandbox/plugins/maven-maven1-plugin: ./
src/main/java/org/apache/maven/maven1converter/plugins/ src/test/
src/test/java/ src/test/java/org/ src/test/java/org/apache/
src/test/java/org/apache/maven/ src/test/java/org/apac...
Author: carlos
Date: Wed May 31 15:21:07 2006
New Revision: 410688
URL: http://svn.apache.org/viewvc?rev=410688&view=rev
Log:
[MNG-2332] Expand Compiler and Surefire Converters
Added:
maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PropertyUtils.java (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/AbstractPCCTest.java (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCCompilerTest.java (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCSurefireTest.java (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PropertyUtilsTest.java (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/
maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCCompilerTest.properties (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest1.properties (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest2.properties (with props)
maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest3.properties (with props)
Modified:
maven/sandbox/plugins/maven-maven1-plugin/pom.xml
maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/AbstractPluginConfigurationConverter.java
maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCCompiler.java
maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCSurefire.java
Modified: maven/sandbox/plugins/maven-maven1-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/pom.xml?rev=410688&r1=410687&r2=410688&view=diff
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/pom.xml (original)
+++ maven/sandbox/plugins/maven-maven1-plugin/pom.xml Wed May 31 15:21:07 2006
@@ -30,6 +30,30 @@
<name>Maven Maven1 Plugin</name>
<version>2.0-SNAPSHOT</version>
<inceptionYear>2006</inceptionYear>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -48,8 +72,13 @@
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
Modified: maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/AbstractPluginConfigurationConverter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/AbstractPluginConfigurationConverter.java?rev=410688&r1=410687&r2=410688&view=diff
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/AbstractPluginConfigurationConverter.java (original)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/AbstractPluginConfigurationConverter.java Wed May 31 15:21:07 2006
@@ -41,8 +41,42 @@
return "org.apache.maven.plugins";
}
+ /**
+ * Add a child element to the configuration.
+ *
+ * @param configuration The configuration to add the element to
+ * @param projectProperties The M1 properties
+ * @param mavenOneProperty The name of the Maven 1 property to convert
+ * @param mavenTwoElement The name of the Maven 2 configuration element
+ * @throws MojoExecutionException if an element can't be created
+ */
+ protected void addConfigurationChild( Xpp3Dom configuration, Properties projectProperties, String mavenOneProperty,
+ String mavenTwoElement )
+ throws MojoExecutionException
+ {
+ String value = projectProperties.getProperty( mavenOneProperty );
+ addConfigurationChild( configuration, mavenTwoElement, value );
+ }
+
+ /**
+ * Add a child element to the configuration.
+ *
+ * @param configuration The configuration to add the element to
+ * @param mavenTwoElement The name of the Maven 2 configuration element
+ * @param value Set the value of the element to this
+ * @throws MojoExecutionException if an element can't be created
+ */
+ protected void addConfigurationChild( Xpp3Dom configuration, String mavenTwoElement, String value )
+ throws MojoExecutionException
+ {
+ if ( value != null )
+ {
+ configuration.addChild( newXpp3Dom( "<" + mavenTwoElement + ">" + value + "</" + mavenTwoElement + ">" ) );
+ }
+ }
+
public void convertConfiguration( Model v4Model, org.apache.maven.model.v3_0_0.Model v3Model,
- Properties projectProperties )
+ Properties projectProperties )
throws MojoExecutionException
{
boolean addPlugin = false;
@@ -66,8 +100,8 @@
if ( addPlugin )
{
- v4Model.getBuild().addPlugin( plugin );
- }
+ v4Model.getBuild().addPlugin( plugin );
+ }
}
}
@@ -88,7 +122,7 @@
if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
{
return plugin;
- }
+ }
}
return null;
}
Modified: maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCCompiler.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCCompiler.java?rev=410688&r1=410687&r2=410688&view=diff
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCCompiler.java (original)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCCompiler.java Wed May 31 15:21:07 2006
@@ -23,12 +23,12 @@
/**
* @author Fabrizio Giustina
+ * @author Dennis Lundberg
* @version $Id$
*/
public class PCCCompiler
extends AbstractPluginConfigurationConverter
{
-
/**
* @see org.apache.maven.maven1converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
*/
@@ -37,24 +37,61 @@
return "maven-compiler-plugin";
}
+ protected void addOnOffConfigurationChild( Xpp3Dom configuration, Properties projectProperties,
+ String mavenOneProperty, String mavenTwoElement )
+ throws MojoExecutionException
+ {
+ String value = projectProperties.getProperty( mavenOneProperty );
+ if ( value != null )
+ {
+ addConfigurationChild( configuration, mavenTwoElement,
+ PropertyUtils.convertOnOffToBoolean( value ) );
+ }
+ }
+
protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
- Properties projectProperties )
+ Properties projectProperties )
throws MojoExecutionException
{
- String compileTarget = projectProperties.getProperty( "maven.compile.target" );
+ addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.debug", "debug" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.encoding", "encoding" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.executable", "executable" );
- if ( compileTarget != null )
+ String fork = projectProperties.getProperty( "maven.compile.fork" );
+ if ( fork != null )
{
- configuration.addChild( newXpp3Dom( "<target>" + compileTarget + "</target>" ) );
+ addConfigurationChild( configuration, "fork", PropertyUtils.convertYesNoToBoolean( fork ) );
}
- String compileSource = projectProperties.getProperty( "maven.compile.source" );
- if ( compileSource != null )
+ addConfigurationChild( configuration, projectProperties, "maven.compile.memoryMaximumSize", "maxmem" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.memoryInitialSize", "meminitial" );
+
+ addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.optimize", "optimize" );
+
+ addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.deprecation", "showDeprecation" );
+
+ String nowarn = projectProperties.getProperty( "maven.compile.nowarn" );
+ if ( nowarn != null )
{
- configuration.addChild( newXpp3Dom( "<source>" + compileSource + "</source>" ) );
+ String convertedNowarn = PropertyUtils.convertOnOffToBoolean( nowarn );
+ if ( convertedNowarn != null )
+ {
+ String showWarnings = PropertyUtils.invertBoolean( convertedNowarn );
+ addConfigurationChild( configuration, "showWarnings", showWarnings );
+ }
}
- // maven.compile.deprecation=on
- }
+ addConfigurationChild( configuration, projectProperties, "maven.compile.source", "source" );
+ addConfigurationChild( configuration, projectProperties, "maven.compile.target", "target" );
+
+ String value = projectProperties.getProperty( "maven.compile.verbose" );
+ if ( value != null )
+ {
+ addConfigurationChild( configuration, "verbose", PropertyUtils.convertYesNoToBoolean( value ) );
+ }
+ }
}
Modified: maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCSurefire.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCSurefire.java?rev=410688&r1=410687&r2=410688&view=diff
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCSurefire.java (original)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PCCSurefire.java Wed May 31 15:21:07 2006
@@ -19,18 +19,19 @@
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
+import java.util.StringTokenizer;
import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
* @author Fabrizio Giustina
+ * @author Dennis Lundberg
* @version $Id$
*/
public class PCCSurefire
extends AbstractPluginConfigurationConverter
{
-
/**
* @see org.apache.maven.maven1converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
*/
@@ -40,16 +41,65 @@
}
protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
- Properties projectProperties )
+ Properties projectProperties )
throws MojoExecutionException
{
- String testFailureIgnore = projectProperties.getProperty( "maven.test.failure.ignore" );
+ addConfigurationChild( configuration, projectProperties, "maven.junit.jvmargs", "argLine" );
+
+ String forkMode = projectProperties.getProperty( "maven.junit.forkmode" );
+ if ( forkMode == null )
+ {
+ String fork = projectProperties.getProperty( "maven.junit.fork" );
+ if ( fork != null )
+ {
+ boolean useFork = Boolean.valueOf( PropertyUtils.convertYesNoToBoolean( fork ) ).booleanValue();
+ if ( useFork )
+ {
+ // Use "once" here as that is the default forkMode
+ addConfigurationChild( configuration, "forkMode", "once" );
+ }
+ }
+ }
+ else
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.junit.forkmode", "forkMode" );
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.junit.jvm", "jvm" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.junit.printSummary", "printSummary" );
- if ( testFailureIgnore != null )
+ addConfigurationChild( configuration, projectProperties, "maven.junit.format", "reportFormat" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.test.skip", "skip" );
+
+ String sysproperties = projectProperties.getProperty( "maven.junit.sysproperties" );
+ if ( sysproperties != null )
{
- configuration.addChild( newXpp3Dom( "<testFailureIgnore>" + testFailureIgnore + "</testFailureIgnore>" ) );
+ StringTokenizer tokenizer = new StringTokenizer( sysproperties );
+ if ( tokenizer.hasMoreTokens() )
+ {
+ Xpp3Dom systemProperties = newXpp3Dom( "<systemProperties></systemProperties>" );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ String name = tokenizer.nextToken();
+ String value = projectProperties.getProperty( name );
+ if ( value != null )
+ {
+ systemProperties.addChild( newXpp3Dom( "<" + name + ">" + value + "</" + name + ">" ) );
+ }
+ }
+ if ( systemProperties.getChildCount() > 0 )
+ {
+ configuration.addChild( systemProperties );
+ }
+ }
}
+ addConfigurationChild( configuration, projectProperties, "maven.test.failure.ignore", "testFailureIgnore" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.junit.usefile", "useFile" );
+
if ( v3Model.getBuild() != null && v3Model.getBuild().getUnitTest() != null )
{
org.apache.maven.model.v3_0_0.UnitTest v3UnitTest = v3Model.getBuild().getUnitTest();
@@ -77,7 +127,5 @@
}
}
-
}
-
}
Added: maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PropertyUtils.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PropertyUtils.java?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PropertyUtils.java (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PropertyUtils.java Wed May 31 15:21:07 2006
@@ -0,0 +1,69 @@
+package org.apache.maven.maven1converter.plugins;
+
+/*
+ * Copyright 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.
+ */
+
+/**
+ * Utility class which features various methods for converting String-based property values.
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PropertyUtils
+{
+ static String convertOnOffToBoolean( String value )
+ {
+ if ( value != null )
+ {
+ if ( "on".equalsIgnoreCase( value ) )
+ {
+ return Boolean.TRUE.toString();
+ }
+ if ( "off".equalsIgnoreCase( value ) )
+ {
+ return Boolean.FALSE.toString();
+ }
+ }
+ return null;
+ }
+
+ static String convertYesNoToBoolean( String value )
+ {
+ if ( value != null )
+ {
+ if ( "yes".equalsIgnoreCase( value ) )
+ {
+ return Boolean.TRUE.toString();
+ }
+ if ( "no".equalsIgnoreCase( value ) )
+ {
+ return Boolean.FALSE.toString();
+ }
+ }
+ return null;
+ }
+
+ static String invertBoolean( String stringValue )
+ {
+ if ( stringValue != null )
+ {
+ boolean booleanValue = Boolean.valueOf( stringValue ).booleanValue();
+ boolean invertedBooleanValue = !booleanValue;
+ return new Boolean( invertedBooleanValue ).toString();
+ }
+ return null;
+ }
+}
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PropertyUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/main/java/org/apache/maven/maven1converter/plugins/PropertyUtils.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/AbstractPCCTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/AbstractPCCTest.java?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/AbstractPCCTest.java (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/AbstractPCCTest.java Wed May 31 15:21:07 2006
@@ -0,0 +1,49 @@
+package org.apache.maven.maven1converter.plugins;
+
+/*
+ * Copyright 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.
+ */
+
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+
+import java.io.StringReader;
+import java.util.Properties;
+
+/**
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class AbstractPCCTest extends PlexusTestCase
+{
+ protected Xpp3Dom configuration;
+ protected AbstractPluginConfigurationConverter pluginConfigurationConverter;
+ protected Properties projectProperties;
+ protected org.apache.maven.model.v3_0_0.Model v3Model;
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ configuration = Xpp3DomBuilder.build( new StringReader( "<configuration></configuration>" ) );
+
+ projectProperties = new Properties();
+
+ v3Model = new org.apache.maven.model.v3_0_0.Model();
+ v3Model.setBuild( new org.apache.maven.model.v3_0_0.Build() );
+ }
+}
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/AbstractPCCTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/AbstractPCCTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCCompilerTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCCompilerTest.java?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCCompilerTest.java (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCCompilerTest.java Wed May 31 15:21:07 2006
@@ -0,0 +1,91 @@
+package org.apache.maven.maven1converter.plugins;
+
+/*
+ * Copyright 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.
+ */
+
+import junit.framework.Assert;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.IOException;
+
+/**
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCCompilerTest extends AbstractPCCTest
+{
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ pluginConfigurationConverter = new PCCCompiler();
+ }
+
+ public void testBuildConfiguration()
+ {
+ try
+ {
+ projectProperties.load( getClassLoader().getResourceAsStream( "PCCCompilerTest.properties" ) );
+
+ pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
+
+ String value = configuration.getChild( "debug" ).getValue();
+ Assert.assertEquals( "check debug value", "true", value );
+
+ value = configuration.getChild( "showDeprecation" ).getValue();
+ Assert.assertEquals( "check deprecation value", "false", value );
+
+ value = configuration.getChild( "encoding" ).getValue();
+ Assert.assertEquals( "check encoding value", "UTF-8", value );
+
+ value = configuration.getChild( "executable" ).getValue();
+ Assert.assertEquals( "check executable value", "/usr/java/bin/javac-2", value );
+
+ value = configuration.getChild( "fork" ).getValue();
+ Assert.assertEquals( "check fork value", "true", value );
+
+ value = configuration.getChild( "meminitial" ).getValue();
+ Assert.assertEquals( "check meminitial value", "10m", value );
+
+ value = configuration.getChild( "maxmem" ).getValue();
+ Assert.assertEquals( "check maxmem value", "20m", value );
+
+ value = configuration.getChild( "optimize" ).getValue();
+ Assert.assertEquals( "check optimize value", "false", value );
+
+ value = configuration.getChild( "showWarnings" ).getValue();
+ Assert.assertEquals( "check showWarnings value", "false", value );
+
+ value = configuration.getChild( "source" ).getValue();
+ Assert.assertEquals( "check source value", "1.3", value );
+
+ value = configuration.getChild( "target" ).getValue();
+ Assert.assertEquals( "check target value", "1.1", value );
+
+ value = configuration.getChild( "verbose" ).getValue();
+ Assert.assertEquals( "check verbose value", "false", value );
+ }
+ catch ( MojoExecutionException e )
+ {
+ Assert.fail();
+ }
+ catch ( IOException e )
+ {
+ Assert.fail( "Unable to find the requested resource." );
+ }
+ }
+}
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCCompilerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCCompilerTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCSurefireTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCSurefireTest.java?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCSurefireTest.java (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCSurefireTest.java Wed May 31 15:21:07 2006
@@ -0,0 +1,156 @@
+package org.apache.maven.maven1converter.plugins;
+
+/*
+ * Copyright 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.
+ */
+
+import junit.framework.Assert;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.io.IOException;
+
+/**
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCSurefireTest extends AbstractPCCTest
+{
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ pluginConfigurationConverter = new PCCSurefire();
+ }
+
+ public void testBuildConfiguration()
+ {
+ try
+ {
+ projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest1.properties" ) );
+
+ pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
+
+ String value = configuration.getChild( "reportFormat" ).getValue();
+ Assert.assertEquals( "check reportFormat value", "xml", value );
+
+ value = configuration.getChild( "jvm" ).getValue();
+ Assert.assertEquals( "check jvm value", "java", value );
+
+ value = configuration.getChild( "argLine" ).getValue();
+ Assert.assertEquals( "check argLine value", "-Xmx160m -verbose", value );
+
+ value = configuration.getChild( "printSummary" ).getValue();
+ Assert.assertEquals( "check printSummary value", "false", value );
+
+ Xpp3Dom systemProperties = configuration.getChild( "systemProperties" );
+ if ( systemProperties.getChildCount() == 2 )
+ {
+ Xpp3Dom systemPropertyOne = systemProperties.getChild( 0 );
+ Assert.assertEquals( "check systemProperties/prop1 name", "prop1", systemPropertyOne.getName() );
+ Assert.assertEquals( "check systemProperties/prop1 value", "your value", systemPropertyOne.getValue() );
+
+ Xpp3Dom systemPropertyTwo = systemProperties.getChild( 1 );
+ Assert.assertEquals( "check systemProperties/prop2 name", "basedir", systemPropertyTwo.getName() );
+ Assert.assertEquals( "check systemProperties/prop2 value", "${basedir}", systemPropertyTwo.getValue() );
+ }
+ else
+ {
+ Assert.fail( "Wrong number of system properties" );
+ }
+
+ value = configuration.getChild( "useFile" ).getValue();
+ Assert.assertEquals( "check useFile value", "false", value );
+
+ value = configuration.getChild( "testFailureIgnore" ).getValue();
+ Assert.assertEquals( "check testFailureIgnore value", "true", value );
+
+ value = configuration.getChild( "skip" ).getValue();
+ Assert.assertEquals( "check skip value", "true", value );
+ }
+ catch ( MojoExecutionException e )
+ {
+ Assert.fail();
+ }
+ catch ( IOException e )
+ {
+ Assert.fail( "Unable to find the requested resource." );
+ }
+ }
+
+ public void testBuildConfigurationFork1()
+ {
+ try
+ {
+ projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest1.properties" ) );
+
+ pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
+
+ String value = configuration.getChild( "forkMode" ).getValue();
+ Assert.assertEquals( "check forkMode value", "once", value );
+ }
+ catch ( MojoExecutionException e )
+ {
+ Assert.fail();
+ }
+ catch ( IOException e )
+ {
+ Assert.fail( "Unable to find the requested resource." );
+ }
+ }
+
+ public void testBuildConfigurationFork2()
+ {
+ try
+ {
+ projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest2.properties" ) );
+
+ pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
+
+ String value = configuration.getChild( "forkMode" ).getValue();
+ Assert.assertEquals( "check forkMode value", "once", value );
+ }
+ catch ( MojoExecutionException e )
+ {
+ Assert.fail();
+ }
+ catch ( IOException e )
+ {
+ Assert.fail( "Unable to find the requested resource." );
+ }
+ }
+
+ public void testBuildConfigurationFork3()
+ {
+ try
+ {
+ projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest3.properties" ) );
+
+ pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
+
+ String value = configuration.getChild( "forkMode" ).getValue();
+ Assert.assertEquals( "check forkMode value", "perTest", value );
+ }
+ catch ( MojoExecutionException e )
+ {
+ Assert.fail();
+ }
+ catch ( IOException e )
+ {
+ Assert.fail( "Unable to find the requested resource." );
+ }
+ }
+}
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCSurefireTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCSurefireTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PropertyUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PropertyUtilsTest.java?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PropertyUtilsTest.java (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PropertyUtilsTest.java Wed May 31 15:21:07 2006
@@ -0,0 +1,57 @@
+package org.apache.maven.maven1converter.plugins;
+
+/*
+ * Copyright 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.
+ */
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PropertyUtilsTest extends TestCase
+{
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+ }
+
+ public void testConvertOnOffToBoolean()
+ {
+ Assert.assertEquals( null, PropertyUtils.convertOnOffToBoolean( null ) );
+ Assert.assertEquals( null, PropertyUtils.convertOnOffToBoolean( "someValue" ) );
+ Assert.assertEquals( "true", PropertyUtils.convertOnOffToBoolean( "on" ) );
+ Assert.assertEquals( "false", PropertyUtils.convertOnOffToBoolean( "OFF" ) );
+ }
+
+ public void testConvertYesNoToBoolean()
+ {
+ Assert.assertEquals( null, PropertyUtils.convertYesNoToBoolean( null ) );
+ Assert.assertEquals( null, PropertyUtils.convertYesNoToBoolean( "someValue" ) );
+ Assert.assertEquals( "true", PropertyUtils.convertYesNoToBoolean( "yes" ) );
+ Assert.assertEquals( "false", PropertyUtils.convertYesNoToBoolean( "NO" ) );
+ }
+
+ public void testInvertBoolean()
+ {
+ Assert.assertEquals( null, PropertyUtils.invertBoolean( null ) );
+ Assert.assertEquals( "true", PropertyUtils.invertBoolean( "someValue" ) );
+ Assert.assertEquals( "true", PropertyUtils.invertBoolean( "false" ) );
+ Assert.assertEquals( "false", PropertyUtils.invertBoolean( "true" ) );
+ }
+}
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PropertyUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PropertyUtilsTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCCompilerTest.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCCompilerTest.properties?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCCompilerTest.properties (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCCompilerTest.properties Wed May 31 15:21:07 2006
@@ -0,0 +1,26 @@
+# Copyright 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.
+
+maven.compile.debug=on
+maven.compile.deprecation=off
+maven.compile.encoding=UTF-8
+maven.compile.executable=/usr/java/bin/javac-2
+maven.compile.fork=yes
+maven.compile.memoryInitialSize=10m
+maven.compile.memoryMaximumSize=20m
+maven.compile.nowarn=On
+maven.compile.optimize=Off
+maven.compile.source=1.3
+maven.compile.target=1.1
+maven.compile.verbose=No
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCCompilerTest.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCCompilerTest.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest1.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest1.properties?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest1.properties (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest1.properties Wed May 31 15:21:07 2006
@@ -0,0 +1,25 @@
+# Copyright 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.
+
+maven.junit.fork=yes
+maven.junit.format=xml
+maven.junit.jvm=java
+maven.junit.jvmargs=-Xmx160m -verbose
+maven.junit.printSummary=false
+maven.junit.sysproperties=prop1 basedir
+prop1=your value
+basedir=${basedir}
+maven.junit.usefile=false
+maven.test.failure.ignore=true
+maven.test.skip=true
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest1.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest1.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest2.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest2.properties?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest2.properties (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest2.properties Wed May 31 15:21:07 2006
@@ -0,0 +1,15 @@
+# Copyright 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.
+
+maven.junit.forkmode=once
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest2.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest2.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest3.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest3.properties?rev=410688&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest3.properties (added)
+++ maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest3.properties Wed May 31 15:21:07 2006
@@ -0,0 +1,15 @@
+# Copyright 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.
+
+maven.junit.forkmode=perTest
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest3.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCSureFireTest3.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"