Author: lcorneliussen Date: Wed May 16 12:01:59 2012 New Revision: 1339128 URL: http://svn.apache.org/viewvc?rev=1339128&view=rev Log: [NPANDAY-231] Remove RDF
o fixed lib resolution in tests Modified: incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java Modified: incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java?rev=1339128&r1=1339127&r2=1339128&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java (original) +++ incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/PathUtil.java Wed May 16 12:01:59 2012 @@ -277,7 +277,7 @@ public final class PathUtil } catch ( IOException e ) { - throw new IOException( "Error on copying " + artifact + " to" + destination); + throw new IOException( "Error on copying " + artifact + " to " + destination); } } } 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=1339128&r1=1339127&r2=1339128&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 12:01:59 2012 @@ -20,6 +20,7 @@ package npanday.plugin.test; import npanday.ArtifactTypeHelper; +import npanday.LocalRepositoryUtil; import npanday.PathUtil; import npanday.PlatformUnsupportedException; import npanday.executable.CommandExecutor; @@ -28,9 +29,12 @@ import npanday.executable.ExecutionExcep import npanday.executable.NetExecutable; import npanday.executable.NetExecutableFactory; import npanday.registry.RepositoryRegistry; +import npanday.resolver.NPandayDependencyResolution; import npanday.vendor.SettingsUtil; import npanday.vendor.StateMachineProcessor; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -108,14 +112,14 @@ public class TesterMojo extends Abstract /** * Directory where reports are written. * - * @parameter expression = "${reportsDirectory}" default-value = "${project.build.directory}/nunit-reports" + * @parameter expression = "${reportsDirectory}" default-value = "${project.build.directory}\\nunit-reports" */ private String reportsDirectory; /** * Test Assembly Location * - * @parameter expression = "${testAssemblyPath}" default-value = "${project.build.directory}/test-assemblies" + * @parameter expression = "${testAssemblyPath}" default-value = "${project.build.directory}\\test-assemblies" */ private String testAssemblyPath; @@ -195,6 +199,11 @@ public class TesterMojo extends Abstract * @component */ private NetExecutableFactory netExecutableFactory; + + /** + * @component + */ + private NPandayDependencyResolution dependencyResolution; private File getExecutableHome() { @@ -278,11 +287,20 @@ public class TesterMojo extends Abstract return; } - // TODO: resolve dependencies with scope test here - getLog().warn( "NPANDAY-251: removed dependency resolution here!" ); - List<Artifact> nunitLibs = new ArrayList<Artifact>(); - Set<Artifact> artifacts = project.getDependencyArtifacts(); + Set<Artifact> artifacts; + try + { + artifacts = dependencyResolution.require( + project, LocalRepositoryUtil.create( localRepository ), new ScopeArtifactFilter( "test" ) + ); + } + catch ( ArtifactResolutionException e ) + { + throw new MojoExecutionException( + "NPANDAY-1100-009: dependency resolution for scope test failed!", e + ); + } for ( Artifact artifact : artifacts ) { @@ -291,29 +309,16 @@ public class TesterMojo extends Abstract continue; } - if ( artifact.getGroupId().equals( "NUnit" ) ) + try { - nunitLibs.add( artifact ); + PathUtil.copyPlainArtifactFileToDirectory( artifact, new File( testAssemblyPath ) ); } - else + catch ( IOException e ) { - try - { - PathUtil.copyPlainArtifactFileToDirectory( artifact, new File( testAssemblyPath ) ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "NPANDAY-1100-002: Error on copying artifact " + artifact.toString(), e ); - } + throw new MojoExecutionException( "NPANDAY-1100-002: Error on copying artifact " + artifact, e ); } } - if ( nunitLibs.size() == 0 ) - { - throw new MojoExecutionException( "NPANDAY-1100-003: Could not find any nunit libraries." ); - } - - // Copy Main Artifact try { if ( project.getArtifact() != null && project.getArtifact().getFile() != null @@ -326,8 +331,7 @@ public class TesterMojo extends Abstract { throw new MojoExecutionException( "NPANDAY-1100-004: Unable to copy library to target directory: ", e ); } - // TODO: Check timestamps - // Copy Test Artifact + try { FileUtils.copyFileToDirectory( new File( testFileName ), new File( testAssemblyPath ) ); @@ -337,22 +341,6 @@ public class TesterMojo extends Abstract throw new MojoExecutionException( "NPANDAY-1100-005: Unable to copy library to target directory: ", e ); } - // Copy NUnit Dependencies - for ( Artifact artifact : nunitLibs ) - { - File file = new File( testAssemblyPath + File.separator + artifact.getArtifactId() + ".dll" ); - try - { - FileUtils.copyFile( artifact.getFile(), file ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( - "NPANDAY-1100-006: Unable to copy nunit library to target directory: File = " - + file.getAbsolutePath(), e ); - } - } - FileUtils.mkdir( reportsDirectory );