diff options
author | mkersten <mkersten> | 2003-08-07 09:16:05 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-08-07 09:16:05 +0000 |
commit | be23e3d01d1acde57b8ae25e04d0fc011a71e219 (patch) | |
tree | 341c6274bc12289cbdf38b54d0d0031fdd816fac /ajde/testsrc | |
parent | 02d3af8df7b3131a7dd64e5e19e19367e275b0bc (diff) | |
download | aspectj-be23e3d01d1acde57b8ae25e04d0fc011a71e219.tar.gz aspectj-be23e3d01d1acde57b8ae25e04d0fc011a71e219.zip |
Changed org.aspectj.bridge.IMessage.getISourceLocation to getSourceLocation in order to match method naming conventions.
Diffstat (limited to 'ajde/testsrc')
3 files changed, 31 insertions, 28 deletions
diff --git a/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java b/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java index 0506eb36d..8208e1515 100644 --- a/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java +++ b/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java @@ -15,6 +15,8 @@ package org.aspectj.ajde; import java.io.IOException; import java.util.List; +import org.aspectj.bridge.IMessage; + /** * @author colyer * @@ -25,10 +27,6 @@ public class CompilerMessagesTest extends AjdeTestCase { private final String CONFIG_FILE_PATH = "../examples/declare-warning/all.lst"; - /** - * Constructor for CompilerMessagesTest. - * @param name - */ public CompilerMessagesTest(String name) { super(name); } @@ -44,24 +42,29 @@ public class CompilerMessagesTest extends AjdeTestCase { assertEquals("Two warning messages should be produced",2,msgs.size()); NullIdeTaskListManager.SourceLineTask task = (NullIdeTaskListManager.SourceLineTask) msgs.get(0); - assertEquals( 8, task.location.getLine()); - assertEquals( "Please don't call init methods", task.message); + assertEquals( 8, task.getContainedMessage().getSourceLocation().getLine()); + assertEquals( "Please don't call init methods", task.message.getMessage()); try { - String fullyQualifiedFile = task.location.getSourceFile().getCanonicalPath(); + String fullyQualifiedFile = task.getContainedMessage().getSourceLocation().getSourceFile().getCanonicalPath(); // this name has a tester specific prefix, followed by the location of the file. // we can validate the ending. fullyQualifiedFile = fullyQualifiedFile.replace('\\','/'); // ignore platform differences in slashes assertTrue( "Fully-qualified source file location returned", fullyQualifiedFile.endsWith("testdata/examples/declare-warning/apackage/SomeClass.java")); } catch (IOException ex) { - assertTrue( "Unable to convert source file location: " + task.location.getSourceFile(), false); + assertTrue( "Unable to convert source file location: " + task.getContainedMessage().getSourceLocation().getSourceFile(), false); } } - + public void testDeclareMessageContents() { List msgs = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); - assertEquals( "Please don't call setters" , ((NullIdeTaskListManager.SourceLineTask) msgs.get(1)).message); + IMessage msg = (IMessage)((NullIdeTaskListManager.SourceLineTask)msgs.get(1)).getContainedMessage(); + assertEquals( "Please don't call setters" , msg.getMessage()); + +// assertEquals("extra info", msg.getCorrespondingJoinPoint()); + +// fail(); } diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java index 239c02cff..2b1275bb0 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java @@ -43,8 +43,8 @@ public class NullIdeTaskListManager implements TaskListManager { if (!hasWarning && IMessage.WARNING.isSameOrLessThan(message.getKind())) { hasWarning = true; } - System.out.println("> added sourceline task: " + message + ", file: " + message.getISourceLocation().getSourceFile().getAbsolutePath() - + ": " + message.getISourceLocation().getLine()); + System.out.println("> added sourceline task: " + message + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath() + + ": " + message.getSourceLocation().getLine()); } public void addProjectTask(String message, IMessage.Kind kind) { @@ -61,8 +61,7 @@ public class NullIdeTaskListManager implements TaskListManager { public void clearTasks() { sourceLineTasks = new ArrayList(); hasWarning = false; -// System.out.println("> cleared tasks"); - } + } /** * Return the list of source line compiler messages resulting from a compile, so @@ -75,23 +74,24 @@ public class NullIdeTaskListManager implements TaskListManager { public static class SourceLineTask { - public String message; - public ISourceLocation location; - public IMessage.Kind kind; + IMessage message; public SourceLineTask(IMessage m) { - message = m.getMessage(); - location = m.getISourceLocation(); - kind = m.getKind(); + message = m; + } + + public IMessage getContainedMessage() { + return message; } + public String toString() { - String loc = "<no location"; - if (null != location) { - loc = location.getSourceFile() + ":" + location.getLine(); + String loc = "<no location>"; + if (null != message.getSourceLocation()) { + loc = message.getSourceLocation().getSourceFile() + ":" + message.getSourceLocation().getLine(); } - return "SourceLineTask [" + message + return "SourceLineTask [" + message.getMessage() + ", " + loc - + ", " + kind + + ", " + message.getKind() + "]"; } } diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java index 1266b0c4b..0a5b8c1a6 100644 --- a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java @@ -49,12 +49,12 @@ public class LstBuildConfigManagerTest extends AjdeTestCase { List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); NullIdeTaskListManager.SourceLineTask message = (NullIdeTaskListManager.SourceLineTask)messages.get(0); - assertEquals(message.location.getSourceFile().getAbsolutePath(), openFile("dir-entry.lst").getAbsolutePath()); + assertEquals(message.getContainedMessage().getSourceLocation().getSourceFile().getAbsolutePath(), openFile("dir-entry.lst").getAbsolutePath()); doSynchronousBuild("bad-injar.lst"); messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); message = (NullIdeTaskListManager.SourceLineTask)messages.get(0); - assertTrue(message.message.indexOf("invalid") != -1); + assertTrue(message.getContainedMessage().getMessage().indexOf("invalid") != -1); } public void testErrorMessages() throws IOException { @@ -63,7 +63,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase { List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); SourceLineTask message = (SourceLineTask)messages.get(0); - assertEquals("invalid option: aaa.bbb", message.message); + assertEquals("invalid option: aaa.bbb", message.getContainedMessage().getMessage()); } |