[webbeans-commits] Webbeans SVN: r2208 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-25 22:53:57 -0400 (Wed, 25 Mar 2009)
New Revision: 2208
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GreatGrannySmithAppleTree.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChicken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChickenLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Apple.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTree.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTreeLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Chicken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/ChickenLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Egg.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/EnterpriseProducerMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Yummy.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/beans.xml
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
Log:
tests for 4.2.dd, 4.2.dj
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GreatGrannySmithAppleTree.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GreatGrannySmithAppleTree.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GreatGrannySmithAppleTree.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
+
+class GreatGrannySmithAppleTree extends GrannySmithAppleTree
+{
+
+}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-03-26 01:25:37 UTC (rev 2207)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -205,7 +205,10 @@
}
@Test
- @SpecAssertion(section = "4.2", id = "da")
+ @SpecAssertions({
+ @SpecAssertion(section = "4.2", id = "da"),
+ @SpecAssertion(section = "4.2", id = "dg")
+ })
public void testNonStaticProducerMethodNotInherited()
{
assert getCurrentManager().resolveByType(Apple.class, new AnnotationLiteral<Yummy>() {}).size() == 1;
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChicken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChicken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChicken.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import javax.ejb.Stateful;
+import javax.inject.Specializes;
+
+@AnotherDeploymentType
+@Stateful
+@Specializes
+public class AndalusianChicken extends Chicken implements AndalusianChickenLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChickenLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChickenLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AndalusianChickenLocal.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface AndalusianChickenLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AnotherDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AnotherDeploymentType.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@interface AnotherDeploymentType
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Apple.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Apple.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Apple.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+public class Apple
+{
+ private AppleTree tree;
+
+ public Apple(AppleTree tree)
+ {
+ this.tree = tree;
+ }
+
+ public AppleTree getTree()
+ {
+ return tree;
+ }
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTree.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTree.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTree.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import javax.ejb.Stateful;
+import javax.inject.Produces;
+
+@Stateful
+public class AppleTree implements AppleTreeLocal
+{
+ @Produces @Yummy public Apple produceApple()
+ {
+ return new Apple(this);
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTreeLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTreeLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/AppleTreeLocal.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface AppleTreeLocal
+{
+ public Apple produceApple();
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Chicken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Chicken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Chicken.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import javax.ejb.Stateful;
+import javax.inject.Produces;
+
+@Stateful
+public class Chicken implements ChickenLocal
+{
+
+ @Produces @Yummy
+ public Egg produceEgg()
+ {
+ return new Egg(this);
+ }
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/ChickenLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/ChickenLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/ChickenLocal.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface ChickenLocal
+{
+ public Egg produceEgg();
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Egg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Egg.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Egg.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+public class Egg
+{
+ private final Chicken mother;
+
+ public Egg(Chicken mother)
+ {
+ this.mother = mother;
+ }
+
+ public Chicken getMother()
+ {
+ return mother;
+ }
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/EnterpriseProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/EnterpriseProducerMethodDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/EnterpriseProducerMethodDefinitionTest.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,40 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import javax.inject.AnnotationLiteral;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@IntegrationTest
+@Artifact
+@BeansXml("beans.xml")
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseProducerMethodDefinitionTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "4.2", id = "dd")
+ public void testNonStaticProducerMethodInheritedBySpecializingSubclass()
+ {
+ assert getCurrentManager().resolveByType(Egg.class, new AnnotationLiteral<Yummy>() {}).size() == 1;
+ assert getCurrentManager().getInstanceByType(Egg.class, new AnnotationLiteral<Yummy>() {}).getMother().getClass().equals(AndalusianChicken.class);
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "4.2", id = "dd"),
+ @SpecAssertion(section = "4.2", id = "dj")
+ })
+ public void testNonStaticProducerMethodNotInherited()
+ {
+ assert getCurrentManager().resolveByType(Apple.class, new AnnotationLiteral<Yummy>() {}).size() == 1;
+ assert getCurrentManager().getInstanceByType(Apple.class, new AnnotationLiteral<Yummy>() {}).getTree().getClass().equals(AppleTree.class);
+ }
+}
+
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Yummy.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Yummy.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/Yummy.java 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Yummy
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/enterprise/beans.xml 2009-03-26 02:53:57 UTC (rev 2208)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+</Beans>
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2207 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-25 21:25:37 -0400 (Wed, 25 Mar 2009)
New Revision: 2207
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Apple.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/AppleTree.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GrannySmithAppleTree.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
Log:
fix 4.2.da test, add test for another aspect of same assertion
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Apple.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Apple.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Apple.java 2009-03-26 01:25:37 UTC (rev 2207)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
+
+class Apple
+{
+ private AppleTree tree;
+
+ public Apple(AppleTree tree)
+ {
+ this.tree = tree;
+ }
+
+ public AppleTree getTree()
+ {
+ return tree;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/AppleTree.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/AppleTree.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/AppleTree.java 2009-03-26 01:25:37 UTC (rev 2207)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
+
+import javax.inject.Produces;
+
+class AppleTree
+{
+ @Produces @Yummy public Apple produceApple()
+ {
+ return new Apple(this);
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GrannySmithAppleTree.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GrannySmithAppleTree.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GrannySmithAppleTree.java 2009-03-26 01:25:37 UTC (rev 2207)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
+
+class GrannySmithAppleTree extends AppleTree
+{
+
+}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-03-26 00:42:15 UTC (rev 2206)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-03-26 01:25:37 UTC (rev 2207)
@@ -196,17 +196,23 @@
assert wolfSpider.getScopeType().equals(RequestScoped.class);
}
- @Test(groups="ri-broken")
+ @Test
@SpecAssertion(section = "4.2", id = "da")
- public void testNonStaticProducerMethodNotInherited()
+ public void testNonStaticProducerMethodInheritedBySpecializingSubclass()
{
- // TODO - does this even test the assertion correctly? where is class Y?
assert getCurrentManager().resolveByType(Egg.class, new AnnotationLiteral<Yummy>() {}).size() == 1;
- System.out.println(getCurrentManager().getInstanceByType(Egg.class, new AnnotationLiteral<Yummy>() {}).getMother().getClass());
- assert getCurrentManager().getInstanceByType(Egg.class, new AnnotationLiteral<Yummy>() {}).getMother().getClass().equals(Chicken.class);
+ assert getCurrentManager().getInstanceByType(Egg.class, new AnnotationLiteral<Yummy>() {}).getMother().getClass().equals(AndalusianChicken.class);
}
@Test
+ @SpecAssertion(section = "4.2", id = "da")
+ public void testNonStaticProducerMethodNotInherited()
+ {
+ assert getCurrentManager().resolveByType(Apple.class, new AnnotationLiteral<Yummy>() {}).size() == 1;
+ assert getCurrentManager().getInstanceByType(Apple.class, new AnnotationLiteral<Yummy>() {}).getTree().getClass().equals(AppleTree.class);
+ }
+
+ @Test
@SpecAssertion(section = "2.3.6", id = "a")
public void testBindingTypesAppliedToProducerMethodParameters()
{
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2206 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-25 20:42:15 -0400 (Wed, 25 Mar 2009)
New Revision: 2206
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/BeanWithInjectedField_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/ParameterizedTypeInjectionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/wildcard/WildcardTypeInjectionTest.java
Log:
WBRI-169
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-03-25 20:42:35 UTC (rev 2205)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-03-26 00:42:15 UTC (rev 2206)
@@ -18,6 +18,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.ArrayList;
@@ -86,6 +87,21 @@
{
throw new DefinitionException("The injection point " + injectionPoint + " is annotated with @New which cannot be combined with other binding types");
}
+ if (injectionPoint.getType() instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
+ for (Type type : parameterizedType.getActualTypeArguments())
+ {
+ if (type instanceof TypeVariable)
+ {
+ throw new DefinitionException("Injection point cannot have a type variable type parameter " + injectionPoint);
+ }
+ if (type instanceof WildcardType)
+ {
+ throw new DefinitionException("Injection point cannot have a wildcard type parameter " + injectionPoint);
+ }
+ }
+ }
checkFacadeInjectionPoint(injectionPoint, Obtains.class, Instance.class);
checkFacadeInjectionPoint(injectionPoint, Fires.class, Event.class);
Annotation[] bindings = injectionPoint.getBindings().toArray(new Annotation[0]);
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/BeanWithInjectedField_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/BeanWithInjectedField_Broken.java 2009-03-25 20:42:35 UTC (rev 2205)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/BeanWithInjectedField_Broken.java 2009-03-26 00:42:15 UTC (rev 2206)
@@ -1,9 +1,13 @@
package org.jboss.jsr299.tck.tests.definition.deployment.broken.typevariable;
-import javax.inject.Current;
+import javax.inject.Initializer;
class BeanWithInjectedField_Broken
{
- @Current
- private Farmer_Broken injectedFarmer;
+
+ @Initializer
+ public <T> void initialize(Farmer_Broken<T> farmer)
+ {
+
+ }
}
\ No newline at end of file
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/ParameterizedTypeInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/ParameterizedTypeInjectionTest.java 2009-03-25 20:42:35 UTC (rev 2205)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/typevariable/ParameterizedTypeInjectionTest.java 2009-03-26 00:42:15 UTC (rev 2206)
@@ -16,7 +16,7 @@
@ExpectedDeploymentException(DefinitionException.class)
public class ParameterizedTypeInjectionTest extends AbstractJSR299Test
{
- @Test(groups = {"ri-broken"})
+ @Test
@SpecAssertion(section = "2.2", id = "c")
public void testInjectionPointIsNotParameterizedTypeWithTypeVariable()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/wildcard/WildcardTypeInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/wildcard/WildcardTypeInjectionTest.java 2009-03-25 20:42:35 UTC (rev 2205)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/broken/wildcard/WildcardTypeInjectionTest.java 2009-03-26 00:42:15 UTC (rev 2206)
@@ -16,7 +16,7 @@
@ExpectedDeploymentException(DefinitionException.class)
public class WildcardTypeInjectionTest extends AbstractJSR299Test
{
- @Test(groups = {"ri-broken"})
+ @Test
@SpecAssertion(section = "2.2", id = "d")
public void testInjectionPointIsNotParameterizedTypeWithWildcardVariable()
{
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2204 - ri/trunk/impl/src/main/java/org/jboss/webbeans/event and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-25 16:01:41 -0400 (Wed, 25 Mar 2009)
New Revision: 2204
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/BostonTerrier.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/ObserverMethodAndTypeVariableEventTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/FooObserver.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3/BostonTerrier.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java
Log:
WBRI-136, fix hashcode on parameterizedtypeimpl, fix it so that only event types with type variables and wildcard types are definition exceptions (and fix tests accordingly)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -255,6 +255,7 @@
{
throw new DuplicateBindingTypeException("Duplicate binding types: " + bindings);
}
+ Type t = new Reflections.HierarchyDiscovery(clazz).getResolvedType();
for (Type type : Reflections.getActualTypeArguments(clazz))
{
if (type instanceof WildcardType)
@@ -502,7 +503,7 @@
public <T> Manager addObserver(ObserverImpl<T> observer)
{
- addObserver(observer, observer.getEventType(), observer.getBindingsAsArray());
+ this.eventManager.addObserver(observer, observer.getEventType(), observer.getBindingsAsArray());
return this;
}
@@ -522,7 +523,7 @@
*/
public <T> Manager addObserver(Observer<T> observer, TypeLiteral<T> eventType, Annotation... bindings)
{
- eventManager.addObserver(observer, eventType.getRawType(), bindings);
+ eventManager.addObserver(observer, eventType.getType(), bindings);
return this;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -96,7 +96,7 @@
* @param eventType The event type
* @param observer The observer to add
*/
- public void put(Class<?> eventType, EventObserver<?> observer)
+ public void put(Type eventType, EventObserver<?> observer)
{
List<EventObserver<?>> observers = super.get(eventType);
if (observers == null)
@@ -142,7 +142,7 @@
* @param eventType The event type the observer is interested in
* @param bindings The bindings the observer wants to filter on
*/
- public <T> void addObserver(Observer<T> observer, Class<T> eventType, Annotation... bindings)
+ public <T> void addObserver(Observer<T> observer, Type eventType, Annotation... bindings)
{
EventObserver<T> eventObserver = new EventObserver<T>(observer, eventType, bindings);
registeredObservers.put(eventType, eventObserver);
@@ -161,7 +161,7 @@
public <T> Set<Observer<T>> getObservers(T event, Annotation... bindings)
{
Set<Observer<T>> interestedObservers = new HashSet<Observer<T>>();
- Set<Type> types = new HierarchyDiscovery<Type>(event.getClass()).getFlattenedTypes();
+ Set<Type> types = new HierarchyDiscovery(event.getClass()).getFlattenedTypes();
for (Type type : types)
{
for (EventObserver<?> observer : registeredObservers.get(type))
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -18,6 +18,7 @@
package org.jboss.webbeans.event;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
@@ -45,7 +46,7 @@
public class EventObserver<T>
{
- private final Class<T> eventType;
+ private final Type eventType;
private final List<Annotation> eventBindings;
private final Observer<T> observer;
@@ -56,7 +57,7 @@
* @param eventType The class of event being observed
* @param eventBindings The array of annotation event bindings, if any
*/
- public EventObserver(final Observer<T> observer, final Class<T> eventType, final Annotation... eventBindings)
+ public EventObserver(final Observer<T> observer, final Type eventType, final Annotation... eventBindings)
{
this.observer = observer;
this.eventType = eventType;
@@ -93,7 +94,7 @@
/**
* @return the eventType
*/
- public final Class<T> getEventType()
+ public final Type getEventType()
{
return eventType;
}
@@ -191,7 +192,7 @@
{
StringBuilder buffer = new StringBuilder();
buffer.append("Event Observer:\n");
- buffer.append(" Event Type: " + eventType.getName() + "\n");
+ buffer.append(" Event Type: " + eventType + "\n");
buffer.append(Strings.collectionToString(" Event Bindings: ", eventBindings));
buffer.append(" Observer: " + observer);
return buffer.toString();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -18,6 +18,9 @@
package org.jboss.webbeans.event;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
import java.util.List;
import javax.context.Dependent;
@@ -59,7 +62,7 @@
private final boolean conditional;
private final boolean asynchronous;
protected ManagerImpl manager;
- private final Class<T> eventType;
+ private final Type eventType;
private final Annotation[] bindings;
/**
@@ -75,12 +78,8 @@
this.manager = manager;
this.observerBean = observerBean;
this.observerMethod = MethodInjectionPoint.of(observerBean, observer);
-
+ this.eventType = observerMethod.getAnnotatedParameters(Observes.class).get(0).getType();
- @SuppressWarnings("unchecked")
- Class<T> c = (Class<T>) observerMethod.getAnnotatedParameters(Observes.class).get(0).getRawType();
- this.eventType = c;
-
this.bindings = observerMethod.getAnnotatedParameters(Observes.class).get(0).getBindingsAsArray();
this.conditional = !observerMethod.getAnnotatedParameters(IfExists.class).isEmpty();
this.asynchronous = !observerMethod.getAnnotatedParameters(Asynchronously.class).isEmpty();
@@ -116,7 +115,17 @@
AnnotatedParameter<?> eventParam = eventObjects.iterator().next();
if (eventParam.isParameterizedType())
{
- throw new DefinitionException(this + " cannot observe parameterized event types");
+ for (Type type : eventParam.getActualTypeArguments())
+ {
+ if (type instanceof TypeVariable)
+ {
+ throw new DefinitionException("Cannot use a type variable " + type + " in an parameterized type " + toString());
+ }
+ else if (type instanceof WildcardType)
+ {
+ throw new DefinitionException("Cannot use a wildcard variable " + type + " in an parameterized type " + toString());
+ }
+ }
}
}
// Check for parameters annotated with @Disposes
@@ -218,7 +227,7 @@
return builder.toString();
}
- public Class<T> getEventType()
+ public Type getEventType()
{
return eventType;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -86,7 +86,7 @@
this.actualTypeArguments = new Type[0];
}
this._parameterizedType = Reflections.isParameterizedType(rawType);
- this.flattenedTypes = new Reflections.HierarchyDiscovery<Type>(type).getFlattenedTypes();
+ this.flattenedTypes = new Reflections.HierarchyDiscovery(type).getFlattenedTypes();
this.proxyable = Proxies.isTypesProxyable(flattenedTypes);
}
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-03-25 16:05:11 UTC (rev 2203)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -48,35 +48,39 @@
public class Reflections
{
- public static class HierarchyDiscovery<T extends Type>
+ public static class HierarchyDiscovery
{
- private final T type;
+ private final Type type;
- private Set<T> types;
+ private Set<Type> types;
- public HierarchyDiscovery(T type)
+ public HierarchyDiscovery(Type type)
{
this.type = type;
}
- protected void add(T type)
+ protected void add(Type type)
{
types.add(type);
}
- public Set<T> getFlattenedTypes()
+ public Set<Type> getFlattenedTypes()
{
if (types == null)
{
- this.types = new HashSet<T>();
+ this.types = new HashSet<Type>();
discoverTypes(type);
}
return types;
}
+ public Type getResolvedType()
+ {
+ return resolveType(type, type);
+ }
- private void discoverTypes(T type)
+ private void discoverTypes(Type type)
{
if (type != null)
{
@@ -99,10 +103,10 @@
@SuppressWarnings("unchecked")
private void discoverFromClass(Class<?> clazz)
{
- discoverTypes((T) resolveType(type, clazz.getGenericSuperclass()));
+ discoverTypes(resolveType(type, clazz.getGenericSuperclass()));
for (Type c : clazz.getGenericInterfaces())
{
- discoverTypes((T) resolveType(type, c));
+ discoverTypes(resolveType(type, c));
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -35,42 +35,28 @@
@Override
public int hashCode()
{
- final int prime = 31;
- int result = 1;
- result = prime * result + Arrays.hashCode(actualTypeArguments);
- result = prime * result + ((ownerType == null) ? 0 : ownerType.hashCode());
- result = prime * result + ((rawType == null) ? 0 : rawType.hashCode());
- return result;
+ return Arrays.hashCode(actualTypeArguments) ^ (ownerType == null ? 0 : ownerType.hashCode()) ^ (rawType == null ? 0 : rawType.hashCode());
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof ParameterizedType))
- return false;
-
- final ParameterizedType other = (ParameterizedType) obj;
- if (!Arrays.equals(actualTypeArguments, other.getActualTypeArguments()))
- return false;
- if (ownerType == null)
{
- if (other.getOwnerType() != null)
- return false;
+ return true;
}
- else if (!ownerType.equals(other.getOwnerType()))
- return false;
- if (rawType == null)
+ else if (obj instanceof ParameterizedType)
{
- if (other.getRawType() != null)
- return false;
+ ParameterizedType that = (ParameterizedType) obj;
+ Type thatOwnerType = that.getOwnerType();
+ Type thatRawType = that.getRawType();
+ return (ownerType == null ? thatOwnerType == null : ownerType.equals(thatOwnerType)) && (rawType == null ? thatRawType == null : rawType.equals(thatRawType)) && Arrays.equals(actualTypeArguments, that.getActualTypeArguments());
}
- else if (!rawType.equals(other.getRawType()))
+ else
+ {
return false;
- return true;
+ }
+
}
public String toString()
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3/BostonTerrier.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3/BostonTerrier.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3/BostonTerrier.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -6,7 +6,7 @@
class BostonTerrier
{
- public void observesBadEvent(@Observes List<String> someArray)
+ public void observesBadEvent(@Observes List<?> someArray)
{
}
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/BostonTerrier.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/BostonTerrier.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/BostonTerrier.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.event.broken.observer3a;
+
+import java.util.List;
+
+import javax.event.Observes;
+
+class BostonTerrier
+{
+ public <T> void observesBadEvent(@Observes List<T> someArray)
+ {
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/BostonTerrier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/ObserverMethodAndTypeVariableEventTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/ObserverMethodAndTypeVariableEventTypeTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/ObserverMethodAndTypeVariableEventTypeTest.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.event.broken.observer3a;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.testng.annotations.Test;
+
+/**
+ * Tests an observer method defined to observe an event type which
+ * is generic and wildcarded.
+ *
+ * @author David Allen
+ *
+ */
+@Artifact
+(a)ExpectedDeploymentException(DefinitionException.class)
+public class ObserverMethodAndTypeVariableEventTypeTest extends AbstractJSR299Test
+{
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "7.5.1", id = "c")
+ public void testObserverMethodCannotObserveParameterizedEvents()
+ {
+ assert false;
+ }
+
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer3a/ObserverMethodAndTypeVariableEventTypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java 2009-03-25 16:05:11 UTC (rev 2203)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/ChecksTypeParametersWhenResolvingTest.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -1,7 +1,6 @@
package org.jboss.jsr299.tck.tests.event.resolve.type;
import java.util.ArrayList;
-import java.util.Set;
import javax.event.Observer;
import javax.inject.TypeLiteral;
@@ -14,6 +13,17 @@
@Artifact
public class ChecksTypeParametersWhenResolvingTest extends AbstractJSR299Test
{
+
+ public static class AList extends ArrayList<String>
+ {
+
+ }
+
+ public static class AnotherList extends ArrayList<Integer>
+ {
+
+ }
+
public static class AListObserver implements Observer<ArrayList<String>>
{
public boolean wasNotified = false;
@@ -34,7 +44,7 @@
}
}
- @Test(groups = { "broken", "events" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.7", id = "f")
public void testResolvingChecksTypeParameters()
{
@@ -46,8 +56,16 @@
getCurrentManager().addObserver(anotherObserver, new TypeLiteral<ArrayList<Integer>>()
{
});
- Set<Observer<ArrayList<String>>> resolvedObservers = getCurrentManager().resolveObservers(new ArrayList<String>());
- //TODO The RI is returning both of the observers above
- assert resolvedObservers.size() == 1;
+ assert getCurrentManager().resolveObservers(new AList()).size() == 1;
+ assert getCurrentManager().resolveObservers(new AList()).iterator().next().getClass().equals(AListObserver.class);
}
+
+ @Test(groups = { "events" })
+ @SpecAssertion(section = "7.7", id = "f")
+ public void testResolvingChecksTypeParametersOnObservesMethod()
+ {
+ Foo<String> fooEvent = new Foo<String>() {};
+ getCurrentManager().fireEvent(fooEvent);
+ assert fooEvent.isObserved();
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.event.resolve.type;
+
+public class Foo<T>
+{
+
+ private boolean observed;
+
+ public boolean isObserved()
+ {
+ return observed;
+ }
+
+ public void setObserved(boolean observed)
+ {
+ this.observed = observed;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/FooObserver.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/FooObserver.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/FooObserver.java 2009-03-25 20:01:41 UTC (rev 2204)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.event.resolve.type;
+
+import javax.event.Observes;
+
+public class FooObserver
+{
+
+ public void observe(@Observes Foo<String> foo)
+ {
+ foo.setObserved(true);
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/type/FooObserver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2203 - in ri/trunk/impl/src/main/java/org/jboss/webbeans/xml: check and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-03-25 12:05:11 -0400 (Wed, 25 Mar 2009)
New Revision: 2203
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanType.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanTypeObtainer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceTypeObtainer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceTypeObtainer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanTypeObtainer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanTypeObtainer.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
some changes with beans declaration validating
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-25 15:00:44 UTC (rev 2202)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -28,11 +28,12 @@
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.xml.check.BeanChildrenChecker;
-import org.jboss.webbeans.xml.check.JmsResourceChildrenChecker;
-import org.jboss.webbeans.xml.check.ResourceChildrenChecker;
-import org.jboss.webbeans.xml.check.SessionBeanChildrenChecker;
-import org.jboss.webbeans.xml.check.SimpleBeanChildrenChecker;
+import org.jboss.webbeans.xml.check.BeanType;
+import org.jboss.webbeans.xml.check.BeanTypeObtainer;
+import org.jboss.webbeans.xml.check.JmsResourceTypeObtainer;
+import org.jboss.webbeans.xml.check.ResourceTypeObtainer;
+import org.jboss.webbeans.xml.check.SessionBeanTypeObtainer;
+import org.jboss.webbeans.xml.check.SimpleBeanTypeObtainer;
public class XmlParser
{
@@ -40,7 +41,7 @@
private final XmlEnvironment environment;
- private List<BeanChildrenChecker> childrenCheckers = new ArrayList<BeanChildrenChecker>();
+ private List<BeanTypeObtainer> beanTypeObtainers = new ArrayList<BeanTypeObtainer>();
private boolean haveAnyDeployElement = false;
@@ -49,10 +50,10 @@
public XmlParser(XmlEnvironment environment)
{
this.environment = environment;
- this.childrenCheckers.add(new JmsResourceChildrenChecker());
- this.childrenCheckers.add(new ResourceChildrenChecker());
- this.childrenCheckers.add(new SessionBeanChildrenChecker());
- this.childrenCheckers.add(new SimpleBeanChildrenChecker());
+ this.beanTypeObtainers.add(new JmsResourceTypeObtainer());
+ this.beanTypeObtainers.add(new ResourceTypeObtainer());
+ this.beanTypeObtainers.add(new SessionBeanTypeObtainer());
+ this.beanTypeObtainers.add(new SimpleBeanTypeObtainer());
}
public void parse()
@@ -76,8 +77,8 @@
for (Element beanElement : beanElements)
{
AnnotatedClass<?> beanClass = ParseXmlHelper.loadElementClass(beanElement, Object.class, environment, packagesMap);
+ checkBeanElement(beanElement, beanClass);
checkProduces(beanElement, beanClass);
- checkBeanChildren(beanElement, beanClass);
beanClasses.add(beanClass);
}
@@ -204,18 +205,19 @@
return deploymentClasses;
}
- private void checkBeanChildren(Element beanElement, AnnotatedClass<?> beanClass)
- {
- for (BeanChildrenChecker childrenChecker : childrenCheckers)
+ private void checkBeanElement(Element beanElement, AnnotatedClass<?> beanClass)
+ {//TODO: not finished
+ BeanType beanType = BeanType.SIMPLE_BEAN;
+ for(BeanTypeObtainer beanTypeObtainer : beanTypeObtainers)
{
- if (childrenChecker.accept(beanElement, beanClass))
+ if(beanTypeObtainer.accept(beanElement, beanClass))
{
- childrenChecker.checkChildren(beanElement);
- return;
+ beanType = beanTypeObtainer.obtainType(beanElement, beanClass);
+ break;
}
}
-
- throw new DefinitionException("Definition of a bean " + beanElement.getName() + " is incorrect");
+
+
}
private void checkProduces(Element beanElement, AnnotatedClass<?> beanClass)
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java 2009-03-25 15:00:44 UTC (rev 2202)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -1,11 +0,0 @@
-package org.jboss.webbeans.xml.check;
-
-import org.dom4j.Element;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-
-public interface BeanChildrenChecker
-{
- boolean accept(Element element, AnnotatedClass<?> beanClass);
-
- void checkChildren(Element element);
-}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanType.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanType.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanType.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.xml.check;
+
+public enum BeanType
+{
+ JMS_RESOURCE, RESOURCE, SESSION_BEAN, SIMPLE_BEAN
+}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanTypeObtainer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanTypeObtainer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanTypeObtainer.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.xml.check;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+
+public interface BeanTypeObtainer
+{
+ boolean accept(Element beanElement, AnnotatedClass<?> beanClass);
+
+ BeanType obtainType(Element beanElement, AnnotatedClass<?> beanClass);
+}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java 2009-03-25 15:00:44 UTC (rev 2202)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -1,25 +0,0 @@
-package org.jboss.webbeans.xml.check;
-
-import org.dom4j.Element;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.xml.ParseXmlHelper;
-import org.jboss.webbeans.xml.XmlConstants;
-
-public class JmsResourceChildrenChecker implements BeanChildrenChecker
-{
- public boolean accept(Element element, AnnotatedClass<?> beanClass)
- {
- if (ParseXmlHelper.isJavaEeNamespace(element) &&
- (element.getName().equalsIgnoreCase(XmlConstants.TOPIC) ||
- element.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
- return true;
- return false;
- }
-
- public void checkChildren(Element element)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceTypeObtainer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceTypeObtainer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceTypeObtainer.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -0,0 +1,23 @@
+package org.jboss.webbeans.xml.check;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.ParseXmlHelper;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class JmsResourceTypeObtainer implements BeanTypeObtainer
+{
+ public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ if (ParseXmlHelper.isJavaEeNamespace(beanElement) &&
+ (beanElement.getName().equalsIgnoreCase(XmlConstants.TOPIC) ||
+ beanElement.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
+ return true;
+ return false;
+ }
+
+ public BeanType obtainType(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ return BeanType.JMS_RESOURCE;
+ }
+}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java 2009-03-25 15:00:44 UTC (rev 2202)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -1,41 +0,0 @@
-package org.jboss.webbeans.xml.check;
-
-import java.util.Iterator;
-
-import org.dom4j.Element;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.xml.ParseXmlHelper;
-import org.jboss.webbeans.xml.XmlConstants;
-
-public class ResourceChildrenChecker implements BeanChildrenChecker
-{
-
- public boolean accept(Element element, AnnotatedClass<?> beanClass)
- {
- if (ParseXmlHelper.isJavaEeNamespace(element) &&
- (element.getName().equalsIgnoreCase(XmlConstants.TOPIC) ||
- element.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
- return false;
-
- Iterator<?> elIterator = element.elementIterator();
- while (elIterator.hasNext())
- {
- Element child = (Element) elIterator.next();
- if (ParseXmlHelper.isJavaEeNamespace(child) &&
- (child.getName().equalsIgnoreCase(XmlConstants.RESOURCE) ||
- child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_CONTEXT) ||
- child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_UNIT) ||
- child.getName().equalsIgnoreCase(XmlConstants.EJB) ||
- child.getName().equalsIgnoreCase(XmlConstants.WEB_SERVICE_REF)))
- return true;
- }
- return false;
- }
-
- public void checkChildren(Element element)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceTypeObtainer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceTypeObtainer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceTypeObtainer.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -0,0 +1,39 @@
+package org.jboss.webbeans.xml.check;
+
+import java.util.Iterator;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.ParseXmlHelper;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class ResourceTypeObtainer implements BeanTypeObtainer
+{
+
+ public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ if (ParseXmlHelper.isJavaEeNamespace(beanElement) &&
+ (beanElement.getName().equalsIgnoreCase(XmlConstants.TOPIC) ||
+ beanElement.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
+ return false;
+
+ Iterator<?> elIterator = beanElement.elementIterator();
+ while (elIterator.hasNext())
+ {
+ Element child = (Element) elIterator.next();
+ if (ParseXmlHelper.isJavaEeNamespace(child) &&
+ (child.getName().equalsIgnoreCase(XmlConstants.RESOURCE) ||
+ child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_CONTEXT) ||
+ child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_UNIT) ||
+ child.getName().equalsIgnoreCase(XmlConstants.EJB) ||
+ child.getName().equalsIgnoreCase(XmlConstants.WEB_SERVICE_REF)))
+ return true;
+ }
+ return false;
+ }
+
+ public BeanType obtainType(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ return BeanType.RESOURCE;
+ }
+}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java 2009-03-25 15:00:44 UTC (rev 2202)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -1,27 +0,0 @@
-package org.jboss.webbeans.xml.check;
-
-import org.dom4j.Element;
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.xml.XmlConstants;
-
-public class SessionBeanChildrenChecker implements BeanChildrenChecker
-{
-
- public boolean accept(Element element, AnnotatedClass<?> beanClass)
- {
- ManagerImpl manager = CurrentManager.rootManager();
- if (manager.getEjbDescriptorCache().containsKey(element.getName()) ||
- element.attribute(XmlConstants.EJB_NAME) != null)
- return true;
- return false;
- }
-
- public void checkChildren(Element element)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanTypeObtainer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanTypeObtainer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanTypeObtainer.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.xml.check;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class SessionBeanTypeObtainer implements BeanTypeObtainer
+{
+
+ public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ ManagerImpl manager = CurrentManager.rootManager();
+ if (manager.getEjbDescriptorCache().containsKey(beanElement.getName()) ||
+ beanElement.attribute(XmlConstants.EJB_NAME) != null)
+ return true;
+ return false;
+ }
+
+ public BeanType obtainType(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ return BeanType.SESSION_BEAN;
+ }
+}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java 2009-03-25 15:00:44 UTC (rev 2202)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -1,29 +0,0 @@
-package org.jboss.webbeans.xml.check;
-
-import org.dom4j.Element;
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.xml.XmlConstants;
-
-public class SimpleBeanChildrenChecker implements BeanChildrenChecker
-{
-
- public boolean accept(Element element, AnnotatedClass<?> beanClass)
- {
- ManagerImpl manager = CurrentManager.rootManager();
- boolean isSessionBean = manager.getEjbDescriptorCache().containsKey(element.getName()) ||
- element.attribute(XmlConstants.EJB_NAME) != null;
-
- if (!beanClass.isAbstract() && !isSessionBean && !beanClass.isParameterizedType())
- return true;
-
- return false;
- }
-
- public void checkChildren(Element element)
- {
- // TODO Auto-generated method stub
-
- }
-}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanTypeObtainer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanTypeObtainer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanTypeObtainer.java 2009-03-25 16:05:11 UTC (rev 2203)
@@ -0,0 +1,47 @@
+package org.jboss.webbeans.xml.check;
+
+import javax.decorator.Decorator;
+import javax.inject.DefinitionException;
+import javax.interceptor.Interceptor;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.ParseXmlHelper;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class SimpleBeanTypeObtainer implements BeanTypeObtainer
+{
+
+ public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ ManagerImpl manager = CurrentManager.rootManager();
+ boolean isSessionBean = manager.getEjbDescriptorCache().containsKey(beanElement.getName()) ||
+ beanElement.attribute(XmlConstants.EJB_NAME) != null;
+
+ if (!beanClass.isAbstract() && !isSessionBean && !beanClass.isParameterizedType())
+ return true;
+
+ return false;
+ }
+
+ public BeanType obtainType(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ if(beanClass.isNonStaticMemberClass())
+ throw new DefinitionException("Bean class '" + beanClass.getName() + "' of a simple bean <" + beanElement.getName() +
+ "> is a non static member class");
+
+ if(beanClass.getRawType().isAnnotationPresent(Interceptor.class) &&
+ ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.INTERCEPTOR).size() != 1)
+ throw new DefinitionException("a simple bean defined in XML as <" + beanElement.getName() + "> has a bean class '" +
+ beanClass.getName() + "' annotated @Interceptor and is not declared as an interceptor in XML");
+
+ if(beanClass.getRawType().isAnnotationPresent(Decorator.class) &&
+ ParseXmlHelper.findElementsInEeNamespace(beanElement, XmlConstants.DECORATOR).size() != 1)
+ throw new DefinitionException("a simple bean defined in XML as <" + beanElement.getName() + "> has a bean class '" +
+ beanClass.getName() + "' annotated @Decorator and is not declared as an interceptor in XML");
+
+ return BeanType.SIMPLE_BEAN;
+ }
+}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2202 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-25 11:00:44 -0400 (Wed, 25 Mar 2009)
New Revision: 2202
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
Log:
Fixed test groups based on current success of various event tests
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-03-25 14:06:36 UTC (rev 2201)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-03-25 15:00:44 UTC (rev 2202)
@@ -93,7 +93,7 @@
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "d") })
public void testEventBindingTypeTargetMostAndRuntime()
{
-
+ assert false;
}
/**
@@ -106,7 +106,7 @@
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "e") })
public void testEventBindingTypeTargetsFieldParameterAndRuntime()
{
-
+ assert false;
}
/**
@@ -115,19 +115,19 @@
* ~@Retention(RUNTIME) TODO If the binding does not have RUNTIME retention,
* it cannot be tested
*/
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events", "stub" })
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "f") })
public void testEventBindingTypeNotRuntime()
{
-
+ assert false;
}
// TODO How to test all annotations w/o BindingType are not event bindings
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events", "underInvestigation" })
@SpecAssertions( { @SpecAssertion(section = "7.1", id = "g") })
public void testEventBindingTypesSpecifyBinding()
{
-
+ assert false;
}
@Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@@ -217,24 +217,19 @@
assert false;
}
- @Test(groups = { "events", "broken" }, expectedExceptions = { IllegalArgumentException.class })
+ @Test(groups = { "events", "underInvestigation" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertions( { @SpecAssertion(section = "7.3", id = "h") })
public void testManagerRemoveObserverWithEventTypeParametersFails()
{
+ //TODO This requires passing a Class<T> corresponding to Event<T> which is not possible
assert false;
- // ATemplatedEventType<String> anEvent = new
- // ATemplatedEventType<String>();
- // Observer<AnEventType> observer = new AnObserver();
- // getCurrentManager().addObserver(observer, anEvent.getClass());
}
- @Test(groups = { "events", "stub" }, expectedExceptions = { IllegalArgumentException.class })
+ @Test(groups = { "events", "underInvestigation" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertions( { @SpecAssertion(section = "7.3", id = "i") })
public void testManagerRemoveObserverWithEventTypeWildcardsFails()
{
- // Although the above test is really the same as with a wildcard,
- // we will test it anyhow since the specification calls it out separately.
- ATemplatedEventType<?> anEventOnAnyType = new ATemplatedEventType<String>();
+ //TODO This requires passing a Class<T> corresponding to Event<?> which is not possible
assert false;
}
@@ -585,7 +580,7 @@
}.run();
}
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertions( { @SpecAssertion(section = "7.6", id = "n") } )
public void testImplicitEventBeanMatchesAPITypeOfInectionPoint() throws Exception
{
@@ -604,7 +599,7 @@
}.run();
}
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertions( { @SpecAssertion(section = "7.6", id = "n") } )
public void testImplicitEventBeanMatchesBindingAnnotationsOfInjectionPoint() throws Exception
{
@@ -623,7 +618,7 @@
}.run();
}
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "o")
public void testImplicitEventBeanHasStandardDeploymentType() throws Exception
{
@@ -644,7 +639,7 @@
}.run();
}
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "p")
public void testImplicitEventBeanHasDependentScope() throws Exception
{
@@ -663,7 +658,7 @@
}.run();
}
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.6", id = "q")
public void testImplicitEventBeanHasNoName() throws Exception
{
@@ -682,7 +677,7 @@
}.run();
}
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertions( { @SpecAssertion(section = "7.6", id = "a"), @SpecAssertion(section = "7.6", id = "r") } )
public void testImplicitEventBeanProvidedByContainer() throws Exception
{
@@ -755,7 +750,7 @@
getCurrentManager().resolveObservers(eventToFire);
}
- @Test(groups = { "broken", "events" }, expectedExceptions = { IllegalArgumentException.class })
+ @Test(groups = { "events" }, expectedExceptions = { IllegalArgumentException.class })
@SpecAssertion(section = "7.7", id = "c")
public void testEventObjectContainsWildcardsWhenResolvingFails()
{
@@ -764,7 +759,6 @@
private void eventObjectContainsWildcards(ArrayList<?> eventToFire)
{
- // TODO There does not seem to be a way to get wildcarded types passed
getCurrentManager().resolveObservers(eventToFire);
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2201 - in ri/trunk/impl/src/main/java/org/jboss/webbeans/xml: check and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-03-25 10:06:36 -0400 (Wed, 25 Mar 2009)
New Revision: 2201
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
add method for validating Producer method and field declarations
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-25 10:38:49 UTC (rev 2200)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-25 14:06:36 UTC (rev 2201)
@@ -2,7 +2,6 @@
import java.io.IOException;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
@@ -19,11 +18,6 @@
import org.dom4j.Namespace;
import org.dom4j.QName;
import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.MethodSignature;
-import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
-import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
import org.jboss.webbeans.resources.spi.ResourceLoadingException;
public class ParseXmlHelper
@@ -194,22 +188,6 @@
return elements;
}
-
- public static boolean isField(Element element, AnnotatedClass<?> beanClass, AnnotatedClass<?> expectedType)
- {
- //TODO
- String fieldName = element.getParent().getName();
- AnnotatedField<?> beanField = beanClass.getDeclaredField(fieldName, expectedType);
- if(beanField != null)
- return true;
- return false;
- }
-
- public static boolean isMethod(Element element, AnnotatedClass<?> beanClass, AnnotatedClass<?> expectedType)
- {
- //TODO
- return false;
- }
private static Set<String> parseNamespaceFile(URL namespaceFile)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-25 10:38:49 UTC (rev 2200)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-25 14:06:36 UTC (rev 2201)
@@ -3,6 +3,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
@@ -12,6 +13,9 @@
import java.util.Map;
import java.util.Set;
+import javax.annotation.Named;
+import javax.annotation.Stereotype;
+import javax.context.ScopeType;
import javax.inject.DefinitionException;
import javax.inject.DeploymentException;
import javax.inject.DeploymentType;
@@ -21,8 +25,14 @@
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.xml.check.BeanChildrenChecker;
+import org.jboss.webbeans.xml.check.JmsResourceChildrenChecker;
+import org.jboss.webbeans.xml.check.ResourceChildrenChecker;
+import org.jboss.webbeans.xml.check.SessionBeanChildrenChecker;
+import org.jboss.webbeans.xml.check.SimpleBeanChildrenChecker;
public class XmlParser
{
@@ -30,6 +40,8 @@
private final XmlEnvironment environment;
+ private List<BeanChildrenChecker> childrenCheckers = new ArrayList<BeanChildrenChecker>();
+
private boolean haveAnyDeployElement = false;
private Map<String, Set<String>> packagesMap = new HashMap<String, Set<String>>();
@@ -37,6 +49,10 @@
public XmlParser(XmlEnvironment environment)
{
this.environment = environment;
+ this.childrenCheckers.add(new JmsResourceChildrenChecker());
+ this.childrenCheckers.add(new ResourceChildrenChecker());
+ this.childrenCheckers.add(new SessionBeanChildrenChecker());
+ this.childrenCheckers.add(new SimpleBeanChildrenChecker());
}
public void parse()
@@ -61,6 +77,7 @@
{
AnnotatedClass<?> beanClass = ParseXmlHelper.loadElementClass(beanElement, Object.class, environment, packagesMap);
checkProduces(beanElement, beanClass);
+ checkBeanChildren(beanElement, beanClass);
beanClasses.add(beanClass);
}
@@ -187,12 +204,26 @@
return deploymentClasses;
}
- public void checkProduces(Element beanElement, AnnotatedClass<?> beanClass)
- {//TODO
- Iterator<?> childIterator = beanElement.elementIterator();
- while(childIterator.hasNext())
+ private void checkBeanChildren(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ for (BeanChildrenChecker childrenChecker : childrenCheckers)
{
- Element beanChild = (Element)childIterator.next();
+ if (childrenChecker.accept(beanElement, beanClass))
+ {
+ childrenChecker.checkChildren(beanElement);
+ return;
+ }
+ }
+
+ throw new DefinitionException("Definition of a bean " + beanElement.getName() + " is incorrect");
+ }
+
+ private void checkProduces(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ Iterator<?> beanIterator = beanElement.elementIterator();
+ while(beanIterator.hasNext())
+ {
+ Element beanChild = (Element)beanIterator.next();
List<Element> producesElements = ParseXmlHelper.findElementsInEeNamespace(beanChild, XmlConstants.PRODUCES);
if(producesElements.size() == 0)
@@ -201,18 +232,93 @@
if(producesElements.size() > 1)
throw new DefinitionException("There is more than one child <Produces> element for <" + beanChild.getName() + "> element");
+ List<AnnotatedClass<?>> producesChildTypes = new ArrayList<AnnotatedClass<?>>();
+
Element producesElement = producesElements.get(0);
+ Iterator<?> producesIt = producesElement.elementIterator();
+ while(producesIt.hasNext())
+ {
+ Element producesChild = (Element)producesIt.next();
+ AnnotatedClass<?> producesChildClass = ParseXmlHelper.loadElementClass(producesChild, Object.class, environment, packagesMap);
+ Class<?> producesChildType = producesChildClass.getRawType();
+ boolean isJavaClass = !producesChildType.isEnum() && !producesChildType.isPrimitive() && !producesChildType.isInterface();
+ boolean isInterface = producesChildType.isInterface() && !producesChildType.isAnnotation();
+ if(isJavaClass || isInterface)
+ {
+ producesChildTypes.add(producesChildClass);
+ continue;
+ }
+ if(producesChildType.isAnnotation())
+ {
+ if(producesChildClass.isAnnotationPresent(DeploymentType.class) ||
+ producesChildClass.isAnnotationPresent(ScopeType.class) ||
+ producesChildClass.isAnnotationPresent(Stereotype.class) ||
+ producesChildClass.isAnnotationPresent(Named.class))
+ continue;
+
+ throw new DefinitionException("<" + producesChild.getName() + "> direct child of <Produces> element for <" + beanChild.getName()
+ + "> in bean" + beanElement.getName() + "must be DeploymentType or ScopeType or Stereotype or Named");
+ }
+ throw new DefinitionException("Only Java class, interface type and Java annotation type can be " +
+ "direct child of <Produces> element for <" + beanChild.getName() + "> in bean" + beanElement.getName() +
+ ". Element <" + producesChild.getName() + "> is incorrect");
+ }
- if(ParseXmlHelper.isField(producesElement, beanClass, beanClass))
+ if(producesChildTypes.size() != 1)
+ throw new DefinitionException("More than one or no one child element of <Produces> element for <" + beanChild.getName() +
+ "> in bean" + beanElement.getName() + " represents a Java class or interface type");
+
+ AnnotatedClass<?> expectedType = producesChildTypes.get(0);
+
+ Method beanMethod = null;
+ AnnotatedField<?> beanField = beanClass.getDeclaredField(beanChild.getName(), expectedType);
+
+ try
{
+ List<Class<?>> paramClassesList = new ArrayList<Class<?>>();
+ Iterator<?> beanChildIt = beanChild.elementIterator();
+ while(beanChildIt.hasNext())
+ {
+ Element methodChild = (Element)beanChildIt.next();
+ if(methodChild.getName().equalsIgnoreCase(XmlConstants.PRODUCES))
+ continue;
+ paramClassesList.add(ParseXmlHelper.loadElementClass(methodChild, Object.class, environment, packagesMap).getRawType());
+ }
+ Class<?>[] paramClasses = (Class<?>[])paramClassesList.toArray(new Class[0]);
+ beanMethod = beanClass.getRawType().getDeclaredMethod(beanChild.getName(), paramClasses);
+ }
+ catch (SecurityException e)
+ {}
+ catch (NoSuchMethodException e)
+ {}
+
+ if(beanField != null && beanMethod != null)
+ throw new DefinitionException("Class '" + beanClass.getName() + "' has produser field and method with the same name '" +
+ beanField.getName() + "'");
+
+ if(beanField != null)
+ {
if(beanChild.elements().size() > 1)
throw new DefinitionException("There is more than one direct child element for producer field <" + beanChild.getName() + ">");
+ continue;
}
- if(ParseXmlHelper.isMethod(producesElement, beanClass, beanClass))
- {}
+ if(beanMethod != null)
+ {
+ Iterator<?> beanChildIt = producesElement.elementIterator();
+ while(beanChildIt.hasNext())
+ {
+ Element element = (Element)beanChildIt.next();
+ if(!element.getName().equalsIgnoreCase(XmlConstants.PRODUCES) &&
+ ParseXmlHelper.findElementsInEeNamespace(beanChild, XmlConstants.INTERCEPTOR).size() == 0)
+ throw new DefinitionException("Only Produces and interceptor binding types can be direct childs of a producer " +
+ "method '" + beanChild.getName() + "' declaration in bean '" + beanElement.getName() + "'");
+ }
+ continue;
+ }
-// throw new DefinitionException("A producer doesn't declared in class file as method or field");
+ throw new DefinitionException("A producer '" + beanChild.getName() + "' doesn't declared in '" + beanElement.getName() +
+ "' class file as method or field");
}
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/BeanChildrenChecker.java 2009-03-25 14:06:36 UTC (rev 2201)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.xml.check;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+
+public interface BeanChildrenChecker
+{
+ boolean accept(Element element, AnnotatedClass<?> beanClass);
+
+ void checkChildren(Element element);
+}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/JmsResourceChildrenChecker.java 2009-03-25 14:06:36 UTC (rev 2201)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.xml.check;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.ParseXmlHelper;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class JmsResourceChildrenChecker implements BeanChildrenChecker
+{
+ public boolean accept(Element element, AnnotatedClass<?> beanClass)
+ {
+ if (ParseXmlHelper.isJavaEeNamespace(element) &&
+ (element.getName().equalsIgnoreCase(XmlConstants.TOPIC) ||
+ element.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
+ return true;
+ return false;
+ }
+
+ public void checkChildren(Element element)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/ResourceChildrenChecker.java 2009-03-25 14:06:36 UTC (rev 2201)
@@ -0,0 +1,41 @@
+package org.jboss.webbeans.xml.check;
+
+import java.util.Iterator;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.ParseXmlHelper;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class ResourceChildrenChecker implements BeanChildrenChecker
+{
+
+ public boolean accept(Element element, AnnotatedClass<?> beanClass)
+ {
+ if (ParseXmlHelper.isJavaEeNamespace(element) &&
+ (element.getName().equalsIgnoreCase(XmlConstants.TOPIC) ||
+ element.getName().equalsIgnoreCase(XmlConstants.QUEUE)))
+ return false;
+
+ Iterator<?> elIterator = element.elementIterator();
+ while (elIterator.hasNext())
+ {
+ Element child = (Element) elIterator.next();
+ if (ParseXmlHelper.isJavaEeNamespace(child) &&
+ (child.getName().equalsIgnoreCase(XmlConstants.RESOURCE) ||
+ child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_CONTEXT) ||
+ child.getName().equalsIgnoreCase(XmlConstants.PERSISTENCE_UNIT) ||
+ child.getName().equalsIgnoreCase(XmlConstants.EJB) ||
+ child.getName().equalsIgnoreCase(XmlConstants.WEB_SERVICE_REF)))
+ return true;
+ }
+ return false;
+ }
+
+ public void checkChildren(Element element)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SessionBeanChildrenChecker.java 2009-03-25 14:06:36 UTC (rev 2201)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.xml.check;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class SessionBeanChildrenChecker implements BeanChildrenChecker
+{
+
+ public boolean accept(Element element, AnnotatedClass<?> beanClass)
+ {
+ ManagerImpl manager = CurrentManager.rootManager();
+ if (manager.getEjbDescriptorCache().containsKey(element.getName()) ||
+ element.attribute(XmlConstants.EJB_NAME) != null)
+ return true;
+ return false;
+ }
+
+ public void checkChildren(Element element)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/check/SimpleBeanChildrenChecker.java 2009-03-25 14:06:36 UTC (rev 2201)
@@ -0,0 +1,29 @@
+package org.jboss.webbeans.xml.check;
+
+import org.dom4j.Element;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.xml.XmlConstants;
+
+public class SimpleBeanChildrenChecker implements BeanChildrenChecker
+{
+
+ public boolean accept(Element element, AnnotatedClass<?> beanClass)
+ {
+ ManagerImpl manager = CurrentManager.rootManager();
+ boolean isSessionBean = manager.getEjbDescriptorCache().containsKey(element.getName()) ||
+ element.attribute(XmlConstants.EJB_NAME) != null;
+
+ if (!beanClass.isAbstract() && !isSessionBean && !beanClass.isParameterizedType())
+ return true;
+
+ return false;
+ }
+
+ public void checkChildren(Element element)
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2200 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: introspector and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-25 06:38:49 -0400 (Wed, 25 Mar 2009)
New Revision: 2200
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java
Log:
minor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-25 10:20:52 UTC (rev 2199)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-25 10:38:49 UTC (rev 2200)
@@ -154,8 +154,7 @@
{
for (AnnotatedMethod<?> method : annotatedClass.getDeclaredAnnotatedMethods(Produces.class))
{
- createProducerMethod(declaringBean, method);
-
+ createProducerMethod(declaringBean, method);
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2009-03-25 10:20:52 UTC (rev 2199)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2009-03-25 10:38:49 UTC (rev 2200)
@@ -19,8 +19,6 @@
import java.lang.reflect.Field;
-import javax.inject.manager.Manager;
-
/**
* AnnotatedField provides a uniform access to the annotations on an annotated
* field
@@ -47,18 +45,6 @@
*/
public void set(Object declaringInstance, Object value) throws IllegalArgumentException, IllegalAccessException;
- /**
- * Injects into the field using the value provided by the manager
- *
- * Unlike {@link #set(Object, Manager)} the field injected into is
- * discovered from the declaring instance. This is slower, but safe to use
- * with proxies.
- *
- * @param declaringInstance The instance to inject into
- * @param value The value to inject
- */
- public void setOnInstance(Object declaringInstance, Object value) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException;
-
public T get(Object instance);
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java 2009-03-25 10:20:52 UTC (rev 2199)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java 2009-03-25 10:38:49 UTC (rev 2200)
@@ -49,11 +49,6 @@
delegate().set(declaringInstance, value);
}
- public void setOnInstance(Object declaringInstance, Object value) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException
- {
- delegate().setOnInstance(declaringInstance, value);
- }
-
public boolean isTransient()
{
return delegate().isTransient();
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2199 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-25 06:20:52 -0400 (Wed, 25 Mar 2009)
New Revision: 2199
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java
Log:
minor
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java 2009-03-24 23:52:21 UTC (rev 2198)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java 2009-03-25 10:20:52 UTC (rev 2199)
@@ -7,6 +7,7 @@
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
import org.testng.annotations.Test;
@@ -18,6 +19,7 @@
*/
@Artifact
@Packaging(PackagingType.EAR)
+@IntegrationTest
public class EnterpriseEventInheritenceTest extends AbstractJSR299Test
{
@Test(groups = { "events", "inheritance" })
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2198 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event: enterprise and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-24 19:52:21 -0400 (Tue, 24 Mar 2009)
New Revision: 2198
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Farmer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java
Log:
tests for 4.2.df, 4.2.dl
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Egg.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+class Egg
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/EnterpriseEventInheritenceTest.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,64 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import java.util.Set;
+
+import javax.event.Observer;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for event inheritence with enterprise beans
+ *
+ * @author Shane Bryzak
+ */
+@Artifact
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseEventInheritenceTest extends AbstractJSR299Test
+{
+ @Test(groups = { "events", "inheritance" })
+ @SpecAssertion(section = "4.2", id = "df")
+ public void testNonStaticObserverMethodNotInherited() throws Exception
+ {
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Set<Observer<Egg>> observers = getCurrentManager().resolveObservers(new Egg());
+ assert observers.size() == 1;
+
+ // Notify the observer so we can confirm that it
+ // is a method only on Farmer, and not LazyFarmer
+ observers.iterator().next().notify(new Egg());
+ assert Farmer.getObserverClazz().equals(Farmer.class);
+ }
+
+ }.run();
+ }
+
+ @Test(groups = { "events", "inheritance" })
+ @SpecAssertion(section = "4.2", id = "dl")
+ public void testNonStaticObserverMethodNotIndirectlyInherited() throws Exception
+ {
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Set<Observer<StockPrice>> observers = getCurrentManager().resolveObservers(new StockPrice());
+ assert observers.size() == 1;
+
+ // Notify the observer so we can confirm that it
+ // is a method only on StockWatcher, and not IndirectStockWatcher
+ observers.iterator().next().notify(new StockPrice());
+ assert StockWatcher.getObserverClazz().equals(StockWatcher.class);
+ }
+
+ }.run();
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Farmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Farmer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/Farmer.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+import javax.event.Observes;
+
+@Stateful
+public class Farmer implements FarmerLocal
+{
+ private static Class<?> observerClazz;
+
+ public void observeEggLaying(@Observes Egg egg)
+ {
+ observerClazz = this.getClass();
+ }
+
+ public static Class<?> getObserverClazz()
+ {
+ return observerClazz;
+ }
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/FarmerLocal.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+import javax.event.Observes;
+
+@Local
+public interface FarmerLocal
+{
+ void observeEggLaying(@Observes Egg egg);
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcher.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class IndirectStockWatcher extends IntermediateStockWatcher implements IndirectStockWatcherLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IndirectStockWatcherLocal.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface IndirectStockWatcherLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/IntermediateStockWatcher.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+class IntermediateStockWatcher extends StockWatcher
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmer.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class LazyFarmer extends Farmer implements LazyFarmerLocal
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/LazyFarmerLocal.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface LazyFarmerLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockPrice.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+class StockPrice
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcher.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Stateful;
+import javax.event.Observes;
+
+@Stateful
+public class StockWatcher implements StockWatcherLocal
+{
+ private static Class<?> observerClazz;
+
+ public void observeStockPrice(@Observes StockPrice price)
+ {
+ observerClazz = this.getClass();
+ }
+
+ public static Class<?> getObserverClazz()
+ {
+ return observerClazz;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/enterprise/StockWatcherLocal.java 2009-03-24 23:52:21 UTC (rev 2198)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.event.enterprise;
+
+import javax.ejb.Local;
+import javax.event.Observes;
+
+@Local
+public interface StockWatcherLocal
+{
+ void observeStockPrice(@Observes StockPrice price);
+}
15 years, 9 months