[jboss-cvs] JBossAS SVN: r73522 - in projects/microcontainer/trunk/kernel/src: main/org/jboss/kernel/plugins/annotations/wb and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 20 08:57:30 EDT 2008
Author: alesj
Date: 2008-05-20 08:57:29 -0400 (Tue, 20 May 2008)
New Revision: 73522
Added:
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/CacheKey.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectFieldAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AbstractAfterInstallVerifier.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/GBProvider.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/Provider.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RBProvider.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGBProvider.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGProvider.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/WBTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBInjectionTestCase.java
Modified:
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ArrayValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ClassFactoryAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CollectionValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ConstructorParameterAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CreateLifecycleAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/DestroyLifecycleAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InstallMethodParameterAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/JavaBeanValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ListValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/MapValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/NullValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/SetValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StartLifecycleAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StopLifecycleAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ThisValueAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/UninstallMethodParameterAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectionResolver.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AfterInstallVerifier.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/OtherVerifier.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/OwnDependencyTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/field/BasicFieldAnnotationSupportTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBTestSuite.java
Log:
Annotation IoC fix.
WB tests.
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ArrayValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ArrayValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ArrayValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -33,9 +33,9 @@
*/
public class ArrayValueAnnotationPlugin extends CollectionsAnnotationPlugin<ArrayValue>
{
- static ArrayValueAnnotationPlugin INSTANCE = new ArrayValueAnnotationPlugin();
+ public static final ArrayValueAnnotationPlugin INSTANCE = new ArrayValueAnnotationPlugin();
- public ArrayValueAnnotationPlugin()
+ protected ArrayValueAnnotationPlugin()
{
super(ArrayValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ClassFactoryAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ClassFactoryAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ClassFactoryAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -45,7 +45,7 @@
*/
public class ClassFactoryAnnotationPlugin extends AbstractAdaptersAnnotationPlugin<ClassInfo, Factory>
{
- protected ClassFactoryAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public ClassFactoryAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(Factory.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CollectionValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CollectionValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CollectionValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -33,9 +33,9 @@
*/
public class CollectionValueAnnotationPlugin extends CollectionsAnnotationPlugin<CollectionValue>
{
- static CollectionValueAnnotationPlugin INSTANCE = new CollectionValueAnnotationPlugin();
+ public static final CollectionValueAnnotationPlugin INSTANCE = new CollectionValueAnnotationPlugin();
- public CollectionValueAnnotationPlugin()
+ protected CollectionValueAnnotationPlugin()
{
super(CollectionValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ConstructorParameterAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ConstructorParameterAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ConstructorParameterAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -41,7 +41,7 @@
*/
public class ConstructorParameterAnnotationPlugin extends AbstractConstructorParameterAnnotationPlugin<Constructor, AbstractConstructorMetaData>
{
- protected ConstructorParameterAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public ConstructorParameterAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(Constructor.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CreateLifecycleAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CreateLifecycleAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/CreateLifecycleAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -36,7 +36,7 @@
*/
public class CreateLifecycleAnnotationPlugin extends LifecycleParameterAnnotationPlugin<Create>
{
- protected CreateLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public CreateLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(Create.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/DestroyLifecycleAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/DestroyLifecycleAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/DestroyLifecycleAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -36,7 +36,7 @@
*/
public class DestroyLifecycleAnnotationPlugin extends LifecycleParameterAnnotationPlugin<Destroy>
{
- protected DestroyLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public DestroyLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(Destroy.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -31,9 +31,9 @@
*/
public class InjectAnnotationPlugin extends PropertyAnnotationPlugin<Inject>
{
- static InjectAnnotationPlugin INSTANCE = new InjectAnnotationPlugin();
+ public final static InjectAnnotationPlugin INSTANCE = new InjectAnnotationPlugin();
- public InjectAnnotationPlugin()
+ protected InjectAnnotationPlugin()
{
super(Inject.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InstallMethodParameterAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InstallMethodParameterAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/InstallMethodParameterAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -41,7 +41,7 @@
*/
public class InstallMethodParameterAnnotationPlugin extends InstallationParameterAnnotationPlugin<InstallMethod>
{
- protected InstallMethodParameterAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public InstallMethodParameterAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(InstallMethod.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/JavaBeanValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/JavaBeanValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/JavaBeanValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -38,7 +38,7 @@
*/
public class JavaBeanValueAnnotationPlugin extends PropertyAnnotationPlugin<JavaBeanValue>
{
- static JavaBeanValueAnnotationPlugin INSTANCE = new JavaBeanValueAnnotationPlugin();
+ public static final JavaBeanValueAnnotationPlugin INSTANCE = new JavaBeanValueAnnotationPlugin();
/** The configuration */
private static Configuration configuration;
@@ -55,7 +55,7 @@
});
}
- public JavaBeanValueAnnotationPlugin()
+ protected JavaBeanValueAnnotationPlugin()
{
super(JavaBeanValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ListValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ListValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ListValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -33,9 +33,9 @@
*/
public class ListValueAnnotationPlugin extends CollectionsAnnotationPlugin<ListValue>
{
- static ListValueAnnotationPlugin INSTANCE = new ListValueAnnotationPlugin();
+ public static final ListValueAnnotationPlugin INSTANCE = new ListValueAnnotationPlugin();
- public ListValueAnnotationPlugin()
+ protected ListValueAnnotationPlugin()
{
super(ListValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/MapValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/MapValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/MapValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -33,9 +33,9 @@
*/
public class MapValueAnnotationPlugin extends CollectionsAnnotationPlugin<MapValue>
{
- static MapValueAnnotationPlugin INSTANCE = new MapValueAnnotationPlugin();
+ public static final MapValueAnnotationPlugin INSTANCE = new MapValueAnnotationPlugin();
- public MapValueAnnotationPlugin()
+ protected MapValueAnnotationPlugin()
{
super(MapValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/NullValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/NullValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/NullValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -32,9 +32,9 @@
*/
public class NullValueAnnotationPlugin extends PropertyAnnotationPlugin<NullValue>
{
- static NullValueAnnotationPlugin INSTANCE = new NullValueAnnotationPlugin();
+ public static final NullValueAnnotationPlugin INSTANCE = new NullValueAnnotationPlugin();
- public NullValueAnnotationPlugin()
+ protected NullValueAnnotationPlugin()
{
super(NullValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/SetValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/SetValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/SetValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -33,9 +33,9 @@
*/
public class SetValueAnnotationPlugin extends CollectionsAnnotationPlugin<SetValue>
{
- static SetValueAnnotationPlugin INSTANCE = new SetValueAnnotationPlugin();
+ public static final SetValueAnnotationPlugin INSTANCE = new SetValueAnnotationPlugin();
- public SetValueAnnotationPlugin()
+ protected SetValueAnnotationPlugin()
{
super(SetValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StartLifecycleAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StartLifecycleAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StartLifecycleAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -36,7 +36,7 @@
*/
public class StartLifecycleAnnotationPlugin extends LifecycleParameterAnnotationPlugin<Start>
{
- protected StartLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public StartLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(Start.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StopLifecycleAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StopLifecycleAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StopLifecycleAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -36,7 +36,7 @@
*/
public class StopLifecycleAnnotationPlugin extends LifecycleParameterAnnotationPlugin<Stop>
{
- protected StopLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public StopLifecycleAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(Stop.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/StringValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -32,9 +32,9 @@
*/
public class StringValueAnnotationPlugin extends PropertyAnnotationPlugin<StringValue>
{
- static StringValueAnnotationPlugin INSTANCE = new StringValueAnnotationPlugin();
+ public static final StringValueAnnotationPlugin INSTANCE = new StringValueAnnotationPlugin();
- public StringValueAnnotationPlugin()
+ protected StringValueAnnotationPlugin()
{
super(StringValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ThisValueAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ThisValueAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ThisValueAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -32,9 +32,9 @@
*/
public class ThisValueAnnotationPlugin extends PropertyAnnotationPlugin<ThisValue>
{
- static ThisValueAnnotationPlugin INSTANCE = new ThisValueAnnotationPlugin();
+ public static final ThisValueAnnotationPlugin INSTANCE = new ThisValueAnnotationPlugin();
- public ThisValueAnnotationPlugin()
+ protected ThisValueAnnotationPlugin()
{
super(ThisValue.class);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/UninstallMethodParameterAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/UninstallMethodParameterAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/UninstallMethodParameterAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -41,7 +41,7 @@
*/
public class UninstallMethodParameterAnnotationPlugin extends InstallationParameterAnnotationPlugin<UninstallMethod>
{
- protected UninstallMethodParameterAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
+ public UninstallMethodParameterAnnotationPlugin(Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters)
{
super(UninstallMethod.class, adapters);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -31,9 +31,9 @@
*/
public class ValueFactoryAnnotationPlugin extends PropertyAnnotationPlugin<ValueFactory>
{
- static ValueFactoryAnnotationPlugin INSTANCE = new ValueFactoryAnnotationPlugin();
+ public static final ValueFactoryAnnotationPlugin INSTANCE = new ValueFactoryAnnotationPlugin();
- public ValueFactoryAnnotationPlugin()
+ protected ValueFactoryAnnotationPlugin()
{
super(ValueFactory.class);
}
Copied: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/CacheKey.java (from rev 73504, projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectionResolver.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/CacheKey.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/CacheKey.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,79 @@
+/*
+* 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.kernel.plugins.annotations.wb;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Contexts cache key.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+// TODO - fix this key to have weak notion
+class CacheKey
+{
+ private Class<?> clazz;
+ private Annotation[] annotations;
+
+ CacheKey(Class<?> clazz, Annotation[] annotations)
+ {
+ this.clazz = clazz;
+ this.annotations = annotations;
+ }
+
+ public int hashCode()
+ {
+ int hash = clazz.hashCode();
+ for (Annotation annotation : annotations)
+ hash += (3 * annotation.hashCode());
+ return hash;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof CacheKey == false)
+ return false;
+
+ CacheKey ck = (CacheKey)obj;
+ if (clazz.equals(ck.clazz) == false)
+ return false;
+ if (annotations.length != ck.annotations.length)
+ return false;
+
+ for (Annotation annotation : annotations)
+ {
+ boolean match = false;
+ for (Annotation ckAnnotation : ck.annotations)
+ {
+ if (annotation.equals(ckAnnotation))
+ {
+ match = true;
+ break;
+ }
+ }
+ if (match == false)
+ return false;
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectAnnotationPlugin.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -21,12 +21,6 @@
*/
package org.jboss.kernel.plugins.annotations.wb;
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
import org.jboss.beans.info.spi.PropertyInfo;
import org.jboss.beans.metadata.api.annotations.Inject;
import org.jboss.beans.metadata.spi.ValueMetaData;
@@ -40,66 +34,22 @@
*/
public class WBInjectAnnotationPlugin extends PropertyAnnotationPlugin<Inject>
{
- private Set<Class<? extends Annotation>> excludedAnnotations = new HashSet<Class<? extends Annotation>>();
+ public static final WBInjectAnnotationPlugin INSTANCE = new WBInjectAnnotationPlugin();
- public WBInjectAnnotationPlugin()
+ protected WBInjectAnnotationPlugin()
{
super(Inject.class);
- addExcludedAnnotation(Inject.class);
- // exclude jdk annotations
- addExcludedAnnotation(SuppressWarnings.class);
- addExcludedAnnotation(Deprecated.class);
- addExcludedAnnotation(Override.class);
}
@SuppressWarnings("deprecation")
protected ValueMetaData createValueMetaData(PropertyInfo info, Inject inject)
{
- return createValueMetaData(info.getType().getType(), info.getUnderlyingAnnotations());
+ return WBInjectionResolver.createValueMetaData(info.getType().getType(), info.getUnderlyingAnnotations());
}
@SuppressWarnings("deprecation")
public ValueMetaData createValueMetaData(ParameterInfo info, Inject inject, ValueMetaData previousValue)
{
- return createValueMetaData(info.getParameterType().getType(), info.getUnderlyingAnnotations());
+ return WBInjectionResolver.createValueMetaData(info.getParameterType().getType(), info.getUnderlyingAnnotations());
}
-
- /**
- * Create wb injection value.
- *
- * @param type the matching type
- * @param underlyingAnnotations underlying annotations
- * @return injection value metadata
- */
- private ValueMetaData createValueMetaData(Class<?> type, Annotation[] underlyingAnnotations)
- {
- List<Annotation> annotations = new ArrayList<Annotation>();
- for (Annotation annotation : underlyingAnnotations)
- {
- if (isFilterAnnotation(annotation))
- annotations.add(annotation);
- }
- return new WBInjectionValueMetaData(type, annotations.toArray(new Annotation[annotations.size()]));
- }
-
- /**
- * Is this 'filter' candidate annotation.
- *
- * @param annotation the annotation
- * @return true if we should include this in filter annotations
- */
- protected boolean isFilterAnnotation(Annotation annotation)
- {
- return excludedAnnotations.contains(annotation.annotationType()) == false;
- }
-
- /**
- * Add excluded annotations.
- *
- * @param annotationClass the excluded annotation's class.
- */
- public void addExcludedAnnotation(Class<? extends Annotation> annotationClass)
- {
- excludedAnnotations.add(annotationClass);
- }
}
Copied: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectFieldAnnotationPlugin.java (from rev 73498, projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectAnnotationPlugin.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectFieldAnnotationPlugin.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectFieldAnnotationPlugin.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,48 @@
+/*
+* 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.kernel.plugins.annotations.wb;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.kernel.plugins.annotations.FieldAnnotationPlugin;
+import org.jboss.reflect.spi.FieldInfo;
+
+/**
+ * Web beans kind of inject.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WBInjectFieldAnnotationPlugin extends FieldAnnotationPlugin<Inject>
+{
+ public static final WBInjectFieldAnnotationPlugin INSTANCE = new WBInjectFieldAnnotationPlugin();
+
+ protected WBInjectFieldAnnotationPlugin()
+ {
+ super(Inject.class);
+ }
+
+ @SuppressWarnings("deprecation")
+ protected ValueMetaData createValueMetaData(FieldInfo info, Inject inject)
+ {
+ return WBInjectionResolver.createValueMetaData(info.getType().getType(), info.getUnderlyingAnnotations());
+ }
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectionResolver.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectionResolver.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/wb/WBInjectionResolver.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -26,12 +26,16 @@
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
+import java.util.List;
+import java.util.ArrayList;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.logging.Logger;
import org.jboss.metadata.spi.MetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.api.annotations.Inject;
/**
* Web beans injection resolver.
@@ -41,12 +45,52 @@
public class WBInjectionResolver
{
/** The log */
- private static Logger log = Logger.getLogger(WBInjectionResolver.class);
+ private static final Logger log = Logger.getLogger(WBInjectionResolver.class);
/** The cache */
- private static Map<Class<?>, Map<KernelControllerContext, Boolean>> cache = new WeakHashMap<Class<?>, Map<KernelControllerContext, Boolean>>();
+ private static final Map<CacheKey, Map<KernelControllerContext, Boolean>> cache = new WeakHashMap<CacheKey, Map<KernelControllerContext, Boolean>>();
+ /** The excluded annotation */
+ private static final Set<Class<? extends Annotation>> excludedAnnotations = new HashSet<Class<? extends Annotation>>();
+
+ static
+ {
+ addExcludedAnnotation(Inject.class);
+ // exclude jdk annotations
+ addExcludedAnnotation(SuppressWarnings.class);
+ addExcludedAnnotation(Deprecated.class);
+ addExcludedAnnotation(Override.class);
+ }
+
/**
+ * Create wb injection value.
+ *
+ * @param type the matching type
+ * @param underlyingAnnotations underlying annotations
+ * @return injection value metadata
+ */
+ static ValueMetaData createValueMetaData(Class<?> type, Annotation[] underlyingAnnotations)
+ {
+ List<Annotation> annotations = new ArrayList<Annotation>();
+ for (Annotation annotation : underlyingAnnotations)
+ {
+ if (excludedAnnotations.contains(annotation.annotationType()) == false)
+ annotations.add(annotation);
+ }
+ return new WBInjectionValueMetaData(type, annotations.toArray(new Annotation[annotations.size()]));
+ }
+
+ /**
+ * Add excluded annotations.
+ *
+ * @param annotationClass the excluded annotation's class.
+ */
+ public static void addExcludedAnnotation(Class<? extends Annotation> annotationClass)
+ {
+ excludedAnnotations.add(annotationClass);
+ }
+
+ /**
* Find matching controller context.
*
* @param controller the kernel controller
@@ -66,11 +110,12 @@
Set<KernelControllerContext> contexts = controller.getContexts(type, ControllerState.INSTALLED);
if (contexts != null && contexts.isEmpty() == false)
{
- Map<KernelControllerContext, Boolean> cachedResults = cache.get(type);
+ CacheKey key = new CacheKey(type, annotations);
+ Map<KernelControllerContext, Boolean> cachedResults = cache.get(key);
if (cachedResults == null)
{
cachedResults = new WeakHashMap<KernelControllerContext, Boolean>();
- cache.put(type, cachedResults);
+ cache.put(key, cachedResults);
}
Set<KernelControllerContext> matchingContexts = new HashSet<KernelControllerContext>();
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AbstractAfterInstallVerifier.java (from rev 73486, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AfterInstallVerifier.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AbstractAfterInstallVerifier.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AbstractAfterInstallVerifier.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,40 @@
+/*
+* 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.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+
+/**
+ * Abstract annotation runner test.
+ *
+ * @param <T> exact type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractAfterInstallVerifier<T> implements AfterInstallVerifier<T> {
+
+ public void verifyContext(KernelControllerContext context)
+ {
+ if (ControllerState.INSTALLED.equals(context.getState()) == false)
+ throw new IllegalArgumentException("Expecting INSTALLED state, but is " + context.getState());
+ }
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AfterInstallVerifier.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AfterInstallVerifier.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/AfterInstallVerifier.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.kernel.annotations.support;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+
/**
* Abstract annotation runner test.
*
@@ -29,6 +31,8 @@
*/
public interface AfterInstallVerifier<T>
{
+ void verifyContext(KernelControllerContext context);
+
void verify(T target);
Class<T> getTargetClass();
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/GBProvider.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/GBProvider.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/GBProvider.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.annotations.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Green
+ at Blue
+public class GBProvider extends Provider
+{
+ public GBProvider()
+ {
+ super("GB");
+ }
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/OtherVerifier.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/OtherVerifier.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/OtherVerifier.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -26,7 +26,7 @@
/**
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class OtherVerifier implements AfterInstallVerifier<Object>
+public class OtherVerifier extends AbstractAfterInstallVerifier<Object>
{
public void verify(Object target)
{
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/Provider.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/Provider.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/Provider.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,40 @@
+/*
+* 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;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class Provider
+{
+ private String type;
+
+ public Provider(String type)
+ {
+ this.type = type;
+ }
+
+ public String toString()
+ {
+ return type;
+ }
+}
\ No newline at end of file
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RBProvider.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RBProvider.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RBProvider.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.annotations.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Red
+ at Blue
+public class RBProvider extends Provider
+{
+ public RBProvider()
+ {
+ super("RB");
+ }
+}
\ No newline at end of file
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGBProvider.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGBProvider.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGBProvider.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,36 @@
+/*
+* 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;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Red
+ at Green
+ at Blue
+public class RGBProvider extends Provider
+{
+ public RGBProvider()
+ {
+ super("RGB");
+ }
+}
\ No newline at end of file
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGProvider.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGProvider.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/RGProvider.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.annotations.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Red
+ at Green
+public class RGProvider extends Provider
+{
+ public RGProvider()
+ {
+ super("RG");
+ }
+}
\ No newline at end of file
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/WBTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/WBTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/WBTester.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,80 @@
+/*
+* 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.beans.metadata.api.annotations.Constructor;
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.Start;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WBTester
+{
+ @Red
+ @Green
+ @Inject
+ private Provider rg_provider;
+ private Provider rb_provider;
+ private Provider gb_provider1;
+ private Provider gb_provider2;
+
+ @Constructor
+ public WBTester(@Green @Blue @Inject Provider gb_provider1)
+ {
+ this.gb_provider1 = gb_provider1;
+ }
+
+ public Provider getRg_provider()
+ {
+ return rg_provider;
+ }
+
+ public Provider getRb_provider()
+ {
+ return rb_provider;
+ }
+
+ @Red
+ @Blue
+ @Inject
+ public void setRb_provider(Provider rb_provider)
+ {
+ this.rb_provider = rb_provider;
+ }
+
+ public Provider getGb_provider1()
+ {
+ return gb_provider1;
+ }
+
+ public Provider getGb_provider2()
+ {
+ return gb_provider2;
+ }
+
+ @Start
+ public void doStart(@Green @Blue @Inject Provider gb_provider2)
+ {
+ this.gb_provider2 = gb_provider2;
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -104,7 +104,7 @@
try
{
KernelControllerContext context = controller.install(beanMetaData, target);
- checkContextState(context);
+ checkContextState(clazz, context);
if (target == null)
target = clazz.cast(context.getTarget());
doTestAfterInstall(clazz, target);
@@ -115,9 +115,13 @@
}
}
- protected void checkContextState(KernelControllerContext context)
+ protected void checkContextState(Class<?> clazz, KernelControllerContext context)
{
- assertEquals(ControllerState.INSTALLED, context.getState());
+ AfterInstallVerifier verifier = (AfterInstallVerifier) verifiers.get(clazz);
+ if (verifier != null)
+ verifier.verifyContext(context);
+ else
+ assertEquals(ControllerState.INSTALLED, context.getState());
}
protected <T> void addVerifier(AfterInstallVerifier<T> verifier)
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/OwnDependencyTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/OwnDependencyTestCase.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/OwnDependencyTestCase.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -50,7 +50,7 @@
runAnnotationsOnTarget(new MyOwnDependency());
}
- protected void checkContextState(KernelControllerContext context)
+ protected void checkContextState(Class<?> clazz, KernelControllerContext context)
{
assertEquals(ControllerState.DESCRIBED, context.getState());
}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/field/BasicFieldAnnotationSupportTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/field/BasicFieldAnnotationSupportTestCase.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/field/BasicFieldAnnotationSupportTestCase.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -21,19 +21,20 @@
*/
package org.jboss.test.kernel.annotations.test.field;
-import org.jboss.test.kernel.annotations.test.AbstractBeanAnnotationAdapterTest;
+import junit.framework.Test;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapter;
+import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapterFactory;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.test.kernel.annotations.support.AbstractAfterInstallVerifier;
import org.jboss.test.kernel.annotations.support.AfterInstallVerifier;
+import org.jboss.test.kernel.annotations.support.CallbacksTester;
+import org.jboss.test.kernel.annotations.support.InjectTester;
+import org.jboss.test.kernel.annotations.support.MyDeployer;
import org.jboss.test.kernel.annotations.support.TestBean;
-import org.jboss.test.kernel.annotations.support.MyDeployer;
-import org.jboss.test.kernel.annotations.support.InjectTester;
import org.jboss.test.kernel.annotations.support.ValueFactoryTester;
-import org.jboss.test.kernel.annotations.support.CallbacksTester;
-import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapter;
-import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapterFactory;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.beans.info.spi.BeanAccessMode;
-import junit.framework.Test;
+import org.jboss.test.kernel.annotations.test.AbstractBeanAnnotationAdapterTest;
/**
* Basic field annotation IoC support
@@ -141,7 +142,7 @@
assertTrue(tester.publicBeans == null || tester.publicBeans.isEmpty());
}
- private class InjectTesterVerifier implements AfterInstallVerifier<InjectTester>
+ private class InjectTesterVerifier extends AbstractAfterInstallVerifier<InjectTester>
{
public void verify(InjectTester target)
{
@@ -167,7 +168,7 @@
}
}
- private class VFTesterVerifier implements AfterInstallVerifier<ValueFactoryTester>
+ private class VFTesterVerifier extends AbstractAfterInstallVerifier<ValueFactoryTester>
{
public void verify(ValueFactoryTester target)
{
@@ -190,7 +191,7 @@
}
}
- private class CallbacksTesterVerifier implements AfterInstallVerifier<CallbacksTester>
+ private class CallbacksTesterVerifier extends AbstractAfterInstallVerifier<CallbacksTester>
{
public void verify(CallbacksTester target)
{
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBInjectionTestCase.java (from rev 73486, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/AnnotationsMatchingTestCase.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBInjectionTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBInjectionTestCase.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -0,0 +1,136 @@
+/*
+* 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.wb;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.plugins.annotations.AbstractBeanAnnotationAdapter;
+import org.jboss.kernel.plugins.annotations.Annotation2ValueMetaDataAdapter;
+import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapter;
+import org.jboss.kernel.plugins.annotations.ConstructorParameterAnnotationPlugin;
+import org.jboss.kernel.plugins.annotations.StartLifecycleAnnotationPlugin;
+import org.jboss.kernel.plugins.annotations.wb.WBInjectAnnotationPlugin;
+import org.jboss.kernel.plugins.annotations.wb.WBInjectFieldAnnotationPlugin;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.annotations.support.AfterInstallVerifier;
+import org.jboss.test.kernel.annotations.support.GBProvider;
+import org.jboss.test.kernel.annotations.support.RBProvider;
+import org.jboss.test.kernel.annotations.support.RGBProvider;
+import org.jboss.test.kernel.annotations.support.RGProvider;
+import org.jboss.test.kernel.annotations.support.WBTester;
+import org.jboss.test.kernel.annotations.test.AbstractBeanAnnotationAdapterTest;
+
+/**
+ * WB injection tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WBInjectionTestCase extends AbstractBeanAnnotationAdapterTest
+{
+ public WBInjectionTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(WBInjectionTestCase.class);
+ }
+
+ protected BeanAnnotationAdapter getBeanAnnotationAdapterClass()
+ {
+ AbstractBeanAnnotationAdapter adapter = new AbstractBeanAnnotationAdapter();
+ // wb injection
+ adapter.addAnnotationPlugin(WBInjectFieldAnnotationPlugin.INSTANCE);
+ adapter.addAnnotationPlugin(WBInjectAnnotationPlugin.INSTANCE);
+ // parameter adapter
+ Annotation2ValueMetaDataAdapter<? extends Annotation> paramAdapter = WBInjectAnnotationPlugin.INSTANCE;
+ Set<Annotation2ValueMetaDataAdapter<? extends Annotation>> adapters = new HashSet<Annotation2ValueMetaDataAdapter<? extends Annotation>>();
+ adapters.add(paramAdapter);
+ // parameter injections
+ adapter.addAnnotationPlugin(new ConstructorParameterAnnotationPlugin(adapters));
+ adapter.addAnnotationPlugin(new StartLifecycleAnnotationPlugin(adapters));
+
+ return adapter;
+ }
+
+ public void testInjection() throws Throwable
+ {
+ KernelController controller = getController();
+ controller.install(new AbstractBeanMetaData("rg", RGProvider.class.getName()));
+ controller.install(new AbstractBeanMetaData("rb", RBProvider.class.getName()));
+ controller.install(new AbstractBeanMetaData("gb", GBProvider.class.getName()));
+
+ runAnnotationsOnClass(WBTester.class, BeanAccessMode.ALL);
+ }
+
+ public void testMultiple() throws Throwable
+ {
+ KernelController controller = getController();
+ controller.install(new AbstractBeanMetaData("gb", GBProvider.class.getName()));
+ controller.install(new AbstractBeanMetaData("rgb", RGBProvider.class.getName()));
+
+ AfterInstallVerifier<WBTester> verifier = new AfterInstallVerifier<WBTester>()
+ {
+ public void verifyContext(KernelControllerContext context)
+ {
+ assertEquals(ControllerState.DESCRIBED, context.getState());
+ }
+
+ public void verify(WBTester target)
+ {
+ assertNull(target);
+ }
+
+ public Class<WBTester> getTargetClass()
+ {
+ return WBTester.class;
+ }
+ };
+ addVerifier(verifier);
+ try
+ {
+ runAnnotationsOnClass(WBTester.class, BeanAccessMode.ALL);
+ }
+ finally
+ {
+ removeVerifier(WBTester.class);
+ }
+ }
+
+ protected void doTestAfterInstall(Object target)
+ {
+ WBTester demander = (WBTester)target;
+ assertEquals("RG", demander.getRg_provider() + "");
+ assertEquals("RB", demander.getRb_provider() + "");
+ assertEquals("GB", demander.getGb_provider1() + "");
+ assertEquals("GB", demander.getGb_provider2() + "");
+ assertEquals(demander.getGb_provider1(), demander.getGb_provider2());
+ }
+}
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBTestSuite.java 2008-05-20 12:28:58 UTC (rev 73521)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/wb/WBTestSuite.java 2008-05-20 12:57:29 UTC (rev 73522)
@@ -42,6 +42,7 @@
TestSuite suite = new TestSuite("WB Tests");
suite.addTest(AnnotationsMatchingTestCase.suite());
+ suite.addTest(WBInjectionTestCase.suite());
return suite;
}
More information about the jboss-cvs-commits
mailing list