Author: norman.richards(a)jboss.com
Date: 2009-10-26 13:27:40 -0400 (Mon, 26 Oct 2009)
New Revision: 4336
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/CallOrder.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/DecoratorAndInterceptorTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/Foo.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooBinding.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooStuff.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/interceptor/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/interceptor/beans.xml
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/FooDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java
Log:
test updates
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/FooDecorator.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/FooDecorator.java 2009-10-26
17:21:58 UTC (rev 4335)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/FooDecorator.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.jboss.jsr299.tck.tests.decorators.definition;
import javax.decorator.Decorates;
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/CallOrder.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/CallOrder.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/CallOrder.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,37 @@
+/*
+ * 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.decorators.interceptor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CallOrder {
+ private static List<String> callers = new ArrayList<String>();
+
+ public static void resetCallers() {
+ callers = new ArrayList<String>();
+ }
+
+ public static void addCaller(String caller) {
+ callers.add(caller);
+ }
+
+ public static List<String> callers() {
+ return callers;
+ }
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/DecoratorAndInterceptorTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/DecoratorAndInterceptorTest.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/DecoratorAndInterceptorTest.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,53 @@
+/*
+ * 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.decorators.interceptor;
+
+import java.util.List;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)BeansXml("beans.xml")
+@SpecVersion(spec="cdi", version="20091018")
+public class DecoratorAndInterceptorTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertions
+ ({
+ @SpecAssertion(section = "8.2", id = "f")
+ })
+ public void testInterceptorCalledBeforeDecorator()
+ {
+ CallOrder.resetCallers();
+ Foo foo = getInstanceByType(Foo.class);
+
+ foo.doSomething();
+
+ List<String> callers = CallOrder.callers();
+
+ assert callers.size() == 2;
+ assert callers.get(0).equals(FooInterceptor.NAME);
+ assert callers.get(1).equals(FooDecorator.NAME);
+ }
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/Foo.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/Foo.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/Foo.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,24 @@
+/*
+ * 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.decorators.interceptor;
+
+public interface Foo {
+
+ public void doSomething();
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooBinding.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooBinding.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooBinding.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,34 @@
+/*
+ * 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.decorators.interceptor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@Inherited
+@InterceptorBinding
+(a)Target(ElementType.TYPE)
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface FooBinding {
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooDecorator.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooDecorator.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooDecorator.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,32 @@
+/*
+ * 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.decorators.interceptor;
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+
+@Decorator
+public class FooDecorator implements Foo {
+ public static String NAME = "FooDecorator";
+
+ @Decorates Foo foo;
+
+ public void doSomething() {
+ CallOrder.addCaller(NAME);
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooInterceptor.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooInterceptor.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooInterceptor.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,34 @@
+/*
+ * 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.decorators.interceptor;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor
+@FooBinding
+public class FooInterceptor {
+ public static String NAME = "FooInterceptor";
+
+ @AroundInvoke
+ public Object interceptMe(InvocationContext ctx) throws Exception
+ {
+ CallOrder.addCaller(NAME);
+ return ctx.proceed();
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooStuff.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooStuff.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/interceptor/FooStuff.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,26 @@
+/*
+ * 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.decorators.interceptor;
+
+@FooBinding
+public class FooStuff implements Foo {
+
+ public void doSomething() {
+
+ }
+
+}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-10-26
17:21:58 UTC (rev 4335)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -56,6 +56,7 @@
@Test
@SpecAssertions({
+ @SpecAssertion(section="8.2", id="b"),
@SpecAssertion(section="8.5", id="d"),
@SpecAssertion(section="8.5", id="e"),
@SpecAssertion(section="8.5", id="f"),
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java 2009-10-26
17:21:58 UTC (rev 4335)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java 2009-10-26
17:27:40 UTC (rev 4336)
@@ -251,7 +251,10 @@
})
public void testInterceptorBindingAnnotation()
{
- Interceptor<?> interceptorBean = getLoggedInterceptors().iterator().next();
+ List<Interceptor<?>> interceptors = getLoggedInterceptors();
+ assert interceptors.size() > 1;
+
+ Interceptor<?> interceptorBean = interceptors.iterator().next();
assert interceptorBean.getInterceptorBindingTypes().size() == 1;
assert interceptorBean.getInterceptorBindingTypes().contains(new
AnnotationLiteral<Logged>(){});
Added:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/interceptor/beans.xml
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/interceptor/beans.xml
(rev 0)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/interceptor/beans.xml 2009-10-26
17:27:40 UTC (rev 4336)
@@ -0,0 +1,9 @@
+<beans>
+ <interceptors>
+
<class>org.jboss.jsr299.tck.tests.decorators.interceptor.FooInterceptor</class>
+ </interceptors>
+
+ <decorators>
+
<class>org.jboss.jsr299.tck.tests.decorators.interceptor.FooDecorator</class>
+ </decorators>
+</beans>