[webbeans-commits] Webbeans SVN: r3837 - ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-04 08:02:24 -0400 (Sun, 04 Oct 2009)
New Revision: 3837
Modified:
ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java
Log:
javadoc
Modified: ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java
===================================================================
--- ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java 2009-10-04 11:49:33 UTC (rev 3836)
+++ ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java 2009-10-04 12:02:24 UTC (rev 3837)
@@ -18,16 +18,44 @@
import org.jboss.webbeans.mock.MockEELifecycle;
import org.jboss.webbeans.mock.TestContainer;
+/**
+ * Configure the AtInject TCK for use with the 299 RI
+ *
+ * @author pmuir
+ *
+ */
public class AtInjectTCK
{
+ /**
+ * The classes that should be deployed as Managed Beans
+ */
+ public static final List<Class<?>> classes = Arrays.<Class<?>>asList(
+ Convertible.class,
+ Seat.class,
+ V8Engine.class,
+ Cupholder.class,
+ FuelTank.class,
+ Tire.class,
+ // Two producer method which allow us to expose SpareTire and Drivers seat with qualifiers
+ DriversSeatProducer.class,
+ SpareTireProducer.class
+ );
- private static final List<Class<?>> classes = Arrays.<Class<?>>asList(Convertible.class, Seat.class, DriversSeatProducer.class, V8Engine.class, Cupholder.class, FuelTank.class, SpareTireProducer.class, Tire.class);
-
+ /**
+ * Create JUnit TestSuite
+ *
+ * @return
+ */
public static Test suite()
{
+ // Create and start the TestContainer, which takes care of starting the container, deploying the
+ // classes, starting the contexts etc.
TestContainer container = new TestContainer(new MockEELifecycle(), classes, null);
container.startContainer();
+
BeanManager beanManager = container.getBeanManager();
+
+ // Obtain a reference to the Car and pass it to the TCK to generate the testsuite
Bean<?> bean = beanManager.resolve(beanManager.getBeans(Car.class));
Car instance = (Car) beanManager.getReference(bean, Car.class, beanManager.createCreationalContext(bean));
return Tck.testsFor(instance, false /* supportsStatic */, true /* supportsPrivate */);
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3836 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/policy and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-04 07:49:33 -0400 (Sun, 04 Oct 2009)
New Revision: 3836
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/CreationalContextForNonContextualTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java
tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
Couple more tests, and a variety of fixes to audit
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/CreationalContextForNonContextualTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/CreationalContextForNonContextualTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/CreationalContextForNonContextualTest.java 2009-10-04 11:49:33 UTC (rev 3836)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.non.contextual;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+@Artifact
+public class CreationalContextForNonContextualTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertion(section = "11.3.3", id = "b")
+ public void testCreationalContext()
+ {
+ assert getCurrentManager().createCreationalContext(null) != null;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/CreationalContextForNonContextualTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java 2009-10-03 01:30:20 UTC (rev 3835)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java 2009-10-04 11:49:33 UTC (rev 3836)
@@ -62,6 +62,14 @@
assert getCurrentManager().getBeans("cat").size() == 1;
assert getCurrentManager().getBeans("dog").size() == 0;
}
+
+ @Test
+ @SpecAssertion(section = "11.1", id = "bc")
+ public void testIsAlternative()
+ {
+ Bean<?> cat = getCurrentManager().resolve(getCurrentManager().getBeans(Cat.class));
+ assert cat.isAlternative();
+ }
@Test(groups = {"policy"})
@SpecAssertions({
Modified: tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-03 01:30:20 UTC (rev 3835)
+++ tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-04 11:49:33 UTC (rev 3836)
@@ -4738,10 +4738,7 @@
<assertion id="faa">
<text>Test with producer method.</text>
</assertion>
-
- <assertion id="fba">
- <text>Test with producer field.</text>
- </assertion>
+
</group>
<assertion id="g">
@@ -5054,13 +5051,18 @@
</section>
<section id="11.3.18" title="Obtaining an InjectionTarget">
- <assertion id="aa">
- <text>The method |BeanManager.createInjectionTarget()| returns a container provided implementation of |InjectionTarget| for a given |AnnotatedType| ~or throws an |IllegalArgumentException| if there is a definition error associated with any injection point of the type~.</text>
- </assertion>
+
+ <group>
+ <text>The method |BeanManager.createInjectionTarget()| returns a container provided implementation of |InjectionTarget| for a given |AnnotatedType| or throws an |IllegalArgumentException| if there is a definition error associated with any injection point of the type.</text>
+ <assertion id="aa">
+ <text>Check |InjectionTarget| is provided.</text>
+ </assertion>
- <assertion id="ab">
- <text>The method |BeanManager.createInjectionTarget()| ~returns a container provided implementation of |InjectionTarget| for a given |AnnotatedType|~ or throws an |IllegalArgumentException| if there is a definition error associated with any injection point of the type.</text>
- </assertion>
+ <assertion id="ab">
+ <text>Check |IllegalArgumentException| is thrown.</text>
+ </assertion>
+ </group>
+
</section>
<section id="11.4" title="Alternative metadata sources">
@@ -5072,7 +5074,6 @@
<assertion id="b" testable="false">
<text>The interface |javax.enterprise.inject.spi.Annotated| exposes the overriding annotations and type declarations.</text>
<note>Statement of intent</note>
-
</assertion>
<assertion id="c">
@@ -5095,9 +5096,111 @@
<text>|isAnnotationPresent()| returns true if the program element has an annotation of the given annotation type, or false otherwise.</text>
</assertion>
- <assertion id="h">
- <text>The container must use the operations of |Annotated| and its subinterfaces to discover program element types and annotations, instead of directly calling the Java Reflection API. In particular, the container must call |Annotated.getBaseType()| to determine the type of an injection point, event parameter or disposed parameter, call |Annotated.getTypeClosure()| to determine the bean types of any kind of bean, call |Annotated.getAnnotations()| to determine the scope, bindings, stereotypes and interceptor bindings of a bean, call |Annotated.isAnnotationPresent()| and |Annotated.getAnnotation()| to read any bean annotations defined by this specification, and call |AnnotatedType.getConstructors()|, |AnnotatedType.getMethods()| and |AnnotatedType.getFields()| to determine the members of a bean class.</text>
- </assertion>
+ <group>
+ <text>The container must use the operations of |Annotated| and its subinterfaces to discover program element types and annotations, instead of directly calling the Java Reflection API. In particular, the container must call |Annotated.getBaseType()| to determine the type of an injection point, event parameter or disposed parameter, call |Annotated.getTypeClosure()| to determine the bean types of any kind of bean, call |Annotated.getAnnotations()| to determine the scope, qualifiers, stereotypes and interceptor bindings of a bean, call |Annotated.isAnnotationPresent()| and |Annotated.getAnnotation()| to read any bean annotations defined by this specification, and call |AnnotatedType.getConstructors()|, |AnnotatedType.getMethods()| and |AnnotatedType.getFields()| to determine the members of a bean class.</text>
+
+ <assertion id="h">
+ <text>Check that |getBaseType()| is used to determine the type of _an injection point_. The base type should be different from the orignal type specified in the class definition</text>
+ </assertion>
+
+ <assertion id="i">
+ <text>Check that |getBaseType()| is used to determine the type of _an event parameter_. The base type should be different from the orignal type specified in the class definition</text>
+ </assertion>
+
+ <assertion id="j">
+ <text>Check that |getBaseType()| is used to determine the type of _disposed parameter_. The base type should be different from the orignal type specified in the class definition</text>
+ </assertion>
+
+ <assertion id="k">
+ <text>Check that a |getTypeClosure()| is used to determine the bean types. The type closure should be different from the orignal type specified in the class definition.</text>
+ </assertion>
+
+ <assertion id="l">
+ <text>Check that |getAnnotations()| is used to determine the bean scope. The annotations should be different from the orignal type specified in the class definition.</text>
+ </assertion>
+
+ <assertion id="m">
+ <text>Check that |getAnnotations()| is used to determine the bean qualifiers. The annotations should be different from the orignal type specified in the class definition.</text>
+ </assertion>
+
+ <assertion id="n">
+ <text>Check that |getAnnotations()| is used to determine the bean stereotypes. The annotations should be different from the orignal type specified in the class definition.</text>
+ </assertion>
+
+ <assertion id="p">
+ <text>Check that |getAnnotations()| is used to determine the bean interceptors. The annotations should be different from the orignal type specified in the class definition.</text>
+ </assertion>
+
+ <assertion id="q" testable="false">
+ <text>Check that |isAnnotationPresent()| returns the provided annotations</text>
+ <note>No testable behavior</note>
+ </assertion>
+
+ <assertion id="r">
+ <text>Check that a previously non-inject-annotated constructor is used by the container to instantiate a bean.</text>
+ </assertion>
+
+ <assertion id="s">
+ <text>Check that a qualifier added to a parameter is used by the container to instantiate a bean.</text>
+ </assertion>
+
+ <assertion id="t">
+ <text>Check that a previously non-inject-annotated field is injected.</text>
+ </assertion>
+
+ <assertion id="u">
+ <text>Check that an extra qualifier is applied.</text>
+ </assertion>
+
+ <assertion id="v">
+ <text>Check that |@Produces| added creates a producer field.</text>
+ </assertion>
+
+ <assertion id="w">
+ <text>Check that a previously non-inject-annotated method is injected.</text>
+ </assertion>
+
+ <assertion id="x">
+ <text>Check that an extra qualifier is applied to an injectable method</text>
+ </assertion>
+
+ <assertion id="y">
+ <text>Check that |@Produces| added creates a producer method</text>
+ </assertion>
+
+ <assertion id="z">
+ <text>Check that an extra qualifier is applied to a producer method.</text>
+ </assertion>
+
+ <assertion id="aa">
+ <text>Check that a qualifer added to a producer method parameter is applied.</text>
+ </assertion>
+
+ <assertion id="ab">
+ <text>Check that |@Disposes| added to a parameter creates a disposes method</text>
+ </assertion>
+
+ <assertion id="ac">
+ <text>Check that an extra qualifier is applied to a disposes method parameter.</text>
+ </assertion>
+
+ <assertion id="ad">
+ <text>Check that a qualifer added to a disposes method injectable parameter is applied.</text>
+ </assertion>
+
+ <assertion id="ae">
+ <text>Check that |@Observes| added to a parameter creates a observer method</text>
+ </assertion>
+
+ <assertion id="af">
+ <text>Check that an extra qualifier is applied to an observes method parameter.</text>
+ </assertion>
+
+ <assertion id="ag">
+ <text>Check that a qualifer added to a observes method injectable parameter is applied.</text>
+ </assertion>
+
+ </group>
</section>
<section id="11.5" title="Container lifecycle events">
@@ -5163,17 +5266,38 @@
<text>|addDefinitionError()| registers a definition error with the container, causing the container to abort deployment after all observers have been notified.</text>
</assertion>
- <assertion id="d">
+ <group>
<text>|addBean()| fires an event of type |ProcessBean| containing the given |Bean| and then registers the |Bean| with the container, thereby making it available for injection into other beans. The given |Bean| may implement |Interceptor| or |Decorator|.</text>
- </assertion>
+
+ <assertion id="da">
+ <text>Check that |ProcessBean| is fired</text>
+ </assertion>
+
+ <assertion id="db">
+ <text>Check that a bean is registered</text>
+ </assertion>
+
+ <assertion id="dc">
+ <text>Check that a decorator is registered</text>
+ </assertion>
+
+ <assertion id="dd">
+ <text>Check that an interceptor is registered</text>
+ </assertion>
+ </group>
- <assertion id="e">
+ <group>
<text>|addObserverMethod()| fires an event of type |ProcessObserverMethod| containing the given |ObserverMethod| and then registers the |ObserverMethod| with the container, thereby making it available for event notifications.</text>
- </assertion>
+ <assertion id="ea">
+ <text>Check that the |ProcessObserverMethod| is fired</text>
+ </assertion>
+ <assertion id="eb">
+ <text>Check that the observer method is registered</text>
+ </assertion>
+ </group>
<assertion id="f">
- <text>|addContext()| registers a custom |Context| object with the container.
-A portable extension may take advantage of this event to register beans, interceptors, decorators, observer methods and custom context objects with the container.</text>
+ <text>|addContext()| registers a custom |Context| object with the container. A portable extension may take advantage of this event to register beans, interceptors, decorators, observer methods and custom context objects with the container.</text>
</assertion>
<assertion id="g">
@@ -5236,17 +5360,112 @@
</section>
<section id="11.5.6" title="ProcessInjectionTarget event">
- <assertion id="a">
+ <group>
<text>The container must fire an event for each managed bean, session bean, Java EE component class supporting injection, producer method or producer field it discovers. The event object must be of type |javax.enterprise.inject.spi.ProcessInjectionTarget<X>|, where |X| is the managed bean class, session bean class or Java EE component class supporting injection.</text>
- </assertion>
-
- <assertion id="ab">
- <text>|getAnnotatedType()| returns the |AnnotatedType| representing the managed bean class, session bean or other Java EE component class supporting injection.</text>
- </assertion>
+ <assertion id="aaa">
+ <text>Test event is fired for a managed bean</text>
+ </assertion>
+ <assertion id="aab">
+ <text>Test event is fired for a session bean</text>
+ </assertion>
+ <assertion id="aac">
+ <text>Test event is fired for a servlet listener</text>
+ </assertion>
+ <assertion id="aad">
+ <text>Test event is fired for a tag handler</text>
+ </assertion>
+ <assertion id="aae">
+ <text>Test event is fired for a tag library listener</text>
+ </assertion>
+ <assertion id="aaf">
+ <text>Test event is fired for an EJB Interceptor</text>
+ </assertion>
+ <assertion id="aag">
+ <text>Test event is fired for a WS endpoint</text>
+ </assertion>
+ <assertion id="aah">
+ <text>Test event is fired for a servlet</text>
+ </assertion>
+ <assertion id="aai">
+ <text>Test event is fired for a filter</text>
+ </assertion>
+ <assertion id="aaj">
+ <text>Test event is fired for a producer method</text>
+ </assertion>
+ <assertion id="aak">
+ <text>Test event is fired for a producer field</text>
+ </assertion>
+ <assertion id="aal">
+ <text>Test type for a managed bean</text>
+ </assertion>
+ <assertion id="aam">
+ <text>Test type for a session bean</text>
+ </assertion>
+ <assertion id="aan">
+ <text>Test type for a servlet listener</text>
+ </assertion>
+ <assertion id="aao">
+ <text>Test type for a tag handler</text>
+ </assertion>
+ <assertion id="aap">
+ <text>Test type for a tag library listener</text>
+ </assertion>
+ <assertion id="aaq">
+ <text>Test type for an EJB Interceptor</text>
+ </assertion>
+ <assertion id="aar">
+ <text>Test type for a WS endpoint</text>
+ </assertion>
+ <assertion id="aas">
+ <text>Test type for a servlet</text>
+ </assertion>
+ <assertion id="aat">
+ <text>Test type for a filter</text>
+ </assertion>
+ <assertion id="aau">
+ <text>Test type for a producer method</text>
+ </assertion>
+ <assertion id="aav">
+ <text>Test type for a producer field</text>
+ </assertion>
+ </group>
- <assertion id="ba">
- <text>|getInjectionTarget()| returns the |InjectionTarget| object that will be used by the container to perform injection.</text>
- </assertion>
+ <group>
+ <text>|getAnnotatedType()| returns the |AnnotatedType| representing the managed bean class, session bean or other Java EE component class supporting injection.</text>
+ <assertion id="aba">
+ <text>Test type for a managed bean</text>
+ </assertion>
+ <assertion id="abb">
+ <text>Test type for a session bean</text>
+ </assertion>
+ <assertion id="abc">
+ <text>Test type for a servlet listener</text>
+ </assertion>
+ <assertion id="abd">
+ <text>Test type for a tag handler</text>
+ </assertion>
+ <assertion id="abe">
+ <text>Test type for a tag library listener</text>
+ </assertion>
+ <assertion id="abf">
+ <text>Test type for an EJB Interceptor</text>
+ </assertion>
+ <assertion id="abg">
+ <text>Test type for a WS endpoint</text>
+ </assertion>
+ <assertion id="abh">
+ <text>Test type for a servlet</text>
+ </assertion>
+ <assertion id="abi">
+ <text>Test type for a filter</text>
+ </assertion>
+ <assertion id="abj">
+ <text>Test type for a producer method</text>
+ </assertion>
+ <assertion id="abk">
+ <text>Test type for a producer field</text>
+ </assertion>
+ </group>
<assertion id="bb">
<text>|setInjectionTarget()| replaces the |InjectionTarget|.</text>
@@ -5256,9 +5475,42 @@
<text>|addDefinitionError()| registers a definition error with the container, causing the container to abort deployment after bean discovery is complete.</text>
</assertion>
- <assertion id="e">
+ <group>
<text>Any observer of this event is permitted to wrap and/or replace the |InjectionTarget|. The container must use the final value of this property, after all observers have been called, whenever it performs injection upon the managed bean, session bean or other Java EE component class supporting injection.</text>
- </assertion>
+ <assertion id="ea">
+ <text>Test type for a managed bean</text>
+ </assertion>
+ <assertion id="eb">
+ <text>Test type for a session bean</text>
+ </assertion>
+ <assertion id="ec">
+ <text>Test type for a servlet listener</text>
+ </assertion>
+ <assertion id="ed">
+ <text>Test type for a tag handler</text>
+ </assertion>
+ <assertion id="ee">
+ <text>Test type for a tag library listener</text>
+ </assertion>
+ <assertion id="ef">
+ <text>Test type for an EJB Interceptor</text>
+ </assertion>
+ <assertion id="eg">
+ <text>Test type for a WS endpoint</text>
+ </assertion>
+ <assertion id="eh">
+ <text>Test type for a servlet</text>
+ </assertion>
+ <assertion id="ei">
+ <text>Test type for a filter</text>
+ </assertion>
+ <assertion id="ej">
+ <text>Test type for a producer method</text>
+ </assertion>
+ <assertion id="ek">
+ <text>Test type for a producer field</text>
+ </assertion>
+ </group>
<assertion id="f">
<text>If any observer method of a |ProcessInjectionTarget| event throws an exception, the exception is treated as a definition error by the container.</text>
@@ -5266,21 +5518,48 @@
</section>
<section id="11.5.7" title="ProcessProducer event">
- <assertion id="a">
+ <group>
<text>The container must fire an event for each producer method or field, including resources.</text>
- </assertion>
+ <assertion id="aa">
+ <text>Test producer method</text>
+ </assertion>
+ <assertion id="ab">
+ <text>Test producer field</text>
+ </assertion>
+ <assertion id="ac">
+ <text>Test resource producer field</text>
+ </assertion>
+ </group>
- <assertion id="ba">
+ <group>
<text>The event object must be of type |javax.enterprise.inject.spi.ProcessProducer<T, X>|, where |T| is the bean class of the bean that declares the producer method or field and |X| is the return type of the producer method or the type of the producer field.</text>
- </assertion>
-
- <assertion id="c">
+ <assertion id="ba">
+ <text>Test producer method</text>
+ </assertion>
+ <assertion id="bb">
+ <text>Test producer field</text>
+ </assertion>
+ </group>
+
+ <group>
<text>|getAnnotatedMember()| returns the |AnnotatedField| representing the producer field or the |AnnotatedMethod| representing the producer method.</text>
- </assertion>
+ <assertion id="ca">
+ <text>Test producer method</text>
+ </assertion>
+ <assertion id="cb">
+ <text>Test producer field</text>
+ </assertion>
+ </group>
- <assertion id="d">
+ <group>
<text>|getProducer()| returns the |Producer| object that will be used by the container to call the producer method or read the producer field.</text>
- </assertion>
+ <assertion id="da">
+ <text>Test producer method</text>
+ </assertion>
+ <assertion id="db">
+ <text>Test producer field</text>
+ </assertion>
+ </group>
<assertion id="e">
<text>|setProducer()| replaces the |Producer|.</text>
@@ -5290,9 +5569,15 @@
<text>|addDefinitionError()| registers a definition error with the container, causing the container to abort deployment after bean discovery is complete.</text>
</assertion>
- <assertion id="g">
+ <group>
<text>Any observer of this event is permitted to wrap and/or replace the |Producer|. The container must use the final value of this property, after all observers have been called, whenever it calls the producer or disposer.</text>
- </assertion>
+ <assertion id="ga">
+ <text>Test producer method</text>
+ </assertion>
+ <assertion id="gb">
+ <text>Test producer field</text>
+ </assertion>
+ </group>
<assertion id="h">
<text>If any observer method of a |ProcessProducer| event throws an exception, the exception is treated as a definition error by the container.</text>
@@ -5327,10 +5612,16 @@
<assertion id="ed">
<text>The interface |javax.enterprise.inject.spi.ProcessBean| is a supertype of all these event types.</text>
</assertion>
-
- <assertion id="ef">
+
+ <group>
<text>|getAnnotated()| returns the |AnnotatedType| representing the bean class, the |AnnotatedMethod| representing the producer method, or the |AnnotatedField| representing the producer field.</text>
- </assertion>
+ <assertion id="efa">
+ <text>Test producer method</text>
+ </assertion>
+ <assertion id="efb">
+ <text>Test producer field</text>
+ </assertion>
+ </group>
<assertion id="fa">
<text>|getBean()| returns the |Bean| object that is about to be registered. The |Bean| may implement |Interceptor| or |Decorator|.</text>
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3835 - in tck/trunk/impl/src/main: resources and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-10-02 21:30:20 -0400 (Fri, 02 Oct 2009)
New Revision: 3835
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Wolf.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/WolfPack.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
added another injection test
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-10-02 10:43:12 UTC (rev 3834)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-10-03 01:30:20 UTC (rev 3835)
@@ -21,6 +21,14 @@
assert spiderNest.numberOfSpiders != null;
assert spiderNest.numberOfSpiders.equals(4);
}
+
+ @Test
+ @SpecAssertion(section = "5.3", id = "kc")
+ public void testInjectionOfNamedBean()
+ {
+ WolfPack wolfPack = getInstanceByType(WolfPack.class);
+ assert wolfPack.getAlphaWolf() != null;
+ }
@Test
@SpecAssertion(section="4.2", id = "aa")
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Wolf.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Wolf.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Wolf.java 2009-10-03 01:30:20 UTC (rev 3835)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.injection;
+
+import javax.inject.Named;
+
+@Named
+class Wolf
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/WolfPack.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/WolfPack.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/WolfPack.java 2009-10-03 01:30:20 UTC (rev 3835)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.lookup.injection;
+
+import javax.inject.Inject;
+
+class WolfPack
+{
+ @Inject Wolf alphaWolf;
+
+ public Wolf getAlphaWolf()
+ {
+ return alphaWolf;
+ }
+}
Modified: tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-02 10:43:12 UTC (rev 3834)
+++ tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-03 01:30:20 UTC (rev 3835)
@@ -1975,6 +1975,10 @@
<assertion id="kb">
<text>Test with a raw type.</text>
</assertion>
+
+ <assertion id="kc">
+ <text>Test with a |@Named| bean.</text>
+ </assertion>
</group>
<group>
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3834 - doc/trunk/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: peteroyle
Date: 2009-10-02 06:43:12 -0400 (Fri, 02 Oct 2009)
New Revision: 3834
Modified:
doc/trunk/reference/en-US/environments.xml
Log:
Updated documentation to reflect API changes
Modified: doc/trunk/reference/en-US/environments.xml
===================================================================
--- doc/trunk/reference/en-US/environments.xml 2009-10-02 09:33:39 UTC (rev 3833)
+++ doc/trunk/reference/en-US/environments.xml 2009-10-02 10:43:12 UTC (rev 3834)
@@ -257,16 +257,11 @@
</listitem>
<listitem>
<para>
- <literal>Binding Types</literal>
+ <literal>Qualifiers</literal>
</para>
</listitem>
<listitem>
<para>
- <literal>Deployment Types</literal>
- </para>
- </listitem>
- <listitem>
- <para>
<literal>Stereotypes</literal>
</para>
</listitem>
@@ -282,11 +277,11 @@
<para>To make life easy for developers Web Beans provides a special module with a
main method which will boot the Web Beans manager,
- automatically registering all simple Web Beans found on the classpath.
+ automatically registering all simple beans found on the classpath.
This eliminates the need for application developers to write any
bootstrapping code. The entry point for a Web Beans SE applications
- is a simple Web Bean which observes the standard <literal>@Deployed
- Manager</literal> event. The command line paramters can be
+ is a simple Web Bean which observes the special <literal>ContainerInitialized</literal>
+ event provided by the SE module. The command line paramters can be
injected using either of the following:
</para>
<programlisting role="JAVA"><![CDATA[@Parameters List<String> params;
@@ -300,7 +295,7 @@
{
@Parameters List<String> parameters;
- public void printHello( @Observes @Deployed Manager manager )
+ public void printHello( @Observes ContainerInitialized event )
{
System.out.println( "Hello " + parameters.get(0) );
}
@@ -312,24 +307,25 @@
<para>If you need to do any custom initialization of the Web Beans manager,
for example registering custom contexts or initializing resources for
- your beans you can do so in response to the <literal>@Initialized Manager</literal>
- event. The following example registers a custom context:</para>
+ your beans you can do so in response to the <literal>AfterBeanDiscovery</literal>
+ or <literal>AfterDeploymentValidation</literal>
+ events. The following example registers a custom context:</para>
<programlisting role="JAVA"><![CDATA[public class PerformSetup
{
- public void setup( @Observes @Initialized Manager manager )
+ public void setup( @Observes AfterBeanDiscovery event )
{
- manager.addContext( ThreadContext.INSTANCE );
+ event.addContext( ThreadContext.INSTANCE );
}
}]]></programlisting>
<note>
<para>
The command line parameters do not become available for injection
- until the <literal>@Deployed Manager</literal> event is fired. If you
+ until the <literal>ContainerInitialized</literal> event is fired. If you
need access to the parameters during initialization you can do so via the
- <literal>public static String getParameters()</literal> method in
+ <literal>public static String[] getParameters()</literal> method in
<literal>StartMain</literal>.
</para>
</note>
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3833 - ri/trunk/inject-tck-runner.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-02 05:33:39 -0400 (Fri, 02 Oct 2009)
New Revision: 3833
Modified:
ri/trunk/inject-tck-runner/pom.xml
Log:
require 330 TCK to pass
Modified: ri/trunk/inject-tck-runner/pom.xml
===================================================================
--- ri/trunk/inject-tck-runner/pom.xml 2009-10-02 09:27:58 UTC (rev 3832)
+++ ri/trunk/inject-tck-runner/pom.xml 2009-10-02 09:33:39 UTC (rev 3833)
@@ -41,7 +41,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <testFailureIgnore>true</testFailureIgnore>
<suiteXmlFiles>
<suiteXmlFile>tests.xml</suiteXmlFile>
</suiteXmlFiles>
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3831 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-02 05:20:29 -0400 (Fri, 02 Oct 2009)
New Revision: 3831
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/NamedLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/NamedOrder.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
Log:
WBRI-404
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-10-01 20:24:31 UTC (rev 3830)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-10-02 09:20:29 UTC (rev 3831)
@@ -193,6 +193,14 @@
log.trace("Adding default @Current binding type");
this.bindings.add(CURRENT_LITERAL);
}
+ if (bindings.size() == 1)
+ {
+ if (bindings.iterator().next().annotationType().equals(Named.class))
+ {
+ log.trace("Adding default @Current binding type");
+ this.bindings.add(CURRENT_LITERAL);
+ }
+ }
this.bindings.add(ANY_LITERAL);
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/NamedLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/NamedLiteral.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/NamedLiteral.java 2009-10-02 09:20:29 UTC (rev 3831)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.literals;
+
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.inject.Named;
+
+public class NamedLiteral extends AnnotationLiteral<Named> implements Named
+{
+
+ public String value()
+ {
+ return "";
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/literals/NamedLiteral.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java 2009-10-01 20:24:31 UTC (rev 3830)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java 2009-10-02 09:20:29 UTC (rev 3831)
@@ -10,6 +10,7 @@
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.literals.AnyLiteral;
import org.jboss.jsr299.tck.literals.DefaultLiteral;
+import org.jboss.jsr299.tck.literals.NamedLiteral;
import org.jboss.jsr299.tck.literals.NewLiteral;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecAssertions;
@@ -32,6 +33,12 @@
assert order.getQualifiers().size() == 2;
assert order.getQualifiers().contains(new DefaultLiteral());
assert order.getQualifiers().contains(new AnyLiteral());
+
+ Bean<NamedOrder> namedOrder = getBeans(NamedOrder.class).iterator().next();
+ assert namedOrder.getQualifiers().size() == 3;
+ assert namedOrder.getQualifiers().contains(new DefaultLiteral());
+ assert namedOrder.getQualifiers().contains(new AnyLiteral());
+ assert namedOrder.getQualifiers().contains(new NamedLiteral());
}
@Test
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/NamedOrder.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/NamedOrder.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/NamedOrder.java 2009-10-02 09:20:29 UTC (rev 3831)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.binding;
+
+import javax.inject.Named;
+
+@Named
+public class NamedOrder
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/NamedOrder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3830 - tck/trunk/doc/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-01 16:24:31 -0400 (Thu, 01 Oct 2009)
New Revision: 3830
Modified:
tck/trunk/doc/reference/en-US/appeals-process.xml
Log:
Discuss how we do TCk releases.
Modified: tck/trunk/doc/reference/en-US/appeals-process.xml
===================================================================
--- tck/trunk/doc/reference/en-US/appeals-process.xml 2009-10-01 17:22:05 UTC (rev 3829)
+++ tck/trunk/doc/reference/en-US/appeals-process.xml 2009-10-01 20:24:31 UTC (rev 3830)
@@ -106,5 +106,16 @@
agree on the issue resolution, it will be referred to the JSR-299
specification lead or his/her designate.
</para>
+ <para>
+ Periodically, an updated TCK will be released containing tests altered
+ due to challenges. No new tests will be added. Implementations are
+ required to pass the updated TCK. This release stream is named 1.0.z where
+ z will be incremented.
+ </para>
+ <para>
+ Additionally, new tests will be added to the TCK improving coverage of the
+ specification. We encourage implementations to pass this TCK, however it is
+ not required. This release stream is named 1.y.z where y > 0.
+ </para>
</section>
</chapter>
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3829 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean and 9 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-01 13:22:05 -0400 (Thu, 01 Oct 2009)
New Revision: 3829
Added:
ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AbstractProducer.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotated.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotated.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/inject-tck-runner/
ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java
ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/DriversSeatProducer.java
ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/SpareTireProducer.java
ri/trunk/osgi-bundle/
ri/trunk/version-matrix/pom.xml
Log:
more fixes for JSR-330
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -17,6 +17,7 @@
package org.jboss.webbeans;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
@@ -42,8 +43,8 @@
private final BeanManagerImpl beanManager;
private final WBClass<T> type;
private final ConstructorInjectionPoint<T> constructor;
- private final Set<FieldInjectionPoint<?, ?>> injectableFields;
- private final Set<MethodInjectionPoint<?, ?>> initializerMethods;
+ private final List<Set<FieldInjectionPoint<?, ?>>> injectableFields;
+ private final List<Set<MethodInjectionPoint<?, ?>>> initializerMethods;
private final WBMethod<?, ?> postConstruct;
private final WBMethod<?, ?> preDestroy;
private final Set<InjectionPoint> injectionPoints;
@@ -69,11 +70,9 @@
// unless someone calls produce()
}
this.constructor = constructor;
- this.injectableFields = new HashSet<FieldInjectionPoint<?,?>>();
- this.injectableFields.addAll(Beans.getFieldInjectionPoints(null, type));
- this.injectionPoints.addAll(injectableFields);
- this.initializerMethods = new HashSet<MethodInjectionPoint<?,?>>();
- this.initializerMethods.addAll(Beans.getInitializerMethods(null, type));
+ this.injectableFields = Beans.getFieldInjectionPoints(null, type);
+ this.injectionPoints.addAll(Beans.getFieldInjectionPoints(null, this.injectableFields));
+ this.initializerMethods = Beans.getInitializerMethods(null, type);
this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, initializerMethods));
this.postConstruct = Beans.getPostConstruct(type);
this.preDestroy = Beans.getPreDestroy(type);
@@ -106,8 +105,7 @@
public void proceed()
{
Beans.injectEEFields(instance, beanManager, ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
- Beans.injectBoundFields(instance, ctx, beanManager, injectableFields);
- Beans.callInitializers(instance, ctx, beanManager, initializerMethods);
+ Beans.injectFieldsAndInitializers(instance, ctx, beanManager, injectableFields, initializerMethods);
}
}.run();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -65,10 +65,10 @@
private static final LogProvider log = Logging.getLogProvider(AbstractClassBean.class);
// The item representation
protected WBClass<T> annotatedItem;
- // The injectable fields
- private Set<FieldInjectionPoint<?, ?>> injectableFields;
- // The initializer methods
- private Set<MethodInjectionPoint<?, ?>> initializerMethods;
+ // The injectable fields of each type in the type hierarchy, with the actual type at the bottom
+ private List<Set<FieldInjectionPoint<?, ?>>> injectableFields;
+ // The initializer methods of each type in the type hierarchy, with the actual type at the bottom
+ private List<Set<MethodInjectionPoint<?, ?>>> initializerMethods;
private Set<String> dependencies;
private List<Decorator<?>> decorators;
@@ -228,8 +228,8 @@
*/
protected void initInjectableFields()
{
- injectableFields = new HashSet<FieldInjectionPoint<?, ?>>(Beans.getFieldInjectionPoints(this, annotatedItem));
- addInjectionPoints(injectableFields);
+ injectableFields = Beans.getFieldInjectionPoints(this, annotatedItem);
+ addInjectionPoints(Beans.getFieldInjectionPoints(this, injectableFields));
}
/**
@@ -320,17 +320,19 @@
*
* @return The set of annotated methods
*/
- public Set<? extends MethodInjectionPoint<?, ?>> getInitializerMethods()
+ public List<? extends Set<? extends MethodInjectionPoint<?, ?>>> getInitializerMethods()
{
- return Collections.unmodifiableSet(initializerMethods);
+ // TODO Make immutable
+ return initializerMethods;
}
/**
* @return the injectableFields
*/
- public Set<FieldInjectionPoint<?, ?>> getInjectableFields()
+ public List<? extends Set<FieldInjectionPoint<?, ?>>> getInjectableFields()
{
- return Collections.unmodifiableSet(injectableFields);
+ // TODO Make immutable
+ return injectableFields;
}
// TODO maybe a better way to expose this?
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -133,8 +133,7 @@
public void proceed()
{
Beans.injectEEFields(instance, getManager(), ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
- Beans.injectBoundFields(instance, ctx, getManager(), getInjectableFields());
- Beans.callInitializers(instance, ctx, getManager(), getInitializerMethods());
+ Beans.injectFieldsAndInitializers(instance, ctx, getManager(), getInjectableFields(), getInitializerMethods());
}
}.run();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -228,8 +228,7 @@
public void proceed()
{
- Beans.injectBoundFields(instance, ctx, getManager(), getInjectableFields());
- Beans.callInitializers(instance, ctx, getManager(), getInitializerMethods());
+ Beans.injectFieldsAndInitializers(instance, ctx, getManager(), getInjectableFields(), getInitializerMethods());
}
}.run();
@@ -310,12 +309,6 @@
return buffer.toString();
}
- public void postConstruct(T instance, CreationalContext<T> creationalContext)
- {
- Beans.injectBoundFields(instance, creationalContext, getManager(), getInjectableFields());
- Beans.callInitializers(instance, creationalContext, getManager(), getInitializerMethods());
- }
-
public void preDestroy(CreationalContext<T> creationalContext)
{
creationalContext.release();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -124,7 +124,7 @@
protected void createProducerMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
{
- for (WBMethod<?, ?> method : annotatedClass.getDeclaredWBAnnotatedMethods(Produces.class))
+ for (WBMethod<?, ?> method : annotatedClass.getDeclaredAnnotatedWBMethods(Produces.class))
{
createProducerMethod(declaringBean, method);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotated.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotated.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotated.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -107,7 +107,18 @@
{
return delegate().isPrivate();
}
+
+ public boolean isPackagePrivate()
+ {
+ return delegate().isPackagePrivate();
+ }
+
+ public Package getPackage()
+ {
+ return delegate().getPackage();
+ }
+ @Override
protected abstract WBAnnotated<T, S> delegate();
public boolean isDeclaredAnnotationPresent(Class<? extends Annotation> annotationType)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -60,9 +60,9 @@
return delegate().getDeclaredAnnotatedWBFields(annotationType);
}
- public Set<WBMethod<?, ?>> getDeclaredWBAnnotatedMethods(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getDeclaredAnnotatedWBMethods(Class<? extends Annotation> annotationType)
{
- return delegate().getDeclaredWBAnnotatedMethods(annotationType);
+ return delegate().getDeclaredAnnotatedWBMethods(annotationType);
}
public Set<WBMethod<?, T>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotated.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotated.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotated.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -177,6 +177,10 @@
public boolean isPublic();
public boolean isPrivate();
+
+ public boolean isPackagePrivate();
+
+ public Package getPackage();
/**
* Gets the name of this AnnotatedItem
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -44,6 +44,13 @@
* @return A set of abstracted fields
*/
public Set<WBMethod<?, ?>> getWBMethods();
+
+ /**
+ * Gets all fields on the type
+ *
+ * @return A set of abstracted fields
+ */
+ public Set<WBMethod<?, ?>> getDeclaredWBMethods();
/**
* Get a field by name
@@ -131,7 +138,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?, ?>> getDeclaredWBAnnotatedMethods(Class<? extends Annotation> annotationType);
+ public Set<WBMethod<?, ?>> getDeclaredAnnotatedWBMethods(Class<? extends Annotation> annotationType);
/**
* Find the annotated method for a given methodDescriptor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -51,6 +51,8 @@
private String toString;
private final boolean _public;
private final boolean _private;
+ private final boolean _packagePrivate;
+ private final Package _package;
private final WBClass<X> declaringType;
/**
@@ -62,8 +64,10 @@
{
super(annotatedItemHelper, rawType, type);
name = member.getName();
- _public = Modifier.isPublic(member.getModifiers());
- _private = Modifier.isPrivate(member.getModifiers());
+ this._public = Modifier.isPublic(member.getModifiers());
+ this._private = Modifier.isPrivate(member.getModifiers());
+ this._packagePrivate = Reflections.isPackagePrivate(member.getModifiers());
+ this._package = member.getDeclaringClass().getPackage();
this.declaringType = declaringType;
}
@@ -105,6 +109,16 @@
{
return _private;
}
+
+ public boolean isPackagePrivate()
+ {
+ return _packagePrivate;
+ }
+
+ public Package getPackage()
+ {
+ return _package;
+ }
/**
* Gets the current value of the member
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -72,7 +72,8 @@
private final String _simpleName;
private final boolean _public;
private final boolean _private;
-
+ private final boolean _packagePrivate;
+ private final Package _package;
private static List<Class<?>> NO_ARGUMENTS = Collections.emptyList();
@@ -151,8 +152,9 @@
this.superclass = null;
}
this._public = Modifier.isFinal(rawType.getModifiers());
- _private = Modifier.isPrivate(rawType.getModifiers());
-
+ this._private = Modifier.isPrivate(rawType.getModifiers());
+ this._packagePrivate = Reflections.isPackagePrivate(rawType.getModifiers());
+ this._package = rawType.getPackage();
this.fields = new HashSet<WBField<?, ?>>();
this.annotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?, ?>>>(), new Supplier< Set<WBField<?, ?>>>()
{
@@ -561,7 +563,7 @@
return Collections.unmodifiableSet(annotatedMethods.get(annotationType));
}
- public Set<WBMethod<?, ?>> getDeclaredWBAnnotatedMethods(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getDeclaredAnnotatedWBMethods(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredAnnotatedMethods.get(annotationType));
}
@@ -631,6 +633,11 @@
}
return null;
}
+
+ public Set<WBMethod<?, ?>> getDeclaredWBMethods()
+ {
+ return declaredMethods;
+ }
@SuppressWarnings("unchecked")
public <M> WBMethod<M, ?> getDeclaredWBMethod(MethodSignature signature, WBClass<M> expectedReturnType)
@@ -720,6 +727,16 @@
{
return _private;
}
+
+ public boolean isPackagePrivate()
+ {
+ return _packagePrivate;
+ }
+
+ public Package getPackage()
+ {
+ return _package;
+ }
@SuppressWarnings("unchecked")
public <U> WBClass<? extends U> asWBSubclass(WBClass<U> clazz)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -47,6 +47,8 @@
private final boolean _static = false;
private final boolean _public = false;
private final boolean _private = false;
+ private final boolean _packagePrivate = false;
+ private final Package _package;
private final int position;
private final WBCallable<?, X, ?> declaringMember;
@@ -72,6 +74,7 @@
{
super(AnnotationStore.of(annotations, annotations, classTransformer.getTypeStore()), rawType, type);
this.declaringMember = declaringMember;
+ this._package = declaringMember.getPackage();
this.position = position;
this.toString = new StringBuilder().append("parameter ").append(position + 1).append(" of ").append(declaringMember.toString()).toString();
}
@@ -109,6 +112,16 @@
{
return _private;
}
+
+ public boolean isPackagePrivate()
+ {
+ return _packagePrivate;
+ }
+
+ public Package getPackage()
+ {
+ return _package;
+ }
/**
* Gets the name of the parameter
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -181,6 +181,16 @@
{
throw new UnsupportedOperationException();
}
+
+ public boolean isPackagePrivate()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Package getPackage()
+ {
+ throw new UnsupportedOperationException();
+ }
public boolean isStatic()
{
@@ -193,6 +203,7 @@
throw new UnsupportedOperationException();
}
+ @Override
public Set<Type> getTypeClosure()
{
return typeClosure;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -18,9 +18,12 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -50,6 +53,7 @@
import org.jboss.webbeans.injection.spi.EjbInjectionServices;
import org.jboss.webbeans.injection.spi.JpaInjectionServices;
import org.jboss.webbeans.injection.spi.ResourceInjectionServices;
+import org.jboss.webbeans.introspector.MethodSignature;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBConstructor;
import org.jboss.webbeans.introspector.WBField;
@@ -61,6 +65,10 @@
import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
+
/**
* Helper class for bean inspection
*
@@ -132,18 +140,35 @@
}
}
- public static Set<FieldInjectionPoint<?, ?>> getFieldInjectionPoints(Bean<?> declaringBean, WBClass<?> annotatedItem)
+ public static List<Set<FieldInjectionPoint<?, ?>>> getFieldInjectionPoints(Bean<?> declaringBean, WBClass<?> type)
{
- Set<FieldInjectionPoint<?, ?>> injectableFields = new HashSet<FieldInjectionPoint<?, ?>>();
- for (WBField<?, ?> annotatedField : annotatedItem.getAnnotatedWBFields(Inject.class))
+ List<Set<FieldInjectionPoint<?, ?>>> injectableFieldsList = new ArrayList<Set<FieldInjectionPoint<?, ?>>>();
+ WBClass<?> t = type;
+ while (!t.getJavaClass().equals(Object.class))
{
- addFieldInjectionPoint(annotatedField, injectableFields, declaringBean);
+ Set<FieldInjectionPoint<?, ?>> fields = new HashSet<FieldInjectionPoint<?,?>>();
+ injectableFieldsList.add(0, fields);
+ for (WBField<?, ?> annotatedField : t.getDeclaredAnnotatedWBFields(Inject.class))
+ {
+ addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ }
+ for (WBField<?, ?> annotatedField : t.getAnnotatedWBFields(Decorates.class))
+ {
+ addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ }
+ t = t.getWBSuperclass();
}
- for (WBField<?, ?> annotatedField : annotatedItem.getAnnotatedWBFields(Decorates.class))
+ return injectableFieldsList;
+ }
+
+ public static Set<FieldInjectionPoint<?, ?>> getFieldInjectionPoints(Bean<?> declaringBean, List<? extends Set<? extends FieldInjectionPoint<?, ?>>> fieldInjectionPoints)
+ {
+ Set<FieldInjectionPoint<?, ?>> injectionPoints = new HashSet<FieldInjectionPoint<?,?>>();
+ for (Set<? extends FieldInjectionPoint<?, ?>> i : fieldInjectionPoints)
{
- addFieldInjectionPoint(annotatedField, injectableFields, declaringBean);
+ injectionPoints.addAll(i);
}
- return injectableFields;
+ return injectionPoints;
}
public static WBMethod<?, ?> getPostConstruct(WBClass<?> type)
@@ -261,32 +286,72 @@
}
}
- public static Set<MethodInjectionPoint<?, ?>> getInitializerMethods(Bean<?> declaringBean, WBClass<?> type)
+ public static List<Set<MethodInjectionPoint<?, ?>>> getInitializerMethods(Bean<?> declaringBean, WBClass<?> type)
{
- Set<MethodInjectionPoint<?, ?>> initializerMethods = new HashSet<MethodInjectionPoint<?, ?>>();
- for (WBMethod<?, ?> method : type.getAnnotatedWBMethods(Inject.class))
+ List<Set<MethodInjectionPoint<?, ?>>> initializerMethodsList = new ArrayList<Set<MethodInjectionPoint<?, ?>>>();
+ // Keep track of all seen methods so we can ignore overridden methods
+ Multimap<MethodSignature, Package> seenMethods = Multimaps.newSetMultimap(new HashMap<MethodSignature, Collection<Package>>(), new Supplier<Set<Package>>()
{
- if (method.getAnnotation(Produces.class) != null)
+
+ public Set<Package> get()
{
- throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Produces on " + type);
+ return new HashSet<Package>();
}
- else if (method.getAnnotatedWBParameters(Disposes.class).size() > 0)
+
+ });
+ WBClass<?> t = type;
+ while (!t.getJavaClass().equals(Object.class))
+ {
+ Set<MethodInjectionPoint<?, ?>> initializerMethods = new HashSet<MethodInjectionPoint<?,?>>();
+ initializerMethodsList.add(0, initializerMethods);
+ for (WBMethod<?, ?> method : t.getDeclaredWBMethods())
{
- throw new DefinitionException("Initializer method " + method.toString() + " cannot have parameters annotated @Disposes on " + type);
+ if (method.isAnnotationPresent(Inject.class))
+ {
+ if (method.getAnnotation(Produces.class) != null)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Produces on " + type);
+ }
+ else if (method.getAnnotatedWBParameters(Disposes.class).size() > 0)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot have parameters annotated @Disposes on " + type);
+ }
+ else if (method.getAnnotatedWBParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Observes on " + type);
+ }
+ else
+ {
+ if (!isOverridden(method, seenMethods))
+ {
+ MethodInjectionPoint<?, ?> initializerMethod = MethodInjectionPoint.of(declaringBean, method);
+ initializerMethods.add(initializerMethod);
+ }
+ }
+ }
+ seenMethods.put(method.getSignature(), method.getPackage());
}
- else if (method.getAnnotatedWBParameters(Observes.class).size() > 0)
- {
- throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Observes on " + type);
- }
- else
- {
- MethodInjectionPoint<?, ?> initializerMethod = MethodInjectionPoint.of(declaringBean, method);
- initializerMethods.add(initializerMethod);
- }
+ t = t.getWBSuperclass();
}
- return initializerMethods;
+ return initializerMethodsList;
}
+ private static boolean isOverridden(WBMethod<?, ?> method, Multimap<MethodSignature, Package> seenMethods)
+ {
+ if (method.isPrivate())
+ {
+ return false;
+ }
+ else if (method.isPackagePrivate() && seenMethods.containsKey(method.getSignature()))
+ {
+ return seenMethods.get(method.getSignature()).contains(method.getPackage());
+ }
+ else
+ {
+ return seenMethods.containsKey(method.getSignature());
+ }
+ }
+
public static Set<ParameterInjectionPoint<?, ?>> getParameterInjectionPoints(Bean<?> declaringBean, WBConstructor<?> constructor)
{
Set<ParameterInjectionPoint<?,?>> injectionPoints = new HashSet<ParameterInjectionPoint<?,?>>();
@@ -297,14 +362,17 @@
return injectionPoints;
}
- public static Set<ParameterInjectionPoint<?, ?>> getParameterInjectionPoints(Bean<?> declaringBean, Set<MethodInjectionPoint<?, ?>> methodInjectionPoints)
+ public static Set<ParameterInjectionPoint<?, ?>> getParameterInjectionPoints(Bean<?> declaringBean, List<Set<MethodInjectionPoint<?, ?>>> methodInjectionPoints)
{
Set<ParameterInjectionPoint<?, ?>> injectionPoints = new HashSet<ParameterInjectionPoint<?,?>>();
- for (MethodInjectionPoint<?, ?> method : methodInjectionPoints)
+ for (Set<MethodInjectionPoint<?, ?>> i : methodInjectionPoints)
{
- for (WBParameter<?, ?> parameter : method.getWBParameters())
+ for (MethodInjectionPoint<?, ?> method : i)
{
- injectionPoints.add(ParameterInjectionPoint.of(declaringBean, parameter));
+ for (WBParameter<?, ?> parameter : method.getWBParameters())
+ {
+ injectionPoints.add(ParameterInjectionPoint.of(declaringBean, parameter));
+ }
}
}
return injectionPoints;
@@ -548,7 +616,7 @@
*
* @param instance The instance to inject into
*/
- public static <T> void injectBoundFields(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<FieldInjectionPoint<?, ?>> injectableFields)
+ public static <T> void injectBoundFields(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<? extends FieldInjectionPoint<?, ?>> injectableFields)
{
for (FieldInjectionPoint<?, ?> injectableField : injectableFields)
{
@@ -556,6 +624,19 @@
}
}
+ public static<T> void injectFieldsAndInitializers(T instance, CreationalContext<T> ctx, BeanManagerImpl beanManager, List<? extends Iterable<? extends FieldInjectionPoint<?, ?>>> injectableFields, List<? extends Iterable<? extends MethodInjectionPoint<?, ?>>>initializerMethods)
+ {
+ if (injectableFields.size() != initializerMethods.size())
+ {
+ throw new IllegalArgumentException("injectableFields and initializerMethods must have the same size. InjectableFields: " + injectableFields + "; InitializerMethods: " + initializerMethods);
+ }
+ for (int i = 0; i < injectableFields.size(); i++)
+ {
+ injectBoundFields(instance, ctx, beanManager, injectableFields.get(i));
+ callInitializers(instance, ctx, beanManager, initializerMethods.get(i));
+ }
+ }
+
/**
* Calls all initializers of the bean
*
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -317,6 +317,11 @@
{
return type.isPrimitive();
}
+
+ public static boolean isPackagePrivate(int mod)
+ {
+ return !(Modifier.isPrivate(mod) || Modifier.isProtected(mod) || Modifier.isPublic(mod));
+ }
/**
* Checks if type is static
Property changes on: ri/trunk/inject-tck-runner
___________________________________________________________________
Name: svn:ignore
- .settings
target
.project
test-output
.classpath
+ .settings
target
.project
test-output
.classpath
bin
Added: ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AbstractProducer.java
===================================================================
--- ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AbstractProducer.java (rev 0)
+++ ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AbstractProducer.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.atinject.tck;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+public class AbstractProducer<T>
+{
+
+ protected final InjectionTarget<T> injectionTarget;
+ protected final BeanManager beanManager;
+
+ public AbstractProducer(BeanManager beanManager, Class<T> type)
+ {
+ this.injectionTarget = beanManager.createInjectionTarget(beanManager.createAnnotatedType(type));
+ this.beanManager = beanManager;
+ }
+
+ public T produce()
+ {
+ CreationalContext<T> ctx = beanManager.createCreationalContext(null);
+ T instance = injectionTarget.produce(ctx);
+ injectionTarget.inject(instance, ctx);
+ return instance;
+ }
+
+}
\ No newline at end of file
Modified: ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java
===================================================================
--- ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/AtInjectTCK.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -12,16 +12,16 @@
import org.atinject.tck.auto.Convertible;
import org.atinject.tck.auto.FuelTank;
import org.atinject.tck.auto.Seat;
+import org.atinject.tck.auto.Tire;
import org.atinject.tck.auto.V8Engine;
import org.atinject.tck.auto.accessories.Cupholder;
-import org.atinject.tck.auto.accessories.SpareTire;
import org.jboss.webbeans.mock.MockEELifecycle;
import org.jboss.webbeans.mock.TestContainer;
public class AtInjectTCK
{
- private static final List<Class<?>> classes = Arrays.<Class<?>>asList(Convertible.class, Seat.class, DriversSeatProducer.class, V8Engine.class, Cupholder.class, FuelTank.class, SpareTireProducer.class, SpareTire.class);
+ private static final List<Class<?>> classes = Arrays.<Class<?>>asList(Convertible.class, Seat.class, DriversSeatProducer.class, V8Engine.class, Cupholder.class, FuelTank.class, SpareTireProducer.class, Tire.class);
public static Test suite()
{
@@ -30,6 +30,6 @@
BeanManager beanManager = container.getBeanManager();
Bean<?> bean = beanManager.resolve(beanManager.getBeans(Car.class));
Car instance = (Car) beanManager.getReference(bean, Car.class, beanManager.createCreationalContext(bean));
- return Tck.testsFor(instance, false /* supportsStatic */, false /* supportsPrivate */);
+ return Tck.testsFor(instance, false /* supportsStatic */, true /* supportsPrivate */);
}
}
\ No newline at end of file
Modified: ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/DriversSeatProducer.java
===================================================================
--- ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/DriversSeatProducer.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/DriversSeatProducer.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -2,30 +2,25 @@
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTarget;
import javax.inject.Inject;
import org.atinject.tck.auto.Drivers;
import org.atinject.tck.auto.DriversSeat;
-import org.atinject.tck.auto.Seat;
-public class DriversSeatProducer
+public class DriversSeatProducer extends AbstractProducer<DriversSeat>
{
- private final InjectionTarget<DriversSeat> injectionTarget;
- private final BeanManager beanManager;
-
@Inject
public DriversSeatProducer(BeanManager beanManager)
{
- this.injectionTarget = beanManager.createInjectionTarget(beanManager.createAnnotatedType(DriversSeat.class));
- this.beanManager = beanManager;
+ super(beanManager, DriversSeat.class);
}
+ @Override
@Produces @Drivers
- public Seat produceDriversSeat()
+ public DriversSeat produce()
{
- return injectionTarget.produce(beanManager.<DriversSeat>createCreationalContext(null));
+ return super.produce();
}
}
Modified: ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/SpareTireProducer.java
===================================================================
--- ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/SpareTireProducer.java 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/inject-tck-runner/src/test/java/org/jboss/webbeans/atinject/tck/SpareTireProducer.java 2009-10-01 17:22:05 UTC (rev 3829)
@@ -2,30 +2,25 @@
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTarget;
import javax.inject.Inject;
import javax.inject.Named;
-import org.atinject.tck.auto.Tire;
import org.atinject.tck.auto.accessories.SpareTire;
-public class SpareTireProducer
+public class SpareTireProducer extends AbstractProducer<SpareTire>
{
-
- private final InjectionTarget<SpareTire> injectionTarget;
- private final BeanManager beanManager;
-
+
@Inject
public SpareTireProducer(BeanManager beanManager)
{
- this.injectionTarget = beanManager.createInjectionTarget(beanManager.createAnnotatedType(SpareTire.class));
- this.beanManager = beanManager;
+ super(beanManager, SpareTire.class);
}
-
+
+ @Override
@Produces @Named("spare")
- public Tire produceSpareTire()
+ public SpareTire produce()
{
- return injectionTarget.produce(beanManager.<SpareTire>createCreationalContext(null));
+ return super.produce();
}
}
Property changes on: ri/trunk/osgi-bundle
___________________________________________________________________
Name: svn:ignore
- target
.settings
.classpath
.project
+ .settings
target
.project
test-output
.classpath
bin
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-10-01 15:20:32 UTC (rev 3828)
+++ ri/trunk/version-matrix/pom.xml 2009-10-01 17:22:05 UTC (rev 3829)
@@ -87,7 +87,7 @@
<dependency>
<groupId>org.atinject</groupId>
<artifactId>inject-tck</artifactId>
- <version>1.0.0-PFD-2</version>
+ <version>1.0.0-PFD-3-jboss-1</version>
</dependency>
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3828 - ri/trunk.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-01 11:20:32 -0400 (Thu, 01 Oct 2009)
New Revision: 3828
Added:
ri/trunk/atinject-trunk.patch
Log:
patch for atinject trunk
Added: ri/trunk/atinject-trunk.patch
===================================================================
--- ri/trunk/atinject-trunk.patch (rev 0)
+++ ri/trunk/atinject-trunk.patch 2009-10-01 15:20:32 UTC (rev 3828)
@@ -0,0 +1,168 @@
+Index: .classpath
+===================================================================
+--- .classpath (revision 0)
++++ .classpath (revision 0)
+@@ -0,0 +1,11 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<classpath>
++ <classpathentry kind="src" output="build/classes" path="src"/>
++ <classpathentry kind="src" output="build/tck/classes" path="tck"/>
++ <classpathentry kind="lib" path="build/dist/javax.inject.jar"/>
++ <classpathentry kind="lib" path="build/tck/dist/javax.inject-tck.jar"/>
++ <classpathentry kind="lib" path="lib/junit-src.jar"/>
++ <classpathentry kind="lib" path="lib/junit.jar" sourcepath="/Users/pmuir/.m2/repository/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
++ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
++ <classpathentry kind="output" path="build/classes"/>
++</classpath>
+Index: tck/org/atinject/tck/auto/Convertible.java
+===================================================================
+--- tck/org/atinject/tck/auto/Convertible.java (revision 46)
++++ tck/org/atinject/tck/auto/Convertible.java (working copy)
+@@ -16,20 +16,21 @@
+
+ package org.atinject.tck.auto;
+
++import javax.inject.Inject;
++import javax.inject.Named;
++import javax.inject.Provider;
++
+ import junit.framework.TestCase;
++
+ import org.atinject.tck.auto.accessories.Cupholder;
++import org.atinject.tck.auto.accessories.RoundThing;
+ import org.atinject.tck.auto.accessories.SpareTire;
+-import org.atinject.tck.auto.accessories.RoundThing;
+
+-import javax.inject.Inject;
+-import javax.inject.Named;
+-import javax.inject.Provider;
+-
+ public class Convertible implements Car {
+
+ @Inject @Drivers Seat driversSeatA;
+ @Inject @Drivers Seat driversSeatB;
+- @Inject SpareTire spareTire;
++ @Inject @Named("spare") Tire spareTire;
+ @Inject Cupholder cupholder;
+ @Inject Provider<Engine> engineProvider;
+
+@@ -177,7 +178,7 @@
+
+ private final Convertible car = localConvertible.get();
+ private final Cupholder cupholder = car.cupholder;
+- private final SpareTire spareTire = car.spareTire;
++ private final Tire spareTire = car.spareTire;
+ private final Tire plainTire = car.fieldPlainTire;
+ private final Engine engine = car.engineProvider.get();
+
+@@ -430,7 +431,7 @@
+
+ public void testOverriddingMixedWithPackagePrivate2() {
+ assertTrue(spareTire.packagePrivateMethod2Injected);
+- assertTrue(((Tire) spareTire).packagePrivateMethod2Injected);
++ assertTrue((spareTire).packagePrivateMethod2Injected);
+ assertFalse(((RoundThing) spareTire).packagePrivateMethod2Injected);
+
+ assertTrue(plainTire.packagePrivateMethod2Injected);
+@@ -438,8 +439,8 @@
+ }
+
+ public void testOverriddingMixedWithPackagePrivate3() {
+- assertFalse(spareTire.packagePrivateMethod3Injected);
+- assertTrue(((Tire) spareTire).packagePrivateMethod3Injected);
++ assertFalse(((SpareTire) spareTire).packagePrivateMethod3Injected);
++ assertTrue((spareTire).packagePrivateMethod3Injected);
+ assertFalse(((RoundThing) spareTire).packagePrivateMethod3Injected);
+
+ assertTrue(plainTire.packagePrivateMethod3Injected);
+@@ -550,7 +551,7 @@
+
+ private final Convertible car = localConvertible.get();
+ private final Engine engine = car.engineProvider.get();
+- private final SpareTire spareTire = car.spareTire;
++ private final Tire spareTire = car.spareTire;
+
+ public void testSupertypePrivateMethodInjected() {
+ assertTrue(spareTire.superPrivateMethodInjected);
+Index: .project
+===================================================================
+--- .project (revision 0)
++++ .project (revision 0)
+@@ -0,0 +1,17 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<projectDescription>
++ <name>atinject</name>
++ <comment></comment>
++ <projects>
++ </projects>
++ <buildSpec>
++ <buildCommand>
++ <name>org.eclipse.jdt.core.javabuilder</name>
++ <arguments>
++ </arguments>
++ </buildCommand>
++ </buildSpec>
++ <natures>
++ <nature>org.eclipse.jdt.core.javanature</nature>
++ </natures>
++</projectDescription>
+Index: build.sh
+===================================================================
+--- build.sh (revision 46)
++++ build.sh (working copy)
+@@ -9,8 +9,8 @@
+ mkdir -p build/tck/dist
+
+ # Compile classes.
+-javac -g -d build/classes `find src -name *.java`
+-javac -g -classpath build/classes:lib/junit.jar -d build/tck/classes \
++javac -source 1.5 -target 1.5 -g -d build/classes `find src -name *.java`
++javac -source 1.5 -target 1.5 -g -classpath build/classes:lib/junit.jar -d build/tck/classes \
+ `find tck -name *.java`
+
+ FOOTER="<font size='-1'>Copyright (C) 2009 <a href='http://code.google.com/p/atinject/'>\
+Index: tck-pom.xml
+===================================================================
+--- tck-pom.xml (revision 0)
++++ tck-pom.xml (revision 0)
+@@ -0,0 +1,21 @@
++<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
++
++ <modelVersion>4.0.0</modelVersion>
++
++ <groupId>org.atinject</groupId>
++ <artifactId>inject-tck</artifactId>
++ <version>1.0.0-PFD-3</version>
++
++ <packaging>jar</packaging>
++
++ <name>JSR-330 TCK: Dependency Injection for Java</name>
++
++ <url>http://code.google.com/p/atinject/</url>
++
++ <build>
++
++ </build>
++
++</project>
++
+Index: pom.xml
+===================================================================
+--- pom.xml (revision 46)
++++ pom.xml (working copy)
+@@ -5,7 +5,7 @@
+
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+- <version>1.0-SNAPSHOT</version>
++ <version>1.0-PFD-1</version>
+
+ <name>Javax Inject from the JSR-330 Expert Group</name>
+
+Index: tck-readme.txt
+===================================================================
+--- tck-readme.txt (revision 0)
++++ tck-readme.txt (revision 0)
+@@ -0,0 +1 @@
++mvn deploy:deploy-file -DpomFile=tck-pom.xml -Dfile=build/tck/dist/javax.inject-tck.jar -Durl=file:///Users/pmuir/development/repository && mvn deploy:deploy-file -DpomFile=tck-pom.xml -Dfile=build/tck/dist/javax.inject-tck-src.zip -Durl=file:///Users/pmuir/development/repository -Dclassifier=sources && mvn deploy:deploy-file -DpomFile=tck-pom.xml -Dfile=build/tck/dist/javax.inject-tck-javadoc.zip -Durl=file:///Users/pmuir/development/repository -Dclassifier=javadoc
15 years, 1 month
[webbeans-commits] Webbeans SVN: r3827 - examples/trunk/se/numberguess.
by webbeans-commits@lists.jboss.org
Author: peteroyle
Date: 2009-10-01 09:30:33 -0400 (Thu, 01 Oct 2009)
New Revision: 3827
Modified:
examples/trunk/se/numberguess/readme.txt
Log:
Updated documentation to reflect API changes
Modified: examples/trunk/se/numberguess/readme.txt
===================================================================
--- examples/trunk/se/numberguess/readme.txt 2009-10-01 07:27:10 UTC (rev 3826)
+++ examples/trunk/se/numberguess/readme.txt 2009-10-01 13:30:33 UTC (rev 3827)
@@ -14,16 +14,17 @@
See the License for the specific language governing permissions and
limitations under the License.
====
-===================
+
+===========================
Swing Example: Number Guess
-===================
+===========================
Here's an example of a Swing application, Number Guess, similar to the example in chapter 3.4.
In the Number Guess application you get given 10 attempts to guess a number between 1 and
100. After each attempt, you will be told whether you are too high, or too low. This example can
be found in the examples/se/numberguess folder of the Web Beans distribution.
-There is an empty beans.xml file in the root package (src/main/resources/beans.xml), which
+There is an empty beans.xml file in the META-INF package (src/main/resources/META-INF/beans.xml), which
marks this application as a Web Beans application.
The game's main logic is located in Game.java. Some key points about this class:
@@ -56,7 +57,7 @@
order to determine the appropriate messages to provide as the prompt for the user's next guess
and the response to the previous guess. Some key points about this class:
- The instance of Game for the application is injected here.
+ The instance of Game for the application is injected.
The Game's state is interrogated to determine the appropriate challenge message.
And again to determine whether to congratulate, console or encourage the user to continue.
@@ -65,34 +66,34 @@
Finally we come to the NumberGuessFrame class which provides the Swing front end to our
guessing game.
- The injected instance of the game (logic and state).
+ The instance of Game for the application is injected.
- The injected message generator for UI messages.
+ The message generator for UI messages is injected.
- This application is started in the usual Web Beans SE way, by observing the @Deployed
- Manager event.
+ This application is started in the usual Web Beans SE way, by observing the
+ ContainerInitialized event.
- This method initialises all of the Swing components. Note the use of the msgGenerator.
- guessButtonActionPerformed is called when the 'Guess' button is clicked, and it does the
- following:
+ The initComponents method initializes all of the Swing components. Note the use of the msgGenerator.
+ guessButtonActionPerformed is called when the 'Guess' button is clicked, and it does the
+ following:
- Gets the guess entered by the user and sets it as the current guess in the Game
- Calls game.check() to validate and perform one 'turn' of the game
- Calls refreshUI. If there were validation errors with the input, this will have been
captured during game.check() and as such will be reflected in the messeges returned
- by MessageGenerator and subsequently presented to the user. If there are no validation
- errors then the user will be told to guess again (higher or lower) or that the game has ended
- either in a win (correct guess) or a loss (ran out of guesses).
+ by MessageGenerator and subsequently presented to the user. If there are no validation
+ errors then the user will be told to guess again (higher or lower) or that the game has ended
+ either in a win (correct guess) or a loss (ran out of guesses).
- replayBtnActionPerformed simply calls game.reset() to start a new game and refreshes
- the messages in the UI.
+ replayBtnActionPerformed simply calls game.reset() to start a new game and refreshes
+ the messages in the UI.
- refreshUI uses the MessageGenerator to update the messages to the user based on the
- current state of the Game.
+ refreshUI uses the MessageGenerator to update the messages to the user based on the
+ current state of the Game.
------------------
+-------------------
Running the Example
------------------
+-------------------
As with all Web Beans SE applications, this example is executed
by starting Java with org.jboss.webbeans.environment.se.StartMain
15 years, 1 month