Author: dennisl Date: Sun Jun 15 05:29:10 2008 New Revision: 667949 URL: http://svn.apache.org/viewvc?rev=667949&view=rev Log: [MSHARED-48] Add support for Jalopy plugin
Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJalopy.java (with props) maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JalopyPluginRelocator.java (with props) maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJalopyTest.java (with props) maven/shared/trunk/maven-model-converter/src/test/resources/PCCJalopyTest.properties (with props) Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJalopy.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJalopy.java?rev=667949&view=auto ============================================================================== --- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJalopy.java (added) +++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJalopy.java Sun Jun 15 05:29:10 2008 @@ -0,0 +1,72 @@ +package org.apache.maven.model.converter.plugins; + +/* + * 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. + */ + +import org.apache.maven.model.converter.ProjectConverterException; +import org.codehaus.plexus.util.xml.Xpp3Dom; + +import java.util.Properties; +import java.util.StringTokenizer; + +/** + * A <code>PluginConfigurationConverter</code> for the Jalopy plugin. + * + * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="jalopy" + * + * @author Dennis Lundberg + * @version $Id: PCCPmd.java 661727 2008-05-30 14:21:49Z bentmann $ + */ +public class PCCJalopy + extends AbstractPluginConfigurationConverter +{ + /** + * @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId() + */ + public String getArtifactId() + { + return "jalopy-maven-plugin"; + } + + public String getType() + { + return TYPE_BUILD_PLUGIN; + } + + protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model, + Properties projectProperties ) + throws ProjectConverterException + { + addConfigurationChild( configuration, projectProperties, "maven.jalopy.fileFormat", "fileFormat" ); + + addConfigurationChild( configuration, projectProperties, "maven.jalopy.style", "convention" ); + + addConfigurationChild( configuration, projectProperties, "maven.jalopy.history", "history" ); + + addConfigurationChild( configuration, projectProperties, "maven.jalopy.failOnError", "failOnError" ); + + addConfigurationChild( configuration, projectProperties, "maven.jalopy.src.filesetExclude", "srcExcludesPattern" ); + + addConfigurationChild( configuration, projectProperties, "maven.jalopy.src.filesetInclude", "srcIncludesPattern" ); + + addConfigurationChild( configuration, projectProperties, "maven.jalopy.test.filesetExclude", "testExcludesPattern" ); + + addConfigurationChild( configuration, projectProperties, "maven.jalopy.test.filesetInclude", "testIncludesPattern" ); + } +} \ No newline at end of file Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJalopy.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JalopyPluginRelocator.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JalopyPluginRelocator.java?rev=667949&view=auto ============================================================================== --- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JalopyPluginRelocator.java (added) +++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JalopyPluginRelocator.java Sun Jun 15 05:29:10 2008 @@ -0,0 +1,56 @@ +package org.apache.maven.model.converter.relocators; + +/* + * 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. + */ + +/** + * A <code>PluginRelocator</code> for the Jalopy plugin. + * + * @author Dennis Lundberg + * @version $Id: JdependPluginRelocator.java 661727 2008-05-30 14:21:49Z bentmann $ + * @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator" + * role-hint="jalopy" + */ +public class JalopyPluginRelocator + extends AbstractPluginRelocator +{ + /** + * @see AbstractPluginRelocator#getNewArtifactId() + */ + public String getNewArtifactId() + { + return "jalopy-maven-plugin"; + } + + /** + * @see AbstractPluginRelocator#getNewGroupId() + */ + public String getNewGroupId() + { + return "org.codehaus.mojo"; + } + + /** + * @see AbstractPluginRelocator#getOldArtifactId() + */ + public String getOldArtifactId() + { + return "maven-jalopy-plugin"; + } +} \ No newline at end of file Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JalopyPluginRelocator.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJalopyTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJalopyTest.java?rev=667949&view=auto ============================================================================== --- maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJalopyTest.java (added) +++ maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJalopyTest.java Sun Jun 15 05:29:10 2008 @@ -0,0 +1,84 @@ +package org.apache.maven.model.converter.plugins; + +/* + * 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. + */ + +import junit.framework.Assert; +import org.apache.maven.model.converter.ProjectConverterException; +import org.codehaus.plexus.util.xml.Xpp3Dom; + +import java.io.IOException; + +/** + * @author Dennis Lundberg + * @version $Id: PCCPmdTest.java 661727 2008-05-30 14:21:49Z bentmann $ + */ +public class PCCJalopyTest + extends AbstractPCCTest +{ + protected void setUp() + throws Exception + { + super.setUp(); + + pluginConfigurationConverter = new PCCJalopy(); + } + + public void testBuildConfiguration() + { + try + { + projectProperties.load( getClassLoader().getResourceAsStream( "PCCJalopyTest.properties" ) ); + + pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties ); + + String value = configuration.getChild( "convention" ).getValue(); + Assert.assertEquals( "check convention value", "jalopy_conventions.xml", value ); + + value = configuration.getChild( "failOnError" ).getValue(); + Assert.assertEquals( "check failOnError value", "false", value ); + + value = configuration.getChild( "fileFormat" ).getValue(); + Assert.assertEquals( "check fileFormat value", "UNIX", value ); + + value = configuration.getChild( "history" ).getValue(); + Assert.assertEquals( "check history value", "FILE", value ); + + value = configuration.getChild( "srcExcludesPattern" ).getValue(); + Assert.assertEquals( "check srcExcludesPattern value", "**/*Exclude.java", value ); + + value = configuration.getChild( "srcIncludesPattern" ).getValue(); + Assert.assertEquals( "check srcIncludesPattern value", "**/*.java", value ); + + value = configuration.getChild( "testExcludesPattern" ).getValue(); + Assert.assertEquals( "check testExcludesPattern value", "**/*Test.java", value ); + + value = configuration.getChild( "testIncludesPattern" ).getValue(); + Assert.assertEquals( "check testIncludesPattern value", "**/*TestCase.java", value ); + } + catch ( ProjectConverterException e ) + { + Assert.fail( e.getMessage() ); + } + catch ( IOException e ) + { + Assert.fail( "Unable to find the requested resource." ); + } + } +} \ No newline at end of file Propchange: maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJalopyTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/shared/trunk/maven-model-converter/src/test/resources/PCCJalopyTest.properties URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/test/resources/PCCJalopyTest.properties?rev=667949&view=auto ============================================================================== --- maven/shared/trunk/maven-model-converter/src/test/resources/PCCJalopyTest.properties (added) +++ maven/shared/trunk/maven-model-converter/src/test/resources/PCCJalopyTest.properties Sun Jun 15 05:29:10 2008 @@ -0,0 +1,25 @@ +# 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.jalopy.fileFormat=UNIX +maven.jalopy.style=jalopy_conventions.xml +maven.jalopy.history=FILE +maven.jalopy.failOnError=false +maven.jalopy.src.filesetInclude=**/*.java +maven.jalopy.src.filesetExclude=**/*Exclude.java +maven.jalopy.test.filesetInclude=**/*TestCase.java +maven.jalopy.test.filesetExclude=**/*Test.java Propchange: maven/shared/trunk/maven-model-converter/src/test/resources/PCCJalopyTest.properties ------------------------------------------------------------------------------ svn:eol-style = native