[webbeans-commits] Webbeans SVN: r2184 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness and 1 other directory.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Mar 24 09:57:22 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-03-24 09:57:22 -0400 (Tue, 24 Mar 2009)
New Revision: 2184
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java
Log:
WBRI-205
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-24 13:54:01 UTC (rev 2183)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-24 13:57:22 UTC (rev 2184)
@@ -19,6 +19,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
+import java.lang.reflect.Type;
import java.util.Set;
import javax.context.CreationalContext;
@@ -129,6 +130,31 @@
{
throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
}
+ else if (declaringBean instanceof EnterpriseBean)
+ {
+ boolean methodDeclaredOnTypes = false;
+ // TODO use annotated item?
+ for (Type type : declaringBean.getTypes())
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ try
+ {
+ clazz.getDeclaredMethod(getAnnotatedItem().getName(), getAnnotatedItem().getParameterTypesAsArray());
+ methodDeclaredOnTypes = true;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // No - op
+ }
+ }
+ }
+ if (!methodDeclaredOnTypes)
+ {
+ throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + declaringBean);
+ }
+ }
}
/**
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java 2009-03-24 13:54:01 UTC (rev 2183)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java 2009-03-24 13:57:22 UTC (rev 2184)
@@ -3,6 +3,7 @@
import javax.inject.DefinitionException;
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.ExpectedDeploymentException;
@@ -15,8 +16,11 @@
@ExpectedDeploymentException(DefinitionException.class)
public class ProducerMethodNotBusinessMethodTest extends AbstractJSR299Test
{
- @Test(groups = "ri-broken")
- @SpecAssertion(section = "3.4.2", id = "f")
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "3.4.2", id = "f"),
+ @SpecAssertion(section = "3.4", id = "d")
+ })
public void testProducerMethodOnSessionBeanMustBeBusinessMethod()
{
assert false;
More information about the weld-commits
mailing list