aboutsummaryrefslogtreecommitdiffstats
path: root/loadtime/testsrc
diff options
context:
space:
mode:
authormwebster <mwebster>2007-03-07 01:29:16 +0000
committermwebster <mwebster>2007-03-07 01:29:16 +0000
commit49aad5d5b4767aa81d2dac74ea80d55bdc8e9643 (patch)
tree72faf8dc29c7540f75959b34ecc5c91b41d5f73a /loadtime/testsrc
parent579ec14c9e86cdbaac656872e26f3e954e8f8946 (diff)
downloadaspectj-49aad5d5b4767aa81d2dac74ea80d55bdc8e9643.tar.gz
aspectj-49aad5d5b4767aa81d2dac74ea80d55bdc8e9643.zip
Bug 176546 "Allow custom aop.xml provider through IWeavingContext"
Diffstat (limited to 'loadtime/testsrc')
-rw-r--r--loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java
index c056b9ee6..97e037317 100644
--- a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java
+++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java
@@ -15,9 +15,12 @@ import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;
+import java.util.List;
import junit.framework.TestCase;
+import org.aspectj.weaver.tools.WeavingAdaptor;
+
public class WeavingContextTest extends TestCase {
private boolean called;
@@ -115,6 +118,24 @@ public class WeavingContextTest extends TestCase {
assertTrue("IWeavingContext not called",called);
}
+ public void testGetDefinitions () throws Exception {
+ File file = new File("../loadtime/testdata");
+ URL fileURL = file.getCanonicalFile().toURL();
+ URLClassLoader loader = new URLClassLoader(new URL[] { fileURL },null);
+ IWeavingContext context = new TestWeavingContext(loader) {
+
+ public List getDefinitions(ClassLoader loader, WeavingAdaptor adaptor) {
+ called = true;
+ return super.getDefinitions(loader,adaptor);
+ }
+
+ };
+ ClassLoaderWeavingAdaptor adaptor = new ClassLoaderWeavingAdaptor();
+ adaptor.initialize(loader,context);
+
+ assertTrue("getDefinitions not called",called);
+ }
+
private static class TestWeavingContext implements IWeavingContext {
private ClassLoader loader;
@@ -157,6 +178,10 @@ public class WeavingContextTest extends TestCase {
}
return isLocallyDefined;
}
+
+ public List getDefinitions(ClassLoader loader, WeavingAdaptor adaptor) {
+ return ((ClassLoaderWeavingAdaptor)adaptor).parseDefinitions(loader);
+ }
}
protected void setUp() throws Exception {