You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2008/03/13 20:46:50 UTC
svn commit: r636852 -
/maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/profiles/DefaultProfileManagerTest.java
Author: brianf
Date: Thu Mar 13 12:46:49 2008
New Revision: 636852
URL: http://svn.apache.org/viewvc?rev=636852&view=rev
Log:
MNG-3460: fixed unit test to not assume default local repo
Modified:
maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/profiles/DefaultProfileManagerTest.java
Modified: maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/profiles/DefaultProfileManagerTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/profiles/DefaultProfileManagerTest.java?rev=636852&r1=636851&r2=636852&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/profiles/DefaultProfileManagerTest.java (original)
+++ maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/profiles/DefaultProfileManagerTest.java Thu Mar 13 12:46:49 2008
@@ -20,11 +20,9 @@
*/
import java.io.File;
-import java.net.URL;
+import java.io.IOException;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.maven.model.Activation;
import org.apache.maven.model.ActivationOS;
import org.apache.maven.model.ActivationProperty;
@@ -32,7 +30,6 @@
import org.apache.maven.profiles.activation.ProfileActivationException;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.StringUtils;
public class DefaultProfileManagerTest
extends PlexusTestCase
@@ -242,7 +239,7 @@
}
public void testFileActivationProfile()
- throws ProfileActivationException
+ throws ProfileActivationException, IOException
{
Profile osActivated = new Profile();
osActivated.setId( "os-profile" );
@@ -251,20 +248,9 @@
org.apache.maven.model.ActivationFile activationFile = new org.apache.maven.model.ActivationFile();
- // convert the class into the path form of the classpath
- String classPathForm = "/" + TestCase.class.getName().replace( '.', '/' ) + ".class";
- // get the location to the class and convert to a string
- URL url = this.getClass().getResource( classPathForm );
-
- //take only the left part
- String[] parts = url.getPath().split( "!" );
-
- //remove file from the beginning.
- String path = StringUtils.stripStart( parts[0],"file://" );
-
- path = new File(path).getAbsolutePath();
- // Assume that junit exists in the local repo
- activationFile.setExists( path );
+ File f = File.createTempFile( "activationTest", null );
+ f.createNewFile();
+ activationFile.setExists( f.getAbsolutePath() );
fileActivation.setFile( activationFile );