You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by lc...@apache.org on 2012/05/16 13:26:59 UTC
svn commit: r1339157 - in /incubator/npanday/trunk:
components/dotnet-packaging/src/main/java/npanday/packaging/
plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/
plugins/maven-test-plugin/ plugins/maven-test-plugin/src/main/java/npa...
Author: lcorneliussen
Date: Wed May 16 13:26:59 2012
New Revision: 1339157
URL: http://svn.apache.org/viewvc?rev=1339157&view=rev
Log:
[NPANDAY-567] Copy along app.config (and transform with app.test.config) for test runs
o initial commit
o make config-file-scanner case-insensitive (app.config == App.config)
o prepare for splitting up in test runner in multiple mojos
Added:
incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandayMojo.java
- copied, changed from r1332286, incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandayMojo.java
incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandaySettingsAwareMojo.java
- copied, changed from r1332286, incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandaySettingsAwareMojo.java
incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractTestrelatedMojo.java
incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/ProcessTestConfigsMojo.java
- copied, changed from r1332286, incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/ProcessAppConfigsMojo.java
Modified:
incubator/npanday/trunk/components/dotnet-packaging/src/main/java/npanday/packaging/ConfigFileHandler.java
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy
incubator/npanday/trunk/plugins/maven-test-plugin/pom.xml
incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java
Modified: incubator/npanday/trunk/components/dotnet-packaging/src/main/java/npanday/packaging/ConfigFileHandler.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-packaging/src/main/java/npanday/packaging/ConfigFileHandler.java?rev=1339157&r1=1339156&r2=1339157&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-packaging/src/main/java/npanday/packaging/ConfigFileHandler.java (original)
+++ incubator/npanday/trunk/components/dotnet-packaging/src/main/java/npanday/packaging/ConfigFileHandler.java Wed May 16 13:26:59 2012
@@ -157,6 +157,7 @@ public class ConfigFileHandler
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( baseDir );
scanner.setIncludes( includes );
+ scanner.setCaseSensitive( false );
List<String> excludesList = Lists.newArrayList(excludes);
excludesList.addAll( Lists.newArrayList( DEFAULT_EXCLUDES ) );
Modified: incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy?rev=1339157&r1=1339156&r2=1339157&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy (original)
+++ incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy Wed May 16 13:26:59 2012
@@ -45,7 +45,9 @@ class CompileLifecycleMap extends Lifecy
def np_resgen_resx = "org.apache.npanday.plugins:maven-resgen-plugin:$npandayVersion:generate-existing-resx-to-resource"
def np_compile = "org.apache.npanday.plugins:maven-compile-plugin:$npandayVersion:compile"
def np_test_compile = "org.apache.npanday.plugins:maven-compile-plugin:$npandayVersion:testCompile"
+
def np_test = "org.apache.npanday.plugins:maven-test-plugin:$npandayVersion:test"
+ def np_test_configs = "org.apache.npanday.plugins:maven-test-plugin:$npandayVersion:process-test-configs"
def default_validate = [np_compile_init, np_generate_settings]
def default_generate_sources = [np_generate_assemblyinfo]
@@ -70,6 +72,7 @@ class CompileLifecycleMap extends Lifecy
b.process_resources (default_process_resources)
b.compile (np_compile)
b.test_compile (np_test_compile)
+ b.process_test_classes(np_test_configs)
b.test (np_test)
b.install (default_install)
b.deploy (mv_deploy)
@@ -81,6 +84,7 @@ class CompileLifecycleMap extends Lifecy
b.process_resources (default_process_resources)
b.compile (np_compile)
b.test_compile (np_test_compile)
+ b.process_test_classes(np_test_configs)
b.test (np_test)
b._package ("org.apache.npanday.plugins:maven-link-plugin:$npandayVersion:package")
b.install (default_install)
@@ -94,6 +98,7 @@ class CompileLifecycleMap extends Lifecy
b.process_resources (default_process_resources)
b.compile (np_compile, "org.apache.npanday.plugins:maven-aspx-plugin:$npandayVersion:compile")
b.test_compile (np_test_compile)
+ b.process_test_classes(np_test_configs)
b.test (np_test)
b._package ("org.apache.npanday.plugins:maven-aspx-plugin:$npandayVersion:package")
b.install (default_install)
@@ -107,6 +112,7 @@ class CompileLifecycleMap extends Lifecy
b.process_resources (default_process_resources)
b.compile (np_compile)
b.test_compile (np_test_compile)
+ b.process_test_classes(np_test_configs)
b.test (np_test)
b.install (default_install)
b._package ("org.apache.npanday.plugins:maven-mojo-generator-plugin:$npandayVersion:generate-bindings")
Modified: incubator/npanday/trunk/plugins/maven-test-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/pom.xml?rev=1339157&r1=1339156&r2=1339157&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-test-plugin/pom.xml (original)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/pom.xml Wed May 16 13:26:59 2012
@@ -35,5 +35,9 @@ under the License.
<artifactId>plexus-utils</artifactId>
<version>${plexus.utils.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.npanday</groupId>
+ <artifactId>dotnet-packaging</artifactId>
+ </dependency>
</dependencies>
</project>
Copied: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandayMojo.java (from r1332286, incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandayMojo.java)
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandayMojo.java?p2=incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandayMojo.java&p1=incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandayMojo.java&r1=1332286&r2=1339157&rev=1339157&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandayMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandayMojo.java Wed May 16 13:26:59 2012
@@ -17,7 +17,7 @@
* under the License.
*/
-package npanday.plugin.application;
+package npanday.plugin.test;
import com.google.common.base.Splitter;
import org.apache.maven.plugin.AbstractMojo;
@@ -26,6 +26,8 @@ import org.apache.maven.plugin.MojoFailu
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
+import java.io.File;
+
import static com.google.common.collect.Iterables.toArray;
/**
@@ -58,6 +60,14 @@ public abstract class AbstractNPandayMoj
*/
protected MavenProjectHelper projectHelper;
+ /**
+ * The local Maven repository.
+ *
+ * @parameter expression="${settings.localRepository}"
+ * @readonly
+ */
+ protected File localRepository;
+
public final void execute() throws MojoExecutionException, MojoFailureException
{
if ( skip )
Copied: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandaySettingsAwareMojo.java (from r1332286, incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandaySettingsAwareMojo.java)
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandaySettingsAwareMojo.java?p2=incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandaySettingsAwareMojo.java&p1=incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandaySettingsAwareMojo.java&r1=1332286&r2=1339157&rev=1339157&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/AbstractNPandaySettingsAwareMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractNPandaySettingsAwareMojo.java Wed May 16 13:26:59 2012
@@ -17,7 +17,7 @@
* under the License.
*/
-package npanday.plugin.application;
+package npanday.plugin.test;
import npanday.registry.RepositoryRegistry;
import npanday.vendor.SettingsUtil;
Added: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractTestrelatedMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractTestrelatedMojo.java?rev=1339157&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractTestrelatedMojo.java (added)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractTestrelatedMojo.java Wed May 16 13:26:59 2012
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package npanday.plugin.test;
+
+/**
+ * @author <a href="mailto:me@lcorneliussen.de>Lars Corneliussen, Faktum Software</a>
+ */
+public abstract class AbstractTestrelatedMojo
+ extends AbstractNPandaySettingsAwareMojo
+{
+ /**
+ * Test Assembly Location
+ *
+ * @parameter expression = "${testAssemblyPath}" default-value = "${project.build.directory}\\test-assemblies"
+ */
+ protected String testAssemblyPath;
+
+ /**
+ * The artifact acts as an Integration test project
+ *
+ * @parameter
+ */
+ protected boolean integrationTest;
+
+ protected String getTestFileName()
+ {
+ if (project == null)
+ throw new RuntimeException( "Project is null!!" );
+
+ return project.getArtifactId() + (integrationTest ? "":"-test") + ".dll";
+ }
+}
Copied: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/ProcessTestConfigsMojo.java (from r1332286, incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/ProcessAppConfigsMojo.java)
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/ProcessTestConfigsMojo.java?p2=incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/ProcessTestConfigsMojo.java&p1=incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/ProcessAppConfigsMojo.java&r1=1332286&r2=1339157&rev=1339157&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/application-maven-plugin/src/main/java/npanday/plugin/application/ProcessAppConfigsMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/ProcessTestConfigsMojo.java Wed May 16 13:26:59 2012
@@ -17,7 +17,7 @@
* under the License.
*/
-package npanday.plugin.application;
+package npanday.plugin.test;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
@@ -33,16 +33,16 @@ import java.io.File;
import java.util.List;
/**
- * Finds, transforms and copies arbitrary configuration files for packaging.
+ * Finds, transforms and copies arbitrary configuration files for testing.
*
*
* @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
- * @phase prepare-package
- * @goal process-configs
+ * @phase process-test-classes
+ * @goal process-test-configs
* @since 1.5.0-incubating
*/
-public class ProcessAppConfigsMojo
- extends AbstractNPandaySettingsAwareMojo
+public class ProcessTestConfigsMojo
+ extends AbstractTestrelatedMojo
{
/**
* The main configuration file (relative to the basedir)
@@ -53,7 +53,7 @@ public class ProcessAppConfigsMojo
*
* @parameter default-value="app.config"
*/
- private String appConfigFile;
+ private String testConfigFile;
/**
* By default this will be the ${artifactId}.${extension}.config; but in
@@ -65,13 +65,13 @@ public class ProcessAppConfigsMojo
/**
* The transformation to apply to the configurations
- * specified in {@link #appConfigFile} and {@link #additionalConfigIncludes}.
+ * specified in {@link #testConfigFile} and {@link #additionalConfigIncludes}.
*
* The Mojo will search for transformations by 'injecting' the
* configured hint between a file name and its extension:
* <code><file-name>.<transformation-hint>.<file-extension></code>.
*
- * @parameter default-value="package"
+ * @parameter default-value="test"
*/
private String transformationHint;
@@ -120,14 +120,6 @@ public class ProcessAppConfigsMojo
private File workingFolder;
/**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @required
- */
- protected MavenProject project;
-
- /**
* @component
*/
protected ConfigFileHandler configFileHandler;
@@ -147,19 +139,17 @@ public class ProcessAppConfigsMojo
super.innerExecute();
final List<String> excludes = Lists.newArrayList( additionalConfigExcludes );
- excludes.add( appConfigFile );
+ excludes.add( testConfigFile );
final String[] includes = additionalConfigIncludes;
- final File targetFolder = PathUtil.getPreparedPackageFolder( project );
+ final File targetFolder = new File( testAssemblyPath );
configFileHandler.setWorkingFolder( workingFolder );
- String extension = ArtifactType.getArtifactTypeForPackagingName( project.getPackaging() ).getExtension();
-
String targetConfigFileName = targetConfigFileNameOverride;
if ( Strings.isNullOrEmpty( targetConfigFileName ) )
{
- targetConfigFileName = project.getArtifactId() + "." + extension + ".config";
+ targetConfigFileName = getTestFileName() + ".config";
}
File targetConfigFile = new File(
@@ -169,7 +159,7 @@ public class ProcessAppConfigsMojo
final VendorRequirement vendorRequirement = getVendorRequirement();
configFileHandler.handleConfigFile(
- vendorRequirement, new File( project.getBasedir(), appConfigFile ), transformationHint, targetConfigFile
+ vendorRequirement, new File( project.getBasedir(), testConfigFile ), transformationHint, targetConfigFile
);
if ( includes.length > 0 )
Modified: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java?rev=1339157&r1=1339156&r2=1339157&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java (original)
+++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java Wed May 16 13:26:59 2012
@@ -59,28 +59,10 @@ import static com.google.common.base.Str
* @phase test
* @description Runs NUnit tests
*/
-public class TesterMojo extends AbstractMojo
+public class TesterMojo
+ extends AbstractTestrelatedMojo
{
/**
- * @parameter expression="${npanday.settings}" default-value="${user.home}/.m2"
- */
- private String settingsPath;
-
- /**
- * @component
- */
- private RepositoryRegistry repositoryRegistry;
-
- /**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- private MavenProject project;
-
- /**
* The home of nunit. Use this if you 1) have not added nunit to your path and you only have MS installed; or 2)
* have mono installed and want to use another version of nunit.
*
@@ -117,13 +99,6 @@ public class TesterMojo extends Abstract
private String reportsDirectory;
/**
- * Test Assembly Location
- *
- * @parameter expression = "${testAssemblyPath}" default-value = "${project.build.directory}\\test-assemblies"
- */
- private String testAssemblyPath;
-
- /**
* nUnitXmlFilePath
*
* @parameter default-value = "${project.build.directory}/nunit-reports/TEST-${project.build.finalName}.xml"
@@ -148,38 +123,11 @@ public class TesterMojo extends Abstract
private File nUnitResultErrorOutputPath;
/**
- * The local Maven repository.
- *
- * @parameter expression="${settings.localRepository}"
- * @readonly
- */
- private File localRepository;
-
- /**
- * The artifact acts as an Integration test project
- *
- * @parameter
- */
- protected boolean integrationTest;
-
- /**
* @component
*/
private StateMachineProcessor processor;
/**
- * The Vendor for the Compiler. Not case or white-space sensitive.
- *
- * @parameter expression="${vendor}"
- */
- private String vendor;
-
- /**
- * @parameter expression = "${vendorVersion}"
- */
- private String vendorVersion;
-
- /**
* Specify the name of the NUnit command to be run, from within the <i>nunitHome</i>/bin directory.
*
* @parameter
@@ -198,11 +146,6 @@ public class TesterMojo extends Abstract
/**
* @component
*/
- private NetExecutableFactory netExecutableFactory;
-
- /**
- * @component
- */
private NPandayDependencyResolution dependencyResolution;
private File getExecutableHome()
@@ -210,7 +153,6 @@ public class TesterMojo extends Abstract
return (nunitHome != null) ? new File(nunitHome, "bin") : null;
}
-
private List<String> getCommandsFor( )
{
String finalName = project.getBuild().getFinalName();
@@ -223,16 +165,8 @@ public class TesterMojo extends Abstract
- if(integrationTest)
- {
- // use the artifact itself if its an integration
- commands.add( testAssemblyPath + File.separator + project.getArtifactId() + ".dll" );
- }
- else
- {
- // if not use the commpiled test
- commands.add( testAssemblyPath + File.separator + project.getArtifactId() + "-test.dll" );
- }
+
+ commands.add( testAssemblyPath + File.separator + getTestFileName() );
String switchChar = "/";
commands.add( switchChar + "xml:" + nUnitXmlFilePath.getAbsolutePath() );
@@ -257,8 +191,8 @@ public class TesterMojo extends Abstract
return commands;
}
- public void execute()
- throws MojoExecutionException, MojoFailureException
+ @Override
+ protected void innerExecute() throws MojoExecutionException, MojoFailureException
{
String skipTests = System.getProperty( "maven.test.skip" );
if ( ( skipTests != null && skipTests.equalsIgnoreCase( "true" ) ) || skipTest )
@@ -267,8 +201,8 @@ public class TesterMojo extends Abstract
return;
}
- SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath );
-
+ super.innerExecute();
+
String testFileName = "";
if(integrationTest)