From 048c86217eadca4f9600392aba2ccaaebd7946ed Mon Sep 17 00:00:00 2001 From: wisberg Date: Thu, 27 Jan 2005 05:32:46 +0000 Subject: [PATCH] old test for done signal --- .../tools/ant/taskdefs/AjcTaskTest.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java index 25030c116..c1361cde5 100644 --- a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java +++ b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java @@ -346,6 +346,18 @@ public class AjcTaskTest extends TestCase { return task; } + /** used in testMessageHolderClassName */ + public static class InfoHolder extends MessageHandler { + public InfoHolder() { + } + public boolean handleMessage(IMessage message) { + if (0 == IMessage.INFO.compareTo(message.getKind())) { + AjcTaskTest.collectMessage(message.getMessage()); + } + return true; + } + } + /** used in testMessageHolderClassName */ public static class Holder extends MessageHandler { public Holder() { @@ -374,6 +386,38 @@ public class AjcTaskTest extends TestCase { assertEquals("messages", "e", result); } + public void testMessageHolderClassWithDoneSignal() { + AjcTask task = getTask("default.lst"); + task.setFailonerror(false); + String DONE = "done"; + task.setXDoneSignal(DONE); + MESSAGES.setLength(0); + runTest( + task, + null, + MessageHolderChecker.INFOS, + InfoHolder.class.getName()); + final String result = MESSAGES.toString(); + String temp = new String(result); + MESSAGES.setLength(0); + if (!temp.endsWith(DONE)) { + if (temp.length() > 20) { + temp = "..." + temp.substring(temp.length()-20, temp.length()); + } + assertTrue(DONE + " is not suffix of \"" + temp + "\"", false); + } + // exactly one such message + temp = new String(result); + temp = temp.substring(0, temp.length()-DONE.length()); + if (temp.endsWith(DONE)) { + temp = new String(result); + if (temp.length() > 20) { + temp = "..." + temp.substring(temp.length()-20, temp.length()); + } + assertTrue(DONE + " signalled twice: \"" + temp + "\"", false); + } + } + public void testDefaultListForkedNoTools() { AjcTask task = getTask("default.lst"); task.setFork(true); -- 2.39.5