[jboss-cvs] JBossAS SVN: r64279 - in projects/aop/trunk/asintegration: src and 33 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 25 14:15:06 EDT 2007
Author: adrian at jboss.org
Date: 2007-07-25 14:15:05 -0400 (Wed, 25 Jul 2007)
New Revision: 64279
Added:
projects/aop/trunk/asintegration/build-test.xml
projects/aop/trunk/asintegration/src/resources/tests/
projects/aop/trunk/asintegration/src/resources/tests/org/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/complex/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/complex/test/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersions-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/junit/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/junit/test/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmoke-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAll-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicit-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimplePrivate-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirst-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParent-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLast-aop.xml
projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParent-aop.xml
projects/aop/trunk/asintegration/src/tests/
projects/aop/trunk/asintegration/src/tests/org/
projects/aop/trunk/asintegration/src/tests/org/jboss/
projects/aop/trunk/asintegration/src/tests/org/jboss/aop/
projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/
projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/
projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTest.java
projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTestDelegate.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestIntercepted.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestInterceptor.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/a/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/a/A.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/test/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersionsUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestIntercepted.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestInterceptor.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/test/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmokeUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestIntercepted.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestInterceptor.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/a/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/a/A.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAllUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicitUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimplePrivateUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParentUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParentUnitTestCase.java
projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastUnitTestCase.java
Modified:
projects/aop/trunk/asintegration/.classpath
Log:
Add some simple tests for AOP use of classloading showing where it is failing in those usecases
Modified: projects/aop/trunk/asintegration/.classpath
===================================================================
--- projects/aop/trunk/asintegration/.classpath 2007-07-25 18:11:38 UTC (rev 64278)
+++ projects/aop/trunk/asintegration/.classpath 2007-07-25 18:15:05 UTC (rev 64279)
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="src" path="src/tests"/>
+ <classpathentry kind="lib" path="src/resources/tests"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/aop"/>
<classpathentry kind="lib" path="/thirdparty/javassist/lib/javassist.jar" sourcepath="/javassist"/>
@@ -15,5 +17,9 @@
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-classloading-spi.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-classloader.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Added: projects/aop/trunk/asintegration/build-test.xml
===================================================================
--- projects/aop/trunk/asintegration/build-test.xml (rev 0)
+++ projects/aop/trunk/asintegration/build-test.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildmagic/targets.ent">
+]>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: build-test.xml 60371 2007-02-07 11:48:07Z alesj $ -->
+
+<project default="main" name="JBoss/AOPIntegration Tests">
+
+ <!-- ================================================================== -->
+ <!-- Setup -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Include the common Buildmagic elements.
+ |
+ | This defines several different targets, properties and paths.
+ | It also sets up the basic extention tasks amoung other things.
+ -->
+
+ &buildmagic;
+
+ <!--
+ | Include the normal targets.
+ -->
+ &targets;
+
+ <!-- ================================================================== -->
+ <!-- Configuration -->
+ <!-- ================================================================== -->
+
+ <property name="source.java" value="src/tests"/>
+ <property name="source.resources" value="src/resources/tests"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="build.classes" value="output/classes-tests"/>
+ <property name="build.testlog" value="output/log"/>
+ <property name="build-bypass.disabled" value="true"/>
+
+ <!--
+ | Configure the build system.
+ |
+ | This target is invoked by the Buildmagic initialization logic and
+ | should contain module specific configuration elements.
+ -->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- =================== -->
+ <!-- Basic Configuration -->
+ <!-- =================== -->
+
+ <!-- Module name(s) & version -->
+ <property name="module.name" value="asintegration tests"/>
+ <property name="module.Name" value="JBossAS Integration tests"/>
+ <property name="module.version" value="M1"/>
+
+ <!-- ========= -->
+ <!-- Libraries -->
+ <!-- ========= -->
+
+ &libraries;
+
+ <!-- The combined library classpath -->
+ <path id="library.classpath">
+ <path refid="apache.ant.classpath"/>
+ <path refid="apache.log4j.classpath"/>
+ <path refid="dom4j.dom4j.classpath"/>
+ <path refid="javassist.classpath"/>
+ <path refid="jbossas/core.libs.classpath"/>
+ <path refid="jboss/jboss.vfs.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="jboss.test.classpath"/>
+ <path refid="junit.junit.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="qdox.classpath"/>
+ <path refid="trove.classpath"/>
+ <path refid="jboss.integration.classpath"/>
+ </path>
+
+<!-- this -->
+<property name="jboss.this.root" value="${module.root}/output"/>
+<property name="jboss.this.lib" value="${jboss.this.root}/lib"/>
+<path id="jboss.this.classpath">
+ <fileset dir="${jboss.this.lib}">
+ <include name="*.jar"/>
+ <exclude name="${jar.prefix}.jar"/>
+ </fileset>
+</path>
+
+ &modules;
+
+ <!-- The combined dependant module classpath -->
+ <path id="dependentmodule.classpath">
+ <path refid="jboss.aop.classpath"/>
+ <path refid="jboss.this.classpath"/>
+ </path>
+
+ <!-- ===== -->
+ <!-- Tasks -->
+ <!-- ===== -->
+
+ <call target="_default:task-init"/>
+
+ <path id="thirdparty.classpath">
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ </path>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Compile -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Compile everything.
+ |
+ | This target should depend on other compile-* targets for each
+ | different type of compile that needs to be performed, short of
+ | documentation compiles.
+ -->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="_default:compile-classes"
+ />
+
+ <!-- ================================================================== -->
+ <!-- Archives -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Build all jar files.
+ -->
+ <target name="module-jars" depends="init">
+
+ <jar destfile="${build.lib}/jbossas-integration-test.jar" manifest="${build.etc}/default.mf">
+ <fileset dir="${build.classes}"/>
+ <fileset dir="${build.resources}">
+ <include name="org/**"/>
+ </fileset>
+ </jar>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Tests -->
+ <!-- ================================================================== -->
+
+ <target name="tests" depends="most"
+ description="Execute all tests in the given test directory.">
+ <mkdir dir="${build.reports}"/>
+ <mkdir dir="${build.testlog}"/>
+ <!-- Remove the test.log so each run has a fresh log -->
+ <delete file="${build.testlog}/test.log"/>
+ <junit dir="${module.output}"
+ printsummary="yes"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <sysproperty key="build.testlog" value="${build.testlog}"/>
+
+ <classpath>
+ <pathelement location="${build.classes}"/>
+ <pathelement location="${build.resources}/tests"/>
+ <path refid="javac.classpath"/>
+ </classpath>
+
+ <formatter type="plain" usefile="true"/>
+ <formatter type="xml" usefile="true"/>
+
+ <batchtest todir="${build.reports}"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/**/*UnitTestCase.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="one-test" depends="init"
+ description="Execute all tests in the given test directory.">
+ <mkdir dir="${build.reports}"/>
+ <mkdir dir="${build.testlog}"/>
+ <!-- Remove the test.log so each run has a fresh log -->
+ <delete file="${build.testlog}/test.log"/>
+ <junit dir="${module.output}"
+ printsummary="yes"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <sysproperty key="build.testlog" value="${build.testlog}"/>
+
+ <classpath>
+ <pathelement location="${build.classes}"/>
+ <pathelement location="${build.resources}/tests"/>
+ <path refid="javac.classpath"/>
+ </classpath>
+
+ <formatter type="plain" usefile="true"/>
+ <formatter type="xml" usefile="true"/>
+
+ <test todir="${build.reports}" name="${test}"
+ haltonerror="${junit.batchtest.haltonerror}"
+ haltonfailure="${junit.batchtest.haltonfailure}"
+ fork="${junit.batchtest.fork}"/>
+ </junit>
+ </target>
+
+ <target name="memory-test" depends="most" description="Execute MemoryLeakTestCase">
+ <mkdir dir="${build.reports}"/>
+ <mkdir dir="${build.testlog}"/>
+
+ <junit printsummary="yes" fork="yes" haltonfailure="no">
+ <classpath>
+ <pathelement location="${build.classes}"/>
+ <pathelement location="${build.resources}/tests"/>
+ <path refid="thirdparty.classpath"/>
+ <path refid="javac.classpath"/>
+ <path refid="apache.xerces.classpath"/>
+ </classpath>
+ <jvmarg value="-agentlib:jbossAgent"/>
+ <formatter type="plain" usefile="true"/>
+ <formatter type="xml" usefile="true"/>
+ <test fork="yes" todir="${build.reports}" name="org.jboss.test.memorytests.ClassInfoMemoryTestCase"/>
+ </junit>
+
+ </target>
+
+</project>
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersions-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersions-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersions-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.complex.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.complex.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.complex.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmoke-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmoke-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmoke-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.junit.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.junit.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.junit.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAll-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAll-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAll-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.simple.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicit-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicit-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicit-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.simple.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimplePrivate-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimplePrivate-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimplePrivate-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.simple.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirst-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirst-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirst-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.simple.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParent-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParent-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParent-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.simple.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLast-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLast-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLast-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.simple.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParent-aop.xml
===================================================================
--- projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParent-aop.xml (rev 0)
+++ projects/aop/trunk/asintegration/src/resources/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParent-aop.xml 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop>
+
+ <interceptor class="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.integration.simple.support.TestIntercepted->*(..))">
+ <interceptor-ref name="org.jboss.test.aop.integration.simple.support.TestInterceptor"/>
+ </bind>
+
+</aop>
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTest.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTest.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTest.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,212 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.integration.junit;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.jboss.classloader.plugins.filter.PatternClassFilter;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.spi.ClassLoaderPolicy;
+import org.jboss.classloader.spi.DelegateLoader;
+import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.test.support.IsolatedClassLoaderTestHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+import org.jboss.test.AbstractTestCaseWithSetup;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * AOPIntegrationTest.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 42515 $
+ */
+public abstract class AOPIntegrationTest extends AbstractTestCaseWithSetup
+{
+ /** The classloader helper */
+ private static IsolatedClassLoaderTestHelper helper;
+
+ public static Test suite(Class<?> clazz)
+ {
+ return suite(clazz, new Class[0]);
+ }
+
+ public static Test suite(Class<?> clazz, Class<?>... packages)
+ {
+ return suite(clazz, true, packages);
+ }
+
+ public static Test suite(Class<?> clazz, boolean importAll, Class<?>... packages)
+ {
+ helper = new IsolatedClassLoaderTestHelper();
+ ClassFilter aopFilter = new PatternClassFilter(new String[] { "org\\.jboss\\.aop\\..+"}, new String[] { "org/jboss/aop/.+" });
+ Class<?> newClass = helper.initializeClassLoader(clazz, aopFilter, importAll, packages);
+ return AbstractTestCaseWithSetup.suite(newClass);
+ }
+
+ /**
+ * Get the test delegate
+ *
+ * @param clazz the test class
+ * @return the delegate
+ */
+ public static AbstractTestDelegate getDelegate(Class<?> clazz)
+ {
+ return new AOPIntegrationTestDelegate(clazz, helper.getSystem());
+ }
+
+ /**
+ * Create a new AOPTest.
+ *
+ * @param name the test name
+ */
+ public AOPIntegrationTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ configureLogging();
+ }
+
+ /**
+ * Get the delegate
+ *
+ * @return the delegate
+ */
+ protected AOPIntegrationTestDelegate getMCDelegate()
+ {
+ return (AOPIntegrationTestDelegate) getDelegate();
+ }
+
+ /**
+ * Create a classloader
+ *
+ * It exports everything
+ *
+ * @param name the name
+ * @param importAll whether to import all
+ * @param packages the packages
+ * @return the classloader
+ * @throws Exception for any error
+ */
+ protected static ClassLoader createClassLoader(String name, boolean importAll, String... packages) throws Exception
+ {
+ return helper.createClassLoader(name, importAll, packages);
+ }
+
+ /**
+ * Create a classloader
+ *
+ * It exports everything
+ *
+ * @param policy the policy
+ * @return the classloader
+ * @throws Exception for any error
+ */
+ protected static ClassLoader createClassLoader(MockClassLoaderPolicy policy) throws Exception
+ {
+ return helper.createClassLoader(policy);
+ }
+
+ /**
+ * Create a classloader
+ *
+ * @param domain the domain
+ * @param policy the policy
+ * @return the classloader
+ * @throws Exception for any error
+ */
+ public ClassLoader createClassLoader(ClassLoaderDomain domain, MockClassLoaderPolicy policy) throws Exception
+ {
+ return helper.createClassLoader(domain, policy);
+ }
+
+ /**
+ * Unregister a classloader
+ *
+ * @param classLoader the classloader
+ * @throws Exception for any error
+ */
+ protected static void unregisterClassLoader(ClassLoader classLoader) throws Exception
+ {
+ helper.unregisterClassLoader(classLoader);
+ }
+
+ /**
+ * Create the default delegate loader
+ *
+ * @return the loaders
+ */
+ public List<? extends DelegateLoader> createDefaultDelegates()
+ {
+ return helper.createDefaultDelegates();
+ }
+
+ /**
+ * Create delegate loaders from policies
+ *
+ * @param policies the policies
+ * @return the loaders
+ */
+ public List<? extends DelegateLoader> createDelegates(ClassLoaderPolicy... policies)
+ {
+ return helper.createDelegates(policies);
+ }
+
+ /**
+ * Create a scoped classloader domain using the test domain as parent
+ * using the parent first policy
+ *
+ * @param name the name
+ * @return the domain
+ */
+ public ClassLoaderDomain createScopedClassLoaderDomainParentFirst(String name)
+ {
+ return helper.createScopedClassLoaderDomainParentFirst(name);
+ }
+
+ /**
+ * Create a scoped classloader domain using the test domain as parent
+ * using the parent last policy
+ *
+ * @param name the name
+ * @return the domain
+ */
+ public ClassLoaderDomain createScopedClassLoaderDomainParentLast(String name)
+ {
+ return helper.createScopedClassLoaderDomainParentLast(name);
+ }
+
+ /**
+ * Unregister a domain
+ *
+ * @param name the domain name
+ */
+ public void unregisterDomain(String name)
+ {
+ helper.unregisterDomain(name);
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTestDelegate.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTestDelegate.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/aop/integration/junit/AOPIntegrationTestDelegate.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,157 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.integration.junit;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * AOPTestDelegate.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 62730 $
+ */
+public class AOPIntegrationTestDelegate extends AbstractTestDelegate
+{
+ /** The deployed urls */
+ private static final CopyOnWriteArrayList<URL> urls = new CopyOnWriteArrayList<URL>();
+
+ /** The classloader system */
+ private ClassLoaderSystem system;
+
+ /**
+ * Create a new AOPTestDelegate.
+ *
+ * @param clazz the test class
+ * @param system the classloader system
+ */
+ public AOPIntegrationTestDelegate(Class clazz, ClassLoaderSystem system)
+ {
+ super(clazz);
+ this.system = system;
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ system.setTranslator(AspectManager.instance());
+
+ // FIXME It should not be necessary to set the context classloader here
+ Thread.currentThread().setContextClassLoader(clazz.getClassLoader());
+
+ try
+ {
+ deploy();
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw e;
+ }
+ catch (Error e)
+ {
+ throw e;
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ undeploy();
+ system.shutdown();
+ system.setTranslator(null);
+ }
+
+ /**
+ * Deploy the aop config
+ *
+ * @throws Exception for any error
+ */
+ protected void deploy() throws Exception
+ {
+ String testName = clazz.getName();
+ int index = testName.indexOf("UnitTestCase");
+ if (index != -1)
+ testName = testName.substring(0, index);
+ testName = testName.replace('.', '/') + "-aop.xml";
+ URL url = clazz.getClassLoader().getResource(testName);
+ if (url != null)
+ deploy(url);
+ else
+ log.debug("No test specific deployment " + testName);
+ }
+
+ protected void undeploy()
+ {
+ for (Iterator i = urls.iterator(); i.hasNext();)
+ {
+ URL url = (URL) i.next();
+ undeploy(url);
+ }
+ }
+
+ /**
+ * Deploy the aop config
+ *
+ * @param url the url
+ * @throws Exception for any error
+ */
+ protected void deploy(URL url) throws Exception
+ {
+ log.debug("Deploying " + url);
+ urls.add(url);
+ AspectXmlLoader.deployXML(url);
+ }
+
+ /**
+ * Undeploy the aop config
+ *
+ * @param url the url
+ */
+ protected void undeploy(URL url)
+ {
+ try
+ {
+ log.debug("Undeploying " + url);
+ urls.remove(url);
+ AspectXmlLoader.undeployXML(url);
+ }
+ catch (Exception e)
+ {
+ log.warn("Ignored error undeploying " + url, e);
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestIntercepted.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestIntercepted.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestIntercepted.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.complex.support;
+
+/**
+ * TestIntercepted.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 43840 $
+ */
+public class TestIntercepted
+{
+ public void doSomething()
+ {
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestInterceptor.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestInterceptor.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/TestInterceptor.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.complex.support;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * TestInterceptor.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 43840 $
+ */
+public class TestInterceptor implements Interceptor
+{
+ public static boolean intercepted = false;
+
+ public String getName()
+ {
+ return getClass().getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ intercepted = true;
+ return invocation.invokeNext();
+ }
+}
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/a/A.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/a/A.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/support/a/A.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.complex.support.a;
+
+import org.jboss.test.aop.integration.complex.support.TestIntercepted;
+import org.jboss.test.aop.integration.complex.support.TestInterceptor;
+
+/**
+ * A.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class A
+{
+ public A()
+ {
+ TestIntercepted test = new TestIntercepted();
+ if (TestInterceptor.intercepted)
+ throw new RuntimeException("Should not be intercepted yet!");
+ test.doSomething();
+ if (TestInterceptor.intercepted == false)
+ throw new RuntimeException("Not intercepted!");
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersionsUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersionsUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/complex/test/ComplexImportMultipleVersionsUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,175 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.complex.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.classloader.test.support.MockClassLoaderHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+
+/**
+ * ComplexImportMultipleVersionsUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ComplexImportMultipleVersionsUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_SUPPORT = "org.jboss.test.aop.integration.complex.support";
+ private static String PACKAGE_A = PACKAGE_SUPPORT + ".a";
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(ComplexImportMultipleVersionsUnitTestCase.class);
+ }
+
+ public ComplexImportMultipleVersionsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A complex test that loads classes from other classloaders
+ * they use aop enhanced classes from other classloaders.
+ *
+ * The aop enchanced classes are the same class but in
+ * different classloaders simulating versioning in OSGi
+ */
+ public void testMultiVersion() throws Exception
+ {
+ MockClassLoaderPolicy support1Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("Support1");
+ support1Policy.setPathsAndPackageNames(PACKAGE_SUPPORT);
+ ClassLoader support1 = createClassLoader(support1Policy);
+ try
+ {
+ MockClassLoaderPolicy a1Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A1");
+ a1Policy.setPathsAndPackageNames(PACKAGE_A);
+ a1Policy.setDelegates(createDelegates(support1Policy));
+ ClassLoader a1 = createClassLoader(a1Policy);
+ try
+ {
+ MockClassLoaderPolicy support2Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("Support2");
+ support2Policy.setPathsAndPackageNames(PACKAGE_SUPPORT);
+ ClassLoader support2 = createClassLoader(support2Policy);
+ try
+ {
+ MockClassLoaderPolicy a2Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A2");
+ a2Policy.setPathsAndPackageNames(PACKAGE_A);
+ a2Policy.setDelegates(createDelegates(support2Policy));
+ ClassLoader a2 = createClassLoader(a2Policy);
+ try
+ {
+ Class<?> classA1 = a1.loadClass(CLASS_A);
+ classA1.newInstance();
+
+ Class<?> classA2 = a2.loadClass(CLASS_A);
+ assertNotSame(classA2, classA1);
+ classA2.newInstance();
+ }
+ finally
+ {
+ unregisterClassLoader(a2);
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(support2);
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(a1);
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(support1);
+ }
+ }
+
+ // FIXME Remove this test when there is no need for the hack - the hack doesn't work anyway :-)
+ public void testMultiVersionHacked() throws Exception
+ {
+ MockClassLoaderPolicy support1Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("Support1");
+ support1Policy.setPathsAndPackageNames(PACKAGE_SUPPORT);
+ ClassLoader support1 = createClassLoader(support1Policy);
+ try
+ {
+ MockClassLoaderPolicy a1Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A1");
+ a1Policy.setPathsAndPackageNames(PACKAGE_A);
+ a1Policy.setDelegates(createDelegates(support1Policy));
+ ClassLoader a1 = createClassLoader(a1Policy);
+ try
+ {
+ MockClassLoaderPolicy support2Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("Support2");
+ support2Policy.setPathsAndPackageNames(PACKAGE_SUPPORT);
+ ClassLoader support2 = createClassLoader(support2Policy);
+ try
+ {
+ MockClassLoaderPolicy a2Policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A2");
+ a2Policy.setPathsAndPackageNames(PACKAGE_A);
+ a2Policy.setDelegates(createDelegates(support2Policy));
+ ClassLoader a2 = createClassLoader(a2Policy);
+ try
+ {
+ try
+ {
+ // FIXME This hack should not be necessary
+ Thread.currentThread().setContextClassLoader(support1);
+ Class<?> classA1 = a1.loadClass(CLASS_A);
+ classA1.newInstance();
+
+ // FIXME This hack does not work
+ Thread.currentThread().setContextClassLoader(support2);
+
+ Class<?> classA2 = a2.loadClass(CLASS_A);
+ assertNotSame(classA2, classA1);
+ classA2.newInstance();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(a2);
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(support2);
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(a1);
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(support1);
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestIntercepted.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestIntercepted.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestIntercepted.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.junit.support;
+
+/**
+ * TestIntercepted.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 43840 $
+ */
+public class TestIntercepted
+{
+ public void doSomething()
+ {
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestInterceptor.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestInterceptor.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/support/TestInterceptor.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.junit.support;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * TestInterceptor.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 43840 $
+ */
+public class TestInterceptor implements Interceptor
+{
+ public static boolean intercepted = false;
+
+ public String getName()
+ {
+ return getClass().getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ intercepted = true;
+ return invocation.invokeNext();
+ }
+}
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmokeUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmokeUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/junit/test/AOPIntegrationSmokeUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.junit.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.test.aop.integration.junit.support.TestIntercepted;
+import org.jboss.test.aop.integration.junit.support.TestInterceptor;
+
+/**
+ * AOPIntegrationSmokeUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AOPIntegrationSmokeUnitTestCase extends AOPIntegrationTest
+{
+ public static Test suite()
+ {
+ return suite(AOPIntegrationSmokeUnitTestCase.class, TestIntercepted.class);
+ }
+
+ public AOPIntegrationSmokeUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testIntercepted() throws Exception
+ {
+ TestIntercepted intercepted = new TestIntercepted();
+ assertFalse(TestInterceptor.intercepted);
+ intercepted.doSomething();
+ assertTrue(TestInterceptor.intercepted);
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestIntercepted.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestIntercepted.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestIntercepted.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.support;
+
+/**
+ * TestIntercepted.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 43840 $
+ */
+public class TestIntercepted
+{
+ public void doSomething()
+ {
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestInterceptor.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestInterceptor.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/TestInterceptor.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.support;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * TestInterceptor.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 43840 $
+ */
+public class TestInterceptor implements Interceptor
+{
+ public static boolean intercepted = false;
+
+ public String getName()
+ {
+ return getClass().getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ intercepted = true;
+ return invocation.invokeNext();
+ }
+}
\ No newline at end of file
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/a/A.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/a/A.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/support/a/A.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.support.a;
+
+import org.jboss.test.aop.integration.simple.support.TestIntercepted;
+import org.jboss.test.aop.integration.simple.support.TestInterceptor;
+
+/**
+ * A.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class A
+{
+ public A()
+ {
+ TestIntercepted test = new TestIntercepted();
+ if (TestInterceptor.intercepted)
+ throw new RuntimeException("Should not be intercepted yet!");
+ test.doSomething();
+ if (TestInterceptor.intercepted == false)
+ throw new RuntimeException("Not intercepted!");
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAllUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAllUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportAllUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.test.aop.integration.simple.support.TestIntercepted;
+
+/**
+ * SimpleImportAllUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleImportAllUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_A = "org.jboss.test.aop.integration.simple.support.a";
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(SimpleImportAllUnitTestCase.class, TestIntercepted.class);
+ }
+
+ public SimpleImportAllUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A simple test that loads a class from another classloader
+ * that uses aop enhanced classes from our classloader.
+ *
+ * The other classloader importsAll from the classloading system.
+ */
+ public void testImportAll() throws Exception
+ {
+ ClassLoader classLoader = createClassLoader("A", true, PACKAGE_A);
+ try
+ {
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ unregisterClassLoader(classLoader);
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicitUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicitUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleImportExplicitUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,74 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.classloader.test.support.MockClassLoaderHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+import org.jboss.test.aop.integration.simple.support.TestIntercepted;
+
+/**
+ * SimpleImportExplicitUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleImportExplicitUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_A = "org.jboss.test.aop.integration.simple.support.a";
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(SimpleImportExplicitUnitTestCase.class, TestIntercepted.class);
+ }
+
+ public SimpleImportExplicitUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A simple test that loads a class from another classloader
+ * that uses aop enhanced classes from our classloader.
+ *
+ * The other classloader explicity imports our exports
+ */
+ public void testImportExplicit() throws Exception
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPathsAndPackageNames(PACKAGE_A);
+ policy.setDelegates(createDefaultDelegates());
+ ClassLoader classLoader = createClassLoader(policy);
+ try
+ {
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ unregisterClassLoader(classLoader);
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimplePrivateUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimplePrivateUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimplePrivateUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,102 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.classloader.test.support.MockClassLoaderHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+
+/**
+ * SimplePrivateUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimplePrivateUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_SUPPORT = "org.jboss.test.aop.integration.simple.support";
+ private static String PACKAGE_SUPPORT_RESOURCE = PACKAGE_SUPPORT.replace(".", "/");
+ private static String PACKAGE_A = PACKAGE_SUPPORT + ".a";
+ private static String PACKAGE_A_RESOURCE = PACKAGE_A.replace(".", "/");
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(SimplePrivateUnitTestCase.class);
+ }
+
+ public SimplePrivateUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A simple test that loads a class from another classloader
+ * that uses aop enhanced classes from its own classloader
+ * that are not exported to us.
+ */
+ public void testPrivate() throws Exception
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPackageNames(PACKAGE_A);
+ policy.setPaths(PACKAGE_A_RESOURCE, PACKAGE_SUPPORT_RESOURCE);
+ ClassLoader classLoader = createClassLoader(policy);
+ try
+ {
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ unregisterClassLoader(classLoader);
+ }
+ }
+
+ // FIXME Remove this test when the hack is not necessary
+ public void testPrivateHacked() throws Exception
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPackageNames(PACKAGE_A);
+ policy.setPaths(PACKAGE_A_RESOURCE, PACKAGE_SUPPORT_RESOURCE);
+ ClassLoader classLoader = createClassLoader(policy);
+ try
+ {
+ // FIXME THIS HACK SHOULD NOT BE NECESSARY
+ Thread.currentThread().setContextClassLoader(classLoader);
+ try
+ {
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ }
+ }
+ finally
+ {
+ unregisterClassLoader(classLoader);
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParentUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParentUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstEnhancedInParentUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.test.support.MockClassLoaderHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+import org.jboss.test.aop.integration.simple.support.TestIntercepted;
+
+/**
+ * SimpleScopedParentFirstEnhancedInParentUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleScopedParentFirstEnhancedInParentUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_A = "org.jboss.test.aop.integration.simple.support.a";
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(SimpleScopedParentFirstEnhancedInParentUnitTestCase.class, TestIntercepted.class);
+ }
+
+ public SimpleScopedParentFirstEnhancedInParentUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A simple test that loads a class that uses aop enhanced classes
+ * from a scoped classloader domain using parent first classloading rules
+ *
+ * The aop enhanced classes are in the parent domain
+ */
+ public void testScopedParentFirstEnhancedInParent() throws Exception
+ {
+ ClassLoaderDomain domain = createScopedClassLoaderDomainParentFirst("Scoped");
+ try
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPathsAndPackageNames(PACKAGE_A);
+ ClassLoader classLoader = createClassLoader(domain, policy);
+
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ unregisterDomain("Scoped");
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentFirstUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,104 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.test.support.MockClassLoaderHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+
+/**
+ * SimpleScopedParentFirstUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleScopedParentFirstUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_SUPPORT = "org.jboss.test.aop.integration.simple.support";
+ private static String PACKAGE_A = "org.jboss.test.aop.integration.simple.support.a";
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(SimpleScopedParentFirstUnitTestCase.class);
+ }
+
+ public SimpleScopedParentFirstUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A simple test that loads a class that uses aop enhanced classes
+ * from a scoped classloader domain using parent first classloading rules
+ *
+ * The aop enhanced classes are in the same classloader
+ */
+ public void testScopedParentFirst() throws Exception
+ {
+ ClassLoaderDomain domain = createScopedClassLoaderDomainParentFirst("Scoped");
+ try
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPathsAndPackageNames(PACKAGE_A, PACKAGE_SUPPORT);
+ ClassLoader classLoader = createClassLoader(domain, policy);
+
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ unregisterDomain("Scoped");
+ }
+ }
+
+ // FIXME Remove this test when the hack is no longer necessary
+ public void testScopedParentFirstHacked() throws Exception
+ {
+ ClassLoaderDomain domain = createScopedClassLoaderDomainParentFirst("Scoped");
+ try
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPathsAndPackageNames(PACKAGE_A, PACKAGE_SUPPORT);
+ ClassLoader classLoader = createClassLoader(domain, policy);
+
+ // FIXME Remove this HACK
+ Thread.currentThread().setContextClassLoader(classLoader);
+ try
+ {
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ }
+ }
+ finally
+ {
+ unregisterDomain("Scoped");
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParentUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParentUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastEnhancedInParentUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.test.support.MockClassLoaderHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+import org.jboss.test.aop.integration.simple.support.TestIntercepted;
+
+/**
+ * SimpleScopedParentLastEnhancedInParentUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleScopedParentLastEnhancedInParentUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_A = "org.jboss.test.aop.integration.simple.support.a";
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(SimpleScopedParentLastEnhancedInParentUnitTestCase.class, TestIntercepted.class);
+ }
+
+ public SimpleScopedParentLastEnhancedInParentUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A simple test that loads a class that uses aop enhanced classes
+ * from a scoped classloader domain using parent first classloading rules
+ *
+ * The aop enhanced classes are in the parent domain
+ */
+ public void testScopedParentLastEnhancedInParent() throws Exception
+ {
+ ClassLoaderDomain domain = createScopedClassLoaderDomainParentLast("Scoped");
+ try
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPathsAndPackageNames(PACKAGE_A);
+ ClassLoader classLoader = createClassLoader(domain, policy);
+
+ enableTrace("org.jboss.classloader");
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ unregisterDomain("Scoped");
+ }
+ }
+}
Added: projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastUnitTestCase.java
===================================================================
--- projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastUnitTestCase.java (rev 0)
+++ projects/aop/trunk/asintegration/src/tests/org/jboss/test/aop/integration/simple/test/SimpleScopedParentLastUnitTestCase.java 2007-07-25 18:15:05 UTC (rev 64279)
@@ -0,0 +1,104 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.integration.simple.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.integration.junit.AOPIntegrationTest;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.test.support.MockClassLoaderHelper;
+import org.jboss.classloader.test.support.MockClassLoaderPolicy;
+
+/**
+ * SimpleScopedParentLastUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleScopedParentLastUnitTestCase extends AOPIntegrationTest
+{
+ private static String PACKAGE_SUPPORT = "org.jboss.test.aop.integration.simple.support";
+ private static String PACKAGE_A = "org.jboss.test.aop.integration.simple.support.a";
+ private static String CLASS_A = PACKAGE_A + ".A";
+
+ public static Test suite()
+ {
+ return suite(SimpleScopedParentLastUnitTestCase.class);
+ }
+
+ public SimpleScopedParentLastUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /*
+ * A simple test that loads a class that uses aop enhanced classes
+ * from a scoped classloader domain using parent first classloading rules
+ *
+ * The aop enhanced classes are in the same classloader
+ */
+ public void testScopedParentLast() throws Exception
+ {
+ ClassLoaderDomain domain = createScopedClassLoaderDomainParentLast("Scoped");
+ try
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPathsAndPackageNames(PACKAGE_A, PACKAGE_SUPPORT);
+ ClassLoader classLoader = createClassLoader(domain, policy);
+
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ unregisterDomain("Scoped");
+ }
+ }
+
+ // FIXME Remove this test when the hack is no longer necessary
+ public void testScopedParentLastHacked() throws Exception
+ {
+ ClassLoaderDomain domain = createScopedClassLoaderDomainParentLast("Scoped");
+ try
+ {
+ MockClassLoaderPolicy policy = MockClassLoaderHelper.createMockClassLoaderPolicy("A");
+ policy.setPathsAndPackageNames(PACKAGE_A, PACKAGE_SUPPORT);
+ ClassLoader classLoader = createClassLoader(domain, policy);
+
+ // FIXME Remove this HACK
+ Thread.currentThread().setContextClassLoader(classLoader);
+ try
+ {
+ Class<?> classA = classLoader.loadClass(CLASS_A);
+ classA.newInstance();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ }
+ }
+ finally
+ {
+ unregisterDomain("Scoped");
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list