Author: dennisl Date: Fri Jun 16 15:01:40 2006 New Revision: 414939 URL: http://svn.apache.org/viewvc?rev=414939&view=rev Log: Add tests for the PluginConfigurationConverter for maven-war-plugin
Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCWarTest.java (with props) maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest1.properties (with props) maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest2.properties (with props) maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest3.properties (with props) Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCWarTest.java URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCWarTest.java?rev=414939&view=auto ============================================================================== --- maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCWarTest.java (added) +++ maven/sandbox/plugins/maven-maven1-plugin/src/test/java/org/apache/maven/maven1converter/plugins/PCCWarTest.java Fri Jun 16 15:01:40 2006 @@ -0,0 +1,107 @@ +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: PCCWarTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $ + */ +public class PCCWarTest extends AbstractPCCTest +{ + protected void setUp() + throws Exception + { + super.setUp(); + + pluginConfigurationConverter = new PCCWar(); + } + + public void testBuildConfiguration1() + { + try + { + projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest1.properties" ) ); + + pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties ); + + String value = configuration.getChild( "warSourceDirectory" ).getValue(); + Assert.assertEquals( "check warSourceDirectory value", "myWebappDirectory", value ); + + System.out.println( configuration ); + } + catch ( MojoExecutionException e ) + { + Assert.fail( e.getMessage() ); + } + catch ( IOException e ) + { + Assert.fail( "Unable to find the requested resource." ); + } + } + + public void testBuildConfiguration2() + { + try + { + projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest2.properties" ) ); + + pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties ); + + String value = configuration.getChild( "warSourceDirectory" ).getValue(); + Assert.assertEquals( "check warSourceDirectory value", "myWebappDirectory", value ); + + System.out.println( configuration ); + } + catch ( MojoExecutionException e ) + { + Assert.fail( e.getMessage() ); + } + catch ( IOException e ) + { + Assert.fail( "Unable to find the requested resource." ); + } + } + + public void testBuildConfiguration3() + { + try + { + projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest3.properties" ) ); + + pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties ); + + Xpp3Dom child = configuration.getChild( "warSourceDirectory" ); + Assert.assertEquals( "check warSourceDirectory element", null, child ); + + System.out.println( configuration ); + } + catch ( MojoExecutionException e ) + { + Assert.fail( e.getMessage() ); + } + 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/PCCWarTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest1.properties URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest1.properties?rev=414939&view=auto ============================================================================== --- maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest1.properties (added) +++ maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest1.properties Fri Jun 16 15:01:40 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.war.src=myWebappDirectory Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest1.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest2.properties URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest2.properties?rev=414939&view=auto ============================================================================== --- maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest2.properties (added) +++ maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest2.properties Fri Jun 16 15:01:40 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.war.src=${basedir}/myWebappDirectory Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest2.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest3.properties URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest3.properties?rev=414939&view=auto ============================================================================== --- maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest3.properties (added) +++ maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest3.properties Fri Jun 16 15:01:40 2006 @@ -0,0 +1,13 @@ +# 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. Propchange: maven/sandbox/plugins/maven-maven1-plugin/src/test/resources/PCCWarTest3.properties ------------------------------------------------------------------------------ svn:eol-style = native