aboutsummaryrefslogtreecommitdiffstats
path: root/weaver/testsrc
diff options
context:
space:
mode:
Diffstat (limited to 'weaver/testsrc')
-rw-r--r--weaver/testsrc/org/aspectj/weaver/AllTracingTests.java30
-rw-r--r--weaver/testsrc/org/aspectj/weaver/BcweaverTests.java1
-rw-r--r--weaver/testsrc/org/aspectj/weaver/CommonsTraceFactoryTest.java26
-rw-r--r--weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java67
-rw-r--r--weaver/testsrc/org/aspectj/weaver/DefaultTraceFactoryTest.java30
-rw-r--r--weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java66
-rw-r--r--weaver/testsrc/org/aspectj/weaver/TraceFactoryTest.java36
7 files changed, 256 insertions, 0 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/AllTracingTests.java b/weaver/testsrc/org/aspectj/weaver/AllTracingTests.java
new file mode 100644
index 000000000..81a952903
--- /dev/null
+++ b/weaver/testsrc/org/aspectj/weaver/AllTracingTests.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTracingTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTracingTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(TraceFactoryTest.class);
+ suite.addTestSuite(DefaultTraceFactoryTest.class);
+ suite.addTestSuite(DefaultTraceTest.class);
+ suite.addTestSuite(CommonsTraceFactoryTest.class);
+ suite.addTestSuite(CommonsTraceTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
index 1d3f65ea7..88a97ce03 100644
--- a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
+++ b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
@@ -54,6 +54,7 @@ public class BcweaverTests extends TestCase {
suite.addTestSuite(TypeXTestCase.class);
suite.addTestSuite(WeaverMessagesTestCase.class);
suite.addTestSuite(DumpTestCase.class);
+ suite.addTest(AllTracingTests.suite());
//$JUnit-END$
return suite;
}
diff --git a/weaver/testsrc/org/aspectj/weaver/CommonsTraceFactoryTest.java b/weaver/testsrc/org/aspectj/weaver/CommonsTraceFactoryTest.java
new file mode 100644
index 000000000..ecdaf63de
--- /dev/null
+++ b/weaver/testsrc/org/aspectj/weaver/CommonsTraceFactoryTest.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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;
+
+import junit.framework.TestCase;
+
+import org.aspectj.weaver.tools.CommonsTraceFactory;
+import org.aspectj.weaver.tools.Trace;
+
+public class CommonsTraceFactoryTest extends TestCase {
+
+ public void testGetTraceFactory() {
+ CommonsTraceFactory factory = new CommonsTraceFactory();
+ Trace trace = factory.getTrace(getClass());
+ assertFalse("Tracing should be disbled by default",trace.isTraceEnabled());
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java b/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java
new file mode 100644
index 000000000..ccc074be1
--- /dev/null
+++ b/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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;
+
+import org.aspectj.weaver.tools.CommonsTrace;
+
+import junit.framework.TestCase;
+
+public class CommonsTraceTest extends TestCase {
+
+ private CommonsTrace trace;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ trace = new CommonsTrace(getClass());
+ trace.setTraceEnabled(true);
+ }
+
+ public void testCommonsTrace() {
+ CommonsTrace trace = new CommonsTrace(getClass());
+ }
+
+ public void testEnterWithThisAndArgs() {
+ trace.enter("testEnterWithThisAndArgs",this,new Object[] { "arg1", "arg2" });
+ }
+
+ public void testEnterWithThis() {
+ trace.enter("testEnterWithThis",this);
+ }
+
+ public void testEnter() {
+ trace.enter("testEnter");
+ }
+
+ public void testExitWithReturn() {
+ trace.exit("testExitWithReturn","ret");
+ }
+
+ public void testExitWithThrowable() {
+ trace.exit("testExitWithThrowable",new RuntimeException());
+ }
+
+ public void testExit() {
+ trace.exit("testExit");
+ }
+
+ public void testIsTraceEnabled() {
+ CommonsTrace trace = new CommonsTrace(getClass());
+ assertFalse(trace.isTraceEnabled());
+ }
+
+ public void testSetTraceEnabled() {
+ CommonsTrace trace = new CommonsTrace(getClass());
+ trace.setTraceEnabled(true);
+ /* XXX Need to find out how to turn tracing on */
+// assertTrue(trace.isTraceEnabled());
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/DefaultTraceFactoryTest.java b/weaver/testsrc/org/aspectj/weaver/DefaultTraceFactoryTest.java
new file mode 100644
index 000000000..16d14bfb6
--- /dev/null
+++ b/weaver/testsrc/org/aspectj/weaver/DefaultTraceFactoryTest.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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;
+
+import org.aspectj.weaver.tools.DefaultTraceFactory;
+import org.aspectj.weaver.tools.Trace;
+
+import junit.framework.TestCase;
+
+public class DefaultTraceFactoryTest extends TestCase {
+
+ public void testGetTrace() {
+ DefaultTraceFactory factory = new DefaultTraceFactory();
+ Trace trace = factory.getTrace(getClass());
+ assertFalse("Tracing should be disbled by default",trace.isTraceEnabled());
+ }
+
+// public void testIsEnabled() {
+// fail("Not yet implemented");
+// }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java b/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java
new file mode 100644
index 000000000..784c20992
--- /dev/null
+++ b/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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;
+
+import junit.framework.TestCase;
+
+import org.aspectj.weaver.tools.DefaultTrace;
+
+public class DefaultTraceTest extends TestCase {
+
+ private DefaultTrace trace;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ trace = new DefaultTrace(getClass());
+ trace.setTraceEnabled(true);
+ }
+
+ public void testDefaultTrace() {
+ DefaultTrace trace = new DefaultTrace(getClass());
+ }
+
+ public void testEnterWithThisAndArgs() {
+ trace.enter("testEnterWithThisAndArgs",this,new Object[] { "arg1", "arg2" });
+ }
+
+ public void testEnterWithThis() {
+ trace.enter("testEnterWithThis",this);
+ }
+
+ public void testEnter() {
+ trace.enter("testEnter");
+ }
+
+ public void testExitWithReturn() {
+ trace.exit("testExitWithReturn","ret");
+ }
+
+ public void testExitWithThrowable() {
+ trace.exit("testExitWithThrowable",new RuntimeException());
+ }
+
+ public void testExit() {
+ trace.exit("testExit");
+ }
+
+ public void testIsTraceEnabled() {
+ DefaultTrace trace = new DefaultTrace(getClass());
+ assertFalse(trace.isTraceEnabled());
+ }
+
+ public void testSetTraceEnabled() {
+ DefaultTrace trace = new DefaultTrace(getClass());
+ trace.setTraceEnabled(true);
+ assertTrue(trace.isTraceEnabled());
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/TraceFactoryTest.java b/weaver/testsrc/org/aspectj/weaver/TraceFactoryTest.java
new file mode 100644
index 000000000..e755fa277
--- /dev/null
+++ b/weaver/testsrc/org/aspectj/weaver/TraceFactoryTest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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;
+
+import org.aspectj.weaver.tools.Trace;
+import org.aspectj.weaver.tools.TraceFactory;
+
+import junit.framework.TestCase;
+
+public class TraceFactoryTest extends TestCase {
+
+ public void testGetTraceFactory() {
+ TraceFactory traceFactory = TraceFactory.getTraceFactory();
+ assertNotNull(traceFactory);
+ }
+
+ public void testGetTrace() {
+ TraceFactory traceFactory = TraceFactory.getTraceFactory();
+ Trace trace = traceFactory.getTrace(getClass());
+ assertNotNull(trace);
+ }
+
+ public void testIsEnabled() {
+ TraceFactory traceFactory = TraceFactory.getTraceFactory();
+ assertTrue(traceFactory.isEnabled());
+ }
+
+}