aboutsummaryrefslogtreecommitdiffstats
path: root/loadtime
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-01-28 12:54:05 -0800
committerAndy Clement <aclement@pivotal.io>2019-01-28 12:54:05 -0800
commita46d7f1cfdf9828116cdd1b065dde35bd5f06cb6 (patch)
treeb255bb016ee8af8502c8c1cad0be936c9f929bdb /loadtime
parent38a19ea6a0b864447883328fe1103fd991a308f0 (diff)
downloadaspectj-a46d7f1cfdf9828116cdd1b065dde35bd5f06cb6.tar.gz
aspectj-a46d7f1cfdf9828116cdd1b065dde35bd5f06cb6.zip
mavenizing loadtime - wip
Diffstat (limited to 'loadtime')
-rw-r--r--loadtime/pom.xml5
-rw-r--r--loadtime/src/main/java/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java3
-rw-r--r--loadtime/src/test/java/org/aspectj/loadtime/LoadtimeModuleTests.java47
-rw-r--r--loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java5
-rw-r--r--loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java30
-rw-r--r--loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simple.xml (renamed from loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simple.xml)0
-rw-r--r--loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml (renamed from loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml)0
7 files changed, 28 insertions, 62 deletions
diff --git a/loadtime/pom.xml b/loadtime/pom.xml
index 2d2a608e7..da12d06c4 100644
--- a/loadtime/pom.xml
+++ b/loadtime/pom.xml
@@ -27,6 +27,11 @@
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
+ <artifactId>runtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
<artifactId>util</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java
index f6b013373..f1a286ee9 100644
--- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java
+++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/WeavingURLClassLoader.java
@@ -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
index f325ad804..000000000
--- a/loadtime/src/test/java/org/aspectj/loadtime/LoadtimeModuleTests.java
+++ /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());
- }
-
-}
diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java b/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java
index 133387cf4..b13ebe421 100644
--- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java
+++ b/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java
@@ -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 {
diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java b/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java
index 187de37ba..2af64a5f6 100644
--- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java
+++ b/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java
@@ -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/resources/org/aspectj/weaver/loadtime/test/simple.xml
index 54d3dd7af..54d3dd7af 100644
--- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simple.xml
+++ b/loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simple.xml
diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml b/loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml
index 252bc0136..252bc0136 100644
--- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml
+++ b/loadtime/src/test/resources/org/aspectj/weaver/loadtime/test/simpleWithDtd.xml