From ae555005ab4de145107089eb7cdcacc3479a160b Mon Sep 17 00:00:00 2001 From: jvanzyl Date: Sat, 31 Jan 2004 05:53:40 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114645 13f79535-47bb-0310-9956-ffa450edef68 --- surefire/plugin.jelly | 9 +- surefire/project.xml | 20 --- .../maven/test/IsolatedClassLoader.class | Bin 864 -> 0 bytes .../maven/test/IsolatedClassLoader.java | 59 -------- .../apache/maven/test/TestRunnerBooter.class | Bin 3431 -> 0 bytes .../apache/maven/test/TestRunnerBooter.java | 130 ------------------ 6 files changed, 5 insertions(+), 213 deletions(-) delete mode 100644 surefire/src/main/org/apache/maven/test/IsolatedClassLoader.class delete mode 100644 surefire/src/main/org/apache/maven/test/IsolatedClassLoader.java delete mode 100644 surefire/src/main/org/apache/maven/test/TestRunnerBooter.class delete mode 100644 surefire/src/main/org/apache/maven/test/TestRunnerBooter.java diff --git a/surefire/plugin.jelly b/surefire/plugin.jelly index 35396f4f..8dc11c81 100644 --- a/surefire/plugin.jelly +++ b/surefire/plugin.jelly @@ -27,6 +27,8 @@ + diff --git a/surefire/project.xml b/surefire/project.xml index 07691cb4..e6bd3a36 100644 --- a/surefire/project.xml +++ b/surefire/project.xml @@ -18,30 +18,10 @@ - - junit - junit - 3.8.1 - - - maven - test-runner - 1.4 - - - maven - maven-model - 2.0-SNAPSHOT - maven maven-project 2.0-SNAPSHOT - - plexus - plexus - 0.14-SNAPSHOT - diff --git a/surefire/src/main/org/apache/maven/test/IsolatedClassLoader.class b/surefire/src/main/org/apache/maven/test/IsolatedClassLoader.class deleted file mode 100644 index ed2c88759befcafa9100be7bf8b3272b52618be8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 864 zcmZuw&2JJx9DM@|Ted4LS_JAxOKUAGZPzx&L@{0(o0tHHqFy|0*%8;kF4RB*et!A_UZN-iZhcsargeS@hs z#&c~}WVXLEoE diff --git a/surefire/src/main/org/apache/maven/test/IsolatedClassLoader.java b/surefire/src/main/org/apache/maven/test/IsolatedClassLoader.java deleted file mode 100644 index 085fddf6..00000000 --- a/surefire/src/main/org/apache/maven/test/IsolatedClassLoader.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.maven.test; - -import java.net.URLClassLoader; -import java.net.URL; - -/** - * - * - * @author Jason van Zyl - * - * @version $Id: IsolatedClassLoader.java,v 1.1 2004/01/09 16:22:59 jvanzyl Exp $ - */ -public class IsolatedClassLoader - extends URLClassLoader -{ - private ClassLoader parent = ClassLoader.getSystemClassLoader(); - - public IsolatedClassLoader() - { - super( new URL[0], null ); - } - - public void addURL( URL url ) - { - super.addURL( url ); - } - - public synchronized Class loadClass( String className ) - throws ClassNotFoundException - { - Class c = findLoadedClass( className ); - - ClassNotFoundException ex = null; - - if ( c == null ) - { - try - { - c = findClass( className ); - } - catch ( ClassNotFoundException e ) - { - ex = e; - - if ( parent != null ) - { - c = parent.loadClass( className ); - } - } - } - - if ( c == null ) - { - throw ex; - } - - return c; - } -} diff --git a/surefire/src/main/org/apache/maven/test/TestRunnerBooter.class b/surefire/src/main/org/apache/maven/test/TestRunnerBooter.class deleted file mode 100644 index 506bc627deab49ce3357ed5e73d43139927d903c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3431 zcma)9X?qjb6@CXx9$B8S2uLA7SZq^o(gZ?NFfm=ansEDDb6YzxZ%O*&mD$n@@ zo)NhP9gE_?vq^jq&n598d{~y}llTZeDvXbHIOG5dwEa!E+ph2&A?wl$F8un#fZ^pDLR$*3|WouqJW}Rn_M>0n>qzWa=_j~88 zd8^lUdr#RVrD0Q6_GZa)X3P`9r(oB_q7%%jz%FRm(sHO8*rndA?bG0n7P6e}4bNs> ztEfB;oyTm)4j$If(LZojL+pfGq^S*A+flh{c}jVc)|41e`YNdVr=hR^e+MDjbhV%g z)j*CvzEDt=z;+#9$5%9LX3PcU`zKXJIYs3ZY~^bh|3CD$TMm>Tn4`X1vI13X3GV2? zSsht%YC00~Jl8YubzC&?7``FPaRVb@S_j%{WUU}|eAB?U zaLK^8afygeS-vXTRQnxV)bU*d-^2HH{J_8u@goC2#!oaDp+~lBMgbl%XWg+;qt;SS53=$^tRxEYFW#(+_42XATer8u=-HX5iX}i;4=kt9 zmdmKJX|pTLcQETR>_=PuuIKeai=9yKsJn6UylR)IZ4U!%D~K|` zK_xSkp!Ci+;xhm$JHrVjWi9}$sjneKmAlta*$|1ejyi=>wI~B6)kuTP2vcSRm55<> zM_puFv!_ZI0oT1kOHYmHGrkHV2?-x4zCq2Xb^%Z|gn zWyhhuvWxSLUt6vxD7lMIjnDYt5<0K&MZ-z1ogq<}kK+_q5#2{)>x4HrbPak_R&KLE z58~*hjo0}C3Iy6Uxr>ovWD)llrdbxJMb=qbm`8&g!)#B-udUSydKv0U6%x1zH_tb z`+juM&S@rmlK!8=4*n|a#|4=DbvcG9mQaz@*%d#tl;Rzv?&m@N2}ud12A83|n7x6H dJUxvqA^sX;lE~uZw-)BfdYx-{g8X$D|1WZxqtpNZ diff --git a/surefire/src/main/org/apache/maven/test/TestRunnerBooter.java b/surefire/src/main/org/apache/maven/test/TestRunnerBooter.java deleted file mode 100644 index 21dc8093..00000000 --- a/surefire/src/main/org/apache/maven/test/TestRunnerBooter.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.apache.maven.test; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Dependency; -import org.apache.maven.project.Project; -import org.codehaus.plexus.util.DirectoryScanner; -import org.codehaus.plexus.util.StringUtils; - -import java.io.File; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.util.Iterator; -import java.util.List; - -public class TestRunnerBooter -{ - private Project project; - - public void setProject( Project project ) - { - this.project = project; - } - - public void execute() - throws Exception - { - // maven.build.dest - // maven.test.dest - - IsolatedClassLoader classLoader = new IsolatedClassLoader(); - - File basedir = project.getFile().getParentFile(); - - System.setProperty( "basedir", basedir.getPath() ); - - Thread.currentThread().setContextClassLoader( classLoader ); - - String mavenRepoLocal = project.getProperty( "maven.repo.local" ); - - classLoader.addURL( new File ( mavenRepoLocal, "junit/jars/junit-3.8.1.jar" ).toURL() ); - - classLoader.addURL( new File ( mavenRepoLocal, "maven/jars/surefire-runner-1.0.jar" ).toURL() ); - - classLoader.addURL( new File( basedir, "target/classes/" ).toURL() ); - - classLoader.addURL( new File( basedir, "target/test-classes/" ).toURL() ); - - processDependencies( project, classLoader ); - - String[] tests = collectTests( basedir, - project.getBuild().getUnitTest().getIncludes(), - project.getBuild().getUnitTest().getExcludes() ); - - Class testRunnerClass = classLoader.loadClass( "org.apache.maven.test.TestRunner" ); - - Object testRunner = testRunnerClass.newInstance(); - - Method m = testRunnerClass.getMethod( "runTestClasses", new Class[] { - ClassLoader.class, - String[].class - } ); - - m.invoke( testRunner, new Object[]{ - classLoader, - tests - } ); - } - - // We need to deal with populating a plugin classloader with its requirements. - private void processDependencies( Project project, IsolatedClassLoader classLoader ) - throws MalformedURLException - { - if ( project.getArtifacts() == null ) - { - return; - } - - for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); ) - { - Artifact artifact = (Artifact) i.next(); - - Dependency dependency = artifact.getDependency(); - - // Only add compile type dependencies to classloader - if ( dependency.getType().equals( "jar" ) ) - { - // We have the jar and the classloader to push it into so - // lets do it! - if ( artifact.exists() ) - { - classLoader.addURL( artifact.getFile().toURL() ); - } - } - } - } - - public String[] collectTests( File basedir, List includes, List excludes ) - throws Exception - { - DirectoryScanner scanner = new DirectoryScanner(); - - scanner.setBasedir( new File( basedir, "target/test-classes" ) ); - - String[] incs = new String[includes.size()]; - - for ( int i = 0; i < incs.length; i++ ) - { - incs[i] = StringUtils.replace( (String) includes.get( i ), "java", "class" ); - } - - scanner.setIncludes( incs ); - - String[] excls = new String[excludes.size() + 1]; - - for ( int i = 0; i < excls.length - 1; i++ ) - { - excls[i] = StringUtils.replace( (String) excludes.get( i ), "java", "class" ); - } - - // Exclude inner classes - - excls[excludes.size()] = "**/*$*"; - - scanner.setExcludes( excls ); - - scanner.scan(); - - return scanner.getIncludedFiles(); - } -}