diff options
author | Andy Clement <aclement@pivotal.io> | 2019-02-08 15:02:11 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-02-08 15:02:11 -0800 |
commit | 635f0ed47ffe11e93d96e4d24e4411eedfa1ddc9 (patch) | |
tree | 2fa95e5cf13bdefa559ce341761f90de747421e9 /aspectj-attic/testing-src/AjcTaskTester2.java | |
parent | 66f6e011d251d84250c562950f491cab31af0ad3 (diff) | |
download | aspectj-635f0ed47ffe11e93d96e4d24e4411eedfa1ddc9.tar.gz aspectj-635f0ed47ffe11e93d96e4d24e4411eedfa1ddc9.zip |
tidyup retired modules and add aspectjtools submodule
Diffstat (limited to 'aspectj-attic/testing-src/AjcTaskTester2.java')
-rw-r--r-- | aspectj-attic/testing-src/AjcTaskTester2.java | 202 |
1 files changed, 0 insertions, 202 deletions
diff --git a/aspectj-attic/testing-src/AjcTaskTester2.java b/aspectj-attic/testing-src/AjcTaskTester2.java deleted file mode 100644 index f5c5b36db..000000000 --- a/aspectj-attic/testing-src/AjcTaskTester2.java +++ /dev/null @@ -1,202 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Common Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - - -import java.io.*; -import java.util.*; -import org.apache.tools.ant.*; -import org.apache.tools.ant.taskdefs.*; -import org.apache.tools.ant.types.*; - - -/** - * Tests the AJC2 ant task. - */ -public class AjcTaskTester2 extends AntTaskTester { - - protected final static String TEST_CLASSES = "test-classes"; - protected final static String TEST_SOURCES = "../src"; - protected File buildDir = null; - - /** - * We use <code>"tests/ant/etc/ajc2.xml"</code>. - */ - public String getAntFile() { - return "tests/ant/etc/ajc2.xml"; - } - - /** - * Put {@link #TEST_CLASSES} and {@link #TEST_SOURCES} - * into the user properties. - */ - protected Map getUserProperties() { - Map userProps = new HashMap(); - userProps.put("ant.test.classes", TEST_CLASSES); - userProps.put("ant.test.sources", TEST_SOURCES); - return userProps; - } - - ////// Begin tests ////////////////////////////////////////////// - - public void test1() { wantClasses("One"); } - public void test2() { wantClasses("One,Two"); } - public void test3() { wantClasses("One,Two,Three"); } - public void test4() { wantClasses("One"); } - public void test4b() { wantClasses("One"); } - public void test5() { wantClasses("One,Two"); } - public void test5b() { wantClasses("One,Two"); } - public void test6() { wantClasses("One,Two,Three"); } - public void test6b() { wantClasses("One,Two,Three"); } - public void test8() { wantClasses("One"); } - public void test9() { wantClasses("One"); } - public void test10() { wantClasses("One"); } - public void test11() { wantClasses("One"); } - public void test12() { wantClasses(""); } - public void test13() { wantClasses("One"); } - public void fail1(BuildException be) {} - public void fail2(BuildException be) {} - public void fail3(BuildException be) {} - - ////// End tests //////////////////////////////////////////////// - - /** - * Make the build dir -- e.g. call {@link #makeBuildDir} - */ - protected void beforeEveryTask() { - makeBuildDir(); - } - - /** - * Assert classes and clear build dir. - * - * @see #checkClasses() - * @see #clearBuildDir() - */ - protected void afterEveryTask() { - checkClasses(); - clearBuildDir(); - } - - - /** - * Expect the classes found in - * <code>classNamesWithoutExtensions</code> - * - * @param classNamesWithoutExtensions Array of class names without - * extensions we want to see. - * @see #wantClasses(List) - */ - protected void wantClasses(String[] classNamesWithoutExtensions) { - List list = new Vector(); - for (int i = 0; i < classNamesWithoutExtensions.length; i++) { - list.add(classNamesWithoutExtensions[i]); - } - wantClasses(list); - } - - /** - * Expect the classes found in - * <code>classNamesWithoutExtensions</code> - * - * @param classNamesWithoutExtensions String of class names without - * extensions we want to see separated - * by <code> </code>, <code>,</code>, or - * <code>;</code>. - * @see #wantClasses(List) - */ - protected void wantClasses(String classNamesWithoutExtensions) { - StringTokenizer tok = new StringTokenizer(classNamesWithoutExtensions, ",;"); - List list = new Vector(); - while (tok.hasMoreTokens()) { - list.add(tok.nextToken()); - } - wantClasses(list); - } - - /** - * Expected each class name found in - * <code>classNamesWithoutExtensions</code>. - * - * @param classNamesWithoutExtensions List of class names without - * exntensions. - * @see #want(Object) - */ - protected void wantClasses(List classNamesWithoutExtensions) { - Iterator iter = classNamesWithoutExtensions.iterator(); - while (iter.hasNext()) { - String className = iter.next() + ""; - className = className.replace('.', '/').replace('\\', '/'); - want(className + ".class"); - } - } - - /** - * Assert that all classes in {@link #wants} were found. - */ - protected void checkClasses() { - Iterator iter = wants.iterator(); - while (iter.hasNext()) { - String className = iter.next() + ""; - File file = new File(buildDir, className); - if (file != null && file.exists()) { - have(className); - } - } - } - - /** - * Create a new build dir. - */ - protected void init() { - buildDir = new File(project.getBaseDir(), TEST_CLASSES); - } - - /** - * Make a new build dir using ANT. - */ - protected void makeBuildDir() { - try { - Mkdir mkdir = (Mkdir)project.createTask("mkdir"); - mkdir.setDir(buildDir); - mkdir.execute(); - } catch (BuildException be) { - be.printStackTrace(); - } - } - - /** - * Clear the build dir using ANT. - */ - protected void clearBuildDir() { - try { - Delete delete = (Delete)project.createTask("delete"); - FileSet fileset = new FileSet(); - fileset.setDir(buildDir); - fileset.setIncludes("**"); - delete.addFileset(fileset); - delete.execute(); - } catch (BuildException be) { - be.printStackTrace(); - } - } - - /** - * Invoke {@link #runTests(String[])} on a - * new instanceof {@link #AjcTaskTester2}. - * - * @param args Command line arguments. - */ - public static void main(String[] args) { - new AjcTaskTester2().runTests(args); - } -} |