From 1f6f58ed2549bf404b559797377dec140dedea52 Mon Sep 17 00:00:00 2001 From: vmassol Date: Sat, 22 Mar 2003 16:40:42 +0000 Subject: [PATCH] Remove sources as this is now provided by the Ant Integration Module in the Cactus project. Note: The Ant Integration does not yet have a scanner to automatically discover cactus tests but that will come soon) git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113172 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/cactus/CactusScanner.java | 270 ------------------ .../apache/maven/cactus/CactusScannerTag.java | 256 ----------------- .../apache/maven/cactus/CactusTagLibrary.java | 72 ----- .../apache/maven/cactus/DynamicTestAll.java | 130 --------- 4 files changed, 728 deletions(-) delete mode 100644 cactus/src/main/org/apache/maven/cactus/CactusScanner.java delete mode 100644 cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java delete mode 100644 cactus/src/main/org/apache/maven/cactus/CactusTagLibrary.java delete mode 100644 cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java diff --git a/cactus/src/main/org/apache/maven/cactus/CactusScanner.java b/cactus/src/main/org/apache/maven/cactus/CactusScanner.java deleted file mode 100644 index 7d2e60b4..00000000 --- a/cactus/src/main/org/apache/maven/cactus/CactusScanner.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.apache.maven.cactus; - -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache Maven" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache Maven", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * ==================================================================== - */ -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Path; -import org.apache.cactus.AbstractTestCase; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URLClassLoader; -import java.net.URL; -import java.lang.reflect.Modifier; -import java.lang.reflect.Method; - -/** - * Process {@link FileSet} and extracts classes that are Cactus tests. A - * class is considered to be a Cactus Test Case if: - * - * - * @author Vincent Massol - * @version $Id: CactusScanner.java,v 1.1 2003/01/24 03:44:39 jvanzyl Exp $ - */ -public class CactusScanner -{ - private Log log = LogFactory.getLog(CactusScanner.class); - - /** - * The Ant project - */ - private Project project; - - /** - * Lists of Cactus class names that were found in the {@link FileSet} - */ - private List cactusTests = new ArrayList(); - - public void setProject(Project project) - { - this.project = project; - } - - public void clear() - { - this.cactusTests.clear(); - } - - /** - * @return the list of valid Cactus test cases - */ - public Iterator iterator() { - return this.cactusTests.iterator(); - } - - /** - * Finds the Cactus test cases from a list of files. - * - * @param fs the list of files in which to look for Cactus tests - * @param classpath the classpaths needed to load the test classes - */ - public void processFileSet(FileSet fs, Path classpath) - { - DirectoryScanner ds = fs.getDirectoryScanner(this.project); - ds.scan(); - String[] files = ds.getIncludedFiles(); - - for (int i = 0; i < files.length; i++) - { - // The path is supposed to be a relative path that matches the - // package directory structure. Thus we only need to replace - // the directory separator char by a "." and remove the file - // extension to get the FQN java class name. - - // Is it a java class file? - if (files[i].endsWith(".class")) - { - String fqn = files[i] - .substring(0, files[i].length() - ".class".length()) - .replace(File.separatorChar, '.'); - - log.debug("Found candidate class: [" + fqn + "]"); - - // Is it a Cactus test case? - if (isCactusTestCase(fqn, classpath)) - { - log.debug("Found Cactus test case: [" + fqn + "]"); - this.cactusTests.add(fqn); - } - } - } - } - - /** - * @param className the fully qualified name of the class to check - * @param classpath the classpaths needed to load the test classes - * @return true if the class is a Cactus test case - */ - private boolean isCactusTestCase(String className, Path classpath) - { - Class clazz = loadClass(className, classpath); - if (clazz == null) - { - return false; - } - - Class abstractTestCaseClass = null; - try - { - abstractTestCaseClass = clazz.getClassLoader().loadClass( - AbstractTestCase.class.getName()); - } - catch (ClassNotFoundException e) - { - log.debug("Cannot load class", e); - return false; - } - - if (!abstractTestCaseClass.isAssignableFrom(clazz)) - { - log.debug("Not a Cactus test as class [" + className + "] does " - + "not inherit from [" + AbstractTestCase.class.getName() - + "]"); - return false; - } - - // the class must not be abstract - if (Modifier.isAbstract(clazz.getModifiers())) - { - log.debug("Not a Cactus test as class [" + className + "] is " - + "abstract"); - return false; - } - - // the class must have at least one test, i.e. a public method - // starting with "test" and that takes no parameters - boolean hasTestMethod = false; - Method[] methods = clazz.getMethods(); - for (int i = 0; i < methods.length; i++) - { - if (methods[i].getName().startsWith("test") - && (methods[i].getReturnType() == Void.TYPE) - && (methods[i].getParameterTypes().length == 0)) - { - hasTestMethod = true; - break; - } - } - - if (!hasTestMethod) - { - log.debug("Not a Cactus test as class [" + className + "] has " - + "no method that start with \"test\", returns void and has " - + "no parameters"); - return false; - } - - return true; - } - - /** - * @param className the fully qualified name of the class to check - * @param classpath the classpaths needed to load the test classes - * @return the class object loaded by reflection from its string name - */ - private Class loadClass(String className, Path classpath) - { - Class clazz = null; - try - { - clazz = createClassLoader(classpath).loadClass(className); - } - catch (ClassNotFoundException e) - { - log.error("Failed to load class [" + className + "]", e); - } - return clazz; - } - - /** - * @param classpath the classpaths needed to load the test classes - * @return a ClassLoader that has all the needed classpaths for loading - * the Cactus tests classes - */ - private ClassLoader createClassLoader(Path classpath) - { - URL[] urls = new URL[classpath.size()]; - - try - { - for (int i = 0; i < classpath.size(); i++) - { - log.debug("Adding [" - + new File(classpath.list()[i]).toURL() + "] " - + "to class loader classpath"); - urls[i] = new File(classpath.list()[i]).toURL(); - } - } - catch (MalformedURLException e) - { - log.debug("Invalid URL", e); - } - - return new URLClassLoader(urls); - } -} diff --git a/cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java b/cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java deleted file mode 100644 index d4c27862..00000000 --- a/cactus/src/main/org/apache/maven/cactus/CactusScannerTag.java +++ /dev/null @@ -1,256 +0,0 @@ -package org.apache.maven.cactus; - -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache Maven" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache Maven", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * ==================================================================== - */ -import java.lang.reflect.InvocationTargetException; - -import org.apache.commons.jelly.JellyTagException; -import org.apache.commons.jelly.TagSupport; -import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.MissingAttributeException; -import org.apache.commons.jelly.tags.ant.TaskSource; -import org.apache.commons.jelly.tags.ant.AntTagLibrary; -import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; - -/** - * Cactus Jelly Tag that scans Ant FileSets and return a list of - * qualified class name that are Cactus TestCases (i.e. - * ServletTestCase, JspTestCase or FilterTestCase) or subclasses - * of Cactus TestCases. - * - * Note: This is useful when used with the <junit> Ant - * task for example, in order to find out the list of tests to - * execute. - * - * @author Vincent Massol - * @version $Id: CactusScannerTag.java,v 1.2 2003/01/29 23:54:51 dion Exp $ - */ -public class CactusScannerTag extends TagSupport implements TaskSource -{ - private Log log = LogFactory.getLog(CactusScannerTag.class); - - /** - * The {@link CactusScanner} object that is exposed by this tag - * to the Jelly script. - */ - private CactusScanner cactusScanner; - - /** - * We need to save the fileset as its XML attributes are set after the - * fileset object is created and thus we need to wait until it is - * completely initialized before being able to process it using - * {@link CactusScanner#processFileSet}. - */ - private FileSet fileset; - - /** - * Nested <classpath> tag values. This is the classpath that will - * be used to dynamically load the test classes to decide whether they - * are Cactus tests or not. - * - * Note: There is a bug in Jelly and it does not work yet. ATM you should - * use the classpathref attribute instead. - */ - private Path classpath; - - /** - * Reference to an Ant {@link Path} object containing the classpath. - * @see #classpath - */ - private String classpathref; - - /** - * The Jelly variable (exposed to the Jelly script) that will - * contain a reference to the {@link CactusScanner} object. - */ - private String var; - - public CactusScannerTag() - { - this.cactusScanner = new CactusScanner(); - } - - /** - * @see TagSupport#doTag(XMLOutput) - */ - public void doTag(XMLOutput xmlOutput) throws JellyTagException - { - this.cactusScanner.setProject(AntTagLibrary.getProject(context)); - this.cactusScanner.clear(); - - // run the body first to configure the task via nested tags - invokeBody(xmlOutput); - - // Process the fileset to extract Cactus test cases. We need to pass - // the project dependency classpath as the CactusScanner will need - // to load the cactus test classes to decide whether they are Cactus - // test case or not and that needs the dependent jars to be in the - // classpath. - Path cp = this.classpath; - if (this.classpathref != null) - { - cp = (Path) AntTagLibrary.getProject( - context).getReference(this.classpathref); - } - - this.cactusScanner.processFileSet(this.fileset, cp); - - // output the cactusScanner - if ( var == null ) - { - throw new MissingAttributeException( "var" ); - } - context.setVariable(var, cactusScanner); - } - - /** - * This method is called internally by Jelly to know on which object to - * call the {@link TaskSource#setTaskProperty} method. - * - * @see TaskSource#getTaskObject() - */ - public Object getTaskObject() - { - return this; - } - - /** - * @see TaskSource#setTaskProperty(String, Object) - */ - public void setTaskProperty(String name, Object value) throws JellyTagException - { - try - { - BeanUtils.setProperty(this, name, value); - } - catch (IllegalAccessException anException) - { - throw new JellyTagException(anException); - } - catch (InvocationTargetException anException) - { - throw new JellyTagException(anException); - } - - } - - /** - * Adds a set of files (nested fileset attribute). This method is called - * dynamically by {@link #setTaskProperty}. - */ - public void addFileset(FileSet set) - { - log.debug("Adding fileset [" + set + "]"); - this.fileset = set; - } - - public Path createClasspath() - { - log.debug("Creating classpath"); - if (this.classpath == null) - { - this.classpath = new Path(AntTagLibrary.getProject(context)); - } - return this.classpath.createPath(); - } - - public Path getClasspath() - { - return this.classpath; - } - - public void setClasspath(Path classpath) - { - log.debug("Setting classpath [" + classpath + "]"); - if (this.classpath == null) - { - this.classpath = classpath; - } else { - this.classpath.append(classpath); - } - } - - public void setClasspathRef(Reference r) - { - createClasspath().setRefid(r); - } - - /** - * @return the Cactus scanner object - */ - public CactusScanner getCactusScanner() - { - return this.cactusScanner; - } - - /** - * Sets the name of the variable exported by this tag - */ - public void setVar(String var) - { - this.var = var; - } - - public void setClasspathref(String classpathref) - { - this.classpathref = classpathref; - } -} diff --git a/cactus/src/main/org/apache/maven/cactus/CactusTagLibrary.java b/cactus/src/main/org/apache/maven/cactus/CactusTagLibrary.java deleted file mode 100644 index 9d590ac4..00000000 --- a/cactus/src/main/org/apache/maven/cactus/CactusTagLibrary.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.apache.maven.cactus; - -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache Maven" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache Maven", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * ==================================================================== - */ -import org.apache.commons.jelly.TagLibrary; - -/** - * Maven tag library for use in Jelly scripts. - * - * @author Vincent Massol - * @version $Id: CactusTagLibrary.java,v 1.1 2003/01/24 03:44:39 jvanzyl Exp $ - */ -public class CactusTagLibrary extends TagLibrary -{ - public CactusTagLibrary() - { - registerTag("scanner", CactusScannerTag.class); - } -} diff --git a/cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java b/cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java deleted file mode 100644 index 036e44ed..00000000 --- a/cactus/src/main/org/apache/maven/cactus/DynamicTestAll.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.apache.maven.cactus; - -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache Maven" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache Maven", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * ==================================================================== - */ -import junit.framework.TestCase; -import junit.framework.Test; -import junit.framework.TestSuite; - -import java.util.Properties; -import java.util.Enumeration; - -/** - * JUnit tests suite that runs all the tests found in System Properties - * whose name start with {@link #PREFIX}. - * - * @author Vincent Massol - * @version $Id: DynamicTestAll.java,v 1.1 2003/01/24 03:44:41 jvanzyl Exp $ - */ -public class DynamicTestAll extends TestCase -{ - /** - * Prefix for test classnames specified as System Properties. - */ - private static final String PREFIX = "maven.cactus.test"; - - /** - * Defines the testcase name for JUnit. - * - * @param theName the test name. - */ - public DynamicTestAll(String theName) - { - super(theName); - } - - /** - * @return a test suite that includes all tests defined as System - * Properties whose name starts with {@link #PREFIX}. - */ - public static Test suite() - { - TestSuite suite = new TestSuite("All Cactus tests"); - - Properties properties = System.getProperties(); - Enumeration keys = properties.keys(); - while (keys.hasMoreElements()) - { - String key = (String) keys.nextElement(); - if (key.startsWith(PREFIX)) - { - suite.addTestSuite(loadClass( - key.substring(PREFIX.length() + 1))); - } - } - return suite; - } - - /** - * @param classname name of class to load dynamically - * @return the loaded class - */ - private static Class loadClass(String classname) - { - Class clazz = null; - try - { - clazz = DynamicTestAll.class.getClassLoader().loadClass(classname); - } - catch (ClassNotFoundException e) - { - e.printStackTrace(); - // Ignore the class - } - - return clazz; - } -}