[Jboss-cvs] JBossAS SVN: r56777 - in trunk: aop aop/src/main/org/jboss/aop aop/src/main/org/jboss/aop/advice aop/src/main/org/jboss/aop/annotation/compiler aop/src/main/org/jboss/aop/classpool aop/src/main/org/jboss/aop/instrument aop/src/test/org/jboss/test/aop/extender aspects/src/etc aspects/src/main/org/jboss/aop/deployment testsuite testsuite/imports/sections testsuite/src/main/org/jboss/test/aop/scopedextender testsuite/src/main/org/jboss/test/aop/test
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 12 14:26:32 EDT 2006
Author: kabir.khan at jboss.com
Date: 2006-09-12 14:25:59 -0400 (Tue, 12 Sep 2006)
New Revision: 56777
Added:
trunk/aop/src/test/org/jboss/test/aop/extender/SuperCallAspect.java
trunk/aspects/src/main/org/jboss/aop/deployment/LoaderRepositoryUrlUtil.java
trunk/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java
trunk/aspects/src/main/org/jboss/aop/deployment/ScopedJBossClassPool.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTesterMBean.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTester.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTesterMBean.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_A1.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_Base.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A2.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A3.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B1.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B2.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B3.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTesterMBean.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTesterMBean.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java
trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TesterMBean.java
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedNoParentDelegationTestCase.java
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedParentDelegationTestCase.java
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedNoParentDelegationTestCase.java
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedParentDelegationTestCase.java
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java
Removed:
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderTestCase.java
Modified:
trunk/aop/build.xml
trunk/aop/src/main/org/jboss/aop/Advisor.java
trunk/aop/src/main/org/jboss/aop/AspectManager.java
trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java
trunk/aop/src/main/org/jboss/aop/ClassContainer.java
trunk/aop/src/main/org/jboss/aop/Domain.java
trunk/aop/src/main/org/jboss/aop/GeneratedClassAdvisor.java
trunk/aop/src/main/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoader.java
trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java
trunk/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java
trunk/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java
trunk/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java
trunk/aop/src/main/org/jboss/aop/classpool/AOPScopedClassLoaderHelper.java
trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java
trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
trunk/aop/src/main/org/jboss/aop/instrument/JoinpointSimpleClassifier.java
trunk/aop/src/main/org/jboss/aop/instrument/TransformerCommon.java
trunk/aspects/src/etc/ReadMe.txt
trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java
trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPoolFactory.java
trunk/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java
trunk/testsuite/build.xml
trunk/testsuite/imports/sections/aop.xml
trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java
Log:
[JBAOP-257] Get basic functionality working for subclasses in a deployment using scoped classloaders extending classes deployed in the global classloading domain.
Still need to test constructors and fields
Modified: trunk/aop/build.xml
===================================================================
--- trunk/aop/build.xml 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/build.xml 2006-09-12 18:25:59 UTC (rev 56777)
@@ -711,6 +711,9 @@
</annotationc>
<antcall target="_run-bootclasspath-test" inheritRefs="true">
+ <param name="test" value="extender"/>
+ </antcall>
+ <antcall target="_run-bootclasspath-test" inheritRefs="true">
<param name="test" value="stress/simple"/>
</antcall>
<antcall target="_run-bootclasspath-test" inheritRefs="true">
@@ -790,6 +793,13 @@
</antcall>
</target>
+ <target name="loadtime-ga-test" depends="init">
+ <antcall target="_run-bootclasspath-test" inheritRefs="true">
+ <param name="test" value="${test}"/>
+ <param name="caller" value="bootclasspath-genadvisor-tests"/>
+ </antcall>
+ </target>
+
<target name="_run-bootclasspath-test">
<path id="bootclasspath">
<pathelement location="${build.bootclasspath}"/>
@@ -976,6 +986,9 @@
</annotationc>
<antcall target="_run-precompiled-test" inheritRefs="true">
+ <param name="test" value="extender"/>
+ </antcall>
+ <antcall target="_run-precompiled-test" inheritRefs="true">
<param name="test" value="invoketarget"/>
</antcall>
<antcall target="_run-precompiled-test" inheritRefs="true">
@@ -1862,80 +1875,7 @@
</junit>
</target>
- <!-- Some targets for testing what I am working on so I don't have to run the whole thing every time -->
- <target name="current-bootclasspath" depends="compile-test-classes">
- <delete dir="${build.bootclasspath}"/>
- <java classname="org.jboss.aop.hook.GenerateInstrumentedClassLoader">
- <classpath>
- <path refid="test.classpath"/>
- </classpath>
- <arg value="${build.bootclasspath}"/>
- </java>
- <path id="bootclasspath">
- <pathelement location="${build.bootclasspath}"/>
- <path refid="test.classpath"/>
- </path>
- <property name="bootclasspath" refid="bootclasspath"/>
- <junit printsummary="yes" fork="no" haltonfailure="no">
- <jvmarg value="-Xbootclasspath/p:${bootclasspath}"/>
- <sysproperty key="jboss.aop.path" value="${source.res}/test/regression/jboss-aop.xml"/>
- <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.GeneratedAdvisorInstrumentor"/>
- <sysproperty key="jboss.aop.verbose" value="true"/>
- <formatter type="plain"/>
- <classpath>
- <pathelement location="${build.tests.classes}"/>
- </classpath>
- <test fork="yes" name="org.jboss.test.aop.regression.jbaop137.ExtenderTestCase"/>
- </junit>
- </target>
- <target name="current-system" depends="compile-test-classes">
- <junit printsummary="yes" fork="no" haltonfailure="no">
- <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader"/>
- <sysproperty key="jboss.aop.path" value="${source.res}/test/regression/jboss-aop.xml"/>
- <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.GeneratedAdvisorInstrumentor"/>
- <sysproperty key="jboss.aop.verbose" value="true"/>
- <formatter type="plain"/>
- <classpath>
- <path refid="test.classpath"/>
- <pathelement location="${build.tests.classes}"/>
- <pathelement location="docs"/>
- </classpath>
- <test fork="yes" name="org.jboss.test.aop.regression.jbaop137.ExtenderTestCase"/>
- </junit>
- </target>
- <target name="current-javaagent" depends="compile-test-classes">
- <junit printsummary="yes" fork="no" haltonfailure="no">
- <jvmarg value="-javaagent:${build.lib}/jboss-aop-jdk50.jar"/>
- <classpath refid="test15.classpath"/>
- <classpath path="${build.tests.classes}"/>
- <sysproperty key="jboss.aop.path" value="${source.res}/test/regression/jboss-aop.xml"/>
- <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.GeneratedAdvisorInstrumentor"/>
- <sysproperty key="jboss.aop.verbose" value="true"/>
- <formatter type="plain"/>
- <classpath>
- <pathelement location="docs"/>
- </classpath>
- <test fork="yes" name="org.jboss.test.aop.regression.jbaop137.ExtenderTestCase"/>
- </junit>
- </target>
- <target name="current-jrockit" depends="compile-test-classes">
- <junit printsummary="yes" fork="no" haltonfailure="no">
- <jvmarg value="-Xmanagement:class=org.jboss.aop.hook.JRockitClassPreProcessor"/>
- <classpath>
- <path refid="test.jrockit.classpath"/>
- <pathelement location="${build.tests.classes}"/>
- <pathelement location="docs"/>
- </classpath>
- <sysproperty key="jboss.aop.path" value="${source.res}/test/regression/jboss-aop.xml"/>
- <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.GeneratedAdvisorInstrumentor"/>
- <sysproperty key="jboss.aop.verbose" value="true"/>
- <formatter type="plain"/>
- <test fork="yes" name="org.jboss.test.aop.regression.jbaop137.ExtenderTestCase"/>
- </junit>
- </target>
-
-
<target name="original-memory-test" depends="compile-test-classes" description="Execute MemoryLeakTestCase">
<taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="jboss.aop.classpath"/>
<taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpathref="jboss.aop.classpath"/>
Modified: trunk/aop/src/main/org/jboss/aop/Advisor.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/Advisor.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/Advisor.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -671,6 +671,7 @@
{
Method method = (Method) advisedMethods.get(keys[i]);
PointcutMethodMatch match = binding.getPointcut().matchesExecution(this, method);
+
if (match != null && match.isMatch())
{
adviceBindings.add(binding);
Modified: trunk/aop/src/main/org/jboss/aop/AspectManager.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/AspectManager.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/AspectManager.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -42,6 +42,8 @@
import org.jboss.aop.advice.AdviceBinding;
import org.jboss.aop.advice.AdviceStack;
import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.aop.advice.AspectFactory;
+import org.jboss.aop.advice.AspectFactoryWithClassLoader;
import org.jboss.aop.advice.DynamicCFlowDefinition;
import org.jboss.aop.advice.InterceptorFactory;
import org.jboss.aop.advice.PrecedenceDef;
@@ -343,7 +345,7 @@
scopedManager = (Domain)manager.scopedClassLoaderDomains.get(scopedClassLoader);
if (scopedManager == null)
{
- scopedManager = new Domain(manager, false);
+ scopedManager = scopedCLHelper.getScopedClassLoaderDomain(scopedClassLoader, manager);
if (verbose)
{
System.out.println("Created domain " + scopedManager + " for scoped deployment on: " +
@@ -1674,13 +1676,37 @@
{
synchronized (aspect)
{
- AspectDefinition adef = (AspectDefinition) aspect;
- aspect = adef.getFactory().createPerVM();
- perVMAspects.put(def, aspect);
+ return createPerVmAspect(def, (AspectDefinition)aspect, null);
}
}
return aspect;
}
+
+ protected Object createPerVmAspect(String def, AspectDefinition adef, ClassLoader scopedClassLoader)
+ {
+ Object instance = null;
+ synchronized (adef)
+ {
+ try
+ {
+ if (scopedClassLoader != null && adef.getFactory() instanceof AspectFactoryWithClassLoader)
+ {
+ //If a scoped classloader with no parent delegation redefines the class, we need to make sure that that class is pushed on the stack
+ ((AspectFactoryWithClassLoader)adef.getFactory()).pushScopedClassLoader(scopedClassLoader);
+ }
+ instance = adef.getFactory().createPerVM();
+ perVMAspects.put(def, instance);
+ }
+ finally
+ {
+ if (scopedClassLoader != null && adef.getFactory() instanceof AspectFactoryWithClassLoader)
+ {
+ ((AspectFactoryWithClassLoader)adef.getFactory()).popScopedClassLoader();
+ }
+ }
+ }
+ return instance;
+ }
public void addAspectDefinition(AspectDefinition def)
{
Modified: trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/ClassAdvisor.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -447,7 +447,6 @@
long[] keys = advisedMethods.keys();
for (int i = 0; i < keys.length; i++)
{
- // Keep compatible with AOP 1.3.x until AOP 2.0 is FINAL
MethodInfo info = new MethodInfo();
Method amethod = (Method) advisedMethods.get(keys[i]);
info.setAdvisedMethod(amethod);
@@ -604,7 +603,7 @@
while (it.hasNext())
{
AdviceBinding binding = (AdviceBinding) it.next();
- if (AspectManager.verbose) System.out.println("iterate binding " + binding.getName());
+ if (AspectManager.verbose) System.out.println("iterate binding " + binding.getName() + " " + binding.getPointcut().getExpr());
resolveMethodPointcut(newMethodInfos, binding);
resolveFieldPointcut(newFieldReadInfos, binding, false);
resolveFieldPointcut(newFieldWriteInfos, binding, true);
Modified: trunk/aop/src/main/org/jboss/aop/ClassContainer.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/ClassContainer.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/ClassContainer.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -58,7 +58,7 @@
initializeMetadata();
rebuildInterceptors();
}
-
+
public void setClass(Class clazz)
{
this.clazz = clazz;
@@ -231,12 +231,12 @@
Arrays.sort(constructors, ConstructorComparator.INSTANCE);
}
}
-
+
protected void createInterceptorChains()
{
MethodInterceptors newMethodInfos = initializeMethodChain();
ArrayList newConstructorInfos = initializeConstructorChain();
-
+
LinkedHashMap bindings = manager.getBindings();
synchronized (bindings)
{
@@ -247,7 +247,6 @@
{
AdviceBinding binding = (AdviceBinding) it.next();
if (AspectManager.verbose) System.out.println("iterate binding " + binding.getName());
- //System.out.println("------------> Binding " + binding.getPointcut().getExpr());
resolveMethodPointcut(newMethodInfos, binding);
resolveConstructorPointcut(newConstructorInfos, binding);
}
@@ -258,9 +257,9 @@
constructorInfos = new ConstructorInfo[newConstructorInfos.size()];
if (constructorInfos.length > 0)
constructorInfos = (ConstructorInfo[]) newConstructorInfos.toArray(constructorInfos);
-
+
populateInterceptorsFromInfos();
-
+
doesHaveAspects = adviceBindings.size() > 0;
}
}
Modified: trunk/aop/src/main/org/jboss/aop/Domain.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/Domain.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/Domain.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -26,10 +26,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.WeakHashMap;
-import javassist.ClassPool;
-
import org.jboss.aop.advice.AdviceStack;
import org.jboss.aop.advice.AspectDefinition;
import org.jboss.aop.advice.InterceptorFactory;
@@ -37,7 +34,6 @@
import org.jboss.aop.pointcut.CFlowStack;
import org.jboss.aop.pointcut.DynamicCFlow;
import org.jboss.aop.pointcut.Pointcut;
-import org.jboss.aop.pointcut.PointcutExpression;
import org.jboss.aop.pointcut.PointcutStats;
import org.jboss.aop.pointcut.Typedef;
import org.jboss.aop.pointcut.ast.ClassExpression;
@@ -193,6 +189,7 @@
ArrayList list = new ArrayList();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
list.addAll(parent.getAnnotationOverrides());
synchronized (annotationOverrides)
{
@@ -220,6 +217,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getInterfaceIntroductions());
synchronized (interfaceIntroductions)
{
@@ -247,6 +245,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getTypedefs());
synchronized (typedefs)
{
@@ -274,6 +273,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getInterceptorStacks());
synchronized (interceptorStacks)
{
@@ -301,6 +301,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getClassMetaDataLoaders());
synchronized (classMetaDataLoaders)
{
@@ -328,6 +329,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getCflowStacks());
synchronized (cflowStacks)
{
@@ -355,6 +357,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getDynamicCFlows());
synchronized (dynamicCFlows)
{
@@ -382,6 +385,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getPerVMAspects());
synchronized (perVMAspects)
{
@@ -402,6 +406,27 @@
return super.getPerVMAspects();
}
+ public LinkedHashMap getPrecedenceDefs()
+ {
+ if (inheritsDeclarations)
+ {
+ if (!parentFirst)
+ {
+ // when child first, parent bindings go in first so that they can be overridden by child.
+ LinkedHashMap map = new LinkedHashMap(parent.getPrecedenceDefs());
+ map.putAll(this.precedenceDefs);
+ return map;
+ }
+ else
+ {
+ LinkedHashMap map = new LinkedHashMap(this.precedenceDefs);
+ map.putAll(parent.getPrecedenceDefs());
+ return map;
+ }
+ }
+ return super.getPrecedenceDefs();
+ }
+
public Map getClassMetaData()
{
if (inheritsBindings)
@@ -409,6 +434,7 @@
HashMap map = new HashMap();
if (!parentFirst)
{
+ // when child first, parent bindings go in first so that they can be overridden by child.
map.putAll(parent.getClassMetaData());
synchronized (classMetaData)
{
@@ -432,7 +458,7 @@
public InterceptorFactory getInterceptorFactory(String name)
{
InterceptorFactory factory = null;
- if (!parentFirst)
+ if (parentFirst)
{
factory = parent.getInterceptorFactory(name);
if (factory != null) return factory;
@@ -446,7 +472,7 @@
public AdviceStack getAdviceStack(String name)
{
AdviceStack factory = null;
- if (!parentFirst)
+ if (parentFirst)
{
factory = parent.getAdviceStack(name);
if (factory != null) return factory;
@@ -459,22 +485,13 @@
public Object getPerVMAspect(AspectDefinition def)
{
- Object factory = null;
- if (!parentFirst)
- {
- factory = parent.getPerVMAspect(def);
- if (factory != null) return factory;
- }
- factory = super.getPerVMAspect(def);
-
- if (factory != null) return factory;
- return parent.getPerVMAspect(def);
+ return getPerVMAspect(def.getName());
}
public Object getPerVMAspect(String def)
{
Object factory = null;
- if (!parentFirst)
+ if (parentFirst)
{
factory = parent.getPerVMAspect(def);
if (factory != null) return factory;
@@ -488,7 +505,7 @@
public AspectDefinition getAspectDefinition(String name)
{
AspectDefinition factory = null;
- if (!parentFirst)
+ if (parentFirst)
{
factory = parent.getAspectDefinition(name);
if (factory != null) return factory;
@@ -502,7 +519,7 @@
public Typedef getTypedef(String name)
{
Typedef factory = null;
- if (!parentFirst)
+ if (parentFirst)
{
factory = parent.getTypedef(name);
if (factory != null) return factory;
@@ -516,7 +533,7 @@
public DomainDefinition getContainer(String name)
{
DomainDefinition container = null;
- if (!parentFirst)
+ if (parentFirst)
{
container = parent.getContainer(name);
if (container != null) return container;
@@ -535,7 +552,7 @@
{
Pointcut pointcut = null;
- if (!parentFirst)
+ if (parentFirst)
{
pointcut = parent.getPointcut(name);
if (pointcut != null) return pointcut;
@@ -626,27 +643,6 @@
}
}
- public LinkedHashMap getPrecedenceDefs()
- {
- if (inheritsDeclarations)
- {
- if (!parentFirst)
- {
- // when child first, parent bindings go in first so that they can be overridden by child.
- LinkedHashMap map = new LinkedHashMap(parent.getPrecedenceDefs());
- map.putAll(this.precedenceDefs);
- return map;
- }
- else
- {
- LinkedHashMap map = new LinkedHashMap(this.precedenceDefs);
- map.putAll(parent.getPrecedenceDefs());
- return map;
- }
- }
- return super.getPrecedenceDefs();
- }
-
public ClassMetaDataLoader findClassMetaDataLoader(String group)
{
if (inheritsDeclarations)
Modified: trunk/aop/src/main/org/jboss/aop/GeneratedClassAdvisor.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/GeneratedClassAdvisor.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/GeneratedClassAdvisor.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -55,20 +55,20 @@
* @version $Revision$
*/
public class GeneratedClassAdvisor extends ClassAdvisor
-{
+{
public static final String ADD_METHOD_INFO = "addMethodInfo";
public static final String ADD_CONSTRUCTOR_INFO = "addConstructorInfo";
public static final String ADD_CONSTRUCTION_INFO = "addConstructionInfo";
public static final String ADD_FIELD_READ_INFO = "addFieldReadInfo";
public static final String ADD_FIELD_WRITE_INFO = "addFieldWriteInfo";
public static final String GET_PARENT_ADVISOR = "getParentAdvisor";
-
+
MethodInterceptors methodInfos = new MethodInterceptors(this);
- ArrayList constructorInfos = new ArrayList();
+ ArrayList constructorInfos = new ArrayList();
ArrayList constructionInfos = new ArrayList();
ArrayList fieldReadInfos = new ArrayList();
ArrayList fieldWriteInfos = new ArrayList();
-
+
ConcurrentReaderHashMap constructorJoinPoinGenerators = new ConcurrentReaderHashMap();
ConcurrentReaderHashMap constructionJoinPoinGenerators = new ConcurrentReaderHashMap();
ConcurrentReaderHashMap fieldReadJoinPoinGenerators = new ConcurrentReaderHashMap();
@@ -78,22 +78,22 @@
ConcurrentReaderHashMap methodByMethodJoinPoinGenerators = new ConcurrentReaderHashMap();
ConcurrentReaderHashMap conByConJoinPoinGenerators = new ConcurrentReaderHashMap();
ConcurrentReaderHashMap conByMethodJoinPoinGenerators = new ConcurrentReaderHashMap();
-
+
protected GeneratedClassAdvisor(String classname)
{
//Generated advisors will not pass in an aspectmanager
//This will be passed in via the initialise() method
super(classname, null);
}
-
+
protected void initialise(Class clazz, AspectManager manager)
{
super.setManager(manager);
//Make sure that we copy across per class and per joinpoint aspects from the old advisor if it exists
- //Generated advisors get created when the class is first accessed (not loaded), meaning that there could be an exisiting advisor
+ //Generated advisors get created when the class is first accessed (not loaded), meaning that there could be an exisiting advisor
//used for mathcing already when setting up the microcontainer.
- Advisor existing = AspectManager.instance().getAnyAdvisorIfAdvised(clazz);
+ Advisor existing = AspectManager.instance().getAnyAdvisorIfAdvised(clazz);
if (existing != null)
{
this.aspects = existing.aspects;
@@ -102,7 +102,7 @@
this.perClassJoinpointAspectDefinitions = ((GeneratedClassAdvisor)existing).perClassJoinpointAspectDefinitions;
}
}
-
+
manager.initialiseClassAdvisor(clazz, this);
}
@@ -112,21 +112,21 @@
//If we do dynamic invokes the method will need to be accessible via reflection if private/protected
SecurityActions.setAccessible(mi.getAdvisedMethod());
}
-
+
protected MethodInterceptors initializeMethodChain()
{
//We have all the advised methods here, need to get all the others here too
-
+
long[] keys = advisedMethods.keys();
for (int i = 0; i < keys.length; i++)
{
MethodMatchInfo matchInfo = methodInfos.getMatchInfo(keys[i]);
-
+
if (super.initialized && matchInfo != null)
{
matchInfo.clear();
}
-
+
if (matchInfo == null)
{
MethodInfo info = new MethodInfo();
@@ -138,7 +138,7 @@
methodInfos.put(keys[i], info);
}
}
-
+
return methodInfos;
}
@@ -149,7 +149,7 @@
//If we do dynamic invokes the constructor will need to be accessible via reflection
SecurityActions.setAccessible(ci.getConstructor());
}
-
+
protected ArrayList initializeConstructorChain()
{
if (super.initialized)
@@ -161,7 +161,7 @@
}
return constructorInfos;
}
-
+
protected void addConstructionInfo(ConstructionInfo ci)
{
constructionInfos.add(ci);
@@ -178,7 +178,7 @@
}
return constructionInfos;
}
-
+
protected void addFieldReadInfo(FieldInfo fi)
{
fieldReadInfos.add(fi);
@@ -190,14 +190,14 @@
{
return mergeFieldInfos(fieldReadInfos);
}
-
+
protected void addFieldWriteInfo(FieldInfo fi)
{
fieldWriteInfos.add(fi);
//If we do dynamic invokes the field will need to be accessible via reflection
SecurityActions.setAccessible(fi.getAdvisedField());
}
-
+
protected ArrayList initializeFieldWriteChain()
{
return mergeFieldInfos(fieldWriteInfos);
@@ -209,14 +209,14 @@
private ArrayList mergeFieldInfos(ArrayList advisedInfos)
{
ArrayList newInfos = new ArrayList(advisedFields.length);
-
+
FieldInfo nextFieldInfo = null;
Iterator it = advisedInfos.iterator();
if (it.hasNext())
{
nextFieldInfo = (FieldInfo)it.next();
}
-
+
for (int i = 0 ; i < advisedFields.length ; i++)
{
if (nextFieldInfo != null && nextFieldInfo.getIndex() == i)
@@ -225,7 +225,7 @@
{
nextFieldInfo.clear();
}
-
+
newInfos.add(nextFieldInfo);
if (it.hasNext())
{
@@ -245,7 +245,7 @@
newInfos.add(info);
}
}
-
+
return newInfos;
}
@@ -258,16 +258,16 @@
{
MethodMatchInfo matchInfo = newMethodInterceptors.getMatchInfo(keys[i]);
matchInfo.populateBindings();
-
+
MethodInfo info = matchInfo.getInfo();
newMethodInfos.put(keys[i], info);
-
+
MethodJoinPointGenerator generator = getJoinPointGenerator(info);
finalizeChainAndRebindJoinPoint(info, generator);
}
methodInterceptors = newMethodInfos;
}
-
+
protected void finalizeFieldReadChain(ArrayList newFieldInfos)
{
for (int i = 0; i < newFieldInfos.size(); i++)
@@ -288,7 +288,7 @@
}
}
-
+
protected void finalizeConstructorChain(ArrayList newConstructorInfos)
{
for (int i = 0; i < newConstructorInfos.size(); i++)
@@ -307,14 +307,14 @@
ConstructionJoinPointGenerator generator = getJoinPointGenerator(info);
finalizeChainAndRebindJoinPoint(info, generator);
}
- }
+ }
protected void finalizeMethodCalledByMethodInterceptorChain(MethodByMethodInfo info)
{
MethodByMethodJoinPointGenerator generator = getJoinPointGenerator(info);
finalizeChainAndRebindJoinPoint(info, generator);
}
-
+
protected void finalizeConCalledByMethodInterceptorChain(ConByMethodInfo info)
{
ConByMethodJoinPointGenerator generator = getJoinPointGenerator(info);
@@ -330,16 +330,16 @@
protected void finalizeMethodCalledByConInterceptorChain(MethodByConInfo info)
{
- //An extra level of indirection since we distinguish between callers of method depending on
+ //An extra level of indirection since we distinguish between callers of method depending on
//where the called method is defined (sub/super interfaces)
- ConcurrentReaderHashMap map = (ConcurrentReaderHashMap)methodByConJoinPoinGenerators.get(info.getJoinpoint());
+ ConcurrentReaderHashMap map = (ConcurrentReaderHashMap)methodByConJoinPoinGenerators.get(info.getJoinpoint());
if (map == null)
{
map = new ConcurrentReaderHashMap();
methodByConJoinPoinGenerators.put(info.getJoinpoint(), map);
map = (ConcurrentReaderHashMap)methodByConJoinPoinGenerators.get(info.getJoinpoint());
}
-
+
MethodByConJoinPointGenerator generator = getJoinPointGenerator(info);
finalizeChainAndRebindJoinPoint(info, generator);
}
@@ -354,7 +354,7 @@
}
return generator;
}
-
+
protected FieldJoinPointGenerator getJoinPointGenerator(FieldInfo info)
{
if (info.isRead())
@@ -378,12 +378,12 @@
return generator;
}
}
-
+
protected void test123()
{
-
+
}
-
+
protected ConstructorJoinPointGenerator getJoinPointGenerator(ConstructorInfo info)
{
ConstructorJoinPointGenerator generator = (ConstructorJoinPointGenerator)constructorJoinPoinGenerators.get(info.getJoinpoint());
@@ -394,7 +394,7 @@
}
return generator;
}
-
+
protected ConstructionJoinPointGenerator getJoinPointGenerator(ConstructionInfo info)
{
ConstructionJoinPointGenerator generator = (ConstructionJoinPointGenerator)constructionJoinPoinGenerators.get(info.getJoinpoint());
@@ -405,19 +405,19 @@
}
return generator;
}
-
+
protected MethodByMethodJoinPointGenerator getJoinPointGenerator(MethodByMethodInfo info)
{
- //An extra level of indirection since we distinguish between callers of method depending on
+ //An extra level of indirection since we distinguish between callers of method depending on
//where the called method is defined (sub/super interfaces)
- ConcurrentReaderHashMap map = (ConcurrentReaderHashMap)methodByMethodJoinPoinGenerators.get(info.getJoinpoint());
+ ConcurrentReaderHashMap map = (ConcurrentReaderHashMap)methodByMethodJoinPoinGenerators.get(info.getJoinpoint());
if (map == null)
{
map = new ConcurrentReaderHashMap();
methodByMethodJoinPoinGenerators.put(info.getJoinpoint(), map);
map = (ConcurrentReaderHashMap)methodByMethodJoinPoinGenerators.get(info.getJoinpoint());
}
-
+
MethodByMethodJoinPointGenerator generator = (MethodByMethodJoinPointGenerator)map.get(info.getCalledClass());
if (generator == null)
{
@@ -427,7 +427,7 @@
}
return generator;
}
-
+
protected ConByMethodJoinPointGenerator getJoinPointGenerator(ConByMethodInfo info)
{
ConByMethodJoinPointGenerator generator = (ConByMethodJoinPointGenerator)conByMethodJoinPoinGenerators.get(info.getJoinpoint());
@@ -438,7 +438,7 @@
}
return generator;
}
-
+
protected ConByConJoinPointGenerator getJoinPointGenerator(ConByConInfo info)
{
ConByConJoinPointGenerator generator = (ConByConJoinPointGenerator)conByConJoinPoinGenerators.get(info.getJoinpoint());
@@ -449,19 +449,19 @@
}
return generator;
}
-
+
protected MethodByConJoinPointGenerator getJoinPointGenerator(MethodByConInfo info)
{
- //An extra level of indirection since we distinguish between callers of method depending on
+ //An extra level of indirection since we distinguish between callers of method depending on
//where the called method is defined (sub/super interfaces)
- ConcurrentReaderHashMap map = (ConcurrentReaderHashMap)methodByConJoinPoinGenerators.get(info.getJoinpoint());
+ ConcurrentReaderHashMap map = (ConcurrentReaderHashMap)methodByConJoinPoinGenerators.get(info.getJoinpoint());
if (map == null)
{
map = new ConcurrentReaderHashMap();
methodByConJoinPoinGenerators.put(info.getJoinpoint(), map);
map = (ConcurrentReaderHashMap)methodByConJoinPoinGenerators.get(info.getJoinpoint());
}
-
+
MethodByConJoinPointGenerator generator = (MethodByConJoinPointGenerator)map.get(info.getCalledClass());
if (generator == null)
{
@@ -496,7 +496,7 @@
curr.add(new GeneratedAdvisorInterceptor(factories[i], this, joinpoint));
}
}
- }
+ }
private void finalizeChainAndRebindJoinPoint(JoinPointInfo info, JoinPointGenerator generator)
{
@@ -510,12 +510,12 @@
generator.rebindJoinpoint(info);
}
-
+
public String toString()
{
Class clazz = this.getClass();
StringBuffer sb = new StringBuffer("CLASS: " + clazz.getName());
-
+
Field[] fields = clazz.getFields();
for (int i = 0 ; i < fields.length ; i++)
{
@@ -523,7 +523,7 @@
}
return sb.toString();
}
-
+
GeneratedAdvisorInterceptor[] applyPrecedence(GeneratedAdvisorInterceptor[] interceptors)
{
return PrecedenceSorter.applyPrecedence(interceptors, manager);
@@ -537,7 +537,7 @@
{
this.parent = parent;
}
-
+
/**
* Generated instance advisors will override this and return the parent class advisor
*/
@@ -545,21 +545,21 @@
{
return parent;
}
-
+
/**
- * If this is an instance advisor, will check with parent class advisor if the aspect
+ * If this is an instance advisor, will check with parent class advisor if the aspect
* is already registered. If so, we should use the one from the parent advisor
*/
public Object getPerClassAspect(AspectDefinition def)
{
ClassAdvisor parentAdvisor = getParentAdvisor();
-
+
if (parentAdvisor != null)
{
Object aspect = parentAdvisor.getPerClassAspect(def);
if (aspect != null) return aspect;
}
-
+
return super.getPerClassAspect(def);
}
@@ -568,9 +568,9 @@
* so keep track of what per_class_joinpoint aspects have been added where
*/
ConcurrentReaderHashMap perClassJoinpointAspectDefinitions = new ConcurrentReaderHashMap();
-
+
/**
- * If this is an instance advisor, will check with parent class advisor if the aspect
+ * If this is an instance advisor, will check with parent class advisor if the aspect
* is already registered. If so, we should use the one from the parent advisor
*/
public Object getPerClassJoinpointAspect(AspectDefinition def, Joinpoint joinpoint)
@@ -582,7 +582,7 @@
Object aspect = parentAdvisor.getPerClassJoinpointAspect(def, joinpoint);
if (aspect != null)return aspect;
}
-
+
Map joinpoints = (Map) perClassJoinpointAspectDefinitions.get(def);
if (joinpoints != null)
{
@@ -590,7 +590,7 @@
}
return null;
}
-
+
public synchronized void addPerClassJoinpointAspect(AspectDefinition def, Joinpoint joinpoint)
{
Map joinpoints = (Map)perClassJoinpointAspectDefinitions.get(def);
@@ -599,7 +599,7 @@
joinpoints = new ConcurrentReaderHashMap();
perClassJoinpointAspectDefinitions.put(def, joinpoints);
}
-
+
if (joinpoints.get(joinpoint) == null)
{
joinpoints.put(joinpoint, def.getFactory().createPerJoinpoint(this, joinpoint));
@@ -607,7 +607,7 @@
}
/**
- * @see Advisor#chainOverridingForInheritedMethods()
+ * @see Advisor#chainOverridingForInheritedMethods()
*/
public boolean chainOverridingForInheritedMethods()
{
Modified: trunk/aop/src/main/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/SuperClassesFirstWeavingStrategy.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/SuperClassesFirstWeavingStrategy.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -29,6 +29,7 @@
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import javassist.ByteArrayClassPath;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
@@ -44,7 +45,7 @@
private boolean verbose = AspectManager.verbose;
public static final String AOP_PACKAGE = Advised.class.getPackage().getName();
-
+
public byte[] translate(AspectManager manager, String className, ClassLoader loader, byte[] classfileBuffer) throws Exception
{
if (isReEntry())
@@ -59,11 +60,11 @@
{
return null;
}
-
+
AOPClassPool pool = (AOPClassPool) manager.registerClassLoader(loader);
CtClassTransformationInfo info = obtainCtClassInfo(pool, className, classfileBuffer);
- CtClass clazz = instrumentClass(manager, loader, pool, info, true);
+ CtClass clazz = instrumentClass(manager, pool, info, true);
if (clazz != null)
{
pool.lockInCache(info.getClazz());
@@ -100,16 +101,8 @@
}
}
- private Map instrumentedClassCache = new ConcurrentReaderHashMap();
-
private CtClassTransformationInfo obtainCtClassInfo(AOPClassPool pool, String className, byte[] classfileBuffer) throws NotFoundException
{
- CtClassTransformationInfo cachedInfo = (CtClassTransformationInfo)instrumentedClassCache.get(className);
- if (cachedInfo != null)
- {
- return cachedInfo;
- }
-
try
{
return new CtClassTransformationInfo(pool.getLocally(className), className);
@@ -128,98 +121,90 @@
}
}
- private CtClass instrumentClass(AspectManager manager, ClassLoader loader, AOPClassPool pool, CtClassTransformationInfo info, boolean isLoadedClass) throws NotFoundException, Exception
+ private CtClass instrumentClass(AspectManager manager, AOPClassPool pool, CtClassTransformationInfo info, boolean isLoadedClass) throws NotFoundException, Exception
{
try
{
CtClass superClass = info.getClazz().getSuperclass();
if (superClass != null && !Instrumentor.implementsAdvised(info.getClazz()))
{
- CtClassTransformationInfo superCached = (CtClassTransformationInfo)instrumentedClassCache.get(superClass.getName());
- if (superCached == null)
- {
- superCached = new CtClassTransformationInfo(superClass, superClass.getName());
- }
+ CtClassTransformationInfo superInfo = new CtClassTransformationInfo(superClass, superClass.getName());
- instrumentClass(manager, loader, pool, superCached, false);
+ ClassPool superPool = superClass.getClassPool();
+ if (superPool instanceof AOPClassPool)
+ {
+ AspectManager aspectManager = manager;
+ if (manager instanceof Domain && superPool != pool)
+ {
+ //We are in a scoped classloader and the superclass is not
+ aspectManager = AspectManager.instance(superPool.getClassLoader());
+ }
+ instrumentClass(aspectManager, (AOPClassPool)superPool, superInfo, false);
+ }
+ }
+ if (manager.isNonAdvisableClassName(info.getClassName()))
+ {
+ return null;
}
- if (instrumentedClassCache.get(info.getClassName()) != null)
+ if (info.getClass().isArray())
{
- if (isLoadedClass && info.isTransformed())
- {
- return info.getClazz();
- }
+ if (verbose) System.out.println("[cannot compile] isArray: " + info.getClassName());
+ pool.flushClass(info.getClassName());
+ return null;
}
- else
+ if (info.getClazz().isInterface())
{
- if (manager.isNonAdvisableClassName(info.getClassName()))
- {
+ if (verbose) System.out.println("[cannot compile] isInterface: " + info.getClassName());
+ //pool.flushClass(info.getClassName());
+ info.getClazz().prune();
+ return null;
+ }
+ if (info.getClazz().isFrozen())
+ {
+ if(isAdvised(pool, info.getClazz()))
return null;
+ if (verbose) System.out.println("[warning] isFrozen: " + info.getClassName() + " " + info.getClazz().getClassPool());
+ if (!isLoadedClass)
+ {
+ info = obtainCtClassInfo(pool, info.getClassName(), null);
}
+ else
+ return null;
+ //info.getClazz().defrost();
+ }
- if (info.getClass().isArray())
+ boolean transformed = info.getClazz().isModified();
+ if (!transformed)
+ {
+ ClassAdvisor advisor =
+ AdvisorFactory.getClassAdvisor(info.getClazz(), manager);
+ Instrumentor instrumentor = InstrumentorFactory.getInstrumentor(
+ pool,
+ manager,
+ manager.dynamicStrategy.getJoinpointClassifier(),
+ manager.dynamicStrategy.getDynamicTransformationObserver(info.getClazz()));
+
+ if (!Instrumentor.isTransformable(info.getClazz()))
{
- if (verbose) System.out.println("[cannot compile] isArray: " + info.getClassName());
- pool.flushClass(info.getClassName());
- return null;
- }
- if (info.getClazz().isInterface())
- {
- if (verbose) System.out.println("[cannot compile] isInterface: " + info.getClassName());
+ if (verbose) System.out.println("[cannot compile] implements Untransformable: " + info.getClassName());
+ //Flushing the generated invocation classes breaks things further down the line
//pool.flushClass(info.getClassName());
- info.getClazz().prune();
return null;
}
- if (info.getClazz().isFrozen())
- {
- if(isAdvised(pool, info.getClazz()))
- return null;
- if (verbose) System.out.println("[warning] isFrozen: " + info.getClassName());
- if (!isLoadedClass)
- {
- info = obtainCtClassInfo(pool, info.getClassName(), null);
- }
- else
- return null;
- //info.getClazz().defrost();
- }
- boolean transformed = info.getClazz().isModified();
- if (!transformed)
- {
- ClassAdvisor advisor =
- AdvisorFactory.getClassAdvisor(info.getClazz(), manager);
- Instrumentor instrumentor = InstrumentorFactory.getInstrumentor(
- pool,
- manager,
- manager.dynamicStrategy.getJoinpointClassifier(),
- manager.dynamicStrategy.getDynamicTransformationObserver(info.getClazz()));
-
- if (!Instrumentor.isTransformable(info.getClazz()))
- {
- if (verbose) System.out.println("[cannot compile] implements Untransformable: " + info.getClassName());
- //Flushing the generated invocation classes breaks things further down the line
- //pool.flushClass(info.getClassName());
- return null;
- }
-
- manager.attachMetaData(advisor, info.getClazz(), true);
- manager.applyInterfaceIntroductions(advisor, info.getClazz());
- transformed = instrumentor.transform(info.getClazz(), advisor);
- }
- if (transformed)
+ manager.attachMetaData(advisor, info.getClazz(), true);
+ manager.applyInterfaceIntroductions(advisor, info.getClazz());
+ transformed = instrumentor.transform(info.getClazz(), advisor);
+ }
+ if (transformed)
+ {
+ if (!isLoadedClass )
{
- if (!isLoadedClass )
- {
- info.setTransformed(transformed);
- //System.out.println("CACHING: "+info.getClassName());
- //TODO: atm caching isnt impl. will be asap...
- //instrumentedClassCache.put(info.getClassName(), info);
- }
- return info.getClazz();
+ info.setTransformed(transformed);
}
+ return info.getClazz();
}
return null;
}
@@ -232,7 +217,7 @@
}
}
- public boolean isAdvised(AOPClassPool pool, CtClass clazz) throws NotFoundException
+ public boolean isAdvised(ClassPool pool, CtClass clazz) throws NotFoundException
{
CtClass[] interfaces = clazz.getInterfaces();
CtClass advised = pool.get(AOP_PACKAGE + ".Advised");
Modified: trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoader.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoader.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoader.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -31,4 +31,7 @@
public interface AspectFactoryWithClassLoader
{
public void setClassLoader(ClassLoader cl);
+ public void pushScopedClassLoader(ClassLoader scopedCl);
+ public void popScopedClassLoader();
+ public ClassLoader peekScopedClassLoader();
}
Modified: trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/advice/AspectFactoryWithClassLoaderSupport.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -34,6 +34,9 @@
{
private WeakReference loader;
+ /** If a scoped classloader with no parent delegation redefines the class, we need to make sure that that class is pushed on the stack */
+ private ThreadLocal scopedClassLoader = new ThreadLocal();
+
protected AspectFactoryWithClassLoaderSupport()
{
}
@@ -45,12 +48,32 @@
protected ClassLoader getLoader()
{
+ ClassLoader scopedClassLoader = peekScopedClassLoader();
+ if (scopedClassLoader != null)
+ {
+ return scopedClassLoader;
+ }
if (loader != null)
{
return (ClassLoader)loader.get();
}
return null;
}
+
+ public void pushScopedClassLoader(ClassLoader scopedCl)
+ {
+ scopedClassLoader.set(scopedCl);
+ }
+
+ public void popScopedClassLoader()
+ {
+ scopedClassLoader.set(null);
+ }
+
+ public ClassLoader peekScopedClassLoader()
+ {
+ return (ClassLoader)scopedClassLoader.get();
+ }
protected Class loadClass(String name) throws ClassNotFoundException
{
Modified: trunk/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/advice/GenericAspectFactory.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -37,8 +37,8 @@
import org.w3c.dom.NodeList;
/**
- *
- *
+ *
+ *
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision$
*/
@@ -48,7 +48,6 @@
final static Class[] INSTANCE_ADVISOR_INJECTOR_SIGNATURE = new Class[]{InstanceAdvisor.class};
final static Class[] JOINPOINT_INJECTOR_SIGNATURE = new Class[]{Joinpoint.class};
- private Class clazz = null;
private String classname;
private Element element;
@@ -68,11 +67,6 @@
}
- public void setClazz(Class clazz)
- {
- this.clazz = clazz;
- }
-
public String getClassname()
{
return classname;
@@ -100,21 +94,14 @@
public Class getClazz()
{
- synchronized (this)
+ try
{
- if (clazz == null)
- {
- try
- {
- clazz = loadClass(classname);
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException(e);
- }
- }
+ return loadClass(classname);
}
- return clazz;
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
}
public Object createPerVM()
@@ -198,7 +185,7 @@
BeanInfo beanInfo = null;
try
{
- beanInfo = Introspector.getBeanInfo(clazz);
+ beanInfo = Introspector.getBeanInfo(instance.getClass());
}
catch (IntrospectionException e)
{
@@ -290,7 +277,7 @@
{
if (AspectManager.verbose)
{
- System.out.println("WARN: Ignoring attempt to set advisor attribute on PER_VM scoped aspect/interceptor: " + classname);
+ System.out.println("[warn] Ignoring attempt to set advisor attribute on PER_VM scoped aspect/interceptor: " + classname);
}
return;
}
@@ -298,7 +285,7 @@
String injector = getInjectorName(attributeName);
try
{
- Method m = clazz.getMethod(injector, ADVISOR_INJECTOR_SIGNATURE);
+ Method m = instance.getClass().getMethod(injector, ADVISOR_INJECTOR_SIGNATURE);
m.invoke(instance, new Object[]{advisor});
}
catch (Exception e)
@@ -313,7 +300,7 @@
{
if (AspectManager.verbose)
{
- System.out.println("WARN: Ignoring attempt to set joinpoint attribute on aspect/interceptor: " + classname + " which is not scoped PER_JOINPOINT");
+ System.out.println("[warn] Ignoring attempt to set joinpoint attribute on aspect/interceptor: " + classname + " which is not scoped PER_JOINPOINT");
}
return;
}
@@ -321,7 +308,7 @@
String injector = getInjectorName(attributeName);
try
{
- Method m = clazz.getMethod(injector, JOINPOINT_INJECTOR_SIGNATURE);
+ Method m = instance.getClass().getMethod(injector, JOINPOINT_INJECTOR_SIGNATURE);
m.invoke(instance, new Object[]{jp});
}
catch (Exception e)
@@ -336,7 +323,7 @@
{
if (AspectManager.verbose)
{
- System.out.println("WARN: Ignoring attempt to set instance advisor attribute on aspect/interceptor: " + classname + " which is not scoped PER_INSTANCE or PER_JOINPOINT");
+ System.out.println("[warn] Ignoring attempt to set instance advisor attribute on aspect/interceptor: " + classname + " which is not scoped PER_INSTANCE or PER_JOINPOINT");
}
return;
}
@@ -344,7 +331,7 @@
String injector = getInjectorName(attributeName);
try
{
- Method m = clazz.getMethod(injector, INSTANCE_ADVISOR_INJECTOR_SIGNATURE);
+ Method m = instance.getClass().getMethod(injector, INSTANCE_ADVISOR_INJECTOR_SIGNATURE);
m.invoke(instance, new Object[]{instanceAdvisor});
}
catch (Exception e)
Modified: trunk/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/annotation/compiler/AnnotationInfoCreator.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -76,11 +76,6 @@
MemberValue mv = base.getMemberValue(name);
if (mv == null)
{
- Iterator it = base.getMemberNames().iterator();
- while (it.hasNext())
- {
- System.out.println(it.next());
- }
throw new RuntimeException("member value is null for created annotation: " + base.getTypeName() + " for name: " + name);
}
node.getValue().jjtAccept(this, mv);
Modified: trunk/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/classpool/AOPClassPool.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -77,7 +77,7 @@
AOPClassPoolRepository.getInstance().perfomUnregisterClassLoader(getClassLoader());
}
- protected CtClass getCached(String classname)
+ public CtClass getCached(String classname)
{
CtClass clazz = getCachedLocally(classname);
if (clazz == null)
@@ -87,7 +87,7 @@
ClassLoader cl = null;
try
{
- cl = getClassLoader();
+ cl = getClassLoader0();
}
catch (RuntimeException e)
{
@@ -95,8 +95,8 @@
}
if (cl != null)
{
- String classReeourceName = getResourceName(classname);
- isLocal = isLocalResource(classReeourceName);
+ String classResourceName = getResourceName(classname);
+ isLocal = isLocalResource(classResourceName);
}
if (!isLocal)
@@ -116,6 +116,12 @@
AspectManager.instance().unregisterClassLoader(pool.getClassLoader());
continue;
}
+
+ //Do not check classpools for scoped classloaders
+ if (pool.getClass().getName().equals("org.jboss.aop.deployment.ScopedJBossClassPool"))
+ {
+ continue;
+ }
clazz = pool.getCachedLocally(classname);
if (clazz != null)
Modified: trunk/aop/src/main/org/jboss/aop/classpool/AOPScopedClassLoaderHelper.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/classpool/AOPScopedClassLoaderHelper.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/classpool/AOPScopedClassLoaderHelper.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -21,6 +21,9 @@
*/
package org.jboss.aop.classpool;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+
/**
* Helper to determine if we are running within a scoped classloader.
*
@@ -32,4 +35,5 @@
ClassLoader ifScopedDeploymentGetScopedParentUclForCL(ClassLoader loader);
ClassLoader getTopLevelJBossClassLoader();
+ Domain getScopedClassLoaderDomain(ClassLoader cl, AspectManager parent);
}
Modified: trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -40,7 +40,6 @@
import org.jboss.aop.MethodByMethodInfo;
import org.jboss.aop.MethodInfo;
import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.util.JavassistToReflect;
/**
* Comment
@@ -52,29 +51,34 @@
{
//field names in advised class
private static final String CURRENT_ADVISOR = "currentAdvisor$aop";
- public static final String INSTANCE_ADVISOR = "instanceAdvisor$aop";
+ private static final String INSTANCE_ADVISOR = "instanceAdvisor$aop";
private static final String GET_CURRENT_ADVISOR_NAME = "getCurrentAdvisor$aop";
public static final String GET_CURRENT_ADVISOR = GET_CURRENT_ADVISOR_NAME + "()";
//field names in advisor
- public static final String ADVISED_CLASS = "advisedClass";
- public static final String DOMAIN = "domain";
- public static final String VERSION = "version";
- public static final String CHECK_VERSION = "checkVersion";
- public static final String ADVICES_UPDATED = "advicesUpdated";
- public static final String INSTANCE_ADVISOR_MIXIN = "instanceAdvisorMixin";
- public static final String CREATE_INSTANCE_ADVISOR = "createInstanceAdvisor";
- public static final String INITIALISE_CALLERS = "initialiseCallers";
- public static final String INITIALISE_FIELD_WRITES = "initialiseFieldWrites";
- public static final String INITIALISE_FIELD_READS = "initialiseFieldReads";
- public static final String INITIALISE_CONSTRUCTIONS = "initialiseConstructions";
- public static final String INITIALISE_CONSTRUCTORS = "initialiseConstructors";
- public static final String INITIALISE_METHODS = "initialiseMethods";
+// private static final String ADVISED_CLASS = "advisedClass";
+ private static final String DOMAIN = "domain";
+ private static final String VERSION = "version";
+ private static final String CHECK_VERSION = "checkVersion";
+ private static final String ADVICES_UPDATED = "advicesUpdated";
+ private static final String INSTANCE_ADVISOR_MIXIN = "instanceAdvisorMixin";
+
+ //method names in advisor or GeneratedClassAdvisor
+ private static final String CREATE_INSTANCE_ADVISOR = "createInstanceAdvisor";
+ private static final String INITIALISE_CALLERS = "initialiseCallers";
+ private static final String INITIALISE_FIELD_WRITES = "initialiseFieldWrites";
+ private static final String INITIALISE_FIELD_READS = "initialiseFieldReads";
+ private static final String INITIALISE_CONSTRUCTIONS = "initialiseConstructions";
+ private static final String INITIALISE_CONSTRUCTORS = "initialiseConstructors";
+ private static final String INITIALISE_METHODS = "initialiseMethods";
public static final String GET_CLASS_ADVISOR = "_getClassAdvisor";
- public static final CtClass[] EMPTY_EXCEPTIONS = new CtClass[0];
- public static final CtClass[] EMPTY_SIG = new CtClass[0];
+ private static final String ADVISED_CLASS = "this.getClass().getDeclaringClass()";
+
+ private static final CtClass[] EMPTY_EXCEPTIONS = new CtClass[0];
+ private static final CtClass[] EMPTY_SIG = new CtClass[0];
+
CtClass genadvisor;
CtClass genInstanceAdvisor;
@@ -183,7 +187,8 @@
//Only static nested classes are supported
final boolean classStatic = true;
genadvisor = TransformerCommon.makeNestedClass(clazz, innerClassName, classStatic);
- genadvisor.setModifiers(Modifier.setProtected(genadvisor.getModifiers()));
+ //The advisor needs to be public in case children are in a child/scoped ucl
+ //genadvisor.setModifiers(Modifier.setPublic(genadvisor.getModifiers()));
//Make super class Advisor
final CtClass superAdvisor = getSuperClassAdvisor(clazz.getSuperclass());
@@ -278,8 +283,6 @@
genadvisor);
genadvisor.addMethod(initialiseFieldReads);
-
-
CtMethod initialiseFieldWrites = CtNewMethod.make(
Modifier.PROTECTED,
CtClass.voidType,
@@ -301,17 +304,6 @@
genadvisor);
genadvisor.addMethod(initialiseCallers);
-
- CtField advisedClass = new CtField(
- forName(Class.class.getName()),
- ADVISED_CLASS,
- genadvisor);
- advisedClass.setModifiers(Modifier.STATIC | Modifier.PROTECTED);
- genadvisor.addField(
- advisedClass,
- CtField.Initializer.byExpr(JavassistToReflect.getClassObjectString(clazz))
- );
-
createAdvisorCtors(clazz);
return genadvisor;
@@ -324,10 +316,10 @@
//Only static nested classes are supported
final boolean classStatic = true;
genInstanceAdvisor = TransformerCommon.makeNestedClass(clazz, innerClassName, classStatic);
- genInstanceAdvisor.setModifiers(Modifier.setProtected(genInstanceAdvisor.getModifiers()));
+ //The advisor needs to be public in case children are in a child/scoped ucl
+ genInstanceAdvisor.setModifiers(Modifier.setPublic(genInstanceAdvisor.getModifiers()));
//Make super class Advisor
- final CtClass superAdvisor = getSuperClassAdvisor(clazz.getSuperclass());
genInstanceAdvisor.setSuperclass(getGenadvisor());
//Make Untransformable
@@ -387,7 +379,7 @@
protected void createAdvisorCtors(CtClass clazz)throws CannotCompileException, NotFoundException
{
- String initBody =
+ String initBody =
"{" +
" " + DOMAIN + "= new org.jboss.aop.GeneratedAdvisorDomain($1, " + ADVISED_CLASS + ", false); " +
" ((org.jboss.aop.Domain)" + DOMAIN + ").setInheritsBindings(true); " +
@@ -416,12 +408,12 @@
ctor.setBody(
"{" +
" super(\"" + clazz.getName() + "\"); " +
- " initialise(org.jboss.aop.AspectManager.instance());" +
+ " initialise(org.jboss.aop.AspectManager.instance(this.getClass().getClassLoader()));" + //Use the CL of the class, since we may be in a scoped loader
"}");
genadvisor.addConstructor(ctor);
//This is called by instance advisors
- String instanceBody =
+ String instanceBody =
"{" +
" super(\"" + clazz.getName() + "\"); " +
" super.setParentAdvisor($1);" +
@@ -445,7 +437,7 @@
{
if (isAdvised(superclass))
{
- return forName(getAdvisorFQN(superclass));
+ return forName(superclass.getClassPool(), getAdvisorFQN(superclass));
}
}
catch (NotFoundException e)
@@ -538,6 +530,7 @@
clazz);
classAdvisor.setModifiers(Modifier.PRIVATE | Modifier.STATIC | Modifier.TRANSIENT);
clazz.addField(classAdvisor, CtField.Initializer.byExpr("new " + getAdvisorFQN(clazz) + "()"));
+// clazz.addField(classAdvisor, CtField.Initializer.byExpr("this.getClass().getClassLoader().loadClass(" + getAdvisorFQN(clazz) + ").newInstance()"));
CtMethod getAdvisor = CtNewMethod.getter("_getAdvisor", classAdvisor);
getAdvisor.setModifiers(Modifier.PUBLIC);
@@ -705,6 +698,7 @@
}
}
+ boolean initialisedMethods = false;
protected void initaliseMethodInfo(String infoName, long hash, long unadvisedHash)throws NotFoundException
{
String code =
@@ -747,7 +741,7 @@
{
String code =
infoName + " = new " + ConstructorExecutionTransformer.CONSTRUCTOR_INFO_CLASS_NAME + "(" +
- GeneratedAdvisorInstrumentor.ADVISED_CLASS + ", " +
+ ADVISED_CLASS + ", " +
index + ", " +
wrapperHash + "L, " +
constructorHash + "L, this);" +
@@ -760,7 +754,7 @@
{
String code =
infoName + " = new " + ConstructionTransformer.CONSTRUCTION_INFO_CLASS_NAME + "(" +
- GeneratedAdvisorInstrumentor.ADVISED_CLASS + ", " +
+ ADVISED_CLASS + ", " +
index + ", " +
constructorHash + "L, this);" +
GeneratedClassAdvisor.ADD_CONSTRUCTION_INFO + "(" + infoName + ");";
Modified: trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/instrument/GeneratedAdvisorMethodExecutionTransformer.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -226,9 +226,7 @@
throw new RuntimeException("code was: " + code + " for method " + trans.getOriginalName());
}
}
-
-
-
+
protected static CtClass[] addTargetToParamsForNonStaticMethod(CtClass outer, CtMethod method)throws NotFoundException
{
CtClass[] params = method.getParameterTypes();
Modified: trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/instrument/Instrumentor.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -775,7 +775,15 @@
return this.classPool.get(name);
}
+ /**
+ * Gets a class by its name.
+ */
+ public CtClass forName(ClassPool pool, String name) throws NotFoundException
+ {
+ return pool.get(name);
+ }
+
/**
* Adds a static field to a class.
*/
Modified: trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -179,8 +179,8 @@
GeneratedClassInfo generatedClass = generateJoinpointClass(pool, info);
Class clazz = toClass(pool, generatedClass.getGenerated());
+ Object obj = instantiateClass(clazz, generatedClass.getAroundSetups());
- Object obj = instantiateClass(clazz, generatedClass.getAroundSetups());
joinpointField.set(advisor, obj);
}
catch (Throwable e)
@@ -355,16 +355,16 @@
field.setModifiers(Modifier.PRIVATE | Modifier.TRANSIENT);
clazz.addField(field);
+ String body = getAspectFieldGetterBody(setup);
CtMethod method = CtNewMethod.make(
aspectClass,
setup.getAspectInitialiserName(),
new CtClass[0],
new CtClass[0],
- getAspectFieldGetterBody(setup),
+ body,
clazz);
method.setModifiers(Modifier.PRIVATE);
clazz.addMethod(method);
-
}
private String getAspectFieldGetterBody(AdviceSetup setup)
Modified: trunk/aop/src/main/org/jboss/aop/instrument/JoinpointSimpleClassifier.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/JoinpointSimpleClassifier.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/instrument/JoinpointSimpleClassifier.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -46,7 +46,7 @@
*/
public class JoinpointSimpleClassifier extends JoinpointClassifier
{
-
+
/**
* Classifies the execution of a joinpoint. The joinpoint being classified
* is identified by <code>matcher</code>.
@@ -61,14 +61,14 @@
for (Iterator it = pointcuts.iterator(); it.hasNext(); )
{
Pointcut pointcut = (Pointcut) it.next();
-
- if (joinpointMatcher.matches(pointcut, advisor, member))
+
+ if (joinpointMatcher.matches(pointcut, advisor, member))
{
if (AspectManager.verbose)
{
System.out.println("[debug] " + member + " matches pointcut: " + pointcut.getExpr());
}
- return JoinpointClassification.WRAPPED;
+ return JoinpointClassification.WRAPPED;
}
}
if (AspectManager.verbose)
Modified: trunk/aop/src/main/org/jboss/aop/instrument/TransformerCommon.java
===================================================================
--- trunk/aop/src/main/org/jboss/aop/instrument/TransformerCommon.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/main/org/jboss/aop/instrument/TransformerCommon.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -135,7 +135,7 @@
public static Class toClass(CtClass newClass, ClassLoader loader) throws CannotCompileException
{
registerGeneratedClass(newClass);
-
+
if (System.getSecurityManager() == null)
{
return ToClassAction.NON_PRIVILEGED.toClass(newClass, loader);
@@ -158,7 +158,7 @@
addStrongReferenceInfoField(instrumentor, infoClassName, infoName, modifiers, addTo, init);
}
}
-
+
private static void registerGeneratedClass(CtClass newClass)
{
//TODO Maybe we should force a ScopedClassPool created by JBoss Retro to be an AOP classpool once AOP kicks in?
@@ -263,7 +263,7 @@
}
if (loader != null)
{
- return clazz.toClass(loader);
+ return clazz.toClass(loader, null);
}
return clazz.toClass();
}
@@ -291,7 +291,7 @@
}
if (loader != null)
{
- return clazz.toClass(loader);
+ return clazz.toClass(loader, null);
}
return clazz.toClass();
}
Added: trunk/aop/src/test/org/jboss/test/aop/extender/SuperCallAspect.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/extender/SuperCallAspect.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aop/src/test/org/jboss/test/aop/extender/SuperCallAspect.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.extender;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SuperCallAspect
+{
+ public static int interceptions = 0;
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ interceptions++;
+ return invocation.invokeNext();
+ }
+}
Modified: trunk/aspects/src/etc/ReadMe.txt
===================================================================
--- trunk/aspects/src/etc/ReadMe.txt 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aspects/src/etc/ReadMe.txt 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,3 @@
+If installing in a version before JBoss 4.0.4, you should leave javassist.jar and common-softvaluehashmap.jar in place in this folder.
+If installing in jboss 4.0.4 or later, the classes contained in javassist.jar and common-softvaluehashmap.jar will already be available,
+and you should delete these files to avoid versioning conflicts.
\ No newline at end of file
Modified: trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPool.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -23,6 +23,7 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.net.URL;
import java.security.ProtectionDomain;
import org.jboss.aop.classpool.AOPClassPool;
@@ -44,13 +45,15 @@
* Used for dynamically created classes (see loadClass(String, byte[]), ClassLoader)
*/
protected File tempdir = null;
+ protected URL tempURL = null;
// For loadClass tmpdir creation for UCL
protected final Object tmplock = new Object();
-
- protected JBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp)
+
+ protected JBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp, URL tmpURL)
{
super(cl, src, repository);
tempdir = tmp;
+ tempURL = tmpURL;
}
protected JBossClassPool(ClassPool src, ScopedClassPoolRepository repository)
@@ -129,7 +132,4 @@
return false;
}
-
-
-
}
Modified: trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPoolFactory.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPoolFactory.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/JBossClassPoolFactory.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -24,6 +24,8 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
+
+import org.jboss.aop.AspectManager;
import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.mx.loading.RepositoryClassLoader;
import javassist.ClassPool;
@@ -54,7 +56,13 @@
if (cl instanceof RepositoryClassLoader)
{
File tempdir = createTempDir(cl);
- return new JBossClassPool(cl, src, repository, tempdir);
+ URL tmpCP = createURLAndAddToLoader(cl, tempdir);
+ if (AspectManager.scopedCLHelper.ifScopedDeploymentGetScopedParentUclForCL(cl) != null)
+ {
+ //It is scoped
+ return new ScopedJBossClassPool(cl, src, repository, tempdir, tmpCP);
+ }
+ return new JBossClassPool(cl, src, repository, tempdir, tmpCP);
}
return new AOPClassPool(cl, src, repository);
}
@@ -75,12 +83,23 @@
tempdir.delete();
tempdir.mkdir();
tempdir.deleteOnExit();
- RepositoryClassLoader ucl = (RepositoryClassLoader) cl;
+
+ return tempdir;
+ }
+
+ private URL createURLAndAddToLoader(ClassLoader cl, File tempdir) throws IOException
+ {
URL tmpURL = tempdir.toURL();
URL tmpCP = new URL(tmpURL, "?dynamic=true");
+ RepositoryClassLoader ucl = (RepositoryClassLoader) cl;
+
// We may be undeploying.
- if (ucl.getLoaderRepository() != null) ucl.addURL(tmpCP);
- return tempdir;
+ if (ucl.getLoaderRepository() != null)
+ {
+ ucl.addURL(tmpCP);
+ }
+
+ return tmpCP;
}
}
Modified: trunk/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/JBossScopedClassLoaderHelper.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -21,11 +21,12 @@
*/
package org.jboss.aop.deployment;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
import org.jboss.aop.classpool.AOPScopedClassLoaderHelper;
import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
import org.jboss.mx.loading.LoaderRepository;
import org.jboss.mx.loading.RepositoryClassLoader;
-import org.jboss.system.server.NoAnnotationURLClassLoader;
/**
*
@@ -34,7 +35,6 @@
*/
public class JBossScopedClassLoaderHelper implements AOPScopedClassLoaderHelper
{
-
public ClassLoader ifScopedDeploymentGetScopedParentUclForCL(ClassLoader loader)
{
ClassLoader parent = loader;
@@ -70,6 +70,7 @@
}
return scoped;
}
+
public ClassLoader getTopLevelJBossClassLoader()
{
@@ -86,4 +87,15 @@
return topRcl;
}
+ public Domain getScopedClassLoaderDomain(ClassLoader cl, AspectManager parent)
+ {
+ boolean parentDelegation = true;
+ if (cl instanceof RepositoryClassLoader)
+ {
+ HeirarchicalLoaderRepository3 repository = (HeirarchicalLoaderRepository3)((RepositoryClassLoader)cl).getLoaderRepository();
+ parentDelegation = repository.getUseParentFirst();
+ }
+ return new ScopedClassLoaderDomain(cl, parentDelegation, parent, false);
+ }
+
}
Added: trunk/aspects/src/main/org/jboss/aop/deployment/LoaderRepositoryUrlUtil.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/LoaderRepositoryUrlUtil.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/LoaderRepositoryUrlUtil.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,175 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.deployment;
+
+import java.net.URL;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+
+import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
+import org.jboss.mx.loading.LoaderRepository;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LoaderRepositoryUrlUtil implements NotificationListener
+{
+ final static MBeanServer SERVER;
+ final static ObjectName MAIN_LOADER_REPOSITORY_OBJECT_NAME;
+ final static LoaderRepository MAIN_LOADER_REPOSITORY;
+ static
+ {
+ SERVER = MBeanServerLocator.locateJBoss();
+ try
+ {
+ MAIN_LOADER_REPOSITORY_OBJECT_NAME = new ObjectName("JMImplementation:name=Default,service=LoaderRepository");
+ MAIN_LOADER_REPOSITORY = (LoaderRepository)SERVER.invoke(MAIN_LOADER_REPOSITORY_OBJECT_NAME, "getInstance", new Object[0], new String[0]);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ long currentSequenceNumber;
+ long lastSequenceNumber = -1;
+ URL[] urls;
+
+ public LoaderRepositoryUrlUtil()
+ {
+ try
+ {
+ SERVER.addNotificationListener(MAIN_LOADER_REPOSITORY_OBJECT_NAME, this, null, null);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public synchronized void handleNotification(Notification notification, Object handback)
+ {
+ if (notification.getType().equals(LoaderRepository.CLASSLOADER_ADDED))
+ {
+ currentSequenceNumber = notification.getSequenceNumber();
+ }
+ else if (notification.getType().equals(LoaderRepository.CLASSLOADER_REMOVED))
+ {
+ currentSequenceNumber = notification.getSequenceNumber();
+ }
+ }
+
+ public synchronized UrlInfo getURLInfo(HeirarchicalLoaderRepository3 scopedLoader, UrlInfo urlInfo)
+ {
+ boolean changed = false;
+ if (lastSequenceNumber != currentSequenceNumber)
+ {
+ urls = MAIN_LOADER_REPOSITORY.getURLs();
+ lastSequenceNumber = currentSequenceNumber;
+ changed = true;
+ }
+ if (!changed)
+ {
+ changed = urlInfo != null && (urlInfo.getSequenceNumber() != lastSequenceNumber);
+ }
+ if (urlInfo == null || changed)
+ {
+ URL[] localUrls = getLocalUrls(scopedLoader, urls);
+ urlInfo = new UrlInfo(urls, localUrls, lastSequenceNumber);
+ }
+ return urlInfo;
+ }
+
+ public long getCurrentSequenceNumber()
+ {
+ return currentSequenceNumber;
+ }
+
+ private URL[] getLocalUrls(HeirarchicalLoaderRepository3 scopedRepository, URL[] globalUrls)
+ {
+ URL[] scopedRepositoryUrls = scopedRepository.getURLs();
+
+ //This is a bit of a hack, since this relies on the order of the urls returned by HeirarchicalLoaderRepository3
+ //My urls, followed by parent urls.
+ int scopedLength = 0;
+ for (int i = 0 ; i < scopedRepositoryUrls.length ; i++)
+ {
+ URL scopedUrl = scopedRepositoryUrls[i];
+ for (int j = 0 ; j < globalUrls.length ; j ++)
+ {
+ URL globalUrl = globalUrls[j];
+ if (scopedRepositoryUrls[i].equals(globalUrls[j]))
+ {
+ scopedLength = i;
+ break;
+ }
+ }
+ if (scopedLength > 0)
+ {
+ break;
+ }
+ }
+
+ URL[] localUrls = new URL[scopedLength];
+ System.arraycopy(scopedRepositoryUrls, 0, localUrls, 0, scopedLength);
+ return localUrls;
+ }
+
+ public class UrlInfo
+ {
+
+ URL[] globalUrls;
+ URL[] localUrls;
+ long sequenceNumber;
+
+ public UrlInfo(URL[] globalUrls, URL[] localUrls, long sequenceNumber)
+ {
+ super();
+ this.globalUrls = globalUrls;
+ this.localUrls = localUrls;
+ this.sequenceNumber = sequenceNumber;
+ }
+
+ public URL[] getGlobalUrls()
+ {
+ return globalUrls;
+ }
+
+ public URL[] getLocalUrls()
+ {
+ return localUrls;
+ }
+
+ public long getSequenceNumber()
+ {
+ return sequenceNumber;
+ }
+ }
+
+}
Added: trunk/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/ScopedClassLoaderDomain.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,152 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.deployment;
+
+import java.lang.ref.WeakReference;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
+import org.jboss.mx.loading.LoaderRepository;
+import org.jboss.mx.loading.RepositoryClassLoader;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+
+/**
+ * A domain that is used for scoped classloaders
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedClassLoaderDomain extends Domain
+{
+
+ WeakReference loader;
+ boolean parentDelegation;
+ ConcurrentReaderHashMap myPerVMAspects = new ConcurrentReaderHashMap();
+ ConcurrentReaderHashMap notMyPerVMAspects = new ConcurrentReaderHashMap();
+
+ public ScopedClassLoaderDomain(ClassLoader loader, boolean parentDelegation, AspectManager manager, boolean parentFirst)
+ {
+ // FIXME ScopedClassLoaderDomain constructor
+ super(manager, parentFirst);
+ this.loader = new WeakReference(loader);
+ this.parentDelegation = parentDelegation;
+ }
+
+ protected ClassLoader getClassLoader()
+ {
+ ClassLoader cl = (ClassLoader)loader.get();
+ if (cl != null)
+ {
+ return cl;
+ }
+ return null;
+ }
+
+ public Object getPerVMAspect(AspectDefinition def)
+ {
+ return getPerVMAspect(def.getName());
+ }
+
+ public Object getPerVMAspect(String def)
+ {
+ if (parentDelegation == true)
+ {
+ //We will alway be loading up the correct class
+ Object aspect = super.getPerVMAspect(def);
+ return aspect;
+ }
+ else
+ {
+ return getPerVmAspectWithNoParentDelegation(def);
+ }
+ }
+
+ private Object getPerVmAspectWithNoParentDelegation(String def)
+ {
+ Object aspect = myPerVMAspects.get(def);
+ if (aspect != null)
+ {
+ return aspect;
+ }
+
+ aspect = super.getPerVMAspect(def);
+ if (aspect != null)
+ {
+ LoaderRepository loadingRepository = getAspectRepository(aspect);
+ LoaderRepository myRepository = getScopedRepository();
+ if (loadingRepository == myRepository)
+ {
+ //The parent does not load this class
+ myPerVMAspects.put(def, aspect);
+ }
+ else
+ {
+ //The class has been loaded by a parent classloader, find out if we also have a copy
+ try
+ {
+ Class clazz = myRepository.loadClass(aspect.getClass().getName());
+ if (clazz == aspect.getClass())
+ {
+ notMyPerVMAspects.put(def, Boolean.TRUE);
+ }
+ else
+ {
+ //We have a different version of the class deployed
+ AspectDefinition aspectDefinition = getAspectDefinition(def);
+ aspect = createPerVmAspect(def, aspectDefinition, getClassLoader());
+ myPerVMAspects.put(def, aspect);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return aspect;
+ }
+
+ private LoaderRepository getAspectRepository(Object aspect)
+ {
+ ClassLoader cl = aspect.getClass().getClassLoader();
+ ClassLoader parent = cl;
+ while (parent != null)
+ {
+ if (parent instanceof RepositoryClassLoader)
+ {
+ return ((RepositoryClassLoader)parent).getLoaderRepository();
+ }
+ parent = parent.getParent();
+ }
+ return null;
+ }
+
+ private HeirarchicalLoaderRepository3 getScopedRepository()
+ {
+ HeirarchicalLoaderRepository3 myRepository = (HeirarchicalLoaderRepository3)((RepositoryClassLoader)getClassLoader()).getLoaderRepository();
+ return myRepository;
+ }
+}
Added: trunk/aspects/src/main/org/jboss/aop/deployment/ScopedJBossClassPool.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/ScopedJBossClassPool.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/ScopedJBossClassPool.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,205 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.deployment;
+
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.net.URL;
+import java.util.Iterator;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.classpool.AOPClassPool;
+import org.jboss.aop.classpool.AOPClassPoolRepository;
+import org.jboss.aop.deployment.LoaderRepositoryUrlUtil.UrlInfo;
+import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
+import org.jboss.mx.loading.LoaderRepository;
+import org.jboss.mx.loading.RepositoryClassLoader;
+
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.NotFoundException;
+import javassist.scopedpool.ScopedClassPoolRepository;
+
+/**
+ * A classpool in JBoss backed by a scoped (HierarchicalLoaderRepository) loader repository
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedJBossClassPool extends JBossClassPool
+{
+ final static LoaderRepositoryUrlUtil LOADER_REPOSITORY_UTIL = new LoaderRepositoryUrlUtil();
+
+ WeakReference repository = null;
+ UrlInfo urlInfo;
+
+ protected ScopedJBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp, URL tmpURL)
+ {
+ super(cl, src, repository, tmp, tmpURL);
+
+ boolean parentFirst = false;
+ LoaderRepository loaderRepository = null;
+ ClassLoader prnt = cl;
+ while (prnt != null)
+ {
+ if (prnt instanceof RepositoryClassLoader)
+ {
+ loaderRepository = ((RepositoryClassLoader)prnt).getLoaderRepository();
+ if (loaderRepository instanceof HeirarchicalLoaderRepository3)
+ {
+ parentFirst = ((HeirarchicalLoaderRepository3)loaderRepository).getUseParentFirst();
+ }
+ break;
+ }
+ prnt = cl.getParent();
+ }
+
+ super.childFirstLookup = !parentFirst;
+ }
+
+
+ private HeirarchicalLoaderRepository3 getRepository()
+ {
+ ClassLoader cl = getClassLoader0();
+ if (cl != null)
+ {
+ return (HeirarchicalLoaderRepository3)((RepositoryClassLoader)cl).getLoaderRepository();
+ }
+ return null;
+ }
+
+ private URL getResourceUrlForClass(String resourcename)
+ {
+ HeirarchicalLoaderRepository3 repo = getRepository();
+ return repo.getResource(resourcename, super.getClassLoader());
+ }
+
+ private boolean isMine(URL url)
+ {
+ HeirarchicalLoaderRepository3 repo = getRepository();
+ if (repo != null)
+ {
+ //The URL of the class loaded with my scoped classloader
+ if (url != null)
+ {
+ urlInfo = LOADER_REPOSITORY_UTIL.getURLInfo(getRepository(), urlInfo);
+
+ URL[] myUrls = urlInfo.getLocalUrls();
+ String resource = url.toString();
+ for (int i = 0 ; i < myUrls.length ; i++)
+ {
+ if (resource.indexOf(myUrls[i].toString()) >= 0)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public CtClass getCached(String classname)
+ {
+ if (classname == null)
+ {
+ return null;
+ }
+
+ if (generatedClasses.get(classname) != null)
+ {
+ //It is a new class, and this callback is probably coming from the frozen check when creating a new nested class
+ return super.getCached(classname);
+ }
+
+ //Is this from the scoped classloader itself of from the parent?
+ String resourcename = getResourceName(classname);
+ URL url = getResourceUrlForClass(resourcename);
+ boolean isMine = isMine(url);
+
+ if (isMine)
+ {
+ if (super.childFirstLookup)
+ {
+ //Parent delegation is false, attempt to get this class out of ourselves
+ CtClass clazz = super.getCachedLocally(classname);
+ if (clazz == null)
+ {
+ clazz = createCtClass(classname, false);
+ if (clazz != null)
+ {
+ lockInCache(clazz);
+ }
+ }
+ if (clazz != null)
+ {
+ return clazz;
+ }
+ }
+ return super.getCached(classname);
+ }
+
+
+ try
+ {
+ ClassPool pool = getCorrectPoolForResource(url);
+ return pool.get(classname);
+ }
+ catch (NotFoundException e)
+ {
+ }
+ return null;
+ }
+
+ private ClassPool getCorrectPoolForResource(URL url)
+ {
+ synchronized(AspectManager.getRegisteredCLs())
+ {
+ for(Iterator it = AspectManager.getRegisteredCLs().values().iterator() ; it.hasNext() ; )
+ {
+ AOPClassPool candidate = (AOPClassPool)it.next();
+ if (candidate.isUnloadedClassLoader())
+ {
+ AspectManager.instance().unregisterClassLoader(candidate.getClassLoader());
+ continue;
+ }
+
+ if (candidate.getClassLoader() instanceof RepositoryClassLoader)
+ {
+ //Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
+ RepositoryClassLoader rcl = (RepositoryClassLoader)candidate.getClassLoader();
+ URL[] urls = rcl.getClasspath();
+ String resource = url.toString();
+ for (int i = 0 ; i < urls.length ; i++)
+ {
+ if (resource.indexOf(urls[i].toString()) >= 0)
+ {
+ return candidate;
+ }
+ }
+ }
+ }
+ }
+
+ return AOPClassPool.createAOPClassPool(ClassPool.getDefault(), AOPClassPoolRepository.getInstance());
+ }
+}
Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/build.xml 2006-09-12 18:25:59 UTC (rev 56777)
@@ -397,9 +397,9 @@
<exclude name="org/jboss/test/recover/oracle/**"/>
<exclude name="org/jboss/test/recover/derby/**"/>
<exclude name="org/jboss/test/aop/bean/Annotated*" if="HAVE_JDK_1.5"/>
- <exclude name="org/jboss/test/xml/JaxpXPathBaseTestCase*" if="HAVE_JDK_1.4"/>
+ <exclude name="org/jboss/test/xml/JaxpXPathBaseTestCase*" if="HAVE_JDK_1.4"/>
<exclude name="org/jboss/test/security/service/HttpsClient.java" if="IBM_JDK"/>
- <exclude name="org/jboss/test/security/test/HttpsUnitTestCase.java" if="IBM_JDK"/>
+ <exclude name="org/jboss/test/security/test/HttpsUnitTestCase.java" if="IBM_JDK"/>
<classpath refid="tests.classpath"/>
</javac>
</target>
@@ -592,7 +592,7 @@
</patternset>
<patternset id="one.test.includes">
<include name="${test}"/>
- </patternset>
+ </patternset>
<!-- The compatibility tests need extra memory -->
<patternset id="compatibility.includes">
<include name="org/jboss/test/compatibility/test/*TestCase.class"/>
@@ -619,7 +619,7 @@
<exclude name="org/jboss/test/*iiop/test/*"/>
</patternset>
<!-- A patternset that requires jboss to run with a JACC security manager -->
- <patternset id="jacc.includes">
+ <patternset id="jacc.includes">
<include name="**/test/jacc/test/*TestCase.class"/>
<include name="org/jboss/test/web/test/UserInRoleUnitTestCase.class" />
<include name="org/jboss/test/cmp2/audit/test/*TestCase.class" />
@@ -629,7 +629,7 @@
<include name="org/jboss/test/cmp2/perf/test/*TestCase.class" />
<include name="org/jboss/test/cmp2/relationship/*TestCase.class" />
<include name="org/jboss/test/cmp2/simple/SimpleUnitTestCase.class" />
- <include name="**/test/webservice/jbws309/*TestCase.class"/>
+ <include name="**/test/webservice/jbws309/*TestCase.class"/>
</patternset>
<patternset id="jacc.excludes">
<exclude name="**/test/jacc/test/*"/>
@@ -698,11 +698,11 @@
<exclude name="**/test/securitymgr/test/*"/>
</patternset>
<!-- Patternset for the JSR-196 based unit tests -->
- <patternset id="security.jaspi.includes">
+ <patternset id="security.jaspi.includes">
<include name="**/test/security/container/auth/**/*TestCase.class"/>
- <include name="**/test/security/managers/**/*TestCase.class"/>
- <include name="org/jboss/test/web/security/authorization/*TestCase.class"/>
- <include name="org/jboss/test/web/test/JASPIFormAuthUnitTestCase.class"/>
+ <include name="**/test/security/managers/**/*TestCase.class"/>
+ <include name="org/jboss/test/web/security/authorization/*TestCase.class"/>
+ <include name="org/jboss/test/web/test/JASPIFormAuthUnitTestCase.class"/>
</patternset>
<patternset id="stax.include">
<include name="org/jboss/test/stax/**/*TestCase.class"/>
@@ -768,12 +768,10 @@
<patternset id="aop-with-classloader.excludes">
<!-- Needs to be started either with the bootclasspath or -javaagent classloader hooks -->
- <exclude name="org/jboss/test/aop/test/ScopedUnitTestCase.class"/>
- <exclude name="org/jboss/test/aop/test/ScopedExtenderTestCase.class"/>
+ <exclude name="org/jboss/test/aop/test/Scoped*.class"/>
</patternset>
<patternset id="aop-with-classloader.includes">
- <include name="org/jboss/test/aop/test/ScopedUnitTestCase.class"/>
- <include name="org/jboss/test/aop/test/ScopedExtenderTestCase.class"/>
+ <include name="org/jboss/test/aop/test/Scoped*TestCase.class"/>
</patternset>
<!-- The union of the excludes -->
@@ -1139,7 +1137,7 @@
<propertyref prefix="javax.net.ssl"/>
</propertyset>
<run-junit junit.patternset="tc-ssl.includes"
- junit.configuration="tomcat-ssl-tests"
+ junit.configuration="tomcat-ssl-tests"
junit.syspropertyset="tomcat-ssl-tests-props" />
<server:stop name="tomcat-ssl"/>
@@ -1223,7 +1221,7 @@
<http-cluster-node-config-change conf="tomcat-sso-cluster0" useBuddyRepl="true"/>
<http-cluster-node-config-change conf="tomcat-sso-cluster1" useBuddyRepl="true"/>
-->
-
+
<server:start name="tomcat-sso-cluster0"/>
<server:start name="tomcat-sso-cluster1"/>
<echo message="Nodes have started, waiting for cluster to stablize..."/>
@@ -2384,17 +2382,17 @@
<server:stop name="jacc-securitymgr"/>
</target>
-
+
<!--
- | JSR196 Based Unit Tests
+ | JSR196 Based Unit Tests
-->
<target name="tests-security-jaspi-unit"
- description="Tests run against a jboss server with jaspi configured">
- <create-config baseconf="default" newconf="jaspi">
+ description="Tests run against a jboss server with jaspi configured">
+ <create-config baseconf="default" newconf="jaspi">
<patternset>
<include name="conf/**"/>
<include name="deploy/hsqldb-ds.xml"/>
- <include name="deploy/jbossweb*.sar/**"/>
+ <include name="deploy/jbossweb*.sar/**"/>
<include name="deploy/client-deployer-service.xml"/>
<include name="deploy/ear-deployer.xml"/>
<include name="deploy/ejb-deployer.xml"/>
@@ -2417,7 +2415,7 @@
<mkdir dir="${build.testlog}"/>
- <property name="jbosstest.secure" value="true"/>
+ <property name="jbosstest.secure" value="true"/>
<property name="java.security.auth.login.config"
value="${build.resources}/security/auth.conf"/>
<propertyset id="jacc-tests-props">
@@ -2975,7 +2973,7 @@
<server:stop name="webservice-ssl"/>
</target>
- <!--
+ <!--
| Standard jaxr tests that should run successfully against a
| JBoss server distribution build that contains jaxr.
-->
@@ -3063,7 +3061,7 @@
<copy todir="${jboss.dist}/bin" file="${jboss.aop.lib}/jdk14-pluggable-instrumentor.jar"/>
<server:start name="scoped-aop-jdk14"/>
- <run-junit junit.patternset="aop-with-classloader.includes"/>
+ <run-junit junit.patternset="aop-with-classloader.includes"/>
<server:stop name="scoped-aop-jdk14"/>
@@ -3506,7 +3504,7 @@
fork="${junit.batchtest.fork}"/>
</junit>
</target>
-
+
<target name="one-cluster-test" if="test">
<property name="jboss-junit-configuration" value="UDP"/>
Modified: trunk/testsuite/imports/sections/aop.xml
===================================================================
--- trunk/testsuite/imports/sections/aop.xml 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/imports/sections/aop.xml 2006-09-12 18:25:59 UTC (rev 56777)
@@ -307,8 +307,9 @@
</jar>
-
- <!-- jars for extender test -->
+ <!-- ************************ -->
+ <!-- jars for extender test -->
+ <!-- *********************** -->
<jar destfile="${build.lib}/aop-extendertest.aop">
<fileset dir="${build.classes}">
<include name="org/jboss/test/aop/extender/*.class"/>
@@ -330,53 +331,102 @@
</fileset>
</jar>
+
+ <!-- **************************** -->
<!-- jars for scopedextender test -->
- <jar destfile="${build.lib}/aop-scopedextendertest1.aop">
+ <!-- **************************** -->
+ <!-- Create aop and jar for base sar-->
+ <jar destfile="${build.lib}/aop-scopedextender-base.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/scopedextender/Base*.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TestUtil*.class"/>
+ <exclude name="org/jboss/test/aop/scopedextender/*Tester*.class"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build.lib}/aop-scopedextender-base.aop">
+ <fileset dir="${build.resources}/aop/scopedextender/base">
+ <include name="META-INF/jboss-aop.xml"/>
+ </fileset>
+ </jar>
+ <!-- Create aop and jar for child sar-->
+ <jar destfile="${build.lib}/aop-scopedextender-child.jar">
<fileset dir="${build.classes}">
- <include name="org/jboss/test/aop/scopedextender/*.class"/>
- <exclude name="org/jboss/test/aop/scopedextender/ScopedExtenderTester*.class"/>
- <exclude name="org/jboss/test/aop/scopedextender/Base.class"/>
- <exclude name="org/jboss/test/aop/scopedextender/Extender.class"/>
+ <include name="org/jboss/test/aop/scopedextender/Child*.class"/>
+ <include name="org/jboss/test/aop/scopedextender/ScopedChild*.class"/>
+ <exclude name="org/jboss/test/aop/scopedextender/*Tester*.class"/>
</fileset>
- <fileset dir="${build.resources}/aop/scopedextender/sar1">
+ </jar>
+ <jar destfile="${build.lib}/aop-scopedextender-child-parentdelegation.aop">
+ <fileset dir="${build.resources}/aop/scopedextender/child/parentdelegation">
<include name="META-INF/jboss-aop.xml"/>
</fileset>
</jar>
-
- <jar destfile="${build.lib}/aop-scopedextendertest1.sar">
+ <jar destfile="${build.lib}/aop-scopedextender-child-noparentdelegation.aop">
+ <fileset dir="${build.resources}/aop/scopedextender/child/noparentdelegation">
+ <include name="META-INF/jboss-aop.xml"/>
+ </fileset>
+ </jar>
+
+ <!-- Create base sar w/ base classes not loaded -->
+ <jar destfile="${build.lib}/aop-scopedextender-base-notloaded.sar">
<fileset dir="${build.lib}">
- <include name="aop-scopedextendertest1.aop"/>
+ <include name="aop-scopedextender-base.*"/>
</fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/test/aop/scopedextender/ScopedExtenderTester*.class"/>
+ <include name="org/jboss/test/aop/scopedextender/BaseNotLoadedTester*.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TesterMBean.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TestUtil.class"/>
</fileset>
- <fileset dir="${build.resources}/aop/scopedextender/sar1">
+ <fileset dir="${build.resources}/aop/scopedextender/base/notloaded">
<include name="META-INF/jboss-service.xml"/>
</fileset>
</jar>
-
- <jar destfile="${build.lib}/aop-scopedextendertest2.aop">
+ <!-- Create base sar w/ base classes loaded -->
+ <jar destfile="${build.lib}/aop-scopedextender-base-loaded.sar">
+ <fileset dir="${build.lib}">
+ <include name="aop-scopedextender-base.*"/>
+ </fileset>
<fileset dir="${build.classes}">
- <include name="org/jboss/test/aop/scopedextender/Base.class"/>
- <include name="org/jboss/test/aop/scopedextender/Extender.class"/>
+ <include name="org/jboss/test/aop/scopedextender/BaseLoadedTester*.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TesterMBean.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TestUtil.class"/>
</fileset>
- <fileset dir="${build.resources}/aop/scopedextender/sar2">
- <include name="META-INF/jboss-aop.xml"/>
- </fileset>
+ <fileset dir="${build.resources}/aop/scopedextender/base/loaded">
+ <include name="META-INF/jboss-service.xml"/>
+ </fileset>
</jar>
-
- <jar destfile="${build.lib}/aop-scopedextendertest2.sar">
- <fileset dir="${build.lib}">
- <include name="aop-scopedextendertest2.aop"/>
- </fileset>
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/aop/scopedextender/ScopedExtenderTester*.class"/>
- </fileset>
- <fileset dir="${build.resources}/aop/scopedextender/sar2">
- <include name="META-INF/jboss-service.xml"/>
- </fileset>
- </jar>
-
+ <!-- Create scoped child sar w/ parent delegation -->
+ <jar destfile="${build.lib}/aop-scopedextender-child-parentdelegation.sar">
+ <fileset dir="${build.lib}">
+ <include name="aop-scopedextender-child.jar"/>
+ <include name="aop-scopedextender-child-parentdelegation.aop"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester*.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TesterMBean.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TestUtil.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/aop/scopedextender/child/parentdelegation">
+ <include name="META-INF/jboss-service.xml"/>
+ </fileset>
+ </jar>
+ <!-- Create scoped child sar w/ no parent delegation -->
+ <jar destfile="${build.lib}/aop-scopedextender-child-noparentdelegation.sar">
+ <fileset dir="${build.lib}">
+ <include name="aop-scopedextender-base.jar"/>
+ <include name="aop-scopedextender-child.jar"/>
+ <include name="aop-scopedextender-child-noparentdelegation.aop"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester*.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TesterMBean.class"/>
+ <include name="org/jboss/test/aop/scopedextender/TestUtil.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/aop/scopedextender/child/noparentdelegation">
+ <include name="META-INF/jboss-service.xml"/>
+ </fileset>
+ </jar>
+
<!-- ok, we have created the loadtime jars, let us now precompile the classes for standalone test -->
<!--
<aopc compilerclasspathref="aop.task.classpath">
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseAspect.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+import java.util.ArrayList;
+
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BaseAspect
+{
+ public static ArrayList invoked = new ArrayList();
+
+ public Object invoke(MethodInvocation invocation) throws Throwable
+ {
+ invoked.add(invocation.getMethod().getName());
+ return invocation.invokeNext();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTester.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,126 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+import org.jboss.aop.Advised;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BaseLoadedTester implements BaseLoadedTesterMBean
+{
+ public void testLoaders() throws Exception
+ {
+ System.out.println("=============== BaseLoadedTester - LOADERS ================");
+ ClassLoader mine = this.getClass().getClassLoader();
+ ClassLoader base = Base_Base.class.getClassLoader();
+
+ if (mine != base)
+ {
+ throw new RuntimeException("ClassLoaders for me and Base_Base should be the same. Mine=" + mine + "; Base_Base=" + base);
+ }
+ }
+
+ public void testMethod() throws Exception
+ {
+ TestUtil testUtil = new TestUtil();
+ try
+ {
+ System.out.println("=============== BaseLoadedTester - METHOD ================");
+ Base_Base base = new Base_Base();
+
+ BaseAspect.invoked.clear();
+ base.base();
+ String m = "Base_Base.base";
+ testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+
+ BaseAspect.invoked.clear();
+ base.overridden();
+ m = "Base_Base.overridden";
+ testUtil.compare(m, "BaseAspect", new String[] {"overridden"}, BaseAspect.invoked);
+
+ Base_A1 a1 = new Base_A1();
+
+ BaseAspect.invoked.clear();
+ a1.a1();
+ m = "Base_A1.a1";
+ testUtil.compare(m, "BaseAspect", new String[]{"a1", "base"}, BaseAspect.invoked);
+
+ BaseAspect.invoked.clear();
+ a1.overridden();
+ m = "Base_A1.overridden";
+ testUtil.compare(m, "BaseAspect", new String[] {"overridden"}, BaseAspect.invoked);
+
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+
+ if (testUtil.getErrors() != null)
+ {
+ throw new RuntimeException(testUtil.getErrors());
+ }
+
+ if(Advised.class.isAssignableFrom(BaseNotBaseWoven.class))
+ {
+ throw new RuntimeException("BaseNotBaseWoven should not be woven");
+ }
+ }
+
+ public void testConstructor() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== BaseLoadedTester - CTOR ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ throw new Exception("Not yet implemented");
+ }
+
+ public void testField() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== BaseLoadedTester - FIELD ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ throw new Exception("Not yet implemented");
+ }
+
+ public String readName()
+ {
+ return "BaseLoadedTester";
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTesterMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTesterMBean.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseLoadedTesterMBean.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface BaseLoadedTesterMBean extends TesterMBean
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotBaseWoven.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BaseNotBaseWoven
+{
+ public void notWovenInBase()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTester.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTester.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,80 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BaseNotLoadedTester implements BaseNotLoadedTesterMBean
+{
+ public void testLoaders() throws Exception
+ {
+ System.out.println("=============== BaseNotLoadedTester - LOADERS ================");
+ }
+
+ public void testMethod() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== BaseNotLoadedTester - METHOD ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void testConstructor() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== BaseNotLoadedTester - METHOD ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void testField() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== BaseNotLoadedTester - METHOD ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String readName()
+ {
+ return "BaseNotLoadedTester";
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTesterMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTesterMBean.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseNotLoadedTesterMBean.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface BaseNotLoadedTesterMBean extends TesterMBean
+{
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/BaseParentAspect.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+import java.util.ArrayList;
+
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BaseParentAspect
+{
+ public static ArrayList invoked = new ArrayList();
+
+ public Object invoke(MethodInvocation invocation) throws Throwable
+ {
+ invoked.add(invocation.getMethod().getName());
+ return invocation.invokeNext();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_A1.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_A1.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_A1.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Base_A1 extends Base_Base
+{
+ public int a1;
+ public void a1()
+ {
+ super.base();
+ }
+
+ public void overridden()
+ {
+
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_Base.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_Base.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Base_Base.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 45554 $
+ */
+public class Base_Base {
+ public int base;
+
+ public void base()
+ {
+
+ }
+
+ public void overridden()
+ {
+
+ }
+ }
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ChildAspect.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+import java.util.ArrayList;
+
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ChildAspect
+{
+ public static ArrayList invoked = new ArrayList();
+
+ public Object invoke(MethodInvocation invocation) throws Throwable
+ {
+ invoked.add(invocation.getMethod().getName());
+ return invocation.invokeNext();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A2.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A2.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A2.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Child_A2 extends Base_A1
+{
+ public int a2;
+
+ public void a2()
+ {
+ super.a1();
+ }
+
+ public void overridden()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A3.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A3.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_A3.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Child_A3 extends Child_A2
+{
+ public int a3;
+
+ public void a3()
+ {
+ super.a2();
+ }
+
+ public void overridden()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B1.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B1.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B1.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Child_B1 extends Base_Base
+{
+ public int b1;
+
+ public void b1()
+ {
+ super.base();
+ }
+
+ public void overridden()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B2.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B2.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B2.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Child_B2 extends Child_B1
+{
+ public int b2;
+
+ public void b2()
+ {
+ super.b1();
+ }
+
+ public void overridden()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B3.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B3.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/Child_B3.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Child_B3 extends Child_B2
+{
+ public int b3;
+
+ public void b3()
+ {
+ super.b2();
+ }
+
+ public void overridden()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTester.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,224 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedChildNoParentDelegationTester implements ScopedChildNoParentDelegationTesterMBean
+{
+ public void testLoaders() throws Exception
+ {
+ System.out.println("=============== ScopedChildNoParentDelegationTester - LOADERS ================");
+ ClassLoader mine = this.getClass().getClassLoader();
+ ClassLoader a3 = Child_A3.class.getClassLoader();
+ ClassLoader base = Base_Base.class.getClassLoader();
+
+ if (mine != a3)
+ {
+ throw new RuntimeException("ClassLoaders for me and Child_A3 should be the same. Mine=" + mine + "; Child_A3=" + a3);
+ }
+
+ if (mine != base)
+ {
+ throw new RuntimeException("ClassLoaders for me and Base_Base should be the same. Mine=" + mine + "; Base_Base=" + base);
+ }
+ }
+
+ public void testMethod() throws Exception
+ {
+ TestUtil testUtil = new TestUtil();
+ System.out.println("=============== ScopedChildNoParentDelegationTester - METHOD ================");
+ Child_A3 a3 = new Child_A3();
+
+ clear();
+ a3.a3();
+ String m = "Child_A3.a3";
+ testUtil.compare(m, "ChildAspect", new String[]{"a3", "a2", "a1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"a3", "a2", "a1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"a3", "a2", "a1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ a3.overridden();
+ m = "Child_A3.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+
+ Child_A2 a2 = new Child_A2();
+
+ clear();
+ a2.a2();
+ m = "Child_A2.a2";
+ testUtil.compare(m, "ChildAspect", new String[]{"a2", "a1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"a2", "a1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"a2", "a1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ a2.overridden();
+ m = "Child_A2.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+ //Base_Base overrides the version from parent/global ucl, so aspects deployed by us should apply to its methods
+ Base_Base base = new Base_Base();
+
+ clear();
+ base.base();
+ m = "Base_Base.base";
+ testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"base"}, BaseParentAspect.invoked);
+
+ clear();
+ base.overridden();
+ m = "Base_Base.overridden";
+ testUtil.compare(m, "BaseAspect", new String[] {"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[] {}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+
+ //Base_A1 overrides the version from parent/global ucl, so aspects deployed by us should apply to its methods
+ Base_A1 a1 = new Base_A1();
+
+ clear();
+ a1.a1();
+ m = "Base_A1.a1";
+ testUtil.compare(m, "BaseAspect", new String[]{"a1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[] {}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"a1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ a1.overridden();
+ m = "Base_A1.overridden";
+ testUtil.compare(m, "BaseAspect", new String[] {"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[] {}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+ Child_B1 b1 = new Child_B1();
+
+ clear();
+ b1.b1();
+ m = "Child_B1.b1";
+ testUtil.compare(m, "ChildAspect", new String[]{"b1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"b1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"b1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ b1.overridden();
+ m = "Child_B1.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+ Child_B2 b2 = new Child_B2();
+
+ clear();
+ b2.b2();
+ m = "Child_B2.b2";
+ testUtil.compare(m, "ChildAspect", new String[]{"b2", "b1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"b2", "b1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"b2", "b1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ b2.overridden();
+ m = "Child_B2.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+ Child_B3 b3 = new Child_B3();
+
+ clear();
+ b3.b3();
+ m = "Child_B3.b3";
+ testUtil.compare(m, "ChildAspect", new String[]{"b3", "b2", "b1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"b3", "b2", "b1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"b3", "b2", "b1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ b3.overridden();
+ m = "Child_B3.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+
+ BaseNotBaseWoven bnbw = new BaseNotBaseWoven();
+ clear();
+ m = "BaseNotBaseWoven.notWovenInBase";
+ bnbw.notWovenInBase();
+ testUtil.compare(m, "ChildAspect", new String[]{"notWovenInBase"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"notWovenInBase"}, BaseParentAspect.invoked);
+
+ if (testUtil.getErrors() != null)
+ {
+ throw new RuntimeException(testUtil.getErrors());
+ }
+ }
+
+ public void testConstructor() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== ScopedChildNoParentDelegationTester - CTOR ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ throw new Exception("Not yet implemented");
+ }
+
+ public void testField() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== ScopedChildNoParentDelegationTester - FIELD ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ throw new Exception("Not yet implemented");
+ }
+
+ public String readName()
+ {
+ return "ScopedChildNoParentDelegationTester";
+ }
+
+ private void clear()
+ {
+ BaseAspect.invoked.clear();
+ ChildAspect.invoked.clear();
+ BaseParentAspect.invoked.clear();
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTesterMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTesterMBean.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildNoParentDelegationTesterMBean.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ScopedChildNoParentDelegationTesterMBean extends TesterMBean
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTester.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,222 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+import org.jboss.aop.Advised;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedChildParentDelegationTester implements ScopedChildParentDelegationTesterMBean
+{
+ public void testLoaders() throws Exception
+ {
+ System.out.println("=============== ScopedChildParentDelegationTester - LOADERS ================");
+ ClassLoader mine = this.getClass().getClassLoader();
+ ClassLoader a3 = Child_A3.class.getClassLoader();
+ ClassLoader base = Base_Base.class.getClassLoader();
+
+ if (mine != a3)
+ {
+ throw new RuntimeException("ClassLoaders for me and Child_A3 should be the same. Mine=" + mine + "; Child_A3=" + a3);
+ }
+
+ if (mine == base)
+ {
+ throw new RuntimeException("ClassLoaders for me and Base_Base should be different. Mine=" + mine + "; Base_Base=" + base);
+ }
+ }
+
+ public void testMethod() throws Exception
+ {
+ TestUtil testUtil = new TestUtil();
+ System.out.println("=============== ScopedChildParentDelegationTester - METHOD ================");
+ Child_A3 a3 = new Child_A3();
+
+ clear();
+ a3.a3();
+ String m = "Child_A3.a3";
+ testUtil.compare(m, "ChildAspect", new String[]{"a3", "a2", "a1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"a3", "a2", "a1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"a3", "a2", "a1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ a3.overridden();
+ m = "Child_A3.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+
+ Child_A2 a2 = new Child_A2();
+
+ clear();
+ a2.a2();
+ m = "Child_A2.a2";
+ testUtil.compare(m, "ChildAspect", new String[]{"a2", "a1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"a2", "a1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"a2", "a1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ a2.overridden();
+ m = "Child_A2.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+
+ //Base_Base is from parent/global ucl, so aspects deployed by us should not apply to its methods
+ Base_Base base = new Base_Base();
+
+ clear();
+ base.base();
+ m = "Base_Base.base";
+ testUtil.compare(m, "BaseAspect", new String[]{"base"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[]{}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+
+ clear();
+ base.overridden();
+ m = "Base_Base.overridden";
+ testUtil.compare(m, "BaseAspect", new String[] {"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[] {}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+
+
+ //Base_A1 is from parent/global ucl, so aspects deployed by us should not apply to its methods
+ Base_A1 a1 = new Base_A1();
+
+ clear();
+ a1.a1();
+ m = "Base_A1.a1";
+ testUtil.compare(m, "BaseAspect", new String[]{"a1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[] {}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+
+ clear();
+ a1.overridden();
+ m = "Base_A1.overridden";
+ testUtil.compare(m, "BaseAspect", new String[] {"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "ChildAspect", new String[] {}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{}, BaseParentAspect.invoked);
+
+ Child_B1 b1 = new Child_B1();
+
+ clear();
+ b1.b1();
+ m = "Child_B1.b1";
+ testUtil.compare(m, "ChildAspect", new String[]{"b1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"b1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"b1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ b1.overridden();
+ m = "Child_B1.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+ Child_B2 b2 = new Child_B2();
+
+ clear();
+ b2.b2();
+ m = "Child_B2.b2";
+ testUtil.compare(m, "ChildAspect", new String[]{"b2", "b1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"b2", "b1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"b2", "b1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ b2.overridden();
+ m = "Child_B2.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+ Child_B3 b3 = new Child_B3();
+
+ clear();
+ b3.b3();
+ m = "Child_B3.b3";
+ testUtil.compare(m, "ChildAspect", new String[]{"b3", "b2", "b1", "base"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"b3", "b2", "b1", "base"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"b3", "b2", "b1", "base"}, BaseParentAspect.invoked);
+
+ clear();
+ b3.overridden();
+ m = "Child_B3.overridden";
+ testUtil.compare(m, "ChildAspect", new String[]{"overridden"}, ChildAspect.invoked);
+ testUtil.compare(m, "BaseAspect", new String[]{"overridden"}, BaseAspect.invoked);
+ testUtil.compare(m, "BaseParentAspect", new String[]{"overridden"}, BaseParentAspect.invoked);
+
+ if (testUtil.getErrors() != null)
+ {
+ throw new RuntimeException(testUtil.getErrors());
+ }
+
+ if(Advised.class.isAssignableFrom(BaseNotBaseWoven.class))
+ {
+ throw new RuntimeException("BaseNotBaseWoven should not be woven");
+ }
+ }
+
+ public void testConstructor() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== ScopedChildParentDelegationTester - CTOR ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ throw new Exception("Not yet implemented");
+ }
+
+ public void testField() throws Exception
+ {
+ try
+ {
+ System.out.println("=============== ScopedChildParentDelegationTester - FIELD ================");
+ }
+ catch (RuntimeException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ throw new Exception("Not yet implemented");
+ }
+
+ public String readName()
+ {
+ return "ScopedChildParentDelegationTester";
+ }
+
+ private void clear()
+ {
+ BaseAspect.invoked.clear();
+ ChildAspect.invoked.clear();
+ BaseParentAspect.invoked.clear();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTesterMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTesterMBean.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/ScopedChildParentDelegationTesterMBean.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ScopedChildParentDelegationTesterMBean extends TesterMBean
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TestUtil.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,72 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestUtil
+{
+ StringBuffer errors;
+ public void compare(String method, String aspect, String[] expect, ArrayList actual)
+ {
+ List expected = Arrays.asList(expect);
+ if (expected.size() != actual.size())
+ {
+ addError("Wrong number interceptions on " + aspect + " for " + method + " Expected=" + expected + "(size=" + expected.size() + ")" + " actual=" + actual + "(size=" + actual.size() + ")" );
+ return;
+ }
+
+ for (int i = 0 ; i < expected.size() ; i++)
+ {
+ if (!expected.get(i).equals(actual.get(i)))
+ {
+ addError("Wrong interceptions on " + aspect + " for " + method + " Expected=" + expected + "(size=" + expected.size() + ")" + " actual=" + actual + "(size=" + actual.size() + ")" );
+ return;
+ }
+ }
+ }
+
+ private void addError(String s)
+ {
+ if (errors == null)
+ {
+ errors = new StringBuffer();
+ }
+ errors.append(s + "\n");
+ }
+
+ public String getErrors()
+ {
+ if (errors == null)
+ {
+ return null;
+ }
+ return errors.toString();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TesterMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TesterMBean.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopedextender/TesterMBean.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.scopedextender;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TesterMBean
+{
+ void testLoaders() throws Exception;
+
+ String readName();
+
+ void testMethod() throws Exception;
+
+ void testField() throws Exception;
+
+ void testConstructor() throws Exception;
+}
Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -54,6 +54,8 @@
ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
Attribute enableTransformer = new Attribute("EnableLoadtimeWeaving", Boolean.TRUE);
getServer().setAttribute(aspectManager, enableTransformer);
+// Attribute verbose = new Attribute("Verbose", Boolean.TRUE);
+// getServer().setAttribute(aspectManager, verbose);
try
{
for (int i = 0 ; i < jars.length ; i++)
@@ -69,6 +71,8 @@
{
enableTransformer = new Attribute("EnableLoadtimeWeaving", Boolean.FALSE);
getServer().setAttribute(aspectManager, enableTransformer);
+// verbose = new Attribute("Verbose", Boolean.TRUE);
+// getServer().setAttribute(aspectManager, verbose);
}
catch(Exception ex)
{
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedNoParentDelegationTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedNoParentDelegationTestCase.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedNoParentDelegationTestCase.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision:
+ */
+public class ScopedExtenderBaseLoadedScopedNoParentDelegationTestCase extends ScopedExtenderBaseTest
+{
+
+ public ScopedExtenderBaseLoadedScopedNoParentDelegationTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(ScopedExtenderBaseLoadedScopedNoParentDelegationTestCase.class));
+
+ AOPClassLoaderHookTestSetup setup = new AOPClassLoaderHookTestSetup(suite, "aop-scopedextender-base-loaded.sar,aop-scopedextender-child-noparentdelegation.sar");
+ return setup;
+ }
+
+ protected String getExpectedBaseName()
+ {
+ return "BaseLoadedTester";
+ }
+
+ protected String getExpectedChildName()
+ {
+ return "ScopedChildNoParentDelegationTester";
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedParentDelegationTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedParentDelegationTestCase.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseLoadedScopedParentDelegationTestCase.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision:
+ */
+public class ScopedExtenderBaseLoadedScopedParentDelegationTestCase extends ScopedExtenderBaseTest
+{
+
+ public ScopedExtenderBaseLoadedScopedParentDelegationTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(ScopedExtenderBaseLoadedScopedParentDelegationTestCase.class));
+
+ AOPClassLoaderHookTestSetup setup = new AOPClassLoaderHookTestSetup(suite, "aop-scopedextender-base-loaded.sar,aop-scopedextender-child-parentdelegation.sar");
+ return setup;
+ }
+
+ protected String getExpectedBaseName()
+ {
+ return "BaseLoadedTester";
+ }
+
+ protected String getExpectedChildName()
+ {
+ return "ScopedChildParentDelegationTester";
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedNoParentDelegationTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedNoParentDelegationTestCase.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedNoParentDelegationTestCase.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision:
+ */
+public class ScopedExtenderBaseNotLoadedScopedNoParentDelegationTestCase extends ScopedExtenderBaseTest
+{
+
+ public ScopedExtenderBaseNotLoadedScopedNoParentDelegationTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(ScopedExtenderBaseNotLoadedScopedNoParentDelegationTestCase.class));
+
+ AOPClassLoaderHookTestSetup setup = new AOPClassLoaderHookTestSetup(suite, "aop-scopedextender-base-notloaded.sar,aop-scopedextender-child-noparentdelegation.sar");
+ return setup;
+ }
+
+ protected String getExpectedBaseName()
+ {
+ return "BaseNotLoadedTester";
+ }
+
+ protected String getExpectedChildName()
+ {
+ return "ScopedChildNoParentDelegationTester";
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedParentDelegationTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedParentDelegationTestCase.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseNotLoadedScopedParentDelegationTestCase.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision:
+ */
+public class ScopedExtenderBaseNotLoadedScopedParentDelegationTestCase extends ScopedExtenderBaseTest
+{
+
+ public ScopedExtenderBaseNotLoadedScopedParentDelegationTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(ScopedExtenderBaseNotLoadedScopedParentDelegationTestCase.class));
+
+ AOPClassLoaderHookTestSetup setup = new AOPClassLoaderHookTestSetup(suite, "aop-scopedextender-base-notloaded.sar,aop-scopedextender-child-parentdelegation.sar");
+ return setup;
+ }
+
+ protected String getExpectedBaseName()
+ {
+ return "BaseNotLoadedTester";
+ }
+
+ protected String getExpectedChildName()
+ {
+ return "ScopedChildParentDelegationTester";
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderBaseTest.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -0,0 +1,132 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.test;
+
+import javax.management.ObjectName;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ScopedExtenderBaseTest extends JBossTestCase
+{
+ final static String BASE_NAME= "jboss.aop:name=BaseTester";
+ final static String CHILD_NAME= "jboss.aop:name=ChildTester";
+ final static Object[] PARAMS = new Object[0];
+ final static String[] SIG = new String[0];
+
+ public ScopedExtenderBaseTest(String name)
+ {
+ super(name);
+ }
+
+ public void testCorrectBaseDeployed() throws Exception
+ {
+ String name = invokeReadName(BASE_NAME);
+ assertEquals(getExpectedBaseName(), name);
+ }
+
+ public void testCorrectChildDeployed() throws Exception
+ {
+ String name = invokeReadName(CHILD_NAME);
+ assertEquals(getExpectedChildName(), name);
+ }
+
+ public void testBaseLoaders() throws Exception
+ {
+ invokeTestClassLoaders(BASE_NAME);
+ }
+
+ public void testChildLoaders() throws Exception
+ {
+ invokeTestClassLoaders(CHILD_NAME);
+ }
+
+ public void testBaseMethod() throws Exception
+ {
+ invokeMethodTest(BASE_NAME);
+ }
+
+ public void testChildMethod() throws Exception
+ {
+ invokeMethodTest(CHILD_NAME);
+ }
+
+// public void testBaseField() throws Exception
+// {
+// invokeFieldTest(BASE_NAME);
+// }
+//
+// public void testChildField() throws Exception
+// {
+// invokeFieldTest(CHILD_NAME);
+// }
+//
+// public void testBaseConstructor() throws Exception
+// {
+// invokeConstructorTest(BASE_NAME);
+// }
+//
+// public void testChildConstructor() throws Exception
+// {
+// invokeConstructorTest(CHILD_NAME);
+// }
+
+ private void invokeMethodTest(String objName) throws Exception
+ {
+ invoke(objName, "testMethod");
+ }
+
+ private void invokeFieldTest(String objName) throws Exception
+ {
+ invoke(objName, "testField");
+ }
+
+ private void invokeConstructorTest(String objName) throws Exception
+ {
+ invoke(objName, "testConstructor");
+ }
+
+ private String invokeReadName(String objName) throws Exception
+ {
+ return (String)invoke(objName, "readName");
+ }
+
+ private void invokeTestClassLoaders(String objName) throws Exception
+ {
+ invoke(objName, "testLoaders");
+ }
+
+ private Object invoke(String objName, String method) throws Exception
+ {
+ ObjectName testerName = new ObjectName(objName);
+ return getServer().invoke(testerName, method, PARAMS, SIG);
+ }
+
+ protected abstract String getExpectedBaseName();
+
+ protected abstract String getExpectedChildName();
+
+}
Deleted: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderTestCase.java 2006-09-12 18:17:48 UTC (rev 56776)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedExtenderTestCase.java 2006-09-12 18:25:59 UTC (rev 56777)
@@ -1,63 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.test;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jboss.test.JBossTestCase;
-
-/**
- *
- * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
- * @version $Revision:
- */
-public class ScopedExtenderTestCase extends JBossTestCase
-{
-
- public ScopedExtenderTestCase(String name)
- {
- super(name);
- }
-
- public void testMethod() throws Exception
- {
- MBeanServerConnection server = getServer();
- ObjectName testerName = new ObjectName("jboss.aop:name=ScopedExtenderTester1");
- Object[] params = {};
- String[] sig = {};
- server.invoke(testerName, "testMethod", params, sig);
- }
-
- public static Test suite() throws Exception
- {
- TestSuite suite = new TestSuite();
- suite.addTest(new TestSuite(ScopedExtenderTestCase.class));
-
- AOPClassLoaderHookTestSetup setup = new AOPClassLoaderHookTestSetup(suite, "aop-scopedextendertest2.sar,aop-scopedextendertest1.sar");
- return setup;
- }
-
-}
More information about the jboss-cvs-commits
mailing list