From: wisberg Date: Fri, 31 Oct 2003 19:41:55 +0000 (+0000) Subject: using ../{module}/ convention for testdata references so tests can be run from any... X-Git-Tag: mostlyLastEclipse2xTree_20040112~99 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=61943d21418e2ded251c9e51933ec61e3f267bb3;p=aspectj.git using ../{module}/ convention for testdata references so tests can be run from any peer directory/module, i.e., from one module Also using canonical rather than absolute path to predict generated paths --- 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 index 777eec89a..5f9480e81 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtAjcTests.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtAjcTests.java @@ -14,10 +14,16 @@ package org.aspectj.ajdt.ajc; +import java.io.File; + import junit.framework.*; public class AjdtAjcTests extends TestCase { + public static final String TESTDATA_PATH + = "../org.aspectj.ajdt.core/testdata"; + public static final File TESTDATA_DIR = new File(TESTDATA_PATH); + public static Test suite() { TestSuite suite = new TestSuite(AjdtAjcTests.class.getName()); //$JUnit-BEGIN$ 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 index 19339ea9f..8ae075bd1 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java @@ -128,7 +128,8 @@ public class AjdtCommandTestCase extends TestCase { outputWriter.flushBuffer(); config = command.genBuildConfig( - new String[] { "-incremental", "-sourceroots", "testdata/src1" }, + new String[] { "-incremental", "-sourceroots", + AjdtAjcTests.TESTDATA_PATH + "/src1" }, counter); assertTrue( 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 index f5ea0ee01..fa541febf 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java @@ -29,7 +29,7 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; public class BuildArgParserTestCase extends TestCase { private BuildArgParser parser = new BuildArgParser(); - private static final String TEST_DIR = "testdata" + File.separator + "ajc" + File.separator; + private static final String TEST_DIR = AjdtAjcTests.TESTDATA_PATH + File.separator + "ajc" + File.separator; private MessageWriter messageWriter = new MessageWriter(new PrintWriter(System.out), false); public BuildArgParserTestCase(String name) { @@ -103,8 +103,8 @@ public class BuildArgParserTestCase extends TestCase { } public void testAspectpath() throws InvalidInputException { - final String SOURCE_JAR = "testdata/testclasses.jar"; - final String SOURCE_JARS = "testdata/testclasses.jar" + File.pathSeparator + final String SOURCE_JAR = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar"; + final String SOURCE_JARS = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar" + File.pathSeparator + "../weaver/testdata/tracing.jar" + File.pathSeparator + "../weaver/testdata/dummyAspect.jar"; AjBuildConfig config = parser.genBuildConfig(new String[] { @@ -120,8 +120,8 @@ public class BuildArgParserTestCase extends TestCase { } public void testInJars() throws InvalidInputException { - final String SOURCE_JAR = "testdata/testclasses.jar"; - final String SOURCE_JARS = "testdata/testclasses.jar" + File.pathSeparator + final String SOURCE_JAR = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar"; + final String SOURCE_JARS = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar" + File.pathSeparator + "../weaver/testdata/tracing.jar" + File.pathSeparator + "../weaver/testdata/dummyAspect.jar"; AjBuildConfig config = parser.genBuildConfig(new String[] { @@ -140,16 +140,16 @@ public class BuildArgParserTestCase extends TestCase { } public void testBadInJars() throws InvalidInputException { - final String SOURCE_JARS = "testdata/testclasses.jar" + File.pathSeparator + "b.far" + File.pathSeparator + "c.jar"; + final String SOURCE_JARS = AjdtAjcTests.TESTDATA_PATH + "/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"; + public void testMultipleSourceRoots() throws InvalidInputException, IOException { + final String SRCROOT_1 = AjdtAjcTests.TESTDATA_PATH + "/src1/p1"; + final String SRCROOT_2 = AjdtAjcTests.TESTDATA_PATH + "/ajc"; AjBuildConfig config = parser.genBuildConfig(new String[] { "-sourceroots", SRCROOT_1 + File.pathSeparator + SRCROOT_2 }, messageWriter); @@ -157,13 +157,13 @@ public class BuildArgParserTestCase extends TestCase { assertEquals(getCanonicalPath(new File(SRCROOT_1)), ((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(), + new File(SRCROOT_1+File.separator+"A.java").getCanonicalFile(), + new File(SRCROOT_1+File.separator+"Foo.java").getCanonicalFile(), + new File(SRCROOT_2+File.separator+"A.java").getCanonicalFile(), + new File(SRCROOT_2+File.separator+"B.java").getCanonicalFile(), + new File(SRCROOT_2+File.separator+"X.aj").getCanonicalFile(), + new File(SRCROOT_2+File.separator+"Y.aj").getCanonicalFile(), + new File(SRCROOT_2+File.separator+"pkg"+File.separator+"Hello.java").getCanonicalFile(), }); //System.out.println(config.getFiles()); @@ -185,8 +185,8 @@ public class BuildArgParserTestCase extends TestCase { return ret; } - public void testSourceRootDir() throws InvalidInputException { - final String SRCROOT = "testdata/ajc"; + public void testSourceRootDir() throws InvalidInputException, IOException { + final String SRCROOT = AjdtAjcTests.TESTDATA_PATH + "/ajc"; AjBuildConfig config = parser.genBuildConfig(new String[] { "-sourceroots", SRCROOT }, messageWriter); @@ -194,11 +194,11 @@ public class BuildArgParserTestCase extends TestCase { assertEquals(getCanonicalPath(new File(SRCROOT)), ((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(), + new File(SRCROOT+File.separator+"A.java").getCanonicalFile(), + new File(SRCROOT+File.separator+"B.java").getCanonicalFile(), + new File(SRCROOT+File.separator+"X.aj").getCanonicalFile(), + new File(SRCROOT+File.separator+"Y.aj").getCanonicalFile(), + new File(SRCROOT+File.separator+"pkg"+File.separator+"Hello.java").getCanonicalFile(), }); //System.out.println(config.getFiles()); @@ -209,7 +209,8 @@ public class BuildArgParserTestCase extends TestCase { public void testBadSourceRootDir() throws InvalidInputException { AjBuildConfig config = parser.genBuildConfig(new String[] { "-sourceroots", - "testdata/mumbleDoesNotExist;testdata/ajc" }, + AjdtAjcTests.TESTDATA_PATH + "/mumbleDoesNotExist;" + + AjdtAjcTests.TESTDATA_PATH + "/ajc" }, messageWriter); assertTrue(config.getSourceRoots().toString(), config.getSourceRoots().size() == 1); @@ -223,17 +224,17 @@ public class BuildArgParserTestCase extends TestCase { } //??? we've decided not to make this an error - public void testSourceRootDirWithFiles() throws InvalidInputException { - final String SRCROOT = "testdata/ajc/pkg"; + public void testSourceRootDirWithFiles() throws InvalidInputException, IOException { + final String SRCROOT = AjdtAjcTests.TESTDATA_PATH + "/ajc/pkg"; AjBuildConfig config = parser.genBuildConfig(new String[] { - "-sourceroots", SRCROOT, "testdata/src1/A.java"}, + "-sourceroots", SRCROOT, AjdtAjcTests.TESTDATA_PATH + "/src1/A.java"}, messageWriter); assertEquals(getCanonicalPath(new File(SRCROOT)), ((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(), + new File(SRCROOT+File.separator+"Hello.java").getCanonicalFile(), + new File(AjdtAjcTests.TESTDATA_PATH +File.separator+"src1"+File.separator+"A.java").getCanonicalFile(), }); TestUtil.assertSetEquals(expectedFiles, config.getFiles()); @@ -241,7 +242,7 @@ public class BuildArgParserTestCase extends TestCase { } public void testExtDirs() throws InvalidInputException { - final String DIR = "testdata"; + final String DIR = AjdtAjcTests.TESTDATA_PATH; AjBuildConfig config = parser.genBuildConfig(new String[] { "-extdirs", DIR }, messageWriter); @@ -264,7 +265,7 @@ public class BuildArgParserTestCase extends TestCase { } public void testOutputJar() throws InvalidInputException { - final String OUT_JAR = "testdata/testclasses.jar"; + final String OUT_JAR = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar"; AjBuildConfig config = parser.genBuildConfig(new String[] { "-outjar", OUT_JAR }, @@ -277,7 +278,7 @@ public class BuildArgParserTestCase extends TestCase { assertEquals( getCanonicalPath(new File(OUT_JAR)),config.getOutputJar().getAbsolutePath()); - File nonExistingJar = new File("testdata/mumbleDoesNotExist.jar"); + File nonExistingJar = new File(AjdtAjcTests.TESTDATA_PATH + "/mumbleDoesNotExist.jar"); config = parser.genBuildConfig(new String[] { "-outjar", nonExistingJar.getAbsolutePath() }, messageWriter); @@ -365,7 +366,7 @@ public class BuildArgParserTestCase extends TestCase { } public void testXlintfile() throws InvalidInputException { - String lintFile = "testdata/lintspec.properties"; + String lintFile = AjdtAjcTests.TESTDATA_PATH + "/lintspec.properties"; String badLintFile = "lint.props"; AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlintfile", lintFile}, messageWriter); assertTrue(new File(lintFile).exists()); @@ -395,10 +396,10 @@ public class BuildArgParserTestCase extends TestCase { 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() + new File(TEST_DIR + SOURCE_PATH_1).getCanonicalFile(), + resultList.contains(new File(TEST_DIR + SOURCE_PATH_1).getCanonicalFile())); assertTrue(resultList.toString() + SOURCE_PATH_2, - resultList.contains(new File(TEST_DIR + SOURCE_PATH_2).getAbsoluteFile())); + resultList.contains(new File(TEST_DIR + SOURCE_PATH_2).getCanonicalFile())); } 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 index dfc350f87..1e53cdd02 100644 --- 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 @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.aspectj.ajdt.ajc.*; import org.aspectj.ajdt.ajc.AjdtCommand; import org.aspectj.bridge.ICommand; import org.aspectj.bridge.IMessage; @@ -99,7 +100,7 @@ public class BasicCommandTestCase extends CommandTestCase { args.add("-classpath"); args.add(getRuntimeClasspath() + File.pathSeparator + "../lib/junit/junit.jar;../testing-client/bin"); args.add("-Xlint:error"); - args.add("testdata/src1/Xlint.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/Xlint.java"); runCompiler(args, new int[] {2}); } @@ -111,7 +112,7 @@ public class BasicCommandTestCase extends CommandTestCase { args.add("-classpath"); args.add(getRuntimeClasspath() + File.pathSeparator + "../lib/junit/junit.jar;../testing-client/bin;not_found_anywhere.jar"); - args.add("testdata/src1/ThisAndModifiers.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/ThisAndModifiers.java"); ICommand command = new AjdtCommand(); MessageHandler myHandler = new MessageHandler(); @@ -131,7 +132,7 @@ public class BasicCommandTestCase extends CommandTestCase { args.add("-classpath"); args.add("../lib/junit/junit.jar;../testing-client/bin"); - args.add("testdata/src1/ThisAndModifiers.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/ThisAndModifiers.java"); ICommand command = new AjdtCommand(); MessageHandler myHandler = new MessageHandler(); @@ -148,16 +149,16 @@ public class BasicCommandTestCase extends CommandTestCase { args.add(getRuntimeClasspath() + File.pathSeparator + "../lib/junit/junit.jar;../testing-client/bin"); - File f1 = new File("testdata/src1/p1/Foo.class"); - File f2 = new File("testdata/src1/WrongPackage.class"); - File f3 = new File("testdata/src1/WrongPackage$1.class"); + File f1 = new File(AjdtAjcTests.TESTDATA_PATH + "/src1/p1/Foo.class"); + File f2 = new File(AjdtAjcTests.TESTDATA_PATH + "/src1/WrongPackage.class"); + File f3 = new File(AjdtAjcTests.TESTDATA_PATH + "/src1/WrongPackage$1.class"); if (f1.exists()) f1.delete(); if (f2.exists()) f2.delete(); if (f3.exists()) f3.delete(); - args.add("testdata/src1/p1/Foo.java"); - args.add("testdata/src1/WrongPackage.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/p1/Foo.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/WrongPackage.java"); runCompiler(args, NO_ERRORS); @@ -184,8 +185,8 @@ public class BasicCommandTestCase extends CommandTestCase { args.add(getRuntimeClasspath() + File.pathSeparator + "../lib/junit/junit.jar;../testing-client/bin"); - args.add("testdata/src1/SizeIssuesAspect.java"); - args.add("testdata/src1/SizeIssues.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/SizeIssuesAspect.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/SizeIssues.java"); runCompiler(args, NO_ERRORS); long size = f1.length(); 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 index d9c5c0062..aa2b13276 100644 --- 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 @@ -17,6 +17,8 @@ import java.io.IOException; import java.util.*; import java.util.ArrayList; +import org.aspectj.ajdt.ajc.AjdtAjcTests; + public class BcweaverJarMaker { public BcweaverJarMaker() { @@ -45,8 +47,8 @@ public class BcweaverJarMaker { args.add("../runtime/bin" + File.pathSeparator + System.getProperty("aspectjrt.path")); - args.add("testdata/src1/Trace.java"); - args.add("testdata/src1/MyTrace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/Trace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/MyTrace.java"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); } @@ -60,8 +62,8 @@ public class BcweaverJarMaker { args.add("../runtime/bin" + File.pathSeparator + System.getProperty("aspectjrt.path")); - args.add("testdata/src1/trace/MegaTrace.java"); - args.add("testdata/src1/trace/ExecTrace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/MegaTrace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/ExecTrace.java"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); } @@ -76,8 +78,8 @@ public class BcweaverJarMaker { args.add("../runtime/bin" + File.pathSeparator + System.getProperty("aspectjrt.path")); - args.add("testdata/src1/trace/MegaTrace.java"); - args.add("testdata/src1/trace/ObviousTraceNothing.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/MegaTrace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/ObviousTraceNothing.java"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); } @@ -91,8 +93,8 @@ public class BcweaverJarMaker { args.add("../runtime/bin" + File.pathSeparator + System.getProperty("aspectjrt.path")); - args.add("testdata/src1/trace/MegaTrace.java"); - args.add("testdata/src1/trace/HardTraceNothing.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/MegaTrace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/HardTraceNothing.java"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); } @@ -109,8 +111,8 @@ public class BcweaverJarMaker { args.add("../runtime/bin" + File.pathSeparator + System.getProperty("aspectjrt.path")); - args.add("testdata/src1/trace/MegaTrace.java"); - args.add("testdata/src1/trace/ExecTrace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/MegaTrace.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/trace/ExecTrace.java"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); } @@ -125,7 +127,7 @@ public class BcweaverJarMaker { args.add("../runtime/bin" + File.pathSeparator + System.getProperty("aspectjrt.path")); - args.add("testdata/src1/DummyAspect.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/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 index 85c1e01ee..d6f8ea31c 100644 --- 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 @@ -17,6 +17,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.aspectj.ajdt.ajc.AjdtAjcTests; import org.aspectj.testing.util.TestUtil; @@ -39,8 +40,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("-d"); args.add("out"); - args.add("testdata/src1/binary/lib/ConcreteA.aj"); - args.add("testdata/src1/binary/lib/AbstractA.aj"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/lib/ConcreteA.aj"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/lib/AbstractA.aj"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); @@ -55,8 +56,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("-d"); args.add("out"); - args.add("testdata/src1/binary/client/Client.java"); - args.add("testdata/src1/binary/client/Client1.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/Client.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/Client1.java"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); @@ -74,8 +75,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("-d"); args.add("out"); - args.add("testdata/src1/binary/client/MyAspect.aj"); - args.add("testdata/src1/binary/client/Client1.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/MyAspect.aj"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/Client1.java"); CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); @@ -92,8 +93,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("-d"); args.add("out"); - args.add("testdata/src1/binary/client/MyAspect1.aj"); - args.add("testdata/src1/binary/client/Client1.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/MyAspect1.aj"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/Client1.java"); CommandTestCase.runCompiler(args, new int[] {24, 30}); @@ -105,7 +106,7 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("-d"); args.add("out"); - args.add("testdata/src1/binary/client/Client1.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/Client1.java"); CommandTestCase.runCompiler(args, new int[] {15, 17, 22}); @@ -118,8 +119,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("-d"); args.add("out"); - args.add("testdata/src1/binary/client/MyAspect.aj"); - args.add("testdata/src1/binary/client/Client1.java"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/MyAspect.aj"); + args.add(AjdtAjcTests.TESTDATA_PATH + "/src1/binary/client/Client1.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 index 1db780683..b9ab0cb30 100644 --- 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 @@ -12,6 +12,7 @@ package org.aspectj.ajdt.internal.compiler.batch; +import org.aspectj.ajdt.ajc.*; import org.aspectj.ajdt.ajc.AjdtCommand; import org.aspectj.bridge.ICommand; import org.aspectj.bridge.IMessage; @@ -57,7 +58,7 @@ public abstract class CommandTestCase extends TestCase { args.add("-g"); //XXX need this to get sourcefile and line numbers, shouldn't - args.add("testdata/" + source); + args.add(AjdtAjcTests.TESTDATA_PATH + "/" + source); runCompiler(args, expectedErrors); } @@ -72,7 +73,7 @@ public abstract class CommandTestCase extends TestCase { args.add("-classpath"); args.add(getRuntimeClasspath()); - args.add("testdata/" + source); + args.add(AjdtAjcTests.TESTDATA_PATH + "/" + source); ICommand compiler = runCompiler(args, NO_ERRORS); Thread.sleep(100); @@ -130,7 +131,7 @@ public abstract class CommandTestCase extends TestCase { } public static void printGenerated(String path, String name) throws IOException { - String fullpath = "testdata/" + path; + String fullpath = AjdtAjcTests.TESTDATA_PATH + "/" + path; LazyClassGen.disassemble(fullpath, name, System.out); } 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 index dc783f0c8..f1f70b276 100644 --- 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 @@ -12,6 +12,8 @@ package org.aspectj.ajdt.internal.core.builder; +import EajcModuleTests; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -19,6 +21,7 @@ import java.io.PrintWriter; import junit.framework.TestCase; +import org.aspectj.ajdt.ajc.*; import org.aspectj.ajdt.ajc.BuildArgParser; import org.aspectj.asm.AsmManager; import org.aspectj.bridge.IMessage; @@ -31,9 +34,9 @@ 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 static File source1 = new File(AjdtAjcTests.TESTDATA_DIR, "src1/A.java"); + public static File source2 = new File(AjdtAjcTests.TESTDATA_DIR, "src1/Hello.java"); + public static File source3 = new File(AjdtAjcTests.TESTDATA_DIR, "src1/X.java"); /** @@ -68,8 +71,9 @@ public class AjBuildManagerTest extends TestCase { "-d", "out", "-classpath", javaClassPath, - "testdata/src1/A.java", -// "testdata/src1/Hello.java", + AjdtAjcTests.TESTDATA_PATH + + "/src1/A.java", +// EajcModuleTests.TESTDATA_PATH + "/src1/Hello.java", }, messageWriter); String err = parser.getOtherMessages(true); assertTrue(err, null == err);