[jboss-cvs] JBossAS SVN: r99038 - in projects/kernel/trunk: aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 5 13:07:21 EST 2010
Author: kabir.khan at jboss.com
Date: 2010-01-05 13:07:20 -0500 (Tue, 05 Jan 2010)
New Revision: 99038
Added:
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Lifecycle.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/LifecycleAnnotationPlugin.java
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPlugin.java
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPluginBean.java
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderedPluginAnnotationAdapter.java
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/OrderedAnnotationPluginsTestCase.java
Removed:
projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/annotations/DisableAopLifecycle.java
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testLifecycleTurnedOff.xml
Modified:
projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/LifecycleBinding.java
projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPConstructorJoinpoint.java
projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java
projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/DisableAOPHelper.java
projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/LifecycleAspectDependencyBuilderListItem.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Configure.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Create.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Describe.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Error.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Install.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Instantiate.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Start.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCase.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCase.java
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testAllAopTurnedOff.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testPointcutsTurnedOff.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackTestCaseNotAutomatic.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackWithDependencyTestCaseNotAutomatic1.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackTestCaseNotAutomatic.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyAopTestCaseNotAutomatic1.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyDeploymentTestCaseNotAutomatic1.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/NonDefaultMethodsLifecycleCallbackTestCaseNotAutomatic.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic0.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic1.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic2.xml
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCaseNotAutomatic.xml
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java
Log:
[JBKERNEL-75] [JBKERNEL-76] Refactor aop lifecycle to use annotation plugin instead of AOP. Modify CommonAnnotationAdapter to order plugins for each annotation to the order they were added. Improve CommonAnnotationAdapter throughput by using R/W locks instead of synchronized
Deleted: projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/annotations/DisableAopLifecycle.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/annotations/DisableAopLifecycle.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/annotations/DisableAopLifecycle.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -1,32 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.annotations;
-
-/**
- * Use to disable aop lifecycle callbacks for a bean. By default they are enabled
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public @interface DisableAopLifecycle {
-
-}
Modified: projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/LifecycleBinding.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/LifecycleBinding.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/LifecycleBinding.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,9 +21,18 @@
*/
package org.jboss.aop.microcontainer.beans;
+import java.lang.annotation.Annotation;
+
+import org.jboss.annotation.factory.AnnotationCreator;
import org.jboss.aop.AspectManager;
-import org.jboss.aop.microcontainer.lifecycle.LifecycleCallbackBinding;
+import org.jboss.aop.microcontainer.integration.LifecycleAspectDependencyBuilderListItem;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.plugins.annotations.AnnotationPlugin;
+import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapter;
+import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapterFactory;
+import org.jboss.kernel.plugins.annotations.CommonAnnotationAdapter;
+import org.jboss.kernel.plugins.annotations.LifecycleAnnotationPlugin;
import org.jboss.util.id.GUID;
/**
@@ -41,6 +50,7 @@
private ControllerState state;
private String installMethod = "install";
private String uninstallMethod = "uninstall";
+ LifecycleAnnotationPlugin<?> plugin;
public void setClasses(String classes)
{
@@ -84,10 +94,10 @@
public void start() throws Exception
{
- if (expr == null && classes == null)
- throw new IllegalArgumentException("Null classes and null expr");
- if (expr != null && classes != null)
- throw new IllegalArgumentException("Both classes and expr were set");
+ if (expr != null)
+ throw new IllegalArgumentException("The 'expr' attribute has been deprecated. Only the name of an annotation in the 'classes' attribute work now.");
+ if (classes == null)
+ throw new IllegalArgumentException("Null 'classes' attribute.");
if (manager == null)
throw new IllegalArgumentException("Null manager");
if (callbackBean == null)
@@ -96,17 +106,38 @@
throw new IllegalArgumentException("Null controller state");
if (name == null)
name = GUID.asString();
+
+ if (!classes.startsWith("@"))
+ throw new IllegalArgumentException("Could not parse '" + classes + " into an annotation. (It must start with '@')");
+ String annotationName = classes.substring(1);
+ Class<Annotation> clazz = null;
+ try
+ {
+ clazz = (Class<Annotation>)SecurityActions.getContextClassLoader().loadClass(annotationName);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("An error occurred loading '" + classes + "'", e);
+ }
-
- LifecycleCallbackBinding binding = new LifecycleCallbackBinding(name, classes, expr, state);
- binding.addLifecycleCallback(callbackBean, installMethod, uninstallMethod);
- manager.addLifecycleBinding(binding);
+ LifecycleAspectDependencyBuilderListItem item = new LifecycleAspectDependencyBuilderListItem(callbackBean, state, installMethod, uninstallMethod);
+ plugin = new LifecycleAnnotationPlugin<Annotation>(clazz, item);
+ getBeanAnnotationAdapter().addAnnotationPlugin(plugin);
}
public void stop() throws Exception
{
- manager.removeLifecycleBinding(name);
+ if (plugin != null)
+ getBeanAnnotationAdapter().removeAnnotationPlugin(plugin);
}
+ @SuppressWarnings("unchecked")
+ private CommonAnnotationAdapter<AnnotationPlugin<?, ?>, MetaDataVisitor> getBeanAnnotationAdapter()
+ {
+ BeanAnnotationAdapter adapter = BeanAnnotationAdapterFactory.getInstance().getBeanAnnotationAdapter();
+ if (adapter instanceof CommonAnnotationAdapter == false)
+ throw new IllegalArgumentException("Adapter is not an instance of CommonAnnotationAdapter");
+ return (CommonAnnotationAdapter<AnnotationPlugin<?,?>, MetaDataVisitor>)adapter;
+ }
}
Modified: projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPConstructorJoinpoint.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPConstructorJoinpoint.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPConstructorJoinpoint.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -31,7 +31,6 @@
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.ConstructorInvocation;
import org.jboss.aop.microcontainer.annotations.DisableAOP;
-import org.jboss.aop.microcontainer.annotations.DisableAopLifecycle;
import org.jboss.aop.microcontainer.annotations.DisabledType;
import org.jboss.aop.microcontainer.annotations.EnableAopProxy;
import org.jboss.aop.microcontainer.beans.AspectManagerFactory;
@@ -237,7 +236,7 @@
//Don't include the annotations for controlling whether to use AOP
for (Annotation ann : annotations)
{
- if (ann.annotationType() == EnableAopProxy.class || ann.annotationType() == DisableAOP.class || ann.annotationType() == DisableAopLifecycle.class)
+ if (ann.annotationType() == EnableAopProxy.class || ann.annotationType() == DisableAOP.class)
annotationsSize--;
}
return annotationsSize > 0;
Modified: projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/AOPDependencyBuilder.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -134,25 +134,6 @@
}
}
- 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)
- {
- for (Entry<Object, Set<LifecycleCallbackDefinition>> states : lifecycleCallbacks.entrySet())
- {
- for (LifecycleCallbackDefinition callback : states.getValue())
- {
- depends.add(new LifecycleAspectDependencyBuilderListItem(
- callback.getBean(), (ControllerState)states.getKey(), callback.getInstallMethod(), callback.getUninstallMethod()));
- }
- }
- }
- }
-
HashSet<String> annotationDependencies = getAnnotationDependencies(beanInfo.getClassInfo(), metaData);
for (String dependency : annotationDependencies)
{
Modified: projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/DisableAOPHelper.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/DisableAOPHelper.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/DisableAOPHelper.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -22,7 +22,6 @@
package org.jboss.aop.microcontainer.integration;
import org.jboss.aop.microcontainer.annotations.DisableAOP;
-import org.jboss.aop.microcontainer.annotations.DisableAopLifecycle;
import org.jboss.aop.microcontainer.annotations.DisabledType;
import org.jboss.aop.microcontainer.annotations.EnableAopProxy;
import org.jboss.metadata.spi.MetaData;
@@ -51,18 +50,8 @@
if (aop != null)
legacyDisabled = DisabledType.isDisabled(aop.value(), constraint);
- if (constraint == DisabledType.LIFECYCLE)
+ if (constraint == DisabledType.POINTCUTS)
{
- DisableAopLifecycle proxy = metaData.getAnnotation(DisableAopLifecycle.class);
- if (proxy != null)
- return true;
-
- if (legacyDisabled != null)
- return legacyDisabled;
- return false;
- }
- else if (constraint == DisabledType.POINTCUTS)
- {
EnableAopProxy proxy = metaData.getAnnotation(EnableAopProxy.class);
if (proxy != null)
return false;
@@ -70,9 +59,6 @@
}
else if (constraint == DisabledType.ALL)
{
- DisableAopLifecycle proxy = metaData.getAnnotation(DisableAopLifecycle.class);
- if (proxy != null)
- return true;
if (legacyDisabled != null)
return legacyDisabled;
return false;
Modified: projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/LifecycleAspectDependencyBuilderListItem.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/LifecycleAspectDependencyBuilderListItem.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/integration/LifecycleAspectDependencyBuilderListItem.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -23,9 +23,12 @@
import java.util.List;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.plugins.AbstractDependencyItem;
import org.jboss.dependency.plugins.AbstractLifecycleCallbackItem;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.DependencyItem;
import org.jboss.dependency.spi.LifecycleCallbackItem;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
@@ -34,13 +37,13 @@
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
-class LifecycleAspectDependencyBuilderListItem extends AspectDependencyBuilderListItem
+public class LifecycleAspectDependencyBuilderListItem extends AspectDependencyBuilderListItem
{
ControllerState state;
String installMethod;
String uninstallMethod;
- LifecycleAspectDependencyBuilderListItem(String beanName, ControllerState state, String installMethod, String uninstallMethod)
+ public LifecycleAspectDependencyBuilderListItem(String beanName, ControllerState state, String installMethod, String uninstallMethod)
{
super(beanName);
this.state = state;
@@ -72,7 +75,10 @@
DependencyInfo di = context.getDependencyInfo();
di.addLifecycleCallback(callback);
- super.addDependency(context);
+ BeanMetaData metaData = context.getBeanMetaData();
+ DependencyItem dependencyItem = new AbstractDependencyItem(metaData.getName(), dependencyName, ControllerState.INSTANTIATED, ControllerState.INSTALLED);
+ DependencyInfo depends = context.getDependencyInfo();
+ depends.addIDependOn(dependencyItem);
}
@Override
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -71,7 +71,8 @@
POJO pojoNotIntercepted = (POJO)getBean("NotIntercepted");
assertFalse(pojoNotIntercepted instanceof AspectManaged);
- assertMoreDependencies("WithLifecycle", "WithLifecycleDisabled");
+ assertNotInstalledContext("WithLifecycle");
+ assertNotInstalledContext("WithLifecycleDisabled");
}
public void testPointcutsTurnedOff() throws Exception
@@ -89,14 +90,6 @@
assertNotInstalledContext("WithLifecycleDisabled");
}
- public void testLifecycleTurnedOff() throws Exception
- {
- assertNotInstalledContext("Intercepted");
- assertNotInstalledContext("NotIntercepted");
-
- assertMoreDependencies("WithLifecycle", "WithLifecycleDisabled");
- }
-
private void assertMoreDependencies(String aspectCtxName, String disabledCtxName)
{
ControllerContext aspectCtx = assertNotInstalledContext(aspectCtxName);
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Configure.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Configure.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Configure.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.microcontainer.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
public @interface Configure {
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Create.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Create.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Create.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.microcontainer.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
public @interface Create {
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Describe.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Describe.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Describe.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.microcontainer.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
public @interface Describe {
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Error.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Error.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Error.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.microcontainer.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
public @interface Error {
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Install.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Install.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Install.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.microcontainer.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
public @interface Install {
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Instantiate.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Instantiate.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Instantiate.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.microcontainer.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
public @interface Instantiate {
}
Added: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Lifecycle.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Lifecycle.java (rev 0)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Lifecycle.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
+public @interface Lifecycle {
+
+}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Start.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Start.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/Start.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.microcontainer.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
public @interface Start {
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCase.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCase.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCase.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -63,18 +63,19 @@
assertTrue(hasExpectedInterception("Intercepted", ControllerState.CONFIGURED));
assertTrue(hasExpectedInterception("Intercepted", ControllerState.START));
+ SimpleLifecycleCallback.clear();
+
//Undeploy the second aspect
- undeploy("UndeployLifecycleCallbackDependencyTestCaseNotAutomatic1.xml");
+ undeploy("UndeployLifecycleCallbackDependencyTestCaseNotAutomatic1.xml");
//Move the bean back to the installed state
controller.change(ctx, ControllerState.INSTALLED);
bean = (SimpleBeanImpl)getBean("Intercepted");
-// SimpleInterceptor1.invoked = false;
-// SimpleInterceptor2.invoked = false;
-// bean.someMethod();
-// assertTrue(SimpleInterceptor1.invoked);
-// assertFalse(SimpleInterceptor2.invoked);
+
+ assertEquals(1, SimpleLifecycleCallback.interceptions.size());
+ assertTrue(hasExpectedInterception("Intercepted", ControllerState.CONFIGURED));
+ SimpleLifecycleCallback.clear();
}
finally
{
@@ -106,10 +107,4 @@
}
return false;
}
-//
-// private void getAssertUninstalledLifecycleCallback(String callbackName)
-// {
-// InstallUninstallLifecycleCallback callback = (InstallUninstallLifecycleCallback)getBean(callbackName);
-// assertTrue(callback.isUninstalledContext());
-// }
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCase.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCase.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCase.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -43,16 +43,16 @@
{
}
- getAssertInstalledLifecycleCallback("DescribeAdvice1");
- getAssertInstalledLifecycleCallback("DescribeAdvice2");
- getAssertInstalledLifecycleCallback("InstantiateAdvice1");
- getAssertInstalledLifecycleCallback("InstantiateAdvice2");
- getAssertInstalledLifecycleCallback("ConfigureAdvice1");
- getAssertInstalledLifecycleCallback("ConfigureAdvice2");
- getAssertInstalledLifecycleCallback("CreateAdvice1");
- getAssertInstalledLifecycleCallback("CreateAdvice2");
- getAssertInstalledLifecycleCallback("StartAdvice1");
- getAssertInstalledLifecycleCallback("StartAdvice2");
+// getAssertInstalledLifecycleCallback("DescribeAdvice1");
+// getAssertInstalledLifecycleCallback("DescribeAdvice2");
+// getAssertInstalledLifecycleCallback("InstantiateAdvice1");
+// getAssertInstalledLifecycleCallback("InstantiateAdvice2");
+// getAssertInstalledLifecycleCallback("ConfigureAdvice1");
+// getAssertInstalledLifecycleCallback("ConfigureAdvice2");
+// getAssertInstalledLifecycleCallback("CreateAdvice1");
+// getAssertInstalledLifecycleCallback("CreateAdvice2");
+// getAssertInstalledLifecycleCallback("StartAdvice1");
+// getAssertInstalledLifecycleCallback("StartAdvice2");
getAssertInstalledLifecycleCallback("InstallAdvice1");
getAssertInstalledLifecycleCallback("InstallAdvice2");
@@ -68,16 +68,16 @@
assertFalse(startNotInvoked.isUninstalledContext());
//Lifecycle callbacks from previous states should have had uninstall called
- getAssertUninstalledLifecycleCallback("DescribeAdvice1");
- getAssertUninstalledLifecycleCallback("DescribeAdvice2");
- getAssertUninstalledLifecycleCallback("InstantiateAdvice1");
- getAssertUninstalledLifecycleCallback("InstantiateAdvice2");
- getAssertUninstalledLifecycleCallback("ConfigureAdvice1");
- getAssertUninstalledLifecycleCallback("ConfigureAdvice2");
- getAssertUninstalledLifecycleCallback("CreateAdvice1");
- getAssertUninstalledLifecycleCallback("CreateAdvice2");
- getAssertUninstalledLifecycleCallback("StartAdvice1");
- getAssertUninstalledLifecycleCallback("StartAdvice2");
+// getAssertUninstalledLifecycleCallback("DescribeAdvice1");
+// getAssertUninstalledLifecycleCallback("DescribeAdvice2");
+// getAssertUninstalledLifecycleCallback("InstantiateAdvice1");
+// getAssertUninstalledLifecycleCallback("InstantiateAdvice2");
+// getAssertUninstalledLifecycleCallback("ConfigureAdvice1");
+// getAssertUninstalledLifecycleCallback("ConfigureAdvice2");
+// getAssertUninstalledLifecycleCallback("CreateAdvice1");
+// getAssertUninstalledLifecycleCallback("CreateAdvice2");
+// getAssertUninstalledLifecycleCallback("StartAdvice1");
+// getAssertUninstalledLifecycleCallback("StartAdvice2");
getAssertUninstalledLifecycleCallback("InstallAdvice1");
getAssertUninstalledLifecycleCallback("InstallAdvice2");
}
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testAllAopTurnedOff.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testAllAopTurnedOff.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testAllAopTurnedOff.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -17,7 +17,7 @@
<lifecycle-configure
name="LifecycleCallback"
class="org.jboss.test.microcontainer.support.LifecycleCallbackWithBeanDependency"
- expr="class(org.jboss.test.microcontainer.beans.POJO2)"
+ classes="@org.jboss.test.microcontainer.support.Lifecycle"
manager-bean="AspectManager">
<property name="dependency"><inject bean="Dependency"/></property>
</lifecycle-configure>
@@ -30,9 +30,11 @@
<annotation>@org.jboss.aop.microcontainer.annotations.DisableAOP</annotation>
</bean>
- <bean name="WithLifecycle" class="org.jboss.test.microcontainer.beans.POJO2"/>
-
+ <bean name="WithLifecycle" class="org.jboss.test.microcontainer.beans.POJO2">
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
+ </bean>
+
<bean name="WithLifecycleDisabled" class="org.jboss.test.microcontainer.beans.POJO2">
- <annotation>@org.jboss.aop.microcontainer.annotations.DisableAOP</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</aop>
Deleted: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testLifecycleTurnedOff.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testLifecycleTurnedOff.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testLifecycleTurnedOff.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<aop xmlns="urn:jboss:aop-beans:1.0">
-
- <bean name="AspectManager" class="org.jboss.aop.AspectManager">
- <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
- </bean>
-
- <aspect class="org.jboss.test.microcontainer.beans.TestAspectWithDependency">
- <property name="dependency"><inject bean="Dependency"/></property>
- </aspect>
-
- <bind pointcut="execution(* org.jboss.test.microcontainer.beans.POJO->*(..))">
- <advice aspect="org.jboss.test.microcontainer.beans.TestAspectWithDependency" name="advice"/>
- </bind>
-
- <lifecycle-configure
- name="LifecycleCallback"
- class="org.jboss.test.microcontainer.support.LifecycleCallbackWithBeanDependency"
- expr="class(org.jboss.test.microcontainer.beans.POJO2)"
- manager-bean="AspectManager">
- <property name="dependency"><inject bean="Dependency"/></property>
- </lifecycle-configure>
-
- <bean name="Intercepted" class="org.jboss.test.microcontainer.beans.POJO">
- <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
- </bean>
-
- <bean name="NotIntercepted" class="org.jboss.test.microcontainer.beans.POJO">
- <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
- <annotation>@org.jboss.aop.microcontainer.annotations.DisableAOP({org.jboss.aop.microcontainer.annotations.DisabledType.LIFECYCLE})</annotation>
- </bean>
-
- <bean name="WithLifecycle" class="org.jboss.test.microcontainer.beans.POJO2"/>
-
- <bean name="WithLifecycleDisabled" class="org.jboss.test.microcontainer.beans.POJO2">
- <annotation>@org.jboss.aop.microcontainer.annotations.DisableAOP({org.jboss.aop.microcontainer.annotations.DisabledType.LIFECYCLE})</annotation>
- </bean>
-</aop>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testPointcutsTurnedOff.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testPointcutsTurnedOff.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AspectWithDependencyTurnedOffAopTestCase#testPointcutsTurnedOff.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -17,7 +17,7 @@
<lifecycle-configure
name="LifecycleCallback"
class="org.jboss.test.microcontainer.support.LifecycleCallbackWithBeanDependency"
- expr="class(org.jboss.test.microcontainer.beans.POJO2)"
+ classes="@org.jboss.test.microcontainer.support.Lifecycle"
manager-bean="AspectManager">
<property name="dependency"><inject bean="Dependency"/></property>
</lifecycle-configure>
@@ -28,9 +28,11 @@
<!-- Pointcuts turned odd by default -->
<bean name="NotIntercepted" class="org.jboss.test.microcontainer.beans.POJO"/>
- <bean name="WithLifecycle" class="org.jboss.test.microcontainer.beans.POJO2"/>
+ <bean name="WithLifecycle" class="org.jboss.test.microcontainer.beans.POJO2">
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
+ </bean>
<bean name="WithLifecycleDisabled" class="org.jboss.test.microcontainer.beans.POJO2">
- <annotation>@org.jboss.aop.microcontainer.annotations.DisableAOP({org.jboss.aop.microcontainer.annotations.DisabledType.POINTCUTS})</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</aop>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackTestCaseNotAutomatic.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackTestCaseNotAutomatic.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackTestCaseNotAutomatic.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -10,12 +10,12 @@
<bean name="LifecycleCallback$Binding" class="org.jboss.aop.microcontainer.beans.LifecycleBinding">
<property name="callbackBean">LifecycleCallback</property>
<property name="manager"><inject bean="AspectManager"/></property>
- <property name="classes">org.jboss.test.microcontainer.support.SimpleBeanImpl</property>
+ <property name="classes">@org.jboss.test.microcontainer.support.Lifecycle</property>
<property name="state">Configured</property>
</bean>
<bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
- <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackWithDependencyTestCaseNotAutomatic1.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackWithDependencyTestCaseNotAutomatic1.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/CreatedBeansLifecycleCallbackWithDependencyTestCaseNotAutomatic1.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -12,11 +12,11 @@
<bean name="LifecycleCallback$Binding" class="org.jboss.aop.microcontainer.beans.LifecycleBinding">
<property name="callbackBean">LifecycleCallback</property>
<property name="manager"><inject bean="AspectManager"/></property>
- <property name="classes">org.jboss.test.microcontainer.support.SimpleBeanImpl</property>
+ <property name="classes">@org.jboss.test.microcontainer.support.Lifecycle</property>
<property name="state">Configured</property>
</bean>
<bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
- <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackTestCaseNotAutomatic.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackTestCaseNotAutomatic.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackTestCaseNotAutomatic.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -8,11 +8,11 @@
<lifecycle-configure xmlns="urn:jboss:aop-beans:1.0"
name="LifecycleCallback"
class="org.jboss.test.microcontainer.support.SimpleLifecycleCallback"
- classes="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+ classes="@org.jboss.test.microcontainer.support.Lifecycle">
<property name="testProperty">Test123</property>
</lifecycle-configure>
<bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
- <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyAopTestCaseNotAutomatic1.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyAopTestCaseNotAutomatic1.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyAopTestCaseNotAutomatic1.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -8,13 +8,13 @@
<lifecycle-configure
name="LifecycleCallback"
class="org.jboss.test.microcontainer.support.LifecycleCallbackWithBeanDependency"
- expr="class(org.jboss.test.microcontainer.support.SimpleBeanImpl)"
+ classes="@org.jboss.test.microcontainer.support.Lifecycle"
manager-bean="TheAspectManager">
<property name="dependency"><inject bean="Dependency"/></property>
</lifecycle-configure>
<bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
- <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</aop>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyDeploymentTestCaseNotAutomatic1.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyDeploymentTestCaseNotAutomatic1.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InitialLifecycleCallbackWithDependencyDeploymentTestCaseNotAutomatic1.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -8,12 +8,12 @@
<lifecycle-configure xmlns="urn:jboss:aop-beans:1.0"
name="LifecycleCallback"
class="org.jboss.test.microcontainer.support.LifecycleCallbackWithBeanDependency"
- expr="class(org.jboss.test.microcontainer.support.SimpleBeanImpl)"
+ classes="@org.jboss.test.microcontainer.support.Lifecycle"
manager-bean="TheAspectManager">
<property name="dependency"><inject bean="Dependency"/></property>
</lifecycle-configure>
<bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
- <annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -20,10 +20,11 @@
<lifecycle-configure xmlns="urn:jboss:aop-beans:1.0"
name="JndiAdvice"
class="org.jboss.test.microcontainer.support.SimpleLifecycleCallback"
- classes="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+ classes="@org.jboss.test.microcontainer.support.Lifecycle">
</lifecycle-configure>
<bean name="Bean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="", exposedInterface=org.jboss.test.microcontainer.support.SimpleBean.class)</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/NonDefaultMethodsLifecycleCallbackTestCaseNotAutomatic.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/NonDefaultMethodsLifecycleCallbackTestCaseNotAutomatic.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/NonDefaultMethodsLifecycleCallbackTestCaseNotAutomatic.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -7,7 +7,7 @@
<lifecycle-configure xmlns="urn:jboss:aop-beans:1.0"
name="LifecycleCallback"
class="org.jboss.test.microcontainer.support.NonDefaultMethodsLifecycleCallback"
- classes="org.jboss.test.microcontainer.support.SimpleBeanImpl"
+ classes="@org.jboss.test.microcontainer.support.Lifecycle"
install="init"
uninstall="uninit"
manager-bean="TheAspectManager"
@@ -15,6 +15,8 @@
</lifecycle-configure>
- <bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl"/>
+ <bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
+ </bean>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic0.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic0.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic0.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -9,7 +9,7 @@
<aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
name="LifecycleCallbackConfigure"
class="org.jboss.test.microcontainer.support.SimpleLifecycleCallback"
- classes="@org.jboss.test.microcontainer.support.Test">
+ classes="@org.jboss.test.microcontainer.support.Lifecycle">
</aop:lifecycle-configure>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic1.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic1.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic1.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -7,7 +7,7 @@
<aop:lifecycle-start xmlns:aop="urn:jboss:aop-beans:1.0"
name="LifecycleCallbackStart"
class="org.jboss.test.microcontainer.support.SimpleLifecycleCallback"
- classes="@org.jboss.test.microcontainer.support.Test">
+ classes="@org.jboss.test.microcontainer.support.Lifecycle">
</aop:lifecycle-start>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic2.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic2.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UndeployLifecycleCallbackDependencyTestCaseNotAutomatic2.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -4,7 +4,7 @@
<bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
<annotation>@org.jboss.aop.microcontainer.annotations.EnableAopProxy</annotation>
- <annotation>@org.jboss.test.microcontainer.support.Test</annotation>
+ <annotation>@org.jboss.test.microcontainer.support.Lifecycle</annotation>
</bean>
</deployment>
Modified: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCaseNotAutomatic.xml
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCaseNotAutomatic.xml 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/UnwindLifeCycleTestCaseNotAutomatic.xml 2010-01-05 18:07:20 UTC (rev 99038)
@@ -69,7 +69,7 @@
class="org.jboss.test.microcontainer.support.InstallUninstallLifecycleCallback"
classes="@org.jboss.test.microcontainer.support.Start">
</aop:lifecycle-start>
-
+
<aop:lifecycle-install xmlns:aop="urn:jboss:aop-beans:1.0"
name="InstallAdvice1"
class="org.jboss.test.microcontainer.support.InstallUninstallLifecycleCallback"
@@ -85,7 +85,7 @@
<aop:lifecycle-install xmlns:aop="urn:jboss:aop-beans:1.0"
name="ErrorAdvice"
class="org.jboss.test.microcontainer.support.ErrorLifecycleCallback"
- classes="@org.jboss.test.microcontainer.support.Error">
+ classes="@org.jboss.test.microcontainer.support.Install">
</aop:lifecycle-install>
<aop:lifecycle-install xmlns:aop="urn:jboss:aop-beans:1.0"
@@ -101,6 +101,5 @@
<annotation>@org.jboss.test.microcontainer.support.Install</annotation>
<annotation>@org.jboss.test.microcontainer.support.Instantiate</annotation>
<annotation>@org.jboss.test.microcontainer.support.Start</annotation>
- <annotation>@org.jboss.test.microcontainer.support.Error</annotation>
</bean>
</deployment>
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -31,10 +31,13 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.info.spi.PropertyInfo;
@@ -68,8 +71,9 @@
/** The annotation plugins */
private final Map<ElementType, Map<Class<? extends Annotation>, Set<T>>> pluginsMap = new HashMap<ElementType, Map<Class<? extends Annotation>, Set<T>>>();
-
+ ReadWriteLock lock = new ReentrantReadWriteLock();
+
/** The property annotation plugin filter */
private static final AnnotationPluginFilter PROPERTY_FILTER = new PropertyAnnotationPluginFilter();
@@ -104,7 +108,8 @@
if (supported == null || supported.isEmpty())
throw new IllegalArgumentException("Null or empty support types: " + plugin);
- synchronized (pluginsMap)
+ lock.writeLock().lock();
+ try
{
for (ElementType type : supported)
{
@@ -117,12 +122,16 @@
Set<T> plugins = pluginsForType.get(plugin.getAnnotation());
if (plugins == null)
{
- plugins = new HashSet<T>();
+ plugins = new LinkedHashSet<T>();
pluginsForType.put(plugin.getAnnotation(), plugins);
}
plugins.add(plugin);
}
}
+ finally
+ {
+ lock.writeLock().unlock();
+ }
}
/**
@@ -139,7 +148,8 @@
if (supported == null || supported.isEmpty())
throw new IllegalArgumentException("Null or empty support types: " + plugin);
- synchronized (pluginsMap)
+ lock.writeLock().lock();
+ try
{
for (ElementType type : supported)
{
@@ -158,6 +168,10 @@
}
}
}
+ finally
+ {
+ lock.writeLock().unlock();
+ }
}
public void addMetaAnnotationPlugin(T plugin)
@@ -180,7 +194,8 @@
if (supported == null || supported.isEmpty())
throw new IllegalArgumentException("Null or empty support types: " + plugin);
- synchronized (metaAnnotationsPluginsMap)
+ lock.writeLock().lock();
+ try
{
for (ElementType type : supported)
{
@@ -193,12 +208,16 @@
Set<T> plugins = pluginsForType.get(((MetaAnnotationPlugin<?, ?>)plugin).getMetaAnnotation());
if (plugins == null)
{
- plugins = new HashSet<T>();
+ plugins = new LinkedHashSet<T>();
pluginsForType.put(((MetaAnnotationPlugin<?, ?>)plugin).getMetaAnnotation(), plugins);
}
plugins.add(plugin);
}
}
+ finally
+ {
+ lock.writeLock().unlock();
+ }
}
public void removeMetaAnnotationPlugin(T plugin)
@@ -210,7 +229,8 @@
if (supported == null || supported.isEmpty())
throw new IllegalArgumentException("Null or empty support types: " + plugin);
- synchronized (metaAnnotationsPluginsMap)
+ lock.writeLock().lock();
+ try
{
for (ElementType type : supported)
{
@@ -229,6 +249,10 @@
}
}
}
+ finally
+ {
+ lock.writeLock().unlock();
+ }
}
/**
@@ -270,7 +294,7 @@
* @param the annotation to find a plugin for
* @param filter possible plugins filter
* @param annotationClasses possible annotations
- * @return iterable matching plugins
+ * @return iterable matching plugins. This is a clone of the original
*/
protected Iterable<T> getPlugins(ElementType type, Annotation annotation, AnnotationPluginFilter filter, Collection<Class<? extends Annotation>> annotationClasses)
{
@@ -282,14 +306,23 @@
return Collections.emptySet();
Set<T> plugins = null;
- synchronized (pluginsMap)
+ lock.readLock().lock();
+ try
{
Map<Class<? extends Annotation>, Set<T>> pluginsForType = pluginsMap.get(type);
if (pluginsForType != null)
{
plugins = pluginsForType.get(annotation.annotationType());
+
+ //Clone the collection since somebody might change it while we read it
+ if (plugins != null && !plugins.isEmpty())
+ plugins = new LinkedHashSet<T>(plugins);
}
}
+ finally
+ {
+ lock.readLock().unlock();
+ }
if (plugins == null || plugins.isEmpty())
return Collections.emptySet();
@@ -310,6 +343,35 @@
}
/**
+ * Get plugins for metaannotations.
+ *
+ * @param type the element type to match
+ * @return A map of the mathing plugins indexed by metaannotation. This is a clone of the original
+ */
+ protected Map<Class<? extends Annotation>, Set<T>> getMetaAnnotationsForType(ElementType type)
+ {
+ lock.readLock().lock();
+ try
+ {
+ Map<Class<? extends Annotation>, Set<T>> metaAnnotationsForType = metaAnnotationsPluginsMap.get(type);
+ if (metaAnnotationsForType == null || metaAnnotationsForType.isEmpty())
+ return Collections.emptyMap();
+
+ Map<Class<? extends Annotation>, Set<T>> clone = new HashMap<Class<? extends Annotation>, Set<T>>();
+ for (Entry<Class<? extends Annotation>, Set<T>> entry : metaAnnotationsForType.entrySet())
+ {
+ clone.put(entry.getKey(), new LinkedHashSet<T>(entry.getValue()));
+ }
+
+ return clone;
+ }
+ finally
+ {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
* Handle apply or cleanup of annotations.
*
* @param info the bean info
@@ -360,7 +422,7 @@
}
//Meta annotations on class
- Map<Class<? extends Annotation>, Set<T>> metaAnnotationsForType = metaAnnotationsPluginsMap.get(ElementType.TYPE);
+ Map<Class<? extends Annotation>, Set<T>> metaAnnotationsForType = getMetaAnnotationsForType(ElementType.TYPE);
if (metaAnnotationsForType != null)
{
for (Entry<Class<? extends Annotation>, Set<T>> entry : metaAnnotationsForType.entrySet())
@@ -572,5 +634,5 @@
protected MethodInfo[] getStaticMethods(ClassInfo classInfo)
{
return classInfo.getDeclaredMethods();
- }
+ }
}
\ No newline at end of file
Added: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/LifecycleAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/LifecycleAnnotationPlugin.java (rev 0)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/LifecycleAnnotationPlugin.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.kernel.plugins.annotations;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.kernel.spi.dependency.DependencyBuilderListItem;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.reflect.spi.ClassInfo;
+
+/**
+ * Annotation plugin to handle annotations that should trigger lifecycle callbacks
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LifecycleAnnotationPlugin<C extends Annotation> extends ClassAnnotationPlugin<C>
+{
+ Logger log = Logger.getLogger(LifecycleAnnotationPlugin.class);
+
+ private final DependencyBuilderListItem item;
+
+ public LifecycleAnnotationPlugin(Class<C> annotation, DependencyBuilderListItem item)
+ {
+ super(annotation);
+ if (item == null)
+ throw new IllegalArgumentException("Null dependency builder list item");
+ this.item = item;
+ }
+
+ @Override
+ protected boolean isCleanup()
+ {
+ return true;
+ }
+
+ @Override
+ protected boolean isCleanupOnly()
+ {
+ return false;
+ }
+
+ @Override
+ protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(ClassInfo info, MetaData retrieval, C annotation, KernelControllerContext context) throws Throwable
+ {
+ item.addDependency(context);
+ return null;
+ }
+
+ @Override
+ protected void internalCleanAnnotation(ClassInfo info, MetaData retrieval, C annotation, KernelControllerContext context) throws Throwable
+ {
+ item.removeDependency(context);
+ }
+}
Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPlugin.java (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPlugin.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -0,0 +1,88 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.kernel.annotations.support;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.kernel.plugins.annotations.ClassAnnotationPlugin;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.reflect.spi.ClassInfo;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestOrderPlugin<C extends Annotation> extends ClassAnnotationPlugin<C>
+{
+ int index;
+ static List<Integer> applied = new ArrayList<Integer>();
+ static List<Integer> cleaned = new ArrayList<Integer>();
+
+ protected TestOrderPlugin(Class<C> annotation, int index)
+ {
+ super(annotation);
+ this.index = index;
+ }
+
+ @Override
+ protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(ClassInfo info, C annotation,
+ BeanMetaData beanMetaData) throws Throwable
+ {
+ applied.add(index);
+ return null;
+ }
+
+ @Override
+ protected void internalCleanAnnotation(ClassInfo info, MetaData retrieval, C annotation,
+ KernelControllerContext context) throws Throwable
+ {
+ cleaned.add(index);
+ }
+
+ @Override
+ protected boolean isCleanup()
+ {
+ return true;
+ }
+
+ public static void clear()
+ {
+ applied.clear();
+ cleaned.clear();
+ }
+
+ public static List<Integer> getApplied()
+ {
+ return applied;
+ }
+
+ public static List<Integer> getCleaned()
+ {
+ return cleaned;
+ }
+}
Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPluginBean.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPluginBean.java (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderPluginBean.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.kernel.annotations.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Green
+public class TestOrderPluginBean
+{
+
+}
Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderedPluginAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderedPluginAnnotationAdapter.java (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestOrderedPluginAnnotationAdapter.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.annotations.support;
+
+import org.jboss.kernel.plugins.annotations.AbstractBeanAnnotationAdapter;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class TestOrderedPluginAnnotationAdapter extends AbstractBeanAnnotationAdapter
+{
+ public static final TestOrderedPluginAnnotationAdapter INSTANCE = new TestOrderedPluginAnnotationAdapter();
+
+ private TestOrderedPluginAnnotationAdapter()
+ {
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 0));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 1));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 2));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 3));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 4));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 5));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 6));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 7));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 8));
+ addAnnotationPlugin(new TestOrderPlugin<Green>(Green.class, 9));
+ }
+}
Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java 2010-01-05 18:06:14 UTC (rev 99037)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -59,6 +59,7 @@
suite.addTest(SearchTestSuite.suite());
suite.addTest(AnnotatedConstructorTestSuite.suite());
suite.addTest(AnnotatedMethodTestSuite.suite());
+ suite.addTest(OrderedAnnotationPluginsTestCase.suite());
return suite;
}
Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/OrderedAnnotationPluginsTestCase.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/OrderedAnnotationPluginsTestCase.java (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/test/OrderedAnnotationPluginsTestCase.java 2010-01-05 18:07:20 UTC (rev 99038)
@@ -0,0 +1,72 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.annotations.test;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapter;
+import org.jboss.test.kernel.annotations.support.TestOrderPlugin;
+import org.jboss.test.kernel.annotations.support.TestOrderPluginBean;
+import org.jboss.test.kernel.annotations.support.TestOrderedPluginAnnotationAdapter;
+
+/**
+ * Test that annotation plugins for a given annotation happen in the order they were added.
+ * This is important for the AOP lifecycle callbacks see UnwindLifecycleTestCase in aop-mc-int.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OrderedAnnotationPluginsTestCase extends AbstractBeanAnnotationAdapterTest
+{
+ public OrderedAnnotationPluginsTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(OrderedAnnotationPluginsTestCase.class);
+ }
+
+ protected BeanAnnotationAdapter getBeanAnnotationAdapterClass()
+ {
+ return TestOrderedPluginAnnotationAdapter.INSTANCE;
+ }
+
+ public void testCleanup() throws Throwable
+ {
+ TestOrderPlugin.clear();
+ runAnnotationsOnTarget(new TestOrderPluginBean());
+
+ List<Integer> applied = TestOrderPlugin.getApplied();
+ assertEquals(10, applied.size());
+ for (int i = 0 ; i < 10 ; i++)
+ assertEquals(Integer.valueOf(i), applied.get(i));
+
+ List<Integer> cleaned = TestOrderPlugin.getCleaned();
+ assertEquals(10, cleaned.size());
+ for (int i = 0 ; i < 10 ; i++)
+ assertEquals(Integer.valueOf(i), cleaned.get(i));
+ }
+
+}
More information about the jboss-cvs-commits
mailing list