Author: sisbell Date: Thu Nov 29 13:12:29 2007 New Revision: 599580 URL: http://svn.apache.org/viewvc?rev=599580&view=rev Log: Added Junit/surefire plugins and included some unit tests.
Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java (with props) incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java (with props) Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java?rev=599580&r1=599579&r2=599580&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java Thu Nov 29 13:12:29 2007 @@ -187,11 +187,6 @@ { throw new IllegalArgumentException("vendor"); } - - if(artifactType == null) - { - throw new IllegalArgumentException("artifactType"); - } } public boolean equals( Object o ) Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java?rev=599580&r1=599579&r2=599580&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java Thu Nov 29 13:12:29 2007 @@ -108,12 +108,12 @@ { if(project == null) { - throw new IllegalArgumentException("mavenProject"); + throw new IllegalArgumentException("NMAVEN-061-000: mavenProject"); } if(compilerConfig == null) { - throw new IllegalArgumentException("compilerConfig"); + throw new IllegalArgumentException("NMAVEN-061-001: compilerConfig"); } this.project = project; @@ -226,7 +226,7 @@ if ( icons.length > 1 ) { throw new PlatformUnsupportedException( - "NMAVEN-061-007: There is more than one win32icon in resource directory: Number = " + icons + "NMAVEN-061-002: There is more than one win32icon in resource directory: Number = " + icons .length ); } if ( icons.length == 1 ) @@ -269,7 +269,7 @@ else { throw new PlatformUnsupportedException( - "NMAVEN-061-008: Could not locate Global Assembly Cache for Mono. Try setting the MONO_ROOT environmental variable." ); + "NMAVEN-061-003: Could not locate Global Assembly Cache for Mono. Try setting the MONO_ROOT environmental variable." ); } } @@ -281,7 +281,7 @@ if ( !gacFile.exists() ) { throw new PlatformUnsupportedException( - "NMAVEN-000-000: Could not find GAC dependency: File = " + gacFile.getAbsolutePath() ); + "NMAVEN-061-004: Could not find GAC dependency: File = " + gacFile.getAbsolutePath() ); } artifact.setFile( gacFile ); } Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java?rev=599580&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java Thu Nov 29 13:12:29 2007 @@ -0,0 +1,120 @@ +package org.apache.maven.dotnet.compiler; + +import org.junit.Test; + +import java.io.File; + +public class NetCompilerConfigTest +{ + @Test + public void verifyCompilerConfig() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithNullArtifactType() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setArtifactType( null ); + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithNullCompilerPlatformVersion() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setCompilerPlatformVersion( null); + + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithNullLocalRepository() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setLocalRepository( null); + + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithNullProgrammingLanguage() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setProgrammingLanguage( null); + + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithNullSourceDirectory() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setSourceDirectory( null); + + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithMissingSourceDirectory() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setSourceDirectory( new File("/" + Math.random())); + + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithNullTargetDirectory() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setTargetDirectory( null); + + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithMissingTargetDirectory() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setTargetDirectory( new File("/" + Math.random())); + + config.verifyCompilerConfig(); + } + + @Test(expected = IllegalArgumentException.class) + public void verifyCompilerConfig_WithNullVendor() + throws IllegalArgumentException + { + DotnetCompilerConfig config = getDefaultDotnetCompilerConfig(); + config.setVendor( null); + + config.verifyCompilerConfig(); + } + + private static DotnetCompilerConfig getDefaultDotnetCompilerConfig() + { + DotnetCompilerConfig config = DotnetCompilerConfig.Factory.createDefaultExecutableConfig(); + config.setArtifactType( ArtifactType.LIBRARY ); + config.setCompilerPlatformVersion( DotnetCompilerPlatformVersion.VERSION_2_0_50727 ); + config.setLocalRepository( new File( "." ) ); + config.setProgrammingLanguage( ProgrammingLanguage.C_SHARP ); + config.setSourceDirectory( new File( "." ) ); + config.setTargetDirectory( new File( "." ) ); + config.setTestCompile( false ); + config.setVendor( Vendor.MICROSOFT ); + + return config; + } +} Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java?rev=599580&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java Thu Nov 29 13:12:29 2007 @@ -0,0 +1,57 @@ +package org.apache.maven.dotnet.compiler.impl; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.Build; +import org.apache.maven.dotnet.compiler.DotnetCompilerConfig; +import org.apache.maven.dotnet.compiler.PlatformUnsupportedException; +import org.junit.Test; + +import java.util.HashSet; +import java.util.Set; + +public class DotnetCompilerContextImplTest +{ + @Test(expected = IllegalArgumentException.class) + public void init_WithNullProject() + throws PlatformUnsupportedException + { + DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl(); + DotnetCompilerConfig compilerConfig = DotnetCompilerConfig.Factory.createDefaultExecutableConfig(); + + ctx.init( null, compilerConfig ); + + } + + @Test(expected = IllegalArgumentException.class) + public void init_WithNullCompilerConfig() + throws PlatformUnsupportedException + { + DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl(); + ctx.init( new MavenProject(), null ); + + } + + public void testInit() + { + DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl(); + MavenProject project = new MavenProject(); + Set<Artifact> dependencyArtifacts = new HashSet<Artifact>(); + project.setDependencyArtifacts( dependencyArtifacts ); + + Build build = new Build(); + build.setDirectory( "" ); + project.setBuild( build ); + + DotnetCompilerConfig compilerConfig = DotnetCompilerConfig.Factory.createDefaultExecutableConfig(); + + try + { + ctx.init( project, compilerConfig ); + } + catch ( PlatformUnsupportedException e ) + { + e.printStackTrace(); + } + } +} Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml?rev=599580&r1=599579&r2=599580&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml Thu Nov 29 13:12:29 2007 @@ -33,5 +33,20 @@ <description>NMaven provides Maven 2.x plugins to support building of .NET applications</description> <modules> <module>dotnet-compiler</module> - </modules> + </modules> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.3</version> + </plugin> + </plugins> + </build> </project>