Author: scabanovich
Date: 2010-08-30 09:48:15 -0400 (Mon, 30 Aug 2010)
New Revision: 24547
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithStereotypeThatIsBinding.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/StereotypeAndBinding.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6935
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithStereotypeThatIsBinding.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithStereotypeThatIsBinding.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithStereotypeThatIsBinding.java 2010-08-30
13:48:15 UTC (rev 24547)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor
+@StereotypeAndBinding
+public class InterceptorWithStereotypeThatIsBinding {
+
+ @AroundInvoke
+ public Object intercept(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithStereotypeThatIsBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/StereotypeAndBinding.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/StereotypeAndBinding.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/StereotypeAndBinding.java 2010-08-30
13:48:15 UTC (rev 24547)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+import javax.interceptor.InterceptorBinding;
+
+@Stereotype
+@InterceptorBinding
+@Target({ TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeAndBinding {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/StereotypeAndBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java 2010-08-30
13:47:14 UTC (rev 24546)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java 2010-08-30
13:48:15 UTC (rev 24547)
@@ -13,6 +13,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.JavaModelException;
@@ -20,6 +21,7 @@
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInterceptorBinding;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
+import org.jboss.tools.cdi.core.IStereotype;
/**
* @author Alexey Kazakov
@@ -80,7 +82,24 @@
assertEquals("Wrong number of interceptor binding declarations", 2,
ds.size());
assertContainsBindingDeclarationWithValue(ds,
"org.jboss.jsr299.tck.tests.interceptors.definition.inheritance.BindingC",
"c1");
}
-
+
+ public void testStereotypeCanBeInterceptorBinding() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/StereotypeAndBinding.java");
+ IStereotype s =
cdiProject.getStereotype("org.jboss.jsr299.tck.tests.jbt.validation.interceptors.StereotypeAndBinding");
+ assertNotNull(s);
+ IInterceptorBinding b =
cdiProject.getInterceptorBinding("org.jboss.jsr299.tck.tests.jbt.validation.interceptors.StereotypeAndBinding");
+ assertNotNull(b);
+
+ Set<IBean> beans =
getBeans("org.jboss.jsr299.tck.tests.jbt.validation.interceptors.InterceptorWithStereotypeThatIsBinding");
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertTrue("The bean should be an interceptor", bean instanceof IClassBean);
+ IClassBean interceptor = (IClassBean)bean;
+ assertFalse("The interceptor should inherites interceptor bindings",
interceptor.getInterceptorBindings().isEmpty());
+
+ }
+
+
void assertContainsBindings(Set<IInterceptorBinding> bs, String... classNames) {
Set<String> bsn = new HashSet<String>();
for (IInterceptorBinding b: bs) {