]> source.dussan.org Git - aspectj.git/commitdiff
mavenizing loadtime - wip
authorAndy Clement <aclement@pivotal.io>
Mon, 28 Jan 2019 20:54:05 +0000 (12:54 -0800)
committerAndy Clement <aclement@pivotal.io>
Mon, 28 Jan 2019 20:54:05 +0000 (12:54 -0800)
loadtime/pom.xml
loadtime/src/main/java/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java
loadtime/src/test/java/org/aspectj/loadtime/LoadtimeModuleTests.java [deleted file]
loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java
loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java
loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simple.xml [deleted file]
loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml [deleted file]
loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simple.xml [new file with mode: 0644]
loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml [new file with mode: 0644]

index 2d2a608e756199fbc9b5d5225dea6bcc50bf64da..da12d06c4dcfdf6c1d7560283f75c0570a659295 100644 (file)
       <artifactId>bridge</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>runtime</artifactId>
+      <version>${project.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.aspectj</groupId>
       <artifactId>util</artifactId>
index f6b0133738c853e29f5f9054f46991ac05ab424d..f1a286ee9404a5fde9e293cd66abc3163ead8c7f 100644 (file)
@@ -64,7 +64,8 @@ public class WeavingURLClassLoader extends ExtensibleURLClassLoader implements W
 
        public WeavingURLClassLoader(URL[] classURLs, URL[] aspectURLs, ClassLoader parent) {
                super(classURLs, parent);
-               // System.out.println("> WeavingURLClassLoader.WeavingURLClassLoader() classURLs=" + Arrays.asList(classURLs));
+//              System.out.println(">WIB WeavingURLClassLoader.WeavingURLClassLoader() classURLs=" + Arrays.asList(classURLs));
+//              System.out.println(">WIB WeavingURLClassLoader.WeavingURLClassLoader() aspectURLs=" + Arrays.asList(aspectURLs));
                this.aspectURLs = aspectURLs;
 
                /*
diff --git a/loadtime/src/test/java/org/aspectj/loadtime/LoadtimeModuleTests.java b/loadtime/src/test/java/org/aspectj/loadtime/LoadtimeModuleTests.java
deleted file mode 100644 (file)
index f325ad8..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.aspectj.loadtime;
-
-/*******************************************************************************
- * Copyright (c) 2005 Contributors.
- * 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://eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Vasseur         initial implementation
- *******************************************************************************/
-
-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.WeavingContextTest;
-import org.aspectj.weaver.loadtime.WeavingURLClassLoaderTest;
-import org.aspectj.weaver.loadtime.test.DocumentParserTest;
-
-/**
- * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
- */
-public class LoadtimeModuleTests extends TestCase {
-
-       public static Test suite() {
-               TestSuite suite = new TestSuite(LoadtimeModuleTests.class.getName());
-
-               suite.addTestSuite(DocumentParserTest.class);
-               suite.addTestSuite(AjTest.class);
-               suite.addTestSuite(ClassLoaderWeavingAdaptorTest.class);
-               // suite.addTestSuite(JRockitAgentTest.class);
-               suite.addTestSuite(WeavingContextTest.class);
-               suite.addTestSuite(WeavingURLClassLoaderTest.class);
-               return suite;
-       }
-
-       public static void main(String args[]) throws Throwable {
-               TestRunner.run(suite());
-       }
-
-}
index 133387cf41900b6e372c14f74c61ce74ca6cf86b..b13ebe421a0228efe93e62650df1417b02cbdaff 100644 (file)
@@ -24,6 +24,8 @@ import java.util.List;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 
+import org.aspectj.util.FileUtil;
+
 import junit.framework.TestCase;
 
 import com.bea.jvm.ClassPreProcessor;
@@ -52,6 +54,9 @@ public class JRockitAgentTest extends TestCase {
 
        public void testJrockitRecursionProtection() {
                URLClassLoader thisLoader = (URLClassLoader) getClass().getClassLoader();
+               URL jrockit = FileUtil.getFileURL(new File("../lib/ext/jrockit/jrockit.jar"));
+               URL[] urls = new URL[] {jrockit};
+                thisLoader = new URLClassLoader(urls, thisLoader);
                ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
 
                try {
index 187de37ba1e491ccd54210f629855fddc9d7f8ea..2af64a5f62fecfc1834812a4fc2dff250386a0c4 100644 (file)
@@ -24,7 +24,6 @@ import junit.framework.TestCase;
 import org.aspectj.bridge.AbortException;
 import org.aspectj.testing.util.TestUtil.TestError;
 import org.aspectj.util.FileUtil;
-import org.aspectj.weaver.BcweaverTests;
 import org.aspectj.weaver.tools.WeavingAdaptor;
 
 /**
@@ -32,18 +31,20 @@ import org.aspectj.weaver.tools.WeavingAdaptor;
  * 
  */
 public class WeavingURLClassLoaderTest extends TestCase {
-
-       private final static String ASPECTJRT = "../runtime/bin";
-       private final static String CLASSES_JAR = BcweaverTests.TESTDATA_PATH + "/ltw-classes.jar";
-       private final static String WOVEN_JAR = BcweaverTests.TESTDATA_PATH + "/ltw-woven.jar";
-       private final static String JUNK_JAR = BcweaverTests.TESTDATA_PATH + "/ltw-junk.jar";
-       private final static String ADVICE_ASPECTS = BcweaverTests.TESTDATA_PATH + "/ltw-aspects.jar";
-       private final static String DW_ADVICE_ASPECTS = BcweaverTests.TESTDATA_PATH + "/ltw-dwaspects.jar";
-       private final static String DE_ADVICE_ASPECTS = BcweaverTests.TESTDATA_PATH + "/ltw-deaspects.jar";
-       private final static String AROUNDCLOSURE_ASPECTS = BcweaverTests.TESTDATA_PATH + "/ltw-acaspects.jar";
-       private final static String ITD_ASPECTS = BcweaverTests.TESTDATA_PATH + "/ltw-itdaspects.jar";
-       private final static String PER_ASPECTS = BcweaverTests.TESTDATA_PATH + "/ltw-peraspects.jar";
-       private final static String TEST_BASE = BcweaverTests.TESTDATA_PATH + "/WeavingURLClassLoaderTest/builtLibs";
+       
+       private final static String TESTDATA_PATH = "../weaver/testdata";
+
+       private final static String ASPECTJRT = "../runtime/target/classes";
+       private final static String CLASSES_JAR = TESTDATA_PATH + "/ltw-classes.jar";
+       private final static String WOVEN_JAR = TESTDATA_PATH + "/ltw-woven.jar";
+       private final static String JUNK_JAR = TESTDATA_PATH + "/ltw-junk.jar";
+       private final static String ADVICE_ASPECTS = TESTDATA_PATH + "/ltw-aspects.jar";
+       private final static String DW_ADVICE_ASPECTS = TESTDATA_PATH + "/ltw-dwaspects.jar";
+       private final static String DE_ADVICE_ASPECTS = TESTDATA_PATH + "/ltw-deaspects.jar";
+       private final static String AROUNDCLOSURE_ASPECTS = TESTDATA_PATH + "/ltw-acaspects.jar";
+       private final static String ITD_ASPECTS = TESTDATA_PATH + "/ltw-itdaspects.jar";
+       private final static String PER_ASPECTS = TESTDATA_PATH + "/ltw-peraspects.jar";
+       private final static String TEST_BASE = TESTDATA_PATH + "/WeavingURLClassLoaderTest/builtLibs";
 
        private final static String NULL = "null";
 
@@ -347,7 +348,8 @@ public class WeavingURLClassLoaderTest extends TestCase {
         * Aspects on ASPECTPATH but missing from CLASSPATH
         */
        public void testIncompletePath() {
-               setSystemProperty(WeavingURLClassLoader.WEAVING_ASPECT_PATH, ADVICE_ASPECTS);
+               URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT));
+               setSystemProperty(WeavingURLClassLoader.WEAVING_ASPECT_PATH, ADVICE_ASPECTS+File.pathSeparator+aspectjrt.toString());
                setSystemProperty(WeavingURLClassLoader.WEAVING_CLASS_PATH, CLASSES_JAR);
                WeavingURLClassLoader loader = new WeavingURLClassLoader(getClass().getClassLoader());
 
diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simple.xml b/loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simple.xml
deleted file mode 100644 (file)
index 54d3dd7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<aspectj>
-    <weaver options="-showWeaveInfo">
-    </weaver>
-    <aspects>
-        <aspect name="test.Aspect"/>
-    </aspects>
-</aspectj>
diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml b/loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml
deleted file mode 100644 (file)
index 252bc01..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://sswww.aspectj.org/dtd/aspectj_1_5_0.dtd">
-<aspectj>
-    <weaver options="-showWeaveInfo">
-        <include within="foo..bar.Goo+"/>
-        <dump within="foo..*" beforeandafter="true"/>
-    </weaver>
-    <aspects>
-        <exclude within="@Baz"/>
-        <include within="@Whoo"/>
-        <aspect name="test.Aspect"/>
-    </aspects>
-</aspectj>
diff --git a/loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simple.xml b/loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simple.xml
new file mode 100644 (file)
index 0000000..54d3dd7
--- /dev/null
@@ -0,0 +1,7 @@
+<aspectj>
+    <weaver options="-showWeaveInfo">
+    </weaver>
+    <aspects>
+        <aspect name="test.Aspect"/>
+    </aspects>
+</aspectj>
diff --git a/loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml b/loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml
new file mode 100644 (file)
index 0000000..252bc01
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://sswww.aspectj.org/dtd/aspectj_1_5_0.dtd">
+<aspectj>
+    <weaver options="-showWeaveInfo">
+        <include within="foo..bar.Goo+"/>
+        <dump within="foo..*" beforeandafter="true"/>
+    </weaver>
+    <aspects>
+        <exclude within="@Baz"/>
+        <include within="@Whoo"/>
+        <aspect name="test.Aspect"/>
+    </aspects>
+</aspectj>