[jboss-cvs] JBossAS SVN: r98989 - in projects/kernel/branches/disableaop/aop-mc-int: src/main/java/org/jboss/aop/microcontainer/integration and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jan 4 10:49:50 EST 2010
Author: kabir.khan at jboss.com
Date: 2010-01-04 10:49:49 -0500 (Mon, 04 Jan 2010)
New Revision: 98989
Modified:
projects/kernel/branches/disableaop/aop-mc-int/pom.xml
projects/kernel/branches/disableaop/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java
projects/kernel/branches/disableaop/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java
projects/kernel/branches/disableaop/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/matrix/mc/test/BaseNotAdvisedChildAdvisedAndProxyTestCase.xml
Log:
All tests pass now with @EnableAopProxy
Modified: projects/kernel/branches/disableaop/aop-mc-int/pom.xml
===================================================================
--- projects/kernel/branches/disableaop/aop-mc-int/pom.xml 2010-01-04 15:39:09 UTC (rev 98988)
+++ projects/kernel/branches/disableaop/aop-mc-int/pom.xml 2010-01-04 15:49:49 UTC (rev 98989)
@@ -505,6 +505,7 @@
<fileset dir="${project.build.directory}/test-classes">
<include name="org/jboss/test/**/*TestCase.class" />
+ <exclude name="org/jboss/test/microcontainer/asynchronous/test/**"/>
</fileset>
</batchtest>
</junit>
@@ -654,6 +655,7 @@
<fileset dir="${project.build.directory}/test-classes">
<include name="org/jboss/test/**/*TestCase.class" />
+ <exclude name="org/jboss/test/microcontainer/asynchronous/test/**"/>
</fileset>
</batchtest>
</junit>
Modified: projects/kernel/branches/disableaop/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java
===================================================================
--- projects/kernel/branches/disableaop/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java 2010-01-04 15:39:09 UTC (rev 98988)
+++ projects/kernel/branches/disableaop/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java 2010-01-04 15:49:49 UTC (rev 98989)
@@ -98,80 +98,85 @@
try
{
Class<?> clazz = getClass(beanInfo);
+ if (clazz == null)
+ return super.getDependencies(beanInfo, metaData);
boolean classIsWoven = Advised.class.isAssignableFrom(clazz);
if (!classIsWoven && bypassAOP(beanInfo, metaData, DisabledType.ALL))
- {
return super.getDependencies(beanInfo, metaData);
- }
+
+ //Only initialize this if AOP is used since it takes a lot of work to create it
+ ReflectiveAspectBinder binder = null;
+ ArrayList<DependencyBuilderListItem> depends = new ArrayList<DependencyBuilderListItem>();
- AspectManager manager = AspectManagerFactory.getAspectManager(metaData);
- if (clazz != null)
+ if (classIsWoven || bypassAOP(beanInfo, metaData, DisabledType.POINTCUTS) == false)
{
- Advisor advisor;
- synchronized (ContainerCache.mapLock)
- {
- ContainerCache cache = ContainerCache.initialise(manager, clazz, metaData, true);
- advisor = cache.getAdvisor();
- }
- ReflectiveAspectBinder binder = new ReflectiveAspectBinder(clazz, advisor);
- ArrayList<DependencyBuilderListItem> depends = new ArrayList<DependencyBuilderListItem>();
+ binder = getBinder(clazz, metaData);
+ Set aspects = binder.getAspects();
- if (!classIsWoven && bypassAOP(beanInfo, metaData, DisabledType.POINTCUTS) == false)
+ if (aspects != null && aspects.size() > 0)
{
- Set aspects = binder.getAspects();
-
- if (aspects != null && aspects.size() > 0)
+ Iterator it = aspects.iterator();
+ while (it.hasNext())
{
- Iterator it = aspects.iterator();
- while (it.hasNext())
+ AspectDefinition def = (AspectDefinition) it.next();
+ if (def instanceof ManagedAspectDefinition)
{
- AspectDefinition def = (AspectDefinition) it.next();
- if (def instanceof ManagedAspectDefinition)
+ String name = ((ManagedAspectDefinition)def).getDependentAspectName();
+ if (name != null)
{
- String name = ((ManagedAspectDefinition)def).getDependentAspectName();
- if (name != null)
- {
- depends.add(new AspectDependencyBuilderListItem(name));
- }
+ depends.add(new AspectDependencyBuilderListItem(name));
}
}
}
}
+ }
- if (bypassAOP(beanInfo, metaData, DisabledType.LIFECYCLE) == false)
+ if (bypassAOP(beanInfo, metaData, DisabledType.LIFECYCLE) == false)
+ {
+ if (binder == null)
+ binder = getBinder(clazz, metaData);
+
+ Map<Object, Set<LifecycleCallbackDefinition>> lifecycleCallbacks = binder.getLifecycleCallbacks();
+ if (lifecycleCallbacks != null && lifecycleCallbacks.size() > 0)
{
- Map<Object, Set<LifecycleCallbackDefinition>> lifecycleCallbacks = binder.getLifecycleCallbacks();
- if (lifecycleCallbacks != null && lifecycleCallbacks.size() > 0)
+ for (Entry<Object, Set<LifecycleCallbackDefinition>> states : lifecycleCallbacks.entrySet())
{
- for (Entry<Object, Set<LifecycleCallbackDefinition>> states : lifecycleCallbacks.entrySet())
+ for (LifecycleCallbackDefinition callback : states.getValue())
{
- for (LifecycleCallbackDefinition callback : states.getValue())
- {
- depends.add(new LifecycleAspectDependencyBuilderListItem(
- callback.getBean(), (ControllerState)states.getKey(), callback.getInstallMethod(), callback.getUninstallMethod()));
- }
+ depends.add(new LifecycleAspectDependencyBuilderListItem(
+ callback.getBean(), (ControllerState)states.getKey(), callback.getInstallMethod(), callback.getUninstallMethod()));
}
}
}
-
- HashSet<String> annotationDependencies = getAnnotationDependencies(beanInfo.getClassInfo(), metaData);
- for (String dependency : annotationDependencies)
- {
- depends.add(new AnnotationDependencyBuilderListItem(dependency));
- }
- return depends;
}
- return null;
-
+
+ HashSet<String> annotationDependencies = getAnnotationDependencies(beanInfo.getClassInfo(), metaData);
+ for (String dependency : annotationDependencies)
+ {
+ depends.add(new AnnotationDependencyBuilderListItem(dependency));
+ }
+ return depends;
}
catch (ClassNotFoundException e)
{
throw new RuntimeException(e);
}
}
+
+ private ReflectiveAspectBinder getBinder(Class<?> clazz, MetaData metaData)
+ {
+ AspectManager manager = AspectManagerFactory.getAspectManager(metaData);
+ Advisor advisor;
+ synchronized (ContainerCache.mapLock)
+ {
+ ContainerCache cache = ContainerCache.initialise(manager, clazz, metaData, true);
+ advisor = cache.getAdvisor();
+ }
+ return new ReflectiveAspectBinder(clazz, advisor);
+ }
private Class<?> getClass(BeanInfo beanInfo) throws ClassNotFoundException
{
Modified: projects/kernel/branches/disableaop/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java
===================================================================
--- projects/kernel/branches/disableaop/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java 2010-01-04 15:39:09 UTC (rev 98988)
+++ projects/kernel/branches/disableaop/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java 2010-01-04 15:49:49 UTC (rev 98989)
@@ -25,6 +25,8 @@
import java.util.Set;
import junit.framework.Test;
+
+import org.jboss.aop.Advised;
import org.jboss.aop.proxy.container.AspectManaged;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
@@ -60,6 +62,10 @@
public void testAllAopTurnedOff() throws Exception
{
+ //Being woven is the same as having @EnableAopProxy
+ if (isWoven())
+ return;
+
assertMoreDependencies("Intercepted", "NotIntercepted");
POJO pojoNotIntercepted = (POJO)getBean("NotIntercepted");
@@ -70,6 +76,10 @@
public void testPointcutsTurnedOff() throws Exception
{
+ //Being woven is the same as having @EnableAopProxy
+ if (isWoven())
+ return;
+
assertMoreDependencies("Intercepted", "NotIntercepted");
POJO pojoNotIntercepted = (POJO)getBean("NotIntercepted");
@@ -120,4 +130,10 @@
assertSame(ControllerState.INSTALLED, ctx.getState());
return ctx;
}
+
+ private boolean isWoven()
+ {
+ POJO pojo = new POJO();
+ return pojo instanceof Advised;
+ }
}
Modified: projects/kernel/branches/disableaop/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/matrix/mc/test/BaseNotAdvisedChildAdvisedAndProxyTestCase.xml
===================================================================
--- projects/kernel/branches/disableaop/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/matrix/mc/test/BaseNotAdvisedChildAdvisedAndProxyTestCase.xml 2010-01-04 15:39:09 UTC (rev 98988)
+++ projects/kernel/branches/disableaop/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/matrix/mc/test/BaseNotAdvisedChildAdvisedAndProxyTestCase.xml 2010-01-04 15:49:49 UTC (rev 98989)
@@ -7,6 +7,7 @@
<bean name="PlainChild" class="org.jboss.test.microcontainer.matrix.Child"/>
<bean name="ProxiedChild" class="org.jboss.test.microcontainer.matrix.Child">
+ <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
<annotation>@org.jboss.test.microcontainer.support.Test</annotation>
</bean>
More information about the jboss-cvs-commits
mailing list