Author: sisbell Date: Fri Nov 30 11:17:48 2007 New Revision: 599918 URL: http://svn.apache.org/viewvc?rev=599918&view=rev Log: Fixed broken unit test for testing mono gac assemblies.
Modified: 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/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java 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=599918&r1=599917&r2=599918&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 Fri Nov 30 11:17:48 2007 @@ -166,7 +166,6 @@ if ( gacRoot != null ) { - System.out.println( gacRoot ); setArtifactGacFile( gacRoot, dependentArtifact ); libraryDependencies.add( dependentArtifact ); } @@ -256,23 +255,24 @@ this.assemblyExistsCheck = true; } - private static String getGacRootForMono() + private String getGacRootForMono() throws PlatformUnsupportedException { - String path = System.getenv( "PATH" ); + String path = System.getProperty( "PATH" ) != null ? System.getProperty( "PATH" ) : System.getenv( "PATH" ); if ( path != null ) { String[] tokens = path.split( System.getProperty( "path.separator" ) ); for ( String token : tokens ) { File gacRoot = new File( new File( token ).getParentFile(), "lib/mono/gac/" ); - if ( gacRoot.exists() ) + if ( ( !assemblyExistsCheck && !gacRoot.exists() ) || gacRoot.exists() ) { return gacRoot.getAbsolutePath(); } } } - String monoRoot = System.getenv( "MONO_ROOT" ); + String monoRoot = System.getProperty( "MONO_ROOT" ) != null ? System.getProperty( "MONO_ROOT" ) + : System.getenv( "MONO_ROOT" ); if ( monoRoot != null && !new File( monoRoot ).exists() ) { //logger.warn( "MONO_ROOT has been incorrectly set. Trying /usr : MONO_ROOT = " + monoRoot ); Modified: 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=599918&r1=599917&r2=599918&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java Fri Nov 30 11:17:48 2007 @@ -162,11 +162,10 @@ } @Test - public void testInit_WithGacGenericAndNovell() + public void testInit_WithGacGenericAndNovellAndPath() throws PlatformUnsupportedException { - System.getenv().clear(); - + System.setProperty( "PATH", "C:\\Program Files\\Mono\\bin" ); DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl(); MavenProject project = new MavenProject(); @@ -183,28 +182,14 @@ ctx.turnOffAssemblyExistsCheck(); DotnetCompilerConfig compilerConfig = getDefaultDotnetCompilerConfig(); - compilerConfig.setVendor( Vendor.NOVELL); + compilerConfig.setVendor( Vendor.NOVELL ); ctx.init( project, compilerConfig ); Set<Artifact> libraries = ctx.getLibraryDependencies(); assertThat( libraries.size(), equalTo( 1 ) ); - assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(), - CoreMatchers.allOf( new BaseMatcher() - { - private String containsString = - "assembly\\GAC_MSIL\\artifactId\\1.0__dsfajkdsfajdfs\\artifactId.dll"; - - public boolean matches( Object object ) - { - return ( (String) object ).contains( containsString ); - } - - public void describeTo( org.hamcrest.Description description ) - { - description.appendText( "Contains = " + containsString ); - } - } ) ); + assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(), equalTo( + "C:\\Program Files\\Mono\\lib\\mono\\gac\\artifactId\\1.0__dsfajkdsfajdfs\\artifactId.dll" ) ); } private static DotnetCompilerConfig getDefaultDotnetCompilerConfig()