diff options
Diffstat (limited to 'loadtime/testsrc')
-rw-r--r-- | loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java | 25 |
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 { |