summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormwebster <mwebster>2006-08-14 15:53:09 +0000
committermwebster <mwebster>2006-08-14 15:53:09 +0000
commit2aac0a2e476d4c5bda5b9e2c5ea24ef337aa3388 (patch)
tree6e16d9f030167b5bfe16d5ee865c769af31d1e7b
parent0850eef4c7060de3848dfdfe90c8b6c7d3d2e75f (diff)
downloadaspectj-2aac0a2e476d4c5bda5b9e2c5ea24ef337aa3388.tar.gz
aspectj-2aac0a2e476d4c5bda5b9e2c5ea24ef337aa3388.zip
Bug 150487 "Tracing and Logging Framework" (remove TraceMessageHandler)
-rw-r--r--loadtime/src/org/aspectj/weaver/loadtime/TraceMessageHandler.java81
-rw-r--r--loadtime/testsrc/org/aspectj/loadtime/LoadtimeModuleTests.java4
-rw-r--r--loadtime/testsrc/org/aspectj/weaver/loadtime/TraceMessageHandlerTest.java58
-rw-r--r--tests/tracing/MyDefaultTraceMessageHandler.java12
-rw-r--r--tests/tracing/aop-defaulttracemessagehandler.xml13
5 files changed, 1 insertions, 167 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/TraceMessageHandler.java b/loadtime/src/org/aspectj/weaver/loadtime/TraceMessageHandler.java
deleted file mode 100644
index b661bc799..000000000
--- a/loadtime/src/org/aspectj/weaver/loadtime/TraceMessageHandler.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Webster - initial implementation
- *******************************************************************************/
-package org.aspectj.weaver.loadtime;
-
-import org.aspectj.bridge.AbortException;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.IMessageHandler;
-import org.aspectj.bridge.WeaveMessage;
-import org.aspectj.bridge.IMessage.Kind;
-import org.aspectj.weaver.tools.Trace;
-import org.aspectj.weaver.tools.TraceFactory;
-
-public class TraceMessageHandler implements IMessageHandler {
-
- private Trace trace;
-
- public TraceMessageHandler () {
- this(TraceFactory.getTraceFactory().getTrace(TraceMessageHandler.class));
- }
-
- /**
- * Used for testing
- *
- */
- protected TraceMessageHandler (Trace t) {
- this.trace = t;
- }
-
- /* Ignore this and defer all decisions about what we log to the Trace
- * configuration
- */
- public void dontIgnore(Kind kind) {
- }
-
- public boolean handleMessage(IMessage message) throws AbortException {
- if (message instanceof WeaveMessage) {
- trace.debug(render(message));
- }
- else if (message.isDebug()) {
- trace.debug(render(message));
- }
- else if (message.isInfo()) {
- trace.info(render(message));
- }
- else if (message.isWarning()) {
- trace.warn(render(message),message.getThrown());
- }
- else if (message.isError()) {
- trace.error(render(message),message.getThrown());
- }
- else if (message.isFailed()) {
- trace.fatal(render(message),message.getThrown());
- }
- else if (message.isAbort()) {
- trace.fatal(render(message),message.getThrown());
- }
- else return false;
-
- return true;
- }
-
- /* Ignore this and defer all decisions about what we log to the Trace
- * configuration
- */
- public boolean isIgnoring(Kind kind) {
- return false;
- }
-
- protected String render(IMessage message) {
- return message.toString();
- }
-
-}
diff --git a/loadtime/testsrc/org/aspectj/loadtime/LoadtimeModuleTests.java b/loadtime/testsrc/org/aspectj/loadtime/LoadtimeModuleTests.java
index bfd89b8de..5683e5a8b 100644
--- a/loadtime/testsrc/org/aspectj/loadtime/LoadtimeModuleTests.java
+++ b/loadtime/testsrc/org/aspectj/loadtime/LoadtimeModuleTests.java
@@ -11,15 +11,14 @@ package org.aspectj.loadtime;
* Alexandre Vasseur initial implementation
*******************************************************************************/
-import junit.framework.TestCase;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.aspectj.weaver.loadtime.AjTest;
import org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptorTest;
import org.aspectj.weaver.loadtime.JRockitAgentTest;
-import org.aspectj.weaver.loadtime.TraceMessageHandlerTest;
import org.aspectj.weaver.loadtime.WeavingContextTest;
import org.aspectj.weaver.loadtime.WeavingURLClassLoaderTest;
import org.aspectj.weaver.loadtime.test.DocumentParserTest;
@@ -36,7 +35,6 @@ public class LoadtimeModuleTests extends TestCase {
suite.addTestSuite(AjTest.class);
suite.addTestSuite(ClassLoaderWeavingAdaptorTest.class);
suite.addTestSuite(JRockitAgentTest.class);
- suite.addTestSuite(TraceMessageHandlerTest.class);
suite.addTestSuite(WeavingContextTest.class);
suite.addTestSuite(WeavingURLClassLoaderTest.class);
return suite;
diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/TraceMessageHandlerTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/TraceMessageHandlerTest.java
deleted file mode 100644
index 7bd499a44..000000000
--- a/loadtime/testsrc/org/aspectj/weaver/loadtime/TraceMessageHandlerTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Webster - initial implementation
- *******************************************************************************/
-package org.aspectj.weaver.loadtime;
-
-import junit.framework.TestCase;
-
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.MessageUtil;
-import org.aspectj.bridge.IMessage.Kind;
-
-public class TraceMessageHandlerTest extends TestCase {
-
- private TraceMessageHandler messageHandler;
-
- protected void setUp() throws Exception {
- super.setUp();
- messageHandler = new TraceMessageHandler();
- }
-
- public void testTraceMessageHandler() {
- TraceMessageHandler tmh = new TraceMessageHandler();
- }
-
- public void testDontIgnore() {
- Kind kind = IMessage.WEAVEINFO;
- messageHandler.dontIgnore(kind);
- boolean b = messageHandler.isIgnoring(kind);
- assertFalse("Don't filter message kinds",b);
- }
-
- public void testHandleMessageInfo () {
- IMessage message = MessageUtil.info("testHandleMessage");
- boolean b = messageHandler.handleMessage(message);
- assertTrue("Message not handled",b);
- }
-
- public void testIsIgnoring() {
- Kind kind = IMessage.WEAVEINFO;
- boolean b = messageHandler.isIgnoring(kind);
- assertFalse("Don't filter message kinds",b);
- }
-
- public void testRender() {
- String text = "testRender";
- IMessage message = MessageUtil.info(text);
- String s = messageHandler.render(message);
- assertTrue("Message not rendered correctly",s.indexOf(text) != -1);
- }
-
-}
diff --git a/tests/tracing/MyDefaultTraceMessageHandler.java b/tests/tracing/MyDefaultTraceMessageHandler.java
deleted file mode 100644
index b617568a6..000000000
--- a/tests/tracing/MyDefaultTraceMessageHandler.java
+++ /dev/null
@@ -1,12 +0,0 @@
-import org.aspectj.weaver.loadtime.TraceMessageHandler;
-import org.aspectj.weaver.tools.*;
-
-public class MyDefaultTraceMessageHandler extends TraceMessageHandler {
-
- private static Trace trace = new DefaultTrace(MyDefaultTraceMessageHandler.class);
-
- public MyDefaultTraceMessageHandler () {
- super(trace);
- trace.setTraceEnabled(true);
- }
-} \ No newline at end of file
diff --git a/tests/tracing/aop-defaulttracemessagehandler.xml b/tests/tracing/aop-defaulttracemessagehandler.xml
deleted file mode 100644
index bf1a587ee..000000000
--- a/tests/tracing/aop-defaulttracemessagehandler.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<aspectj>
- <aspects>
- <aspect name="IncludedAspect"/>
- <aspect name="ExcludedAspect"/>
-
- <concrete-aspect name="IncludedMissingAspect" extends="MissingAbstractAspect">
- <pointcut name="pointcut" expression="within(*)"/>
- </concrete-aspect>
-
- <include within="Included*"/>
- </aspects>
- <weaver options="-verbose -Xlint:warning -XmessageHandlerClass:MyDefaultTraceMessageHandler"/>
-</aspectj> \ No newline at end of file