aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core/testsrc
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 17:58:19 +0000
committerwisberg <wisberg>2002-12-16 17:58:19 +0000
commitd842c4f1139629c1f062b74ba818d233b2c31043 (patch)
tree842d3871620bc0eb60edcd95e55804d67e0f61fa /org.aspectj.ajdt.core/testsrc
parent3ce247199704eae6b2c92c6e38c69584e3250c52 (diff)
downloadaspectj-d842c4f1139629c1f062b74ba818d233b2c31043.tar.gz
aspectj-d842c4f1139629c1f062b74ba818d233b2c31043.zip
initial version
Diffstat (limited to 'org.aspectj.ajdt.core/testsrc')
-rw-r--r--org.aspectj.ajdt.core/testsrc/AroundAMain.java47
-rw-r--r--org.aspectj.ajdt.core/testsrc/EajcModuleTests.java33
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtAjcTests.java33
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java111
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java401
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/ConsoleMessageHandlerTestCase.java62
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java39
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java103
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java90
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java52
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java160
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompileAndRunTestCase.java90
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/ImageTestCase.java58
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java485
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/MultipleCompileTestCase.java35
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/VerifyWeaveTestCase.java114
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java131
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java366
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java33
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClassFileCacheTest.java253
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClasspathContainerTestCase.java66
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFileTest.java112
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFolderTest.java128
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/WorkspaceResourcesTests.java31
24 files changed, 3033 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/testsrc/AroundAMain.java b/org.aspectj.ajdt.core/testsrc/AroundAMain.java
new file mode 100644
index 000000000..21cf5e3ec
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/AroundAMain.java
@@ -0,0 +1,47 @@
+/* *******************************************************************
+ * Copyright (c) 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.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.aspectj.runtime.internal.AroundClosure;
+import org.aspectj.util.Reflection;
+
+public class AroundAMain extends TestCase {
+
+ public AroundAMain(String name) {
+ super(name);
+ }
+
+
+ public static void main(String[] args) throws ClassNotFoundException {
+ AroundClosure closure = new AroundClosure() {
+ public Object run(Object[] args) throws Throwable {
+// System.out.println("run with: " + Arrays.asList(args));
+ return new Integer(10);
+ }
+ };
+
+ Object instance = Reflection.getStaticField(Class.forName("AroundA"),
+ "ajc$perSingletonInstance");
+
+ Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$46",
+ new Integer(10), new Boolean(true), closure);
+
+ Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$c5",
+ "hello there", closure);
+ Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$150",
+ new String[1], closure);
+
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/EajcModuleTests.java b/org.aspectj.ajdt.core/testsrc/EajcModuleTests.java
new file mode 100644
index 000000000..09bd583ee
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/EajcModuleTests.java
@@ -0,0 +1,33 @@
+/* *******************************************************************
+ * 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
+ * ******************************************************************/
+
+
+// default package
+
+import junit.framework.*;
+import junit.framework.Test;
+
+public class EajcModuleTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(EajcModuleTests.class.getName());
+ suite.addTest(org.aspectj.ajdt.ajc.AjdtAjcTests.suite());
+ suite.addTest(org.aspectj.ajdt.internal.compiler.batch.AjdtBatchTests.suite());
+ suite.addTest(org.aspectj.ajdt.internal.core.builder.AjdtBuilderTests.suite());
+ suite.addTest(org.aspectj.workbench.resources.WorkspaceResourcesTests.suite());
+ return suite;
+ }
+
+ public EajcModuleTests(String name) { super(name); }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtAjcTests.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtAjcTests.java
new file mode 100644
index 000000000..9893c4bcc
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtAjcTests.java
@@ -0,0 +1,33 @@
+/* *******************************************************************
+ * 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
+ * ******************************************************************/
+
+
+package org.aspectj.ajdt.ajc;
+
+import junit.framework.*;
+
+public class AjdtAjcTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjdtAjcTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(AjdtCommandTestCase.class);
+ suite.addTestSuite(BuildArgParserTestCase.class);
+ suite.addTestSuite(ConsoleMessageHandlerTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+ public AjdtAjcTests(String name) { super(name); }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java
new file mode 100644
index 000000000..40f7f13b4
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java
@@ -0,0 +1,111 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+
+package org.aspectj.ajdt.ajc;
+
+import org.aspectj.ajdt.internal.core.builder.AjBuildConfig;
+import org.aspectj.bridge.AbortException;
+import org.aspectj.bridge.MessageWriter;
+import org.aspectj.util.StreamPrintWriter;
+import org.eclipse.jdt.core.compiler.InvalidInputException;
+
+import java.io.PrintWriter;
+
+import junit.framework.TestCase;
+
+/**
+ * Some black-box test is happening here.
+ */
+public class AjdtCommandTestCase extends TestCase {
+
+ private StreamPrintWriter outputWriter = new StreamPrintWriter(new PrintWriter(System.out));
+ private AjdtCommand command = new AjdtCommand();
+ private MessageWriter messageWriter = new MessageWriter(outputWriter, false);
+
+ public AjdtCommandTestCase(String name) {
+ super(name);
+// command.buildArgParser.out = outputWriter;
+ }
+
+ public void testIncrementalOption() throws InvalidInputException {
+ AjBuildConfig config = command.genBuildConfig(new String[] { "-incremental" }, messageWriter);
+
+ assertTrue(
+ "didn't specify source root",
+ outputWriter.getContents().indexOf("specify a source root") != -1);
+
+ outputWriter.flushBuffer();
+ config = command.genBuildConfig(
+ new String[] { "-incremental", "-sourceroots", "testdata/src1" },
+ messageWriter);
+
+ assertTrue(
+ outputWriter.getContents(),
+ outputWriter.getContents().equals(""));
+
+ outputWriter.flushBuffer();
+ config = command.genBuildConfig(
+ new String[] { "-incremental", "testdata/src1/Hello.java" },
+ messageWriter);
+
+ assertTrue(
+ "specified a file",
+ outputWriter.getContents().indexOf("can not directly specify files") != -1); ;
+ }
+
+ public void testBadOptionAndUsagePrinting() throws InvalidInputException {
+ try {
+ command.genBuildConfig(new String[] { "-mubleBadOption" }, messageWriter);
+ } catch (AbortException ae) { }
+
+ assertTrue(
+ outputWriter.getContents() + " contains? " + "Usage",
+ outputWriter.getContents().indexOf("Usage") != -1);
+
+ }
+
+ public void testHelpUsagePrinting() {
+ try {
+ command.genBuildConfig(new String[] { "-help" }, messageWriter);
+ } catch (AbortException ae) { }
+ assertTrue(
+ outputWriter.getContents() + " contains? " + "Usage",
+ outputWriter.getContents().indexOf("Usage") != -1);
+ }
+
+ public void testVersionOutput() throws InvalidInputException {
+ try {
+ command.genBuildConfig(new String[] { "-version" }, messageWriter);
+ } catch (AbortException ae) { }
+ assertTrue(
+ "version output",
+ outputWriter.getContents().indexOf("AspectJ Compiler") != -1);
+ }
+
+ public void testNonExistingLstFile() {
+ command.genBuildConfig(new String[] { "@mumbleDoesNotExist" }, messageWriter);
+
+ assertTrue(
+ outputWriter.getContents(),
+ outputWriter.getContents().indexOf("file does not exist") != -1);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ outputWriter.flushBuffer();
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
new file mode 100644
index 000000000..e2d23f7a1
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
@@ -0,0 +1,401 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.ajc;
+
+import org.aspectj.ajdt.internal.core.builder.AjBuildConfig;
+import org.aspectj.ajdt.internal.core.builder.AjCompilerOptions;
+import org.aspectj.bridge.MessageWriter;
+import org.aspectj.testing.util.TestUtil;
+import org.eclipse.jdt.core.compiler.InvalidInputException;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * Some black-box test is happening here.
+ */
+public class BuildArgParserTestCase extends TestCase {
+
+ private BuildArgParser parser = new BuildArgParser();
+ private static final String TEST_DIR = "testdata" + File.separator + "ajc" + File.separator;
+ private MessageWriter messageWriter = new MessageWriter(new PrintWriter(System.out), false);
+
+ public BuildArgParserTestCase(String name) {
+ super(name);
+ }
+
+ public void testDefaultClasspathAndTargetCombo() throws InvalidInputException {
+ String ENTRY = "1.jar;2.jar";
+ final String classpath = System.getProperty("java.class.path");
+ try {
+ System.setProperty("java.class.path", ENTRY); // see finally below
+ AjBuildConfig config = parser.genBuildConfig(new String[] { }, messageWriter);
+ String err = parser.getOtherMessages(true);
+ assertTrue(err, null == err);
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("1.jar"));
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("2.jar"));
+
+ config = parser.genBuildConfig(new String[] { "-1.3" }, messageWriter);
+ err = parser.getOtherMessages(true);
+ assertTrue(err, null == err);
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("1.jar"));
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("2.jar"));
+
+ config = parser.genBuildConfig(new String[] { "-1.3" }, messageWriter);
+ err = parser.getOtherMessages(true);
+ assertTrue(err, null == err);
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("1.jar"));
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("2.jar"));
+
+ config = parser.genBuildConfig(new String[] {
+ "-classpath", ENTRY, "-1.4" }, messageWriter);
+ err = parser.getOtherMessages(true);
+ assertTrue("expected errors for missing jars", null != err);
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("1.jar"));
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("2.jar"));
+
+ } finally {
+ // do finally to avoid messing up classpath for other tests
+ System.setProperty("java.class.path", classpath);
+ String setPath = System.getProperty("java.class.path");
+ String m = "other tests will fail - classpath not reset";
+ assertEquals(m, classpath, setPath);
+ }
+ }
+
+ public void testAjOptions() throws InvalidInputException {
+ AjBuildConfig config = parser.genBuildConfig(new String[] { "-Xlint" }, messageWriter);
+
+ assertTrue(
+ "default options",
+ config.getAjOptions().get(AjCompilerOptions.OPTION_Xlint).equals(
+ CompilerOptions.GENERATE));
+ }
+
+ public void testAspectpath() throws InvalidInputException {
+ final String SOURCE_JAR = "testdata/testclasses.jar";
+ final String SOURCE_JARS = "testdata/testclasses.jar" + File.pathSeparator
+ + "../bcweaver/testdata/tracing.jar" + File.pathSeparator
+ + "../bcweaver/testdata/dummyAspect.jar";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-aspectpath", SOURCE_JAR },
+ messageWriter);
+
+ assertTrue(((File)config.getAspectpath().get(0)).getName(), ((File)config.getAspectpath().get(0)).getName().equals("testclasses.jar"));
+
+ config = parser.genBuildConfig(new String[] {
+ "-aspectpath", SOURCE_JARS },
+ messageWriter);
+ assertTrue("size", + config.getAspectpath().size() == 3);
+ }
+
+ public void testInJars() throws InvalidInputException {
+ final String SOURCE_JAR = "testdata/testclasses.jar";
+ final String SOURCE_JARS = "testdata/testclasses.jar" + File.pathSeparator
+ + "../bcweaver/testdata/tracing.jar" + File.pathSeparator
+ + "../bcweaver/testdata/dummyAspect.jar";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-injars", SOURCE_JAR },
+ messageWriter);
+ //XXX don't let this remain in both places in beta1
+ assertTrue(
+ "" + config.getAjOptions().get(AjCompilerOptions.OPTION_InJARs),
+ config.getAjOptions().get(AjCompilerOptions.OPTION_InJARs).equals(CompilerOptions.PRESERVE));
+ assertTrue(((File)config.getInJars().get(0)).getName(), ((File)config.getInJars().get(0)).getName().equals("testclasses.jar"));
+
+ config = parser.genBuildConfig(new String[] {
+ "-injars", SOURCE_JARS },
+ messageWriter);
+ assertTrue("size", + config.getInJars().size() == 3);
+ }
+
+ public void testBadInJars() throws InvalidInputException {
+ final String SOURCE_JARS = "testdata/testclasses.jar" + File.pathSeparator + "b.far" + File.pathSeparator + "c.jar";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-injars", SOURCE_JARS },
+ messageWriter);
+ assertTrue("size: " + config.getInJars().size(), config.getInJars().size() == 1);
+ }
+
+ public void testMultipleSourceRoots() throws InvalidInputException {
+ final String SRCROOT_1 = "testdata/src1/p1";
+ final String SRCROOT_2 = "testdata/ajc";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-sourceroots", SRCROOT_1 + File.pathSeparator + SRCROOT_2 },
+ messageWriter);
+
+ assertEquals(new File(SRCROOT_1).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+
+ Collection expectedFiles = Arrays.asList(new File[] {
+ new File(SRCROOT_1+File.separator+"A.java").getAbsoluteFile(),
+ new File(SRCROOT_1+File.separator+"Foo.java").getAbsoluteFile(),
+ new File(SRCROOT_2+File.separator+"A.java").getAbsoluteFile(),
+ new File(SRCROOT_2+File.separator+"B.java").getAbsoluteFile(),
+ new File(SRCROOT_2+File.separator+"X.aj").getAbsoluteFile(),
+ new File(SRCROOT_2+File.separator+"Y.aj").getAbsoluteFile(),
+ new File(SRCROOT_2+File.separator+"pkg"+File.separator+"Hello.java").getAbsoluteFile(),
+ });
+
+ //System.out.println(config.getFiles());
+
+ TestUtil.assertSetEquals(expectedFiles, config.getFiles());
+ }
+
+ public void testSourceRootDir() throws InvalidInputException {
+ final String SRCROOT = "testdata/ajc";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-sourceroots", SRCROOT },
+ messageWriter);
+
+ assertEquals(new File(SRCROOT).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+
+ Collection expectedFiles = Arrays.asList(new File[] {
+ new File(SRCROOT+File.separator+"A.java").getAbsoluteFile(),
+ new File(SRCROOT+File.separator+"B.java").getAbsoluteFile(),
+ new File(SRCROOT+File.separator+"X.aj").getAbsoluteFile(),
+ new File(SRCROOT+File.separator+"Y.aj").getAbsoluteFile(),
+ new File(SRCROOT+File.separator+"pkg"+File.separator+"Hello.java").getAbsoluteFile(),
+ });
+
+ //System.out.println(config.getFiles());
+
+ TestUtil.assertSetEquals(expectedFiles, config.getFiles());
+ }
+
+ public void testBadSourceRootDir() throws InvalidInputException {
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-sourceroots",
+ "testdata/mumbleDoesNotExist;testdata/ajc" },
+ messageWriter);
+
+ assertTrue(config.getSourceRoots().toString(), config.getSourceRoots().size() == 1);
+
+ config = parser.genBuildConfig(new String[] {
+ "-sourceroots" },
+ messageWriter);
+
+ assertTrue("" + config.getSourceRoots(), config.getSourceRoots().size() == 0);
+
+ }
+
+ //??? we've decided not to make this an error
+ public void testSourceRootDirWithFiles() throws InvalidInputException {
+ final String SRCROOT = "testdata/ajc/pkg";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-sourceroots", SRCROOT, "testdata/src1/A.java"},
+ messageWriter);
+
+ assertEquals(new File(SRCROOT).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+
+ Collection expectedFiles = Arrays.asList(new File[] {
+ new File(SRCROOT+File.separator+"Hello.java").getAbsoluteFile(),
+ new File("testdata"+File.separator+"src1"+File.separator+"A.java").getAbsoluteFile(),
+ });
+
+ TestUtil.assertSetEquals(expectedFiles, config.getFiles());
+
+ }
+
+ public void testExtDirs() throws InvalidInputException {
+ final String DIR = "testdata";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-extdirs", DIR },
+ messageWriter);
+ assertTrue(config.getClasspath().toString(), config.getClasspath().contains(
+ new File(DIR + File.separator + "testclasses.jar").getAbsolutePath()
+ ));
+ }
+
+ public void testBootclasspath() throws InvalidInputException {
+ final String PATH = "mumble/rt.jar";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-bootclasspath", PATH },
+ messageWriter);
+ assertTrue(config.getClasspath().toString(), config.getClasspath().get(0).equals(PATH));
+
+ config = parser.genBuildConfig(new String[] {
+ },
+ messageWriter);
+ assertTrue(config.getClasspath().toString(), !config.getClasspath().get(0).equals(PATH));
+ }
+
+ public void testOutputJar() throws InvalidInputException {
+ final String OUT_JAR = "testdata/testclasses.jar";
+
+ AjBuildConfig config = parser.genBuildConfig(new String[] {
+ "-outjar", OUT_JAR },
+ messageWriter);
+
+ //XXX don't let this remain in both places in beta1
+ assertTrue(
+ "will generate: " + config.getAjOptions().get(AjCompilerOptions.OPTION_OutJAR),
+ config.getAjOptions().get(AjCompilerOptions.OPTION_OutJAR).equals(CompilerOptions.GENERATE));
+ assertTrue(
+ "testclasses jar: " + config.getOutputJar().getName(),
+ config.getOutputJar().getAbsolutePath().equals(new File(OUT_JAR).getAbsolutePath()));
+
+ File nonExistingJar = new File("testdata/mumbleDoesNotExist.jar");
+ config = parser.genBuildConfig(new String[] {
+ "-outjar", nonExistingJar.getAbsolutePath() },
+ messageWriter);
+ assertTrue(
+ "testclasses jar: " + config.getOutputJar().getName(),
+ config.getOutputJar().getAbsolutePath().equals(nonExistingJar.getAbsolutePath()));
+
+ nonExistingJar.delete();
+ }
+
+ //XXX shouldn't need -1.4 to get this to pass
+ public void testCombinedOptions() throws InvalidInputException {
+ AjBuildConfig config = parser.genBuildConfig(new String[] { "-Xlint", "-target", "1.4", "-1.4" }, messageWriter);
+ String TARGET = "1.4";
+ assertTrue(
+ "target set",
+ config.getJavaOptions().get(CompilerOptions.OPTION_TargetPlatform).equals(TARGET));
+
+ assertTrue(
+ "Xlint option set",
+ config.getAjOptions().get(AjCompilerOptions.OPTION_Xlint).equals(
+ CompilerOptions.GENERATE));
+ }
+
+ public void testOutputDirectorySetting() throws InvalidInputException {
+ AjBuildConfig config = parser.genBuildConfig(new String[] { "-d", TEST_DIR }, messageWriter);
+
+ assertTrue(
+ new File(config.getOutputDir().getPath()).getAbsolutePath() + " ?= " +
+ new File(TEST_DIR).getAbsolutePath(),
+ config.getOutputDir().getAbsolutePath().equals((new File(TEST_DIR)).getAbsolutePath()));
+ }
+
+ public void testClasspathSetting() throws InvalidInputException {
+ String ENTRY = "1.jar;2.jar";
+ AjBuildConfig config = parser.genBuildConfig(new String[] { "-classpath", ENTRY }, messageWriter);
+
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("1.jar"));
+
+ assertTrue(
+ config.getClasspath().toString(),
+ config.getClasspath().contains("2.jar"));
+ }
+
+ public void testArgInConfigFile() throws InvalidInputException {
+ String FILE_PATH = "@" + TEST_DIR + "configWithArgs.lst";
+ String OUT_PATH = "bin";
+ AjBuildConfig config = parser.genBuildConfig(new String[] { FILE_PATH }, messageWriter);
+
+ assertNotNull(config);
+ File outputDir = config.getOutputDir();
+ assertNotNull(outputDir);
+ assertEquals(outputDir.getPath(), OUT_PATH);
+ }
+
+ public void testXlint() throws InvalidInputException {
+ AjdtCommand command = new AjdtCommand();
+ AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlint"}, messageWriter);
+ assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_DEFAULT));
+ config = parser.genBuildConfig(new String[] {"-Xlint:warn"}, messageWriter);
+ assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_WARN));
+ config = parser.genBuildConfig(new String[] {"-Xlint:error"}, messageWriter);
+ assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_ERROR));
+ config = parser.genBuildConfig(new String[] {"-Xlint:ignore"}, messageWriter);
+ assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_INGORE));
+ }
+
+ public void testXlintfile() throws InvalidInputException {
+ String lintFile = "testdata/lintspec.properties";
+ String badLintFile = "lint.props";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlintfile", lintFile}, messageWriter);
+ assertTrue(new File(lintFile).exists());
+ assertTrue(config.getLintSpecFile().getAbsolutePath(), config.getLintSpecFile().getAbsolutePath().equals(new File(lintFile).getAbsolutePath()));
+ }
+
+ public void testOptions() throws InvalidInputException {
+ AjdtCommand command = new AjdtCommand();
+ String TARGET = "1.4";
+ AjBuildConfig config = parser.genBuildConfig(new String[] {"-target", TARGET, "-source", TARGET}, messageWriter);
+ assertTrue(
+ "target set",
+ config.getJavaOptions().get(CompilerOptions.OPTION_TargetPlatform).equals(TARGET));
+ assertTrue(
+ "source set",
+ config.getJavaOptions().get(CompilerOptions.OPTION_Compliance).equals(CompilerOptions.VERSION_1_4));
+ }
+
+ public void testLstFileExpansion() throws IOException, FileNotFoundException, InvalidInputException {
+ String FILE_PATH = TEST_DIR + "config.lst";
+ String SOURCE_PATH_1 = "A.java";
+ String SOURCE_PATH_2 = "B.java";
+
+ File f = new File(FILE_PATH);
+
+ AjBuildConfig config = parser.genBuildConfig(new String[] { "@" + FILE_PATH }, messageWriter);
+ List resultList = config.getFiles();
+
+ assertTrue("correct number of files", resultList.size() == 2);
+ assertTrue(resultList.toString() + new File(TEST_DIR + SOURCE_PATH_1).getAbsoluteFile(),
+ resultList.contains(new File(TEST_DIR + SOURCE_PATH_1).getAbsoluteFile()));
+ assertTrue(resultList.toString() + SOURCE_PATH_2,
+ resultList.contains(new File(TEST_DIR + SOURCE_PATH_2).getAbsoluteFile()));
+ }
+
+
+ //??? do we need to remove this limitation
+// public void testArgInConfigFileAndRelativizingPathParam() throws InvalidInputException {
+// String FILE_PATH = "@" + TEST_DIR + "configWithArgs.lst";
+// String OUT_PATH = TEST_DIR + "bin";
+// AjBuildConfig config = parser.genBuildConfig(new String[] { FILE_PATH });
+//
+// assertTrue(
+// config.getOutputDir().getPath() + " ?= " + OUT_PATH,
+// config.getOutputDir().getAbsolutePath().equals((new File(OUT_PATH)).getAbsolutePath()));
+// }
+
+ public void testAjFileInclusion() throws InvalidInputException {
+ parser.genBuildConfig(new String[] { TEST_DIR + "X.aj", TEST_DIR + "Y.aj"}, messageWriter);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/ConsoleMessageHandlerTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/ConsoleMessageHandlerTestCase.java
new file mode 100644
index 000000000..c359f91bb
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/ConsoleMessageHandlerTestCase.java
@@ -0,0 +1,62 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.ajc;
+
+import java.io.PrintWriter;
+
+import junit.framework.TestCase;
+import org.aspectj.bridge.*;
+import org.aspectj.bridge.Message;
+import org.aspectj.util.StreamPrintWriter;
+
+/**
+ * @author Mik Kersten
+ */
+public class ConsoleMessageHandlerTestCase extends TestCase {
+
+ /**
+ * Constructor for ConsoleWriterTestCase.
+ * @param name
+ */
+ public ConsoleMessageHandlerTestCase(String name) {
+ super(name);
+ }
+
+ public void testIgnoringInfoMessages() {
+ testOutput(false);
+ }
+
+ public void testHandlingInfoMessages() {
+ testOutput(true);
+ }
+
+ private void testOutput(boolean verboseMode) {
+ //XXX update to new MessageHandler
+// final String MESSAGE = "test;";
+//
+// StreamPrintWriter output = new StreamPrintWriter(new PrintWriter(System.out));
+// ConsoleMessageHandler writer = new ConsoleMessageHandler(output);
+// if (!verboseMode) writer.ignore(IMessage.INFO);
+//
+// writer.handleMessage(new Message(MESSAGE, Message.INFO, null, null));
+// if (verboseMode) {
+// assertTrue("message=" + output.getContents(), output.getContents().equals(MESSAGE + "\n"));
+// } else {
+// assertTrue("message=" + output.getContents(), output.getContents().equals(""));
+// }
+//
+// output.flushBuffer();
+// writer.handleMessage(new Message(MESSAGE, Message.ERROR, null, null));
+// assertTrue(output.getContents(), output.getContents().equals(MESSAGE + "\n"));
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java
new file mode 100644
index 000000000..025e7c766
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java
@@ -0,0 +1,39 @@
+/* *******************************************************************
+ * 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
+ * ******************************************************************/
+
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import junit.framework.*;
+
+public class AjdtBatchTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjdtBatchTests.class.getName());
+ // Abstract superclass
+ //suite.addTestSuite(CommandTestCase.class);
+ //$JUnit-BEGIN$
+ suite.addTestSuite(BasicCommandTestCase.class);
+ suite.addTestSuite(BinaryFormsTestCase.class);
+ suite.addTestSuite(CompileAndRunTestCase.class);
+ suite.addTestSuite(ImageTestCase.class);
+ suite.addTestSuite(MultipleCompileTestCase.class);
+ // XXX suite.addTestSuite(VerifyWeaveTestCase.class);
+ //suite.addTestSuite(WorkingCommandTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+ public AjdtBatchTests(String name) { super(name); }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
new file mode 100644
index 000000000..9b5a69fb6
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
@@ -0,0 +1,103 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.util.*;
+
+import org.aspectj.ajdt.ajc.*;
+import org.aspectj.bridge.*;
+
+import junit.framework.*;
+
+/**
+ * @author hugunin
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates.
+ * To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class BasicCommandTestCase extends CommandTestCase {
+
+ /**
+ * Constructor for CommandTestCase.
+ * @param name
+ */
+ public BasicCommandTestCase(String name) {
+ super(name);
+ }
+
+ public void testA() {
+ checkCompile("src1/A.java", NO_ERRORS);
+ }
+
+ public void testA1() {
+ checkCompile("src1/A1.java", NO_ERRORS);
+ }
+
+ public void testBadA() {
+ checkCompile("src1/BadA.java", new int[] {7, 8});
+ }
+
+ public void testHello() {
+ checkCompile("src1/Hello.java", NO_ERRORS);
+ }
+
+ public void testBadHello() {
+ checkCompile("src1/BadHello.java", new int[] {5});
+ }
+
+ public void testMissingHello() {
+ checkCompile("src1/MissingHello.java", TOP_ERROR);
+ }
+
+ public void testBadBinding() {
+ checkCompile("src1/BadBinding.java", new int[] {2, 4, 8, 10, 13, 16, 19});
+ }
+ public void testThisAndModifiers() {
+ checkCompile("src1/ThisAndModifiers.java", NO_ERRORS);
+ }
+ public void testDeclares() {
+ checkCompile("src1/Declares.java", new int[] {3});
+ }
+
+ public void testDeclareWarning() {
+ checkCompile("src1/DeclareWarning.java", NO_ERRORS);
+ }
+
+
+ public void testP1() {
+ checkCompile("src1/p1/Foo.java", NO_ERRORS);
+ }
+
+ public void testUnimplementedSyntax() {
+ checkCompile("src1/UnimplementedSyntax.java",
+ new int[] {5, 15, 16, 23});
+ }
+ public void testXlintWarn() {
+ checkCompile("src1/Xlint.java", NO_ERRORS);
+ }
+ public void testXlintError() {
+ List args = new ArrayList();
+
+ args.add("-d");
+ args.add("out");
+
+ args.add("-classpath");
+ args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin");
+ args.add("-Xlint:error");
+ args.add("testdata/src1/Xlint.java");
+
+ runCompiler(args, new int[] {2});
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
new file mode 100644
index 000000000..7c232aa96
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
@@ -0,0 +1,90 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.ArrayList;
+
+public class BcweaverJarMaker {
+
+ public BcweaverJarMaker() {
+ super();
+ }
+
+ public static void main(String[] args) throws IOException {
+ makeJar0();
+ makeJar1();
+ makeJar1a();
+ makeJar2();
+ }
+
+ public static void makeJar0() throws IOException {
+ List args = new ArrayList();
+ args.add("-outjar");
+ args.add("../bcweaver/testdata/tracing.jar");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ args.add("testdata/src1/Trace.java");
+ args.add("testdata/src1/MyTrace.java");
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ }
+
+ public static void makeJar1() throws IOException {
+ List args = new ArrayList();
+ args.add("-outjar");
+ args.add("../bcweaver/testdata/megatrace.jar");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ args.add("testdata/src1/trace/MegaTrace.java");
+ args.add("testdata/src1/trace/ExecTrace.java");
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ }
+
+
+ public static void makeJar1a() throws IOException {
+ List args = new ArrayList();
+ args.add("-outjar");
+ args.add("../bcweaver/testdata/megatraceNoweave.jar");
+
+ args.add("-noweave");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ args.add("testdata/src1/trace/MegaTrace.java");
+ args.add("testdata/src1/trace/ExecTrace.java");
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ }
+
+
+ public static void makeJar2() throws IOException {
+ List args = new ArrayList();
+ args.add("-outjar");
+ args.add("../bcweaver/testdata/dummyAspect.jar");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ args.add("testdata/src1/DummyAspect.java");
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java
new file mode 100644
index 000000000..4fc63b0dc
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java
@@ -0,0 +1,52 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.io.IOException;
+import java.util.*;
+
+
+public class BinaryFormsTestCase extends CommandTestCase {
+
+ public BinaryFormsTestCase(String name) {
+ super(name);
+ }
+
+ public void testDummy() {}
+
+
+ public void XXXtestJar1() throws IOException {
+ List args = new ArrayList();
+ args.add("-outjar");
+ args.add("out/megatrace.jar");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ args.add("testdata/src1/trace/MegaTrace.java");
+ args.add("testdata/src1/trace/ExecTrace.java");
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+
+ args = new ArrayList();
+ args.add("-aspectpath");
+ args.add("out/megatrace.jar");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ args.add("testdata/src1/tracep1/TraceTest.java");
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java
new file mode 100644
index 000000000..cd9a440de
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java
@@ -0,0 +1,160 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import org.aspectj.ajdt.ajc.AjdtCommand;
+import org.aspectj.bridge.ICommand;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IMessageHandler;
+import org.aspectj.bridge.MessageHandler;
+
+import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.aspectj.ajdt.ajc.*;
+import org.aspectj.weaver.*;
+import org.aspectj.weaver.bcel.LazyClassGen;
+import org.aspectj.bridge.*;
+
+import junit.framework.*;
+import org.aspectj.weaver.*;
+
+public abstract class CommandTestCase extends TestCase {
+
+ /**
+ * Constructor for CommandTestCase.
+ * @param name
+ */
+ public CommandTestCase(String name) {
+ super(name);
+ }
+
+ public static final int[] NO_ERRORS = new int[0];
+ public static final int[] TOP_ERROR = new int[0];
+
+
+ public static void checkCompile(String source, int[] expectedErrors) {
+ List args = new ArrayList();
+ args.add("-verbose");
+
+ args.add("-d");
+ args.add("out");
+
+ args.add("-classpath");
+ args.add("../runtime/bin;../lib/junit/junit.jar");
+
+ args.add("-g"); //XXX need this to get sourcefile and line numbers, shouldn't
+
+ args.add("testdata/" + source);
+
+ runCompiler(args, expectedErrors);
+ }
+
+ public void checkMultipleCompile(String source) throws InterruptedException {
+ List args = new ArrayList();
+ args.add("-verbose");
+
+ args.add("-d");
+ args.add("out");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ args.add("testdata/" + source);
+
+ ICommand compiler = runCompiler(args, NO_ERRORS);
+ Thread.sleep(100);
+
+ rerunCompiler(compiler);
+ }
+
+ public void rerunCompiler(ICommand command) {
+ MessageHandler myHandler = new MessageHandler();
+ List recompiledFiles = new ArrayList();
+ if (!command.repeatCommand(myHandler)) {
+ assertTrue("recompile failed", false);
+ }
+ assertEquals(0, myHandler.numMessages(IMessage.ERROR, true));
+ }
+
+
+
+ public static ICommand runCompiler(List args, int[] expectedErrors) {
+ ICommand command = new AjdtCommand();
+ MessageHandler myHandler = new MessageHandler();
+ myHandler.setInterceptor(org.aspectj.tools.ajc.Main.MessagePrinter.TERSE);
+ command.runCommand((String[])args.toArray(new String[args.size()]), myHandler);
+
+// System.out.println("errors: " + Arrays.asList(myHandler.getErrors()));
+// System.out.println("warnings: " + Arrays.asList(myHandler.getWarnings()));
+
+ int nErrors = myHandler.numMessages(IMessage.ERROR, IMessageHolder.EQUAL);
+ if (expectedErrors == NO_ERRORS) {
+ if (0 != nErrors) {
+ String s = ""+Arrays.asList(myHandler.getErrors());
+ assertTrue("unexpected errors: " + s, false);
+ }
+ } else if (expectedErrors == TOP_ERROR) { // ?? what is this?
+ assertTrue("expected error", nErrors > 0);
+ } else {
+ List errors = new ArrayList(Arrays.asList(myHandler.getErrors()));
+ for (int i=0, len=expectedErrors.length; i < len; i++) {
+ int line = expectedErrors[i];
+ boolean found = false;
+ for (Iterator iter = errors.iterator(); iter.hasNext(); ) {
+ IMessage m = (IMessage)iter.next();
+ if (m.getISourceLocation() != null && m.getISourceLocation().getLine() == line) {
+ found = true;
+ iter.remove();
+ }
+ }
+ assertTrue("didn't find error on line " + line, found);
+ }
+ if (errors.size() > 0) {
+ assertTrue("didn't expect errors: " + errors, false);
+ }
+ }
+ return command;
+ }
+
+ public static void printGenerated(String path, String name) throws IOException {
+ String fullpath = "testdata/" + path;
+ LazyClassGen.disassemble(fullpath, name, System.out);
+ }
+
+ /** incremental test case adapter to JUnit */
+ public class IncCase extends IncrementalCase {
+ protected void fail(IMessageHandler handler, String mssg) {
+ assertTrue(mssg, false);
+ }
+ protected void message(
+ IMessage.Kind kind,
+ String mssg,
+ IMessageHandler handler) {
+ if ((kind == IMessage.FAIL) || (kind == IMessage.ABORT)) {
+ assertTrue(mssg, false);
+ } else {
+ System.err.println("IncCase " + kind + ": " + mssg); // XXX
+ }
+ super.message(kind, mssg, handler);
+ }
+
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompileAndRunTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompileAndRunTestCase.java
new file mode 100644
index 000000000..30a76570d
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CompileAndRunTestCase.java
@@ -0,0 +1,90 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.io.IOException;
+
+import org.aspectj.testing.util.TestUtil;
+
+
+public class CompileAndRunTestCase extends CommandTestCase {
+
+ public CompileAndRunTestCase(String name) {
+ super(name);
+ }
+
+ public void testAround() throws IOException {
+ checkCompile("src1/AroundA.java", NO_ERRORS);
+ TestUtil.runMain("out", "AroundAMain");
+ }
+
+ public void testInterType() throws IOException {
+ checkCompile("src1/InterType.java", NO_ERRORS);
+ TestUtil.runMain("out", "InterType");
+ }
+
+ public void testInterTypeMethods() throws IOException {
+ checkCompile("src1/InterTypeMethods.java", NO_ERRORS);
+ TestUtil.runMain("out", "InterTypeMethods");
+ }
+
+ public void testIf() throws IOException {
+ CommandTestCase.checkCompile("src1/IfPcd.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "IfPcd");
+ }
+
+ public void testDeclareParentsFail() throws IOException {
+ CommandTestCase.checkCompile("src1/ParentsFail.java", new int[] {3, 11, 19, 21});
+ }
+
+ public void testDeclareParents() throws IOException {
+ CommandTestCase.checkCompile("src1/Parents.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "Parents");
+ }
+
+ public void testPerCflow() throws IOException {
+ CommandTestCase.checkCompile("src1/PerCflow.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "PerCflow");
+ }
+
+ public void testPerObject() throws IOException {
+ CommandTestCase.checkCompile("src1/PerObject.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "PerObject");
+ }
+
+ public void testDeclareSoft() throws IOException {
+ CommandTestCase.checkCompile("src1/DeclareSoft.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "DeclareSoft");
+ }
+
+ public void testPrivileged() throws IOException {
+ CommandTestCase.checkCompile("src1/Privileged.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "Privileged");
+ }
+
+ public void testHandler() throws IOException {
+ CommandTestCase.checkCompile("src1/Handler.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "Handler");
+ }
+
+ public void testInterConstructors() throws IOException {
+ CommandTestCase.checkCompile("src1/InterTypeConstructors.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "InterTypeConstructors");
+ }
+
+ public void testAroundA1() throws IOException {
+ CommandTestCase.checkCompile("src1/AroundA1.java", CommandTestCase.NO_ERRORS);
+ TestUtil.runMain("out", "AroundA1");
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/ImageTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/ImageTestCase.java
new file mode 100644
index 000000000..681c46668
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/ImageTestCase.java
@@ -0,0 +1,58 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.io.*;
+import java.io.File;
+import java.util.*;
+
+import junit.framework.*;
+
+import org.aspectj.ajdt.internal.core.builder.*;
+import org.aspectj.bridge.*;
+import org.aspectj.util.*;
+import org.aspectj.workbench.resources.*;
+import org.eclipse.core.internal.resources.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jdt.core.compiler.*;
+import org.eclipse.jdt.internal.compiler.*;
+import org.eclipse.jdt.internal.compiler.Compiler;
+import org.eclipse.jdt.internal.core.builder.*;
+
+public class ImageTestCase extends TestCase {
+
+
+
+ public ImageTestCase(String name) {
+ super(name);
+ }
+ public void testNothing() {}
+
+// public void test1() throws IOException, CoreException {
+// EclipseMessageHandler handler = new EclipseMessageHandler(new MessageHandler());
+// AjBuildManager config = new AjBuildManager(handler);
+//// config.setArgs(new String[] { "testdata/src1/BadHello.java" });
+//// config.setArgs(new String[] { "testdata/src1/A.java" });
+// List files = new ArrayList();
+// files.add(new File("testdata/src1/A.java"));
+// config.getBuildConfig().setFiles(files);
+//
+// SimpleBatchBuilder builder = new SimpleBatchBuilder(config);
+// builder.run();
+//
+// SimpleIncrementalBuilder builder1 = new SimpleIncrementalBuilder(config);
+// builder1.run();
+// }
+}
+
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java
new file mode 100644
index 000000000..e4f645f3a
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java
@@ -0,0 +1,485 @@
+/* *******************************************************************
+ * 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import org.aspectj.bridge.ICommand;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IMessageHandler;
+import org.aspectj.bridge.IMessageHolder;
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
+import org.aspectj.bridge.MessageHandler;
+import org.aspectj.bridge.ReflectionFactory;
+import org.aspectj.util.FileUtil;
+import org.aspectj.util.LangUtil;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Mostly stateless incremental test case.
+ * Subclass to use from junit.
+ */
+public class IncrementalCase { // XXX NOT bound to junit - bridge tests?
+ public static final String[] RA_String = new String[0]; // XXX
+ boolean verbose = true;
+ boolean ignoreWarnings = false;
+
+ public static void main(String[] args) throws IOException {
+ IncrementalCase me = new IncrementalCase();
+ MessageHandler h = new MessageHandler();
+ boolean result;
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < args.length; i++) {
+ sb.append("\n###### results for " + args[i]);
+ sb.append("\n" + me.run(new File(args[i]), h) + ": " + h);
+ }
+ System.err.flush();
+ System.out.flush();
+ System.err.println(sb.toString());
+ }
+
+ /**
+ * Run an incremental compile case.
+ * For each i=1..9, copy files srcDir/*{i=1..9}0.java
+ * to the sandbox and compile.
+ * This only expects the changed files to be recompiled, but
+ * it also calls verifyCompile(..);
+ * @param handler all non-functional feedback here.
+ * Exceptions are logged as ABORT messages
+ */
+ public boolean run(File srcBase, IMessageHandler handler)
+ throws IOException {
+ final String cname = ReflectionFactory.ECLIPSE;
+
+ File targetBase =
+ makeDir(getSandboxDir(), "IncrementalCaseSandbox", handler);
+ if (null == targetBase) {
+ return false;
+ }
+ File targetSrc = makeDir(targetBase, "src", handler);
+ if (null == targetSrc) {
+ return false;
+ }
+ File targetClasses = makeDir(targetBase, "classes", handler);
+ if (null == targetClasses) {
+ return false;
+ }
+ final ArrayList files = new ArrayList();
+ final FileFilter collector = new FileFilter() {
+ public boolean accept(File file) {
+ return files.add(file);
+ }
+ };
+ final ICommand compiler =
+ ReflectionFactory.makeCommand(cname, handler);
+
+ ArrayList recompiled = null;
+ boolean result = true;
+
+ final String toSuffix = ".java";
+ final String canonicalFrom = srcBase.getCanonicalPath();
+ final Definition[] defs = getDefinitions(srcBase);
+ if ((null == defs) || (defs.length < 9)) {
+ throw new Error("did not get definitions");
+ }
+ MessageHandler compilerMessages = new MessageHandler();
+ StringBuffer commandLine = new StringBuffer();
+ for (int i = 1; result && (i < 10); i++) {
+ String fromSuffix = "." + i + "0.java";
+ // copy files, collecting as we go...
+ files.clear();
+ FileUtil.copyDir(
+ srcBase,
+ targetSrc,
+ fromSuffix,
+ toSuffix,
+ collector);
+ if (0 == files.size()) { // XXX detect incomplete?
+ break;
+ }
+ List safeFiles = Collections.unmodifiableList(files);
+ log("Compiling ", safeFiles, handler);
+ if (1 == i) {
+ ArrayList argList = new ArrayList();
+ argList.addAll(getBaseArgs(targetSrc, targetClasses));
+ File[] fra = (File[]) safeFiles.toArray(new File[0]);
+ // sigh
+ argList.addAll(
+ Arrays.asList(FileUtil.getAbsolutePaths(fra)));
+ String[] args = (String[]) argList.toArray(new String[0]);
+ commandLine.append(""+argList);
+ result = compiler.runCommand(args, compilerMessages);
+ } else {
+ if (null == recompiled) {
+ recompiled = new ArrayList();
+ } else {
+ recompiled.clear();
+ }
+ compilerMessages.init();
+ commandLine.append("["+i+": " + recompiled + "] ");
+ result =
+ compiler.repeatCommand(compilerMessages);
+ }
+ result =
+ verifyCompile(
+ i,
+ result,
+ srcBase,
+ targetSrc,
+ targetClasses,
+ defs[i - 1],
+ compilerMessages,
+ commandLine,
+ handler);
+ }
+ return result;
+ }
+
+ // -------------------------------------- test case verification
+ /**
+ * Verify that this incremental compile step worked.
+ * @param recompiled the List of Files the compiler recompiled - null the first pass
+ * @param files the (unmodifiable) List of File passed as sources to the compiler
+ * @param recompiled the List sink for the Files actually recompiled
+ */
+ // XXX argh no parent/child relationship in this world...
+ protected boolean verifyCompile(
+ int iteration,
+ boolean result,
+ File srcDir,
+ File sandboxSrcDir,
+ File sandboxClassesDir,
+ Definition def,
+ IMessageHolder compilerMessages,
+ StringBuffer commandLine,
+ IMessageHandler handler) {
+ log("verifyCompile - iteration ", new Integer(iteration), handler);
+ log("verifyCompile - def ", def, handler);
+ log("verifyCompile - command ", commandLine.toString(), handler);
+ log("verifyCompile - messages ", compilerMessages, handler);
+ StringBuffer failures = new StringBuffer();
+ if (def.expectFail == result) {
+ failures.append("iteration " + iteration +
+ " expected to " + (def.expectFail ? "fail\n" : "pass"));
+ }
+ if (0 < failures.length()) {
+ fail(handler,
+ "\nFailures in iteration " + iteration
+ + "\n Command: " + commandLine
+ + "\nMessages: " + compilerMessages
+ + "\n Def: " + def
+ + "\nFailures: " + failures);
+ return false;
+ }
+ IMessage[] messages = compilerMessages.getMessages(IMessage.ERROR, IMessageHolder.EQUAL);
+ String[] expected =
+ (null != def.errors ? def.errors : def.eclipseErrors);
+ if (haveAll("errors", expected, messages, handler)) {
+ if (!ignoreWarnings) {
+ messages = compilerMessages.getMessages(IMessage.WARNING, IMessageHolder.EQUAL);
+ expected =
+ (null != def.warnings
+ ? def.warnings
+ : def.eclipseWarnings);
+ if (!haveAll("warnings", expected, messages, handler)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ // -------------------------------------- test case setup
+ /**
+ * Get the sandbox (parent) directory.
+ * This implementation uses the temporary directory
+ */
+ protected File getSandboxDir() throws IOException { // XXX util
+ File tempFile = File.createTempFile("IncrementalCase", ".txt");
+ File tempDir = tempFile.getParentFile();
+ tempFile.delete();
+ return tempDir;
+ }
+
+ //XXX hack
+ public File outputDir;
+
+ /** @param srcDir ignored for now */
+ protected List getBaseArgs(File srcDir, File classesDir) {
+ outputDir = classesDir;
+ String[] input =
+ new String[] {
+ "-verbose",
+// "-classpath",
+// System.getProperty("sun.boot.class.path"),
+ "-d",
+ classesDir.getAbsolutePath()};
+ return Collections.unmodifiableList(
+ new ArrayList(Arrays.asList(input)));
+ }
+
+ protected File makeDir(
+ File parent,
+ String name,
+ IMessageHandler handler) { // XXX util
+ File result = new File(parent, name);
+ if (!result.exists()) {
+ result.mkdirs();
+ if (!result.exists()) {
+ fail(handler, "unable to create " + result);
+ return null;
+ }
+ }
+ return result;
+ }
+
+ // -------------------------------------- test case verification
+
+
+ List normalizeFilenames(String[] ra) { // XXX util
+ ArrayList result = new ArrayList();
+ if (null != ra) {
+ for (int i = 0; i < ra.length; i++) {
+ result.add(normalizeFilename(ra[i]));
+ }
+ if (1 < ra.length) {
+ Collections.sort(result);
+ }
+ }
+ return result;
+ }
+
+ /** @param list the List of File */
+ List normalizeFilenames(List list) { // XXX util
+ ArrayList result = new ArrayList();
+ for (Iterator iter = list.iterator(); iter.hasNext();) {
+ result.add(normalizeFilename(((File) iter.next()).getPath()));
+ }
+ Collections.sort(result);
+ return result;
+ }
+
+ String normalizeFilename(String s) { // XXX error-prone
+ final String suffix = ".java";
+ int loc = s.lastIndexOf(suffix);
+ if (-1 == loc) {
+ return s; // punt
+ }
+ s = s.substring(0, loc + suffix.length()).replace('\\', '/');
+ loc = s.lastIndexOf("/");
+ return (-1 == loc ? s : s.substring(loc+1));
+ }
+
+
+ /** XXX duplicate message checking */
+ boolean haveAll(
+ String label,
+ String[] expected,
+ IMessage[] messages,
+ IMessageHandler handler) {
+ if (null == expected) {
+ expected = new String[0];
+ }
+ boolean result = true;
+ final int[] exp = new int[expected.length];
+ StringBuffer sb = new StringBuffer();
+ sb.append("[");
+ for (int i = 0; i < exp.length; i++) {
+ String s = expected[i];
+ int loc = s.lastIndexOf(":");
+ if (-1 != loc)
+ s = s.substring(loc + 1);
+ try {
+ exp[i] = Integer.valueOf(s).intValue();
+ sb.append(exp[i] + ((i < (exp.length - 1)) ? ", " : ""));
+ } catch (NumberFormatException e) {
+ info(handler, "bad " + label + ":" + expected[i]);
+ // XXX worse than info...
+ sb.append("bad" + ((i < (exp.length - 1)) ? ", " : "]"));
+ }
+ }
+ sb.append("]");
+ final String context =
+ label
+ + "\n in context haveAll expected="
+ + Arrays.asList(expected)
+ + " exp="
+ + sb
+ + " actual="
+ + Arrays.asList(messages);
+ info(handler, context);
+
+ BitSet foundSet = new BitSet(10);
+ for (int i = 0; i < exp.length; i++) {
+ final int expLine = exp[i];
+ boolean found = false;
+ for (int j = 0; !found && (j < messages.length); j++) {
+ ISourceLocation sl = messages[j].getISourceLocation();
+ found = ((null != sl) && (expLine == sl.getLine()));
+ if (found) {
+ info(handler, "found " + label + " for: " + exp[i]);
+ if (foundSet.get(j)) {
+ info(
+ handler,
+ "duplicate " + label + " expected: " + exp[i]);
+ }
+ foundSet.set(j);
+ }
+ }
+ if (!found) {
+ String s =
+ "expected "
+ + label
+ + " not found: "
+ + exp[i]
+ + context;
+ fail(handler, s); // bad short-circuit
+ if (!result) {
+ result = false;
+ }
+ }
+
+ }
+ sb.setLength(0);
+ for (int i = 0; i < messages.length; i++) {
+ if (!foundSet.get(i)) {
+ sb.append(
+ "\n unexpected " + label + " found: " + messages[i]);
+ }
+ }
+ if (0 == sb.length()) {
+ return true;
+ } else {
+ fail(handler, sb.toString() + context);
+ return false;
+ }
+ }
+ // -------------------------------------- messages
+ protected void log(String label, Object o, IMessageHandler handler) {
+ if (verbose) {
+ if (null != handler) {
+ message(IMessage.INFO, label + ": " + o, handler);
+ } else {
+ System.err.println("\nlog: " + label + ": " + o);
+ }
+ }
+ }
+ protected void info(IMessageHandler handler, String mssg) {
+ message(IMessage.INFO, mssg, handler);
+ }
+ protected void fail(IMessageHandler handler, String mssg) {
+ message(IMessage.FAIL, mssg, handler);
+ }
+
+ /** this is the only client of the message handler - remplement to do other notification*/
+ protected void message(
+ IMessage.Kind kind,
+ String mssg,
+ IMessageHandler handler) {
+ if (null != handler) {
+ handler.handleMessage(
+ new Message("\n### " + mssg, kind, null, null));
+ }
+ }
+
+ /** @return Definition[9] read from srceBase/Definition.PATH */
+ Definition[] getDefinitions(File srcBase) {
+ File file = new File(srcBase, Definition.PATH);
+ Properties props = new Properties();
+ FileInputStream in = null;
+ try {
+ in = new FileInputStream(file);
+ props.load(in);
+ } catch (IOException e) {
+ e.printStackTrace(System.err);
+ } finally {
+ if (null != in)
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
+ }
+ Definition[] result = new Definition[9];
+ for (int i = 0; i < 9; i++) { // XXX matches run
+ result[i] = new Definition((1+i) + "0", props);
+ }
+ return result;
+ }
+
+ static class Definition {
+ static final String PATH = "expected.txt";
+ boolean expectFail;
+ String prefix;
+ String[] files;
+ String[] recompiled;
+ String[] errors;
+ String[] warnings;
+ String[] eclipseErrors;
+ String[] eclipseWarnings;
+ Definition(String prefix, Properties props) {
+ Enumeration keys = props.keys();
+ this.prefix = prefix;
+ files = get(props, prefix + ".files");
+ recompiled = get(props, prefix + ".recompiled");
+ errors = get(props, prefix + ".errors");
+ warnings = get(props, prefix + ".warnings");
+ eclipseErrors = get(props, prefix + ".eclipse.errors");
+ eclipseWarnings = get(props, prefix + ".eclipse.warnings");
+ expectFail =
+ (((null != errors) && (0 < errors.length))
+ || ((null != eclipseErrors)
+ && (0 < eclipseErrors.length)));
+ }
+ String[] get(Properties props, String key) {
+ String s = props.getProperty(key);
+ if (null != s) {
+ return LangUtil.split(s);
+ }
+ return null;
+ }
+ public String toString() {
+ return "Definition "
+ + " expectFail="
+ + expectFail
+ + " prefix="
+ + prefix
+ + " files="
+ + safe(files)
+ + " recompiled="
+ + safe(recompiled)
+ + " errors="
+ + safe(errors)
+ + " warnings="
+ + safe(warnings)
+ + " eclipseErrors="
+ + safe(eclipseErrors)
+ + " eclipseWarnings="
+ + safe(eclipseWarnings);
+ }
+ String safe(String[] in) {
+ return (null == in ? "" : "" + Arrays.asList(in));
+ }
+ }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/MultipleCompileTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/MultipleCompileTestCase.java
new file mode 100644
index 000000000..665cc98e4
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/MultipleCompileTestCase.java
@@ -0,0 +1,35 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.io.*;
+
+import org.aspectj.weaver.bcel.*;
+
+import junit.framework.*;
+
+public class MultipleCompileTestCase extends CommandTestCase {
+
+ /**
+ * Constructor for WorkingCommandTestCase.
+ * @param name
+ */
+ public MultipleCompileTestCase(String name) {
+ super(name);
+ }
+
+ public void testA1() throws IOException, InterruptedException {
+ checkMultipleCompile("src1/Hello.java");
+ }
+}
+
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/VerifyWeaveTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/VerifyWeaveTestCase.java
new file mode 100644
index 000000000..0a7471261
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/VerifyWeaveTestCase.java
@@ -0,0 +1,114 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+class Ignore {}
+//import java.io.*;
+//import java.util.*;
+//
+//import junit.framework.*;
+//
+////import org.apache.bcel.classfile.*;
+//import org.aspectj.ajdt.ajc.*;
+////import org.aspectj.weaver.bcel.*;
+//import org.aspectj.bridge.*;
+//import org.aspectj.testing.util.TestUtil;
+//import org.aspectj.util.*;
+
+//public class VerifyWeaveTestCase extends WeaveTestCase {
+// {
+// regenerate = false;
+// runTests = true;
+// }
+//
+// static final String outDirName = "out";
+// static final String srcDir = "testdata" + File.separator + "src1"+ File.separator;
+//
+// public VerifyWeaveTestCase(String name) {
+// super(name);
+// }
+//
+// public void testCompile() throws IOException {
+// buildTest("A", "Hello", outDirName);
+// }
+//
+//
+// public boolean doCompile(String fileToCompile, String specifiedOutDir) {
+// List args = new ArrayList();
+// if (specifiedOutDir != null) {
+// args.add("-d");
+// args.add(specifiedOutDir);
+// }
+// args.add("-classpath");
+// args.add("../runtime/bin");
+// args.add(fileToCompile);
+//
+//
+// ICommand command = new AjdtCommand();
+// MessageHandler myHandler = new MessageHandler();
+// command.runCommand((String[])args.toArray(new String[0]), myHandler);
+// IMessage[] info = myHandler.getMessages(IMessage.INFO, IMessageHolder.EQUAL);
+//// System.out.println("info messages: " + Arrays.asList(info));
+//// System.out.println("compiled: " + fileToCompile);
+//// System.out.println("errors: " + Arrays.asList(myHandler.getErrors()));
+//// System.out.println("warnings: " + Arrays.asList(myHandler.getWarnings()));
+// return true;
+// }
+//
+// public void testBuildOutputDir() throws IOException {
+// FileUtil.deleteContents(new File(outDirName));
+//
+// doCompile(srcDir + "A.java", outDirName);
+// assertTrue("default package, output dir specified",
+// new File(outDirName + File.separator + "A.class").exists());
+//
+// File testFile = new File(srcDir + "A.class");
+// //XXX These test for javac compatible behavior with output dirs
+//// testFile.delete();
+//// doCompile(srcDir + "A.java", null);
+//// assertTrue("default package, no output dir specified",
+//// testFile.exists());
+////
+//// doCompile(srcDir + "Ap.java", null);
+//// assertTrue("package named, no dir specified",
+//// new File(srcDir + "Ap.class").exists());
+//
+// doCompile(srcDir + "Ap.java", outDirName);
+// File checkFile =
+// new File(outDirName + File.separator + "src1" + File.separator + "Ap.class");
+// assertTrue("package named, dir specified: " + checkFile.getAbsolutePath(),
+// checkFile.exists());
+//
+// }
+//
+// public void buildTest(String name, String outName, String specifiedOutDir) throws IOException {
+// String classDir = "bin";
+//
+// doCompile(srcDir + name + ".java", specifiedOutDir);
+//
+// LazyClassGen gen = new LazyClassGen(new BcelObjectType(new ClassParser(outDirName + File.separator + outName +".class").parse()));
+//
+// try {
+// checkClass(gen, outDirName, outName + ".txt");
+// if (runTests) {
+// TestUtil.runMain(outDirName, "A");
+// }
+// } catch (Error e) {
+// gen.print(System.err);
+// throw e;
+// } catch (RuntimeException e) {
+// gen.print(System.err);
+// throw e;
+// }
+// }
+//
+//}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java
new file mode 100644
index 000000000..d93baa036
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java
@@ -0,0 +1,131 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.List;
+
+import org.aspectj.testing.util.TestUtil;
+
+public class WorkingTestMain {
+
+ public static void main(String[] args1) throws IOException {
+ //testExamples();
+ testOne();
+ }
+
+ public static void testOne() throws IOException {
+ //CommandTestCase.checkCompile("src1/Parents.java", CommandTestCase.NO_ERRORS);
+
+ //CommandTestCase.checkCompile("../../tests/new/ArgsInCflow2.java", CommandTestCase.NO_ERRORS);
+
+ //CommandTestCase.checkCompile("src1/ParentsFail.java", CommandTestCase.NO_ERRORS);
+
+ List args = new ArrayList();
+ args.add("-verbose");
+
+ args.add("-d");
+ args.add("out");
+
+ args.add("-classpath");
+ args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin");
+ //args.add("../runtime/bin;../lib/junit/junit.jar");
+
+// args.add("-injars");
+// args.add("testdata/testclasses.jar");
+
+ //args.add("-aspectpath");
+ //args.add("../bcweaver/testdata/megatrace.jar");
+
+ //args.add("testdata/src1/AroundA1.java");
+ args.add("../tests/new/StrictFPAdvice.java");
+ //args.add("-Xlint:error");
+ //args.add("testdata/src1/InterType.java");
+ //args.add("@" + examplesDir + "tjp/files.lst");
+
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ //CommandTestCase.runCompiler(args, new int[] {11, 14, 18, 32, 43});
+
+ CommandTestCase.printGenerated("../out", "StrictFPAdvice");
+ CommandTestCase.printGenerated("../out", "A");
+
+ //TestUtil.runMain("out;../bcweaver/testdata/megatrace.jar", "Privileged");
+ TestUtil.runMain("out;../lib/test/testing-client.jar", "StrictFPAdvice");
+ }
+
+ private static String examplesDir = "c:/aspectj/examples/";
+ private static void example(String[] argfiles, String[] classes) {
+ List args = new ArrayList();
+ args.add("-verbose");
+
+ args.add("-d");
+ args.add("out");
+
+ args.add("-classpath");
+ args.add("../runtime/bin");
+
+ for (int i=0; i < argfiles.length; i++) {
+ args.add("@" + examplesDir + argfiles[i]);
+ }
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+ for (int i=0; i < classes.length; i++) {
+ TestUtil.runMain("out", classes[i]);
+ }
+ }
+
+
+ public static void testExamples() throws IOException {
+// example(new String[] {"observer/files.lst"},
+// new String[] {"observer.Demo"});
+
+// example(new String[] {"tjp/files.lst"},
+// new String[] {"tjp.Demo"});
+
+ example(new String[] {"telecom/timing.lst"},
+ new String[] {"telecom.TimingSimulation"});
+
+ example(new String[] {"telecom/billing.lst"},
+ new String[] {"telecom.BillingSimulation"});
+
+ example(new String[] {"tracing/tracev1.lst"},
+ new String[] {"tracing.version1.TraceMyClasses"});
+
+ example(new String[] {"tracing/tracev2.lst"},
+ new String[] {"tracing.version2.TraceMyClasses"});
+
+ example(new String[] {"tracing/tracev3.lst"},
+ new String[] {"tracing.version3.TraceMyClasses"});
+
+
+ example(new String[] {"introduction/files.lst"},
+ new String[] {"introduction.HashablePoint", "introduction.ComparablePoint"});
+
+
+
+
+ example(new String[] {"bean/files.lst"},
+ new String[] {"bean.Demo"});
+
+ example(new String[] {"spacewar/demo.lst"},
+ new String[] {});
+
+ example(new String[] {"spacewar/debug.lst"},
+ new String[] {});
+
+
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java
new file mode 100644
index 000000000..4b98bba37
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java
@@ -0,0 +1,366 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.core.builder;
+
+import java.io.*;
+import java.util.*;
+
+import junit.framework.TestCase;
+import org.aspectj.ajdt.ajc.BuildArgParser;
+import org.aspectj.asm.*;
+import org.aspectj.asm.StructureModelManager;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.MessageHandler;
+import org.aspectj.bridge.MessageWriter;
+import org.aspectj.testing.util.TestUtil;
+import org.aspectj.util.*;
+import org.aspectj.workbench.resources.FilesystemFolder;
+import org.eclipse.core.internal.events.ResourceDelta;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.internal.core.builder.*;
+import org.eclipse.jdt.internal.core.builder.SimpleLookupTable;
+
+public class AjBuildManagerTest extends TestCase {
+
+ private StreamPrintWriter outputWriter = new StreamPrintWriter(new PrintWriter(System.out));
+ private MessageWriter messageWriter = new MessageWriter(outputWriter, false);
+ public static File source1 = new File("testdata/src1/A.java");
+ public static File source2 = new File("testdata/src1/Hello.java");
+ public static File source3 = new File("testdata/src1/X.java");
+
+ public AjBuildManagerTest(String name) {
+ super(name);
+ }
+
+ public void testSimpleStructure() throws IOException, CoreException {
+
+ AjBuildManager manager = new AjBuildManager(messageWriter);
+ BuildArgParser parser = new BuildArgParser();
+ String javaClassPath = System.getProperty("java.class.path");
+ AjBuildConfig buildConfig =
+ parser.genBuildConfig(new String[] {
+ "-d", "out",
+ "-classpath",
+ javaClassPath,
+ "testdata/src1/A.java",
+// "testdata/src1/Hello.java",
+ }, messageWriter);
+ String err = parser.getOtherMessages(true);
+ assertTrue(err, null == err);
+ manager.setStructureModel(StructureModelManager.INSTANCE.getStructureModel());
+ MessageHandler handler = new MessageHandler();
+ manager.batchBuild(buildConfig, handler);
+ assertEquals(0, handler.numMessages(IMessage.WARNING, true));
+// System.out.println(
+// ">> model: \n" +
+// StructureModelManager.INSTANCE.getStructureModel().getRoot().toLongString()
+// );
+//
+// System.out.println(
+// ">> children: \n" +
+// ((StructureNode)StructureModelManager.INSTANCE.getStructureModel().getRoot().getChildren().get(0)).getChildren()
+// );
+ }
+
+
+
+
+ //XXX add test for resource deltas
+
+ public void testUpdateBuildConfig() {
+ final File FILE_1 = new File("testdata/testclasses/Temp1.java");
+ final File FILE_2 = new File("testdata/testclasses/Temp2.java");
+ final File FILE_3 = new File("testdata/testclasses/Temp3.java");
+ List files = new ArrayList();
+ files.add(FILE_1);
+ files.add(FILE_2);
+
+ AjBuildManager manager = new AjBuildManager(messageWriter);
+ AjBuildConfig buildConfig = new AjBuildConfig();
+ manager.buildConfig = buildConfig;
+ buildConfig.setFiles(files);
+
+ manager.updateBuildConfig(buildConfig);
+ assertTrue("no change", manager.deletedFiles.isEmpty());
+
+ AjBuildConfig newConfig = new AjBuildConfig();
+ newConfig.getFiles().add(FILE_1);
+ newConfig.getFiles().add(FILE_2);
+ newConfig.getFiles().add(FILE_3);
+ manager.updateBuildConfig(newConfig);
+ assertTrue("added file", manager.deletedFiles.isEmpty());
+ assertTrue(manager.addedFiles.size() == 1);
+ assertTrue(manager.addedFiles.contains(FILE_3));
+
+ newConfig = new AjBuildConfig();
+ newConfig.getFiles().add(FILE_3);
+ manager.updateBuildConfig(newConfig);
+ assertTrue("deleted 2 files", manager.addedFiles.isEmpty());
+ assertTrue(manager.deletedFiles.size() == 2);
+ assertTrue(manager.deletedFiles.contains(FILE_1));
+
+ newConfig = new AjBuildConfig();
+ newConfig.getFiles().add(FILE_2);
+ manager.updateBuildConfig(newConfig);
+ assertTrue("added file", manager.addedFiles.size() == 1);
+ assertTrue("deleted file", manager.deletedFiles.size() == 1);
+ assertTrue(manager.deletedFiles.size() == 1);
+ assertTrue(manager.addedFiles.contains(FILE_2));
+ assertTrue(manager.deletedFiles.contains(FILE_3));
+ }
+
+ /**
+ * Pretends that the files 'have been' modified in the future and waits.
+ * Tests:
+ * 1) no change,
+ * 2) added file,
+ * 3) removed file
+ *
+ * XXX should just test modified
+ */
+ public void testGetModifiedFiles() throws IOException, InterruptedException {
+ final File TEMP_1 = new File("testdata/testclasses/TempChanged.java");
+ final File EXISTS_2 = new File("testdata/testclasses/p1/Foo.java");
+ final File NEW = new File("testdata/testclasses/TempNew.java");
+ NEW.delete();
+ touch(TEMP_1, false);
+ List files = new ArrayList();
+ files.add(TEMP_1);
+ files.add(EXISTS_2);
+
+ assertTrue("input files", TEMP_1.exists() && EXISTS_2.exists());
+ assertTrue("new file", !NEW.exists());
+
+ Thread.sleep(100);
+ long lastBuildTime = System.currentTimeMillis();
+
+ AjBuildManager manager = new AjBuildManager(messageWriter);
+ manager.buildConfig = new AjBuildConfig();
+ manager.buildConfig.setFiles(files);
+ Collection changedFiles = manager.getModifiedFiles(lastBuildTime);
+ assertTrue("nothing changed: " + changedFiles, changedFiles.isEmpty());
+
+ lastBuildTime = System.currentTimeMillis();
+ Thread.sleep(100);
+
+ touch(NEW, false);
+
+ //NEW.createNewFile();
+ files.add(NEW);
+ changedFiles = manager.getModifiedFiles(lastBuildTime);
+ assertTrue("new file: " + changedFiles, changedFiles.contains(NEW));
+
+ lastBuildTime = System.currentTimeMillis();
+ Thread.sleep(100);
+
+ files.remove(NEW);
+ changedFiles = manager.getModifiedFiles(lastBuildTime);
+ assertTrue("nothing changed", changedFiles.isEmpty());
+
+ lastBuildTime = System.currentTimeMillis();
+ Thread.sleep(100);
+
+ touch(TEMP_1, true);
+ changedFiles = manager.getModifiedFiles(lastBuildTime);
+ assertTrue("touched file: " + changedFiles, changedFiles.contains(TEMP_1));
+
+ lastBuildTime = System.currentTimeMillis();
+ Thread.sleep(100);
+
+ files.remove(NEW);
+ changedFiles = manager.getModifiedFiles(lastBuildTime);
+ assertTrue("nothing changed", changedFiles.isEmpty());
+
+ TEMP_1.delete();
+ NEW.delete();
+ }
+
+ public void testMakeDeltas() throws IOException, InterruptedException {
+ AjBuildManager manager = new AjBuildManager(messageWriter);
+ manager.buildConfig = new AjBuildConfig();
+ List sourceRoots = new ArrayList();
+ sourceRoots.add(new File("out"));
+ manager.buildConfig.setSourceRoots(sourceRoots);
+ assertTrue(manager.testInit(messageWriter));
+ List modified = Arrays.asList(new File[] { new File("A.java"), new File("B.java") });
+ List deleted = Arrays.asList(new File[] { new File("X.java") });
+ SimpleLookupTable deltas = new SimpleLookupTable();
+ manager.makeDeltas(
+ deltas,
+ modified,
+ deleted,
+ ((File)manager.buildConfig.getSourceRoots().get(0)).getPath());
+
+ ResourceDelta d = (ResourceDelta)deltas.get(manager.getJavaBuilder().currentProject);
+ assertNotNull(d);
+
+ assertEquals(d.getAffectedChildren().length, 3);
+ //XXX do more testing of children
+ }
+
+ // XXX should this be working??
+ public void testDeleteRealFiles() throws CoreException, IOException {
+ AjBuildManager manager = new AjBuildManager(messageWriter);
+ manager.buildConfig = new AjBuildConfig();
+ List sourceRoots = new ArrayList();
+ sourceRoots.add(new File("testdata/src1"));
+ manager.buildConfig.setSourceRoots(sourceRoots);
+ manager.buildConfig.setOutputDir(new File("out"));
+ assertTrue(manager.testInit(messageWriter));
+
+ File realClassFile = new File("out/X.class");
+ touch(realClassFile, false);
+
+ assertTrue(realClassFile.exists());
+
+ IFile classfile = manager.classFileCache.getFile(new Path("X.class"));
+ classfile.create(FileUtil.getStreamFromZip("testdata/testclasses.jar", "Hello.class"), true, null);
+ assertTrue(classfile.exists());
+
+ manager.addAspectClassFilesToWeaver();
+
+ classfile.delete(true, false, null);
+ assertTrue(realClassFile.exists());
+
+ manager.addAspectClassFilesToWeaver();
+
+ assertTrue(!realClassFile.exists());
+
+ }
+
+ public void testIncrementalCompilerCall() throws IOException, InterruptedException, CoreException {
+ AjBuildManager manager = new AjBuildManager(messageWriter);
+
+ manager.buildConfig = new AjBuildConfig();
+ List roots = new ArrayList();
+ roots.add(new File("testdata/src1"));
+ manager.testInit(messageWriter);
+ manager.buildConfig.setSourceRoots(roots);
+ assertTrue(manager.testInit(messageWriter));
+ List modified = Arrays.asList(new File[] { source1, source2 });
+ List deleted = Arrays.asList(new File[] { source3 });
+ SimpleLookupTable deltas = new SimpleLookupTable();
+ manager.makeDeltas(
+ deltas,
+ modified,
+ deleted,
+ ((File)manager.buildConfig.getSourceRoots().get(0)).getAbsolutePath());
+
+ JavaBuilder jbuilder = manager.getJavaBuilder();
+ jbuilder.lastState = new State(jbuilder);
+ jbuilder.binaryResources = new SimpleLookupTable();
+
+ AjBuildManager.IncrementalBuilder builder
+ = manager.getIncrementalBuilder(messageWriter); // XXX trap errors
+ TestNotifier testNotifier = new TestNotifier(builder, jbuilder.currentProject);
+ jbuilder.notifier = testNotifier;
+
+ IContainer[] sourceFolders = new IContainer[] {
+ new FilesystemFolder(((File)manager.buildConfig.getSourceRoots().get(0)).getAbsolutePath())
+ };
+ builder.setSourceFolders(sourceFolders);
+ testNotifier.builder = builder;
+
+ IFile classfile = manager.classFileCache.getFile(new Path("X.class"));
+ classfile.create(new ByteArrayInputStream(new byte[] {1,2,3}), true, null);
+
+ assertTrue(classfile.exists());
+
+
+ try {
+ manager.testSetHandler(messageWriter);
+ boolean succeeded = builder.build(deltas);
+ } catch (NonLocalExit nle) {
+ assertEquals(nle.getExitCode(), 0);
+ } finally {
+ manager.testSetHandler(null);
+ }
+
+ assertTrue(!classfile.exists());
+ }
+
+ static class TestNotifier extends BuildNotifier {
+ int state = 0;
+ AjBuildManager.IncrementalBuilder builder;
+
+ public TestNotifier(AjBuildManager.IncrementalBuilder builder, IProject project) {
+ super(null, project);
+ this.builder = builder;
+ }
+
+
+ public void updateProgressDelta(float percentWorked) {
+ switch(state) {
+ case 0:
+ checkInitialConfig();
+ break;
+ case 1:
+ checkBinaryResources();
+ break;
+ case 2:
+ checkAffectedFiles();
+ break;
+ }
+ state += 1;
+ }
+
+ private void checkBinaryResources() {
+ }
+
+
+ private void checkInitialConfig() {
+ Collection files = builder.getLocations();
+ //System.out.println("initial: " + files);
+ }
+
+ private void checkAffectedFiles() {
+ Collection files = builder.getLocations();
+ TestUtil.assertSetEquals(Arrays.asList(new String[] {
+ source1.getAbsolutePath().replace(File.separatorChar, '/'),
+ source2.getAbsolutePath().replace(File.separatorChar, '/') }), files);
+ throw new NonLocalExit(0);
+ }
+ }
+
+ /**
+ * Method touch.
+ * @param NEW
+ * @param b
+ */
+ private void touch(File file, boolean isAppend) throws IOException {
+ FileOutputStream s = new FileOutputStream(file.getAbsolutePath(), isAppend);
+ s.write(new byte[] {1,2,3});
+ s.close();
+ }
+
+
+ /*
+ * jar
+ * directory
+ * source directory
+ * container
+ */
+// public void testMakeClasspathLocations() {
+// List classpath = new ArrayList();
+// classpath.add(
+//
+// AjBuildConfig config = new AjBuildConfig();
+// config.setClasspath()
+// }
+
+// private void testClasspathLocation(String loca
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java
new file mode 100644
index 000000000..55b7690f3
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java
@@ -0,0 +1,33 @@
+/* *******************************************************************
+ * 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
+ * ******************************************************************/
+
+
+package org.aspectj.ajdt.internal.core.builder;
+
+import junit.framework.*;
+
+public class AjdtBuilderTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjdtBuilderTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(AjBuildManagerTest.class);
+ suite.addTestSuite(ClassFileCacheTest.class);
+ suite.addTestSuite(ClasspathContainerTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+ public AjdtBuilderTests(String name) { super(name); }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClassFileCacheTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClassFileCacheTest.java
new file mode 100644
index 000000000..1b8c78bfb
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClassFileCacheTest.java
@@ -0,0 +1,253 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.core.builder;
+
+import java.io.*;
+import java.util.*;
+
+import junit.framework.TestCase;
+
+import org.aspectj.bridge.MessageHandler;
+import org.aspectj.testing.util.TestUtil;
+import org.aspectj.util.*;
+import org.aspectj.workbench.resources.FilesystemFolder;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+
+public class ClassFileCacheTest extends TestCase {
+
+ private MessageHandler handler = new MessageHandler();
+
+ public ClassFileCacheTest(String name) {
+ super(name);
+ }
+
+ public void testExists() throws CoreException {
+ ClassFileCache cache = new ClassFileCache(new FilesystemFolder(new Path("out")), handler);
+ IPath folderPath = new Path("tempfolder");
+ IFolder folder = cache.getFolder(folderPath);
+
+ assertTrue("default folder always exists", cache.exists(new Path("")));
+ assertTrue("default folder always exists", cache.getFolder(new Path("")).exists());
+
+
+ assertTrue("" + folder, !cache.exists(folderPath));
+
+ folder.create(true, true, null);
+ assertTrue("created: " + folderPath, cache.exists(folderPath));
+ assertTrue("created: " + folderPath, cache.getFolder(folderPath).exists());
+
+ folder.delete(true, null);
+ assertTrue("deleted: " + folderPath, !cache.exists(folderPath));
+
+ IPath filePath = new Path("tempfolder/TempClass.class");
+ IFile file = cache.getFile(filePath);
+ assertTrue("" + file, !cache.exists(filePath));
+ assertTrue("" + file, !cache.exists(folderPath));
+
+ createFile(cache, "tempfolder/TempClass.class");
+ assertTrue("" + file, cache.exists(filePath));
+ //XXX should be created when children are
+ //XXXassertTrue("" + file, cache.exists(folderPath));
+ }
+
+ public void testFilesAreCached() throws CoreException {
+ ClassFileCache cache = new ClassFileCache(new FilesystemFolder(new Path("out")), handler);
+ IFolder folder = cache.getFolder(new Path("testpath"));
+ IFile file1 = folder.getFile("Foo.class");
+ assertTrue("" + file1.getClass(), file1 instanceof DeferredWriteFile);
+
+ IFile file2 = cache.getFile(new Path("testpath/Foo.class"));
+ assertTrue("" + file2.getClass(), file2 instanceof DeferredWriteFile);
+
+ assertTrue("" + file1 + ", " + file2, file1 == file2);
+
+
+ folder = cache.getFolder(new Path("testpath"));
+ folder = folder.getFolder("p1");
+ assertTrue("" + folder, !folder.exists());
+
+
+ file1 = folder.getFile(new Path("Bar.class"));
+ file2 = cache.getFile(new Path("testpath/p1/Bar.class"));
+
+ assertTrue("" + file1.getClass(), file1 instanceof DeferredWriteFile);
+ assertTrue("" + file2.getClass(), file2 instanceof DeferredWriteFile);
+
+ assertTrue("" + file1 + ", " + file2, file1 == file2);
+
+
+ assertTrue(!cache.exists(new Path("testpath/p1/Bar.class")));
+
+ InputStream source = new ByteArrayInputStream(new byte[] {0,1,2,3,4,5,6,7,8,9});
+ file1.create(source, true, null);
+ assertTrue(cache.exists(new Path("testpath/p1/Bar.class")));
+
+ file1.delete(true, true, null);
+ assertTrue(!cache.exists(new Path("testpath/p1/Bar.class")));
+
+ IResource[] members = cache.members();
+ assertEquals(members.length, 2);
+
+ DeferredWriteFile dwf1 = (DeferredWriteFile) members[0];
+ DeferredWriteFile dwf2 = (DeferredWriteFile) members[1];
+
+ if (dwf1.getName().endsWith("Bar.class")) {
+ DeferredWriteFile tmp = dwf1;
+ dwf1 = dwf2; dwf2 = tmp;
+ }
+
+ assertTrue(!dwf1.exists());
+ assertTrue(!dwf2.exists());
+
+ assertEquals(dwf1.getName(), "Foo.class");
+ assertEquals(dwf2.getName(), "Bar.class");
+ }
+
+ public void testChange() throws CoreException {
+ MessageHandler handler = new MessageHandler();
+ ClassFileCache cache = new ClassFileCache(new FilesystemFolder(new Path("out")), handler);
+ cache.resetIncrementalInfo();
+ String path1 = "testpath/Foo.class";
+ String path2 = "testpath/Bar.class";
+// cache.getFolder(new Path("testpath")).delete(true, false, null);
+ assertTrue(!cache.getFolder(new Path("testpath")).exists());
+
+ createFile(cache, path1);
+ createFile(cache, path2);
+
+ //XXX assertTrue(cache.getFolder(new Path("testpath")).exists());
+
+ checkFileMatch(cache.getAddedOrChanged(),
+ new String[] { "out/" + path1, "out/" + path2 });
+ checkFileMatch(cache.getDeleted(), new String[0] );
+
+ // added
+ cache.resetIncrementalInfo();
+ String path3 = "testpath/Baz.class";
+ createFile(cache, path3);
+ checkFileMatch(cache.getAddedOrChanged(), new String[] { "out/" + path3 });
+ checkFileMatch(cache.getDeleted(), new String[0] );
+
+ // remove
+ cache.resetIncrementalInfo();
+ deleteFile(cache, path3);
+ checkFileMatch(cache.getDeleted(), new String[] { "out/" + path3 });
+ checkFileMatch(cache.getAddedOrChanged(), new String[0] );
+
+ // change
+ cache.resetIncrementalInfo();
+ createFile(cache, path1);
+
+ deleteFile(cache, path2);
+ createFile(cache, path2);
+
+ checkFileMatch(cache.getAddedOrChanged(),
+ new String[] { "out/" + path1, "out/" + path2 });
+ checkFileMatch(cache.getDeleted(), new String[0] );
+ }
+
+ public void testWrite() throws CoreException {
+ MessageHandler handler = new MessageHandler();
+ clearDirectory("out");
+ checkEmpty("out");
+
+ ClassFileCache cache = new ClassFileCache(new FilesystemFolder(new Path("out")), handler);
+ cache.resetIncrementalInfo();
+ String path1 = "testpath/Foo.class";
+ String path2 = "testpath/Bar.class";
+ createFile(cache, path1);
+ createFile(cache, path2);
+
+ checkEmpty("out");
+
+ writeCache(cache);
+
+ checkContents("out", new String[] {"out/" + path1, "out/" + path2});
+
+ deleteFile(cache, path2);
+ checkContents("out", new String[] {"out/" + path1, "out/" + path2});
+ writeCache(cache);
+
+ checkContents("out", new String[] {"out/" + path1});
+ }
+
+ private void writeCache(ClassFileCache cache) throws CoreException {
+ IResource[] members = cache.members();
+ for (int i = 0; i < members.length; i++) {
+ IResource iResource = members[i];
+ DeferredWriteFile file = (DeferredWriteFile) iResource;
+ //System.out.println("about to write: " + file);
+ if (file.exists()) {
+ file.writeWovenBytes(new byte[] { 0, 1, 2,3});
+ } else {
+ file.deleteRealFile();
+ }
+ }
+ }
+
+ private void checkContents(String path, String[] files) {
+ File dir = new File(path);
+ assertTrue(dir.exists());
+ List allFiles = new ArrayList();
+ listRecursively(new File(path), allFiles, "");
+ TestUtil.assertSetEquals(Arrays.asList(files), allFiles);
+ }
+
+ private void listRecursively(File file, List accumulator, String prefix) {
+ if (file.isDirectory()) {
+ if (prefix.length() == 0) prefix = file.getName() + "/";
+ else prefix = prefix + file.getName() + "/";
+ File[] files = file.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ listRecursively(files[i], accumulator, prefix);
+ }
+ } else {
+ accumulator.add(prefix + file.getName());
+ }
+ }
+
+
+
+ private void checkEmpty(String path) {
+ checkContents(path, new String[0]);
+ }
+
+
+ private void clearDirectory(String path) {
+ FileUtil.deleteContents(new File(path));
+ }
+
+
+ private void checkFileMatch(List list, String[] names) {
+ Set found = new HashSet();
+ for (Iterator iter = list.iterator(); iter.hasNext();) {
+ EclipseUnwovenClassFile file = (EclipseUnwovenClassFile) iter.next();
+ found.add(file.getFile().getFullPath().toString());
+ }
+
+ TestUtil.assertSetEquals(Arrays.asList(names), found);
+ }
+
+ private void createFile(ClassFileCache cache, String path) throws CoreException {
+ IFile file = cache.getFile(new Path(path));
+ InputStream source = new ByteArrayInputStream(new byte[] {0,1,2,3,4,5,6,7,8,9});
+ file.create(source, true, null);
+ }
+
+ private void deleteFile(ClassFileCache cache, String path) throws CoreException {
+ IFile file = cache.getFile(new Path(path));
+ file.delete(true, null);
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClasspathContainerTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClasspathContainerTestCase.java
new file mode 100644
index 000000000..cc06fa901
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/ClasspathContainerTestCase.java
@@ -0,0 +1,66 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.ajdt.internal.core.builder;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.aspectj.util.FileUtil;
+import org.aspectj.workbench.resources.FilesystemFolder;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.core.builder.ClasspathLocation;
+
+public class ClasspathContainerTestCase extends TestCase {
+
+ public ClasspathContainerTestCase(String name) {
+ super(name);
+ }
+
+ // XXX add some inner cases
+ public void testFindClass() throws IOException {
+ FileUtil.extractJar("testdata/testclasses.jar", "out/testclasses");
+
+
+ IContainer container = new FilesystemFolder(new Path("out/testclasses"));
+ ClasspathLocation classpathLocation = new ClasspathContainer(container);
+ // put back in for sanity check
+ //classpathLocation = ClasspathContainer.forBinaryFolder("testdata/testclasses");
+
+ NameEnvironmentAnswer answer = classpathLocation.findClass("Hello.class", "", "Hello.class");
+ assertTrue("" + answer, answer != null);
+
+ NameEnvironmentAnswer answer2 = classpathLocation.findClass("Foo.class", "p1", "p1/Foo.class");
+ assertTrue("" + answer2, answer2 != null);
+
+ NameEnvironmentAnswer answer3 = classpathLocation.findClass("DoesNotExist.class", "", "DoesNotExist.class");
+ assertTrue("" + answer3, answer3 == null);
+
+ NameEnvironmentAnswer answer4 = classpathLocation.findClass("DoesNotExist.class", "p1", "DoesNotExist.class");
+ assertTrue("" + answer4, answer4 == null);
+
+
+ }
+
+ public void testIsPackage() {
+ IContainer container = new FilesystemFolder(new Path("testdata/testclasses"));
+ ClasspathLocation classpathLocation = new ClasspathContainer(container);
+
+ assertTrue("is a package", classpathLocation.isPackage("p1"));
+ assertTrue("is not a package", !classpathLocation.isPackage("mumble"));
+ assertTrue("is not a package", !classpathLocation.isPackage("Hello.class"));
+ }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFileTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFileTest.java
new file mode 100644
index 000000000..a320cceec
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFileTest.java
@@ -0,0 +1,112 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+
+package org.aspectj.workbench.resources;
+
+import java.io.*;
+import java.io.FileInputStream;
+
+import junit.framework.TestCase;
+import org.aspectj.util.FileUtil;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+//XXX this *has* to be tested on Linux
+public class FilesystemFileTest extends TestCase {
+
+ private static final String PATH = "testdata" + File.separator + "resources" + File.separator;
+
+ private static final String TEST = PATH + "test.txt";
+ private static final String SOURCE = PATH + "file.txt";
+ private static final String EMPTY = PATH + "empty.txt";
+ private IProgressMonitor monitor = new NullProgressMonitor();
+ private FilesystemFile file;
+ private File javaFile;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ file = new FilesystemFile(TEST);
+ javaFile = new File(TEST);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (file.exists()) file.delete(true, monitor);
+ }
+
+ public FilesystemFileTest(String name) {
+ super(name);
+ }
+
+ public void testCreateExistsContentsDelete() throws FileNotFoundException, CoreException, InterruptedException, IOException {
+ if (file.exists()) file.delete(true, monitor);
+ assertTrue(!file.exists());
+ FileInputStream fis = new FileInputStream(SOURCE);
+
+ file.create(fis, 0, monitor);
+ fis.close();
+ assertTrue(file.exists());
+
+ String expected = FileUtil.readAsString(new File(SOURCE));
+ String contents = FileUtil.readAsString(file.getContents());
+ assertEquals(expected, contents);
+
+ file.setContents(new FileInputStream(EMPTY), 0, monitor);
+ assertEquals("", FileUtil.readAsString(file.getContents()));
+
+ file.delete(true, monitor);
+ assertTrue(!file.exists());
+ }
+
+ public void testGetFileExtension() {
+ assertEquals(file.getFileExtension(), "txt");
+ }
+
+ public void testGetFullPath() {
+ assertEquals(file.getFullPath().toString(), javaFile.getPath().replace('\\', '/'));
+ }
+
+ public void testGetLocation() {
+ assertEquals(file.getLocation().toString(), javaFile.getAbsolutePath().replace('\\', '/'));
+ }
+
+ public void testGetName() {
+ assertEquals(file.getName(), javaFile.getName());
+ }
+
+ public void testGetModificationStamp() throws IOException, CoreException {
+ FileInputStream fis = new FileInputStream(SOURCE);
+ file.create(fis, 0, monitor);
+ assertEquals(file.getModificationStamp(), javaFile.lastModified());
+ }
+
+ public void testGetParent() {
+ assertEquals(file.getParent().getFullPath().toString(), javaFile.getParentFile().getPath().replace('\\', '/'));
+ }
+
+ public void testReadOnly() throws CoreException, IOException {
+ FileInputStream fis = new FileInputStream(SOURCE);
+ file.create(fis, 0, monitor);
+
+ assertTrue(!file.isReadOnly());
+ file.setReadOnly(true);
+ assertTrue(file.isReadOnly());
+ }
+
+ //XXX not implemented
+ public void testCopy() { }
+
+ //XXX not implemented
+ public void testTouch() { }
+
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFolderTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFolderTest.java
new file mode 100644
index 000000000..a958808f2
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/FilesystemFolderTest.java
@@ -0,0 +1,128 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.workbench.resources;
+
+import java.io.*;
+import junit.framework.TestCase;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class FilesystemFolderTest extends TestCase {
+
+ private static final String PATH = "testdata" + File.separator + "resources" + File.separator;
+ private static final String DIR = PATH + "dir";
+ private IProgressMonitor monitor = new NullProgressMonitor();
+ private FilesystemFolder dir;
+ private File javaDir;
+
+ public FilesystemFolderTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ dir = new FilesystemFolder(DIR);
+ javaDir = new File(DIR);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ dir.delete(true, monitor);
+ }
+
+ public void testCreateExistsDelete() throws CoreException {
+ dir.delete(true, monitor);
+ assertTrue(!dir.exists());
+
+ dir.create(true, true, monitor);
+ assertTrue(dir.exists());
+ assertTrue(javaDir.exists());
+
+ dir.delete(true, monitor);
+ assertTrue(!dir.exists());
+ assertTrue(!javaDir.exists());
+ }
+
+ public void testGetFullPath() {
+ assertEquals(dir.getFullPath().toString(), javaDir.getPath().replace('\\', '/'));
+ }
+
+ public void testGetLocation() {
+ assertEquals(dir.getLocation().toString(), javaDir.getAbsolutePath().replace('\\', '/'));
+ }
+
+ public void testGetName() {
+ assertEquals(dir.getName(), javaDir.getName());
+ }
+
+ public void testGetModificationStamp() throws CoreException {
+ dir.create(true, true, monitor);
+ assertEquals(dir.getModificationStamp(), javaDir.lastModified());
+ }
+
+ public void testReadOnly() throws CoreException, IOException {
+ dir.create(true, true, monitor);
+
+ assertTrue(!dir.isReadOnly());
+ assertTrue(javaDir.canWrite());
+ dir.setReadOnly(true);
+ assertTrue(dir.isReadOnly());
+ assertTrue(!javaDir.canWrite());
+ }
+
+ public void testGetParent() {
+ assertEquals(dir.getParent().getFullPath().toString(), javaDir.getParentFile().getPath().replace('\\', '/'));
+ }
+
+ public void testExistsAbsoluteAndRelativeIPath() throws CoreException {
+ final String CHILD_PATH = DIR + File.separator + "child";
+ IPath childIPath = new Path(CHILD_PATH);
+ FilesystemFolder child = new FilesystemFolder(CHILD_PATH);
+
+ child.create(true, true, monitor);
+ assertTrue("relative", dir.exists(childIPath));
+
+ IPath absoluteChildIPath = new Path(new File(CHILD_PATH).getAbsolutePath());
+ assertTrue("absolute", dir.exists(absoluteChildIPath));
+ }
+
+ public void testGetFileIPath() {
+ final String DIRFILE = "dirfile.txt";
+ IFile dirfile = dir.getFile(DIRFILE);
+ assertEquals(
+ dirfile.getLocation().toString(),
+ new File(DIR + File.separator + DIRFILE).getAbsolutePath().replace('\\', '/'));
+ }
+
+ public void testGetFolderIPath() {
+ final String DIRFOLDER = "dirfolder";
+ IFolder dirfile = dir.getFolder(DIRFOLDER);
+ assertEquals(
+ dirfile.getLocation().toString(),
+ new File(DIR + File.separator + DIRFOLDER).getAbsolutePath().replace('\\', '/'));
+ }
+
+ //XXX not implemented
+ public void testCopy() { }
+
+ //XXX not implemented
+ public void testTouch() { }
+
+ //XXX not implemented
+ public void testFindMemberIPath() { }
+
+ //XXX not implemented
+ public void testMembers() { }
+}
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/WorkspaceResourcesTests.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/WorkspaceResourcesTests.java
new file mode 100644
index 000000000..bba3f0c01
--- /dev/null
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/workbench/resources/WorkspaceResourcesTests.java
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 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
+ * ******************************************************************/
+
+package org.aspectj.workbench.resources;
+
+import junit.framework.*;
+
+public class WorkspaceResourcesTests {
+
+ public static void main(String[] args) {
+ }
+
+ public static Test suite() {
+ TestSuite suite =
+ new TestSuite("Test for org.aspectj.workbench.resources");
+ //$JUnit-BEGIN$
+ suite.addTest(new TestSuite(FilesystemFileTest.class));
+ suite.addTest(new TestSuite(FilesystemFolderTest.class));
+ //$JUnit-END$
+ return suite;
+ }
+}