Author: dallen6
Date: 2009-04-25 08:54:51 -0400 (Sat, 25 Apr 2009)
New Revision: 2623
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestBindingType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptor.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptorBindingType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestStereotype.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherInterceptorBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherStereotype.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBindingAnnotation.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithInterceptorBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithStereotype.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InheritedInterceptorTestBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor1.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor2.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorRecorder.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType1.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType2.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Order.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestBindingType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptor.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptorBindingType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestNamed.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestScopeType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestStereotype.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml
Log:
Changes for tests related to the defining binding types, interceptor binding types, and
stereotypes in XML
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java 2009-04-24
01:09:57 UTC (rev 2622)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnnotationTypesTest.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -1,53 +1,123 @@
package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+import javax.context.RequestScoped;
+import javax.inject.AnnotationLiteral;
+import javax.inject.manager.Bean;
+
import org.hibernate.tck.annotations.SpecAssertion;
import org.hibernate.tck.annotations.SpecAssertions;
import org.jboss.jsr299.tck.AbstractJSR299Test;
-import
org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.AnotherTestInterceptorBindingType;
-import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestBindingType;
-import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestDeploymentType;
-import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestInterceptorBindingType;
-import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestNamed;
-import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestScopeType;
-import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.TestStereotype;
-import org.jboss.jsr299.tck.tests.xml.annotationtypes.foo.Order;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.testng.annotations.Test;
@Artifact
-@Classes({
- Order.class,
- TestBindingType.class,
- TestInterceptorBindingType.class,
- TestStereotype.class,
- AnotherTestInterceptorBindingType.class,
- TestScopeType.class,
- TestDeploymentType.class,
- TestNamed.class})
@BeansXml("beans.xml")
public class AnnotationTypesTest extends AbstractJSR299Test
{
- @Test
+ @Test(groups = { "stub", "xml" })
@SpecAssertions({
- @SpecAssertion(section="9", id="d"),//without schema
- @SpecAssertion(section="9.4", id="a"),
- @SpecAssertion(section="9.4", id="b"),
+ @SpecAssertion(section="9", id="d")//without schema
+ })
+ public void testXMLSchemaUse()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "ri-broken", "xml" })
+ @SpecAssertions({
+ @SpecAssertion(section="9.4", id="a")
+ })
+ public void testBindingTypeFromXML()
+ {
+ //TODO The binding type appears as a non-binding annotation in the call to
resolveByType()
+ assert getCurrentManager().resolveByType(BeanWithBinding.class, new
AnnotationLiteral<TestBindingType>(){}).size() > 0;
+ }
+
+ @Test(groups = { "ri-broken", "xml" })
+ @SpecAssertions({
+ @SpecAssertion(section="9.4", id="b")
+ })
+ public void testInterceptorBindingTypeFromXML()
+ {
+ BeanWithInterceptorBinding bean =
getCurrentManager().getInstanceByType(BeanWithInterceptorBinding.class);
+ assert bean != null : "Test bean not resolvable";
+ Object returnValue = bean.getInterceptor();
+ //TODO Bean method is not currently being intercepted due to lack of interceptor
support in the RI
+ assert returnValue != null : "Bean method was not intercepted";
+ assert returnValue instanceof TestInterceptor : "Incorrect return type";
+ }
+
+ @Test(groups = { "ri-broken", "xml" })
+ @SpecAssertions({
@SpecAssertion(section="9.4", id="c"),
- @SpecAssertion(section="9.4", id="e"),
- @SpecAssertion(section="9.4", id="f"),
- @SpecAssertion(section="9.4", id="g"),
@SpecAssertion(section="9.4.1", id="a"),
@SpecAssertion(section="9.4.1", id="d"),
@SpecAssertion(section="9.4.1", id="e"),
@SpecAssertion(section="9.4.1", id="f"),
- @SpecAssertion(section="9.4.1", id="g"),
+ @SpecAssertion(section="9.4.1", id="g")
+ })
+ public void testStereotypeFromXML()
+ {
+ //TODO The stereotype is not being applied to this bean
+ Bean<BeanWithStereotype> bean =
getCurrentManager().resolveByType(BeanWithStereotype.class).iterator().next();
+ assert TestScopeType.class.isAssignableFrom(bean.getScopeType());
+ assert TestDeploymentType.class.isAssignableFrom(bean.getDeploymentType());
+ assert bean.getName() != null : "No default name for bean";
+ assert "beanWithStereotype".equals(bean.getName()) : "Incorrect name
for bean";
+
+ // Now check that the correct interceptor is also being applied through the
+ // stereotype.
+ BeanWithStereotype beanWithStereotype = (BeanWithStereotype)
getCurrentManager().getInstanceByName("beanWithStereotype");
+ Object interceptor = beanWithStereotype.getInterceptor();
+ assert interceptor != null : "Bean method was not intercepted";
+ assert interceptor instanceof AnotherTestInterceptor : "Incorrect return
type";
+ }
+
+ @Test(groups = { "ri-broken", "xml" })
+ @SpecAssertions({
+ @SpecAssertion(section="9.4", id="e")
+ })
+ public void testBindingAnnotationOverridenByXML()
+ {
+ assert getCurrentManager().getInstanceByType(BeanWithBindingAnnotation.class, new
AnnotationLiteral<TestBindingType>(){}) != null;
+ }
+
+ @Test(groups = { "ri-broken", "xml" })
+ @SpecAssertions({
+ @SpecAssertion(section="9.4", id="f")
+ })
+ public void testInterceptorBindingAnnotationOverridenByXML()
+ {
+ BeanWithAnotherInterceptorBinding bean =
getCurrentManager().getInstanceByType(BeanWithAnotherInterceptorBinding.class);
+ assert bean != null : "Test bean not resolvable";
+ Object returnValue = bean.getInterceptor();
+ //TODO Bean method is not currently being intercepted due to lack of interceptor
support in the RI
+ assert returnValue != null : "Bean method was not intercepted";
+ assert returnValue instanceof TestInterceptor : "Incorrect return type";
+ }
+
+ @Test(groups = { "ri-broken", "xml" })
+ @SpecAssertions({
+ @SpecAssertion(section="9.4", id="g")
+ })
+ public void testStereotypeAnnotationOverridenByXML()
+ {
+ //TODO The stereotype is not being applied to this bean
+ Bean<BeanWithAnotherStereotype> bean =
getCurrentManager().resolveByType(BeanWithAnotherStereotype.class).iterator().next();
+ assert RequestScoped.class.isAssignableFrom(bean.getScopeType());
+ }
+
+ @Test(groups = { "ri-broken", "xml" })
+ @SpecAssertions({
@SpecAssertion(section="9.4.2", id="a"),
@SpecAssertion(section="9.4.2", id="d")
})
- public void testAnnotationTypes()
+ public void testInheritedInterceptorsFromXML()
{
- assert getCurrentManager().resolveByType(Order.class).size() == 1;
+ InheritedInterceptorTestBean bean =
getCurrentManager().getInstanceByType(InheritedInterceptorTestBean.class);
+ InterceptorRecorder interceptorRecorder = bean.getInterceptors();
+ assert interceptorRecorder.containsInterceptor(InterceptorType1.class);
+ assert interceptorRecorder.containsInterceptor(InterceptorType2.class);
}
}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestBindingType.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestBindingType.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestBindingType.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@BindingType
+@interface AnotherTestBindingType
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestBindingType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptor.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptor.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptor.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@TestInterceptorBindingType @Interceptor
+class AnotherTestInterceptor
+{
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx)
+ {
+ return this;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptorBindingType.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/AnotherTestInterceptorBindingType.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptorBindingType.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestInterceptorBindingType.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.interceptor.InterceptorBindingType;
+
+@InterceptorBindingType
+@interface AnotherTestInterceptorBindingType
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestStereotype.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestStereotype.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestStereotype.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.annotation.Stereotype;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+@Stereotype
+@interface AnotherTestStereotype
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/AnotherTestStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherInterceptorBinding.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherInterceptorBinding.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherInterceptorBinding.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+@AnotherTestInterceptorBindingType
+class BeanWithAnotherInterceptorBinding
+{
+ public Object getInterceptor()
+ {
+ return null;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherInterceptorBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherStereotype.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherStereotype.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherStereotype.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+@AnotherTestStereotype
+class BeanWithAnotherStereotype
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithAnotherStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBinding.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBinding.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBinding.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+@TestBindingType
+class BeanWithBinding
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBindingAnnotation.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBindingAnnotation.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBindingAnnotation.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+@AnotherTestBindingType
+class BeanWithBindingAnnotation
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithBindingAnnotation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithInterceptorBinding.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithInterceptorBinding.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithInterceptorBinding.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+@TestInterceptorBindingType
+class BeanWithInterceptorBinding
+{
+ public Object getInterceptor()
+ {
+ return null;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithInterceptorBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithStereotype.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithStereotype.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithStereotype.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+@TestStereotype
+class BeanWithStereotype
+{
+
+ public Object getInterceptor()
+ {
+ return null;
+ }
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/BeanWithStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InheritedInterceptorTestBean.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InheritedInterceptorTestBean.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InheritedInterceptorTestBean.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+@InterceptorType2
+class InheritedInterceptorTestBean
+{
+ public InterceptorRecorder getInterceptors()
+ {
+ return new InterceptorRecorder();
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InheritedInterceptorTestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor1.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor1.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor1.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+@InterceptorType1
+class Interceptor1
+{
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx)
+ {
+ InterceptorRecorder interceptorRecorder = null;
+ try
+ {
+ interceptorRecorder = (InterceptorRecorder) ctx.proceed();
+ interceptorRecorder.addInterceptor(this);
+ }
+ catch (Exception e)
+ {
+ }
+ return interceptorRecorder;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor2.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor2.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor2.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+@InterceptorType2
+class Interceptor2
+{
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx)
+ {
+ InterceptorRecorder interceptorRecorder = null;
+ try
+ {
+ interceptorRecorder = (InterceptorRecorder) ctx.proceed();
+ interceptorRecorder.addInterceptor(this);
+ }
+ catch (Exception e)
+ {
+ }
+ return interceptorRecorder;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Interceptor2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorRecorder.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorRecorder.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorRecorder.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,52 @@
+/*
+ * 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.xml.annotationtypes;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+
+/**
+ * Records each interceptor that is invoked. Each of the interceptors
+ * must actually make use of this.
+ *
+ * @author David Allen
+ *
+ */
+class InterceptorRecorder
+{
+ private ArrayList<Object> interceptors = new ArrayList<Object>();
+
+ public void addInterceptor(Object interceptor)
+ {
+ interceptors.add(interceptor);
+ }
+
+ public boolean containsInterceptor(Class<? extends Annotation>
interceptorAnnotationClass)
+ {
+ boolean result = false;
+ for (Object interceptor : interceptors)
+ {
+ if (interceptorAnnotationClass.isAssignableFrom(interceptor.getClass()))
+ {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorRecorder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType1.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType1.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType1.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+@interface InterceptorType1
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType2.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType2.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType2.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+@interface InterceptorType2
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/InterceptorType2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Order.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/Order.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Order.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/Order.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,28 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.context.Dependent;
+import javax.inject.Current;
+import javax.inject.Initializer;
+import javax.inject.manager.Manager;
+
+//@TestBindingType
+//@TestInterceptorBindingType
+//@TestStereotype
+class Order
+{
+ private boolean active;
+
+ @Initializer
+ public Order(@Current Manager manager)
+ {
+ if (manager.getContext(Dependent.class).isActive())
+ {
+ active = true;
+ }
+ }
+
+ public boolean isActive()
+ {
+ return active;
+ }
+}
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestBindingType.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestBindingType.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestBindingType.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestBindingType.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+@interface TestBindingType
+{
+
+}
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestDeploymentType.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestDeploymentType.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestDeploymentType.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestDeploymentType.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.inject.DeploymentType;
+
+@DeploymentType
+public @interface TestDeploymentType
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptor.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptor.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptor.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@TestInterceptorBindingType @Interceptor
+class TestInterceptor
+{
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx)
+ {
+ return this;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptorBindingType.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestInterceptorBindingType.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptorBindingType.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestInterceptorBindingType.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+@interface TestInterceptorBindingType
+{
+
+}
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestNamed.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestNamed.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestNamed.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestNamed.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.annotation.Named;
+
+@Named
+public @interface TestNamed
+{
+
+}
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestScopeType.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestScopeType.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestScopeType.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestScopeType.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import javax.context.ScopeType;
+
+@ScopeType
+public @interface TestScopeType
+{
+
+}
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestStereotype.java
(from rev 2614,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/foo/TestStereotype.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestStereotype.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/annotationtypes/TestStereotype.java 2009-04-25
12:54:51 UTC (rev 2623)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.xml.annotationtypes;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+@interface TestStereotype
+{
+
+}
Modified:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml
===================================================================
---
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml 2009-04-24
01:09:57 UTC (rev 2622)
+++
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/annotationtypes/beans.xml 2009-04-25
12:54:51 UTC (rev 2623)
@@ -1,13 +1,18 @@
<Beans xmlns="urn:java:ee"
- xmlns:dd="urn:java:org.jboss.jsr299.tck.tests.xml.annotationtypes.foo"
+ xmlns:dd="urn:java:org.jboss.jsr299.tck.tests.xml.annotationtypes"
xmlns:manager="urn:java:javax.inject.manager">
<dd:TestBindingType>
<BindingType />
</dd:TestBindingType>
+ <dd:AnotherTestBindingType>
+ <BindingType />
+ </dd:AnotherTestBindingType>
<dd:TestInterceptorBindingType>
<InterceptorBindingType />
- <dd:AnotherTestInterceptorBindingType />
</dd:TestInterceptorBindingType>
+ <dd:AnotherTestInterceptorBindingType>
+ <InterceptorBindingType />
+ </dd:AnotherTestInterceptorBindingType>
<dd:TestStereotype>
<Stereotype />
<dd:TestScopeType />
@@ -15,10 +20,35 @@
<dd:AnotherTestInterceptorBindingType />
<dd:TestNamed />
</dd:TestStereotype>
+ <dd:AnotherTestStereotype>
+ <Stereotype />
+ <RequestScoped />
+ </dd:AnotherTestStereotype>
+ <!--
+ *** Uncomment once WBRI-252 is fixed. ***
+ <dd:InterceptorType1>
+ <InterceptorBindingType />
+ </dd:InterceptorType1>
+ <dd:InterceptorType2>
+ <InterceptorBindingType />
+ <dd:InterceptorType1 />
+ </dd:InterceptorType2>
+ -->
+ <!--
<dd:Order>
<dd:TestBindingType />
<dd:TestInterceptorBindingType />
<dd:TestStereotype />
<manager:Manager />
</dd:Order>
+ -->
+ <!--
+ *** Uncomment once WBRI-244 is fixed. ***
+ <dd:BeanWithBindingAnnotation>
+ <dd:TestBindingType />
+ </dd:BeanWithBindingAnnotation>
+ -->
+ <dd:BeanWithAnotherStereotype>
+ <dd:AnotherTestStereotype />
+ </dd:BeanWithAnotherStereotype>
</Beans>
\ No newline at end of file