Author: jharting
Date: 2009-10-22 08:45:59 -0400 (Thu, 22 Oct 2009)
New Revision: 4223
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cheese.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cow.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/CowLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Farm.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Food.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Milk.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessAnnotatedTypeObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessBeanObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessInjectionTargetObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Sheep.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Tame.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/AddDefinitionErrorTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/ProcessBeanObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/Sheep.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ProcessBeanObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/Sheep.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ThrowExceptionInProcessBeanObserverTest.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/javax.enterprise.inject.spi.Extension
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/javax.enterprise.inject.spi.Extension
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/ejb-jar.xml
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/javax.enterprise.inject.spi.Extension
Log:
Tests for 11.5.8 and 12.3
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cheese.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cheese.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cheese.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+class Cheese extends Food
+{
+ public Cheese(boolean fresh)
+ {
+ super(fresh);
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,185 @@
+/*
+ * 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.extensions.container.event;
+
+import javax.ejb.Stateless;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import static javax.enterprise.inject.spi.SessionBeanType.STATELESS;
+import static javax.enterprise.inject.spi.SessionBeanType.STATEFUL;
+
+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.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for ProcessAnnotatedType, ProcessBean and ProcessInjectionTarget events.
+ * @author Jozef Hartinger
+ *
+ */
+@Artifact
+@Resources({
+ @Resource(source = "javax.enterprise.inject.spi.Extension", destination =
"META-INF/services/javax.enterprise.inject.spi.Extension"),
+ @Resource(source = "ejb-jar.xml", destination =
"META-INF/ejb-jar.xml")})
+@IntegrationTest
+@SpecVersion(spec = "cdi", version = "20091018")
+(a)Packaging(PackagingType.EAR)
+public class ContainerEventTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "12.3", id = "ba"),
+ @SpecAssertion(section = "11.5.6", id = "aaa")})
+ public void testProcessInjectionTargetFiredForManagedBean() {
+ assert ProcessInjectionTargetObserver.getManagedBeanEvent() != null;
+
validateManagedBean(ProcessInjectionTargetObserver.getManagedBeanEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aab"),
+ @SpecAssertion(section = "11.5.6", id = "abb"),
+ @SpecAssertion(section = "12.3", id = "db")})
+ public void testProcessInjectionTargetFiredForSessionBean() {
+ assert ProcessInjectionTargetObserver.getStatelessSessionBeanEvent() != null;
+ assert ProcessInjectionTargetObserver.getStatefulSessionBeanEvent() != null;
+
validateStatelessSessionBean(ProcessInjectionTargetObserver.getStatelessSessionBeanEvent().getAnnotatedType());
+
validateStatefulSessionBean(ProcessInjectionTargetObserver.getStatefulSessionBeanEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aaf"),
+ @SpecAssertion(section = "11.5.6", id = "abf"),
+ @SpecAssertion(section = "12.3", id = "dh")})
+ public void testProcessInjectionTargetFiredForSessionBeanInterceptor() {
+ assert ProcessInjectionTargetObserver.getSessionBeanInterceptorEvent() != null;
+
validateSessionBeanInterceptor(ProcessInjectionTargetObserver.getSessionBeanInterceptorEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="11.5.6", id="aal"),
+ @SpecAssertion(section="11.5.6", id="aam"),
+ @SpecAssertion(section="11.5.6", id="aau"),
+ @SpecAssertion(section="11.5.6", id="aav")
+ })
+ public void testTypeOfProcessInjectionTargetParameter() {
+ assert ProcessInjectionTargetObserver.getEvent1Observed() == 0;
+ assert ProcessInjectionTargetObserver.getEvent2Observed() == 0;
+ assert ProcessInjectionTargetObserver.getEvent3Observed() == 0;
+ assert ProcessInjectionTargetObserver.getEvent4Observed() == 0;
+ assert ProcessInjectionTargetObserver.getEvent5Observed() == 1;
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id= "bb")
+ public void testProcessAnnotatedTypeFiredForSessionBean() {
+ assert ProcessAnnotatedTypeObserver.getStatelessSessionBeanEvent() != null;
+ assert ProcessAnnotatedTypeObserver.getStatefulSessionBeanEvent() != null;
+
validateStatelessSessionBean(ProcessAnnotatedTypeObserver.getStatelessSessionBeanEvent().getAnnotatedType());
+
validateStatefulSessionBean(ProcessAnnotatedTypeObserver.getStatefulSessionBeanEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id= "bh")
+ public void testProcessAnnotatedTypeFiredForSessionBeanInterceptor() {
+ assert ProcessAnnotatedTypeObserver.getSessionBeanInterceptorEvent() != null;
+
validateSessionBeanInterceptor(ProcessAnnotatedTypeObserver.getSessionBeanInterceptorEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertion(section = "11.5.8", id = "ba")
+ public void testProcessManagedBeanFired()
+ {
+ assert ProcessBeanObserver.getProcessManagedBeanEvent() != null;
+
validateManagedBean(ProcessBeanObserver.getProcessManagedBeanEvent().getAnnotatedBeanClass());
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="11.5.8", id="c"),
+ @SpecAssertion(section="12.3", id="fb")})
+ public void testProcessSessionBeanFiredForStatelessSessionBean() {
+ assert ProcessBeanObserver.getProcessStatelessSessionBeanEvent() != null;
+
validateStatelessSessionBean(ProcessBeanObserver.getProcessStatelessSessionBeanEvent().getAnnotatedSessionBeanClass());
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="11.5.8", id="c"),
+ @SpecAssertion(section="12.3", id="fb"),
+ @SpecAssertion(section="12.3", id="g")})
+ public void testProcessSessionBeanFiredForStatefulSessionBean() {
+ assert ProcessBeanObserver.getProcessStatefulSessionBeanEvent() != null;
+
validateStatefulSessionBean(ProcessBeanObserver.getProcessStatefulSessionBeanEvent().getAnnotatedSessionBeanClass());
+ }
+
+ @Test
+ @SpecAssertion(section="11.5.8", id="hb")
+ public void testGetEJBName() {
+ assert
ProcessBeanObserver.getProcessStatelessSessionBeanEvent().getEjbName().equals("sheep");
+ assert
ProcessBeanObserver.getProcessStatefulSessionBeanEvent().getEjbName().equals("cow");
+ }
+
+ @Test
+ @SpecAssertion(section="11.5.8", id="hc")
+ public void testGetSessionBeanType() {
+ assert
ProcessBeanObserver.getProcessStatelessSessionBeanEvent().getSessionBeanType().equals(STATELESS);
+ assert
ProcessBeanObserver.getProcessStatefulSessionBeanEvent().getSessionBeanType().equals(STATEFUL);
+ }
+
+ private void validateStatelessSessionBean(Annotated type) {
+ assert type.getBaseType().equals(Sheep.class);
+ assert typeSetMatches(type.getTypeClosure(), Sheep.class, SheepLocal.class,
Object.class);
+ assert type.getAnnotations().size() == 2;
+ assert annotationSetMatches(type.getAnnotations(), Tame.class, Stateless.class);
//TODO Check
+ }
+
+ private void validateStatefulSessionBean(Annotated type) {
+ assert type.getBaseType().equals(Cow.class);
+ assert typeSetMatches(type.getTypeClosure(), Cow.class, CowLocal.class,
Object.class);
+ assert type.getAnnotations().size() == 0;
+ }
+
+ private void validateSessionBeanInterceptor(AnnotatedType<SheepInterceptor>
type) {
+ assert type.getBaseType().equals(SheepInterceptor.class);
+ assert typeSetMatches(type.getTypeClosure(), SheepInterceptor.class,
Object.class);
+ assert type.getAnnotations().size() == 0;
+ assert type.getFields().size() == 0;
+ assert type.getMethods().size() == 1;
+ }
+
+ private void validateManagedBean(AnnotatedType<Farm> type) {
+ assert type.getBaseType().equals(Farm.class);
+ assert typeSetMatches(type.getTypeClosure(), Farm.class, Object.class);
+ assert type.getFields().size() == 1;
+ assert type.getFields().iterator().next().isAnnotationPresent(Produces.class);
+ assert type.getMethods().size() == 1;
+ assert type.getMethods().iterator().next().isAnnotationPresent(Produces.class);
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cow.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cow.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Cow.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+/**
+ * This is a stateful session bean defined in ejb-jar.xml
+ *
+ */
+public class Cow implements CowLocal
+{
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/CowLocal.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/CowLocal.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/CowLocal.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+/**
+ * This is a local interface for a session bean defined in ejb-jar.xml
+ *
+ */
+public interface CowLocal
+{
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Farm.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Farm.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Farm.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+import javax.enterprise.inject.Produces;
+
+class Farm
+{
+ @SuppressWarnings("unused")
+ @Produces
+ private Milk milk = new Milk(true);
+
+ @Produces
+ public Cheese getCheese() {
+ return new Cheese(true);
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Food.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Food.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Food.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+class Food
+{
+ @SuppressWarnings("unused")
+ private boolean fresh;
+
+ public Food(boolean fresh) {
+ this.fresh = fresh;
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Milk.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Milk.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Milk.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+class Milk extends Food
+{
+ public Milk(boolean fresh)
+ {
+ super(fresh);
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessAnnotatedTypeObserver.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessAnnotatedTypeObserver.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessAnnotatedTypeObserver.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,49 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+public class ProcessAnnotatedTypeObserver implements Extension
+{
+ private static ProcessAnnotatedType<Sheep> statelessSessionBeanEvent = null;
+ private static ProcessAnnotatedType<Cow> statefulSessionBeanEvent = null;
+ private static ProcessAnnotatedType<SheepInterceptor>
sessionBeanInterceptorEvent = null;
+ private static ProcessAnnotatedType<Farm> managedBeanEvent = null;
+
+ public void observeStatelessSessionBean(@Observes ProcessAnnotatedType<Sheep>
event) {
+ statelessSessionBeanEvent = event;
+ }
+
+ public void observeStatefulSessionBean(@Observes ProcessAnnotatedType<Cow>
event) {
+ statefulSessionBeanEvent = event;
+ }
+
+ public void observeSessionBeanInterceptor(@Observes
ProcessAnnotatedType<SheepInterceptor> event) {
+ sessionBeanInterceptorEvent = event;
+ }
+
+ public void observeManagedBean(@Observes ProcessAnnotatedType<Farm> event) {
+ managedBeanEvent = event;
+ }
+
+ public static ProcessAnnotatedType<Sheep> getStatelessSessionBeanEvent()
+ {
+ return statelessSessionBeanEvent;
+ }
+
+ public static ProcessAnnotatedType<Cow> getStatefulSessionBeanEvent()
+ {
+ return statefulSessionBeanEvent;
+ }
+
+ public static ProcessAnnotatedType<SheepInterceptor>
getSessionBeanInterceptorEvent()
+ {
+ return sessionBeanInterceptorEvent;
+ }
+
+ public static ProcessAnnotatedType<Farm> getManagedBeanEvent()
+ {
+ return managedBeanEvent;
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessBeanObserver.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessBeanObserver.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessBeanObserver.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,62 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+
+public class ProcessBeanObserver implements Extension
+{
+ private static ProcessManagedBean<Farm> processManagedBeanEvent = null;
+ private static ProcessSessionBean<Sheep> processStatelessSessionBeanEvent =
null;
+ private static ProcessSessionBean<Cow> processStatefulSessionBeanEvent = null;
+ private static ProcessProducerField<Milk, Farm> processProducerFieldEvent =
null;
+ private static ProcessProducerMethod<Cheese, Farm> processProducerMethodEvent =
null;
+
+ public void observeProcessManagedBean(@Observes ProcessManagedBean<Farm> event)
{
+ processManagedBeanEvent = event;
+ }
+
+ public void observeProcessStatelessSessionBean(@Observes
ProcessSessionBean<Sheep> event) {
+ processStatelessSessionBeanEvent = event;
+ }
+
+ public void observeProcessStatefulSessionBean(@Observes ProcessSessionBean<Cow>
event) {
+ processStatefulSessionBeanEvent = event;
+ }
+
+ public void observeProcessProduceField(@Observes ProcessProducerField<Milk,
Farm> event) {
+ processProducerFieldEvent = event;
+ }
+
+ public void observeProcessProduceMethod(@Observes ProcessProducerMethod<Cheese,
Farm> event) {
+ processProducerMethodEvent = event;
+ }
+
+ public static ProcessProducerField<Milk, Farm> getProcessProducerFieldEvent()
+ {
+ return processProducerFieldEvent;
+ }
+
+ public static ProcessManagedBean<Farm> getProcessManagedBeanEvent()
+ {
+ return processManagedBeanEvent;
+ }
+
+ public static ProcessSessionBean<Sheep> getProcessStatelessSessionBeanEvent()
+ {
+ return processStatelessSessionBeanEvent;
+ }
+
+ public static ProcessSessionBean<Cow> getProcessStatefulSessionBeanEvent()
+ {
+ return processStatefulSessionBeanEvent;
+ }
+
+ public static ProcessProducerMethod<Cheese, Farm>
getProcessProducerMethodEvent()
+ {
+ return processProducerMethodEvent;
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessInjectionTargetObserver.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessInjectionTargetObserver.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ProcessInjectionTargetObserver.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,101 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+public class ProcessInjectionTargetObserver implements Extension
+{
+ private static ProcessInjectionTarget<Sheep> statelessSessionBeanEvent = null;
+ private static ProcessInjectionTarget<Cow> statefulSessionBeanEvent = null;
+ private static ProcessInjectionTarget<SheepInterceptor>
sessionBeanInterceptorEvent = null;
+ private static ProcessInjectionTarget<Farm> managedBeanEvent = null;
+
+ private static int event1Observed = 0;
+ private static int event2Observed = 0;
+ private static int event3Observed = 0;
+ private static int event4Observed = 0;
+ private static int event5Observed = 0;
+
+
+ public void observeStatelessSessionBean(@Observes ProcessInjectionTarget<Sheep>
event) {
+ statelessSessionBeanEvent = event;
+ }
+
+ public void observeStatefulSessionBean(@Observes ProcessInjectionTarget<Cow>
event) {
+ statefulSessionBeanEvent = event;
+ }
+
+ public void observeSessionBeanInterceptor(@Observes
ProcessInjectionTarget<SheepInterceptor> event) {
+ sessionBeanInterceptorEvent = event;
+ }
+
+ public void observeManagedBean(@Observes ProcessInjectionTarget<Farm> event) {
+ managedBeanEvent = event;
+ }
+
+ public void observeEvent1(@Observes ProcessInjectionTarget<? super String>
event) {
+ event1Observed++;
+ }
+
+ public void observeEvent2(@Observes ProcessInjectionTarget<? extends String>
event) {
+ event2Observed++;
+ }
+
+ public void observeEvent3(@Observes ProcessInjectionTarget<String> event) {
+ event3Observed++;
+ }
+
+ public void observeEvent4(@Observes ProcessInjectionTarget<? super SheepLocal>
event) {
+ event4Observed++;
+ }
+
+ public void observeEvent5(@Observes ProcessInjectionTarget<? extends SheepLocal>
event) {
+ event5Observed++;
+ }
+
+ public static ProcessInjectionTarget<Sheep> getStatelessSessionBeanEvent()
+ {
+ return statelessSessionBeanEvent;
+ }
+
+ public static ProcessInjectionTarget<Cow> getStatefulSessionBeanEvent()
+ {
+ return statefulSessionBeanEvent;
+ }
+
+ public static ProcessInjectionTarget<SheepInterceptor>
getSessionBeanInterceptorEvent()
+ {
+ return sessionBeanInterceptorEvent;
+ }
+
+ public static ProcessInjectionTarget<Farm> getManagedBeanEvent()
+ {
+ return managedBeanEvent;
+ }
+
+ public static int getEvent1Observed()
+ {
+ return event1Observed;
+ }
+
+ public static int getEvent2Observed()
+ {
+ return event2Observed;
+ }
+
+ public static int getEvent3Observed()
+ {
+ return event3Observed;
+ }
+
+ public static int getEvent4Observed()
+ {
+ return event4Observed;
+ }
+
+ public static int getEvent5Observed()
+ {
+ return event5Observed;
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Sheep.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Sheep.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Sheep.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+
+@Stateless(name = "sheep")
+@Tame
+public class Sheep implements SheepLocal
+{
+ @Interceptors(Sheep.class)
+ public void baa() {
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepInterceptor.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepInterceptor.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepInterceptor.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class SheepInterceptor
+{
+ @AroundInvoke
+ public Object intercept(InvocationContext invocation) throws Exception
+ {
+ return invocation.proceed();
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepLocal.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepLocal.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/SheepLocal.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+import javax.ejb.Local;
+
+@Local
+public interface SheepLocal
+{
+ void baa();
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Tame.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Tame.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/Tame.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.extensions.container.event;
+
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@interface Tame
+{
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/AddDefinitionErrorTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/AddDefinitionErrorTest.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/AddDefinitionErrorTest.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,42 @@
+/*
+ * 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.extensions.container.event.broken.processBeanObserverRegistersException;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DefinitionError;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)ExpectedDeploymentException(DefinitionError.class)
+@Resource(source = "javax.enterprise.inject.spi.Extension", destination =
"WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension")
+@IntegrationTest
+@SpecVersion(spec = "cdi", version = "20091018")
+public class AddDefinitionErrorTest extends AbstractJSR299Test
+{
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section="11.5.8", id="h")
+ //WELD-223
+ public void testAddDefinitionError() {
+ assert false;
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/ProcessBeanObserver.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/ProcessBeanObserver.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/ProcessBeanObserver.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,12 @@
+package
org.jboss.jsr299.tck.tests.extensions.container.event.broken.processBeanObserverRegistersException;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+public class ProcessBeanObserver implements Extension
+{
+ public void observe(@Observes ProcessBean<Sheep> event) {
+ event.addDefinitionError(new RuntimeException());
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/Sheep.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/Sheep.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/Sheep.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,6 @@
+package
org.jboss.jsr299.tck.tests.extensions.container.event.broken.processBeanObserverRegistersException;
+
+class Sheep
+{
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ProcessBeanObserver.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ProcessBeanObserver.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ProcessBeanObserver.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,12 @@
+package
org.jboss.jsr299.tck.tests.extensions.container.event.broken.processBeanObserverThrowsException;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+public class ProcessBeanObserver implements Extension
+{
+ public void observe(@Observes ProcessBean<Sheep> event) {
+ throw new RuntimeException();
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/Sheep.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/Sheep.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/Sheep.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,6 @@
+package
org.jboss.jsr299.tck.tests.extensions.container.event.broken.processBeanObserverThrowsException;
+
+class Sheep
+{
+
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ThrowExceptionInProcessBeanObserverTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ThrowExceptionInProcessBeanObserverTest.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/ThrowExceptionInProcessBeanObserverTest.java 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,42 @@
+/*
+ * 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.extensions.container.event.broken.processBeanObserverThrowsException;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DefinitionError;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)ExpectedDeploymentException(DefinitionError.class)
+@Resource(source = "javax.enterprise.inject.spi.Extension", destination =
"WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension")
+@IntegrationTest
+@SpecVersion(spec = "cdi", version = "20091018")
+public class ThrowExceptionInProcessBeanObserverTest extends AbstractJSR299Test
+{
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section="11.5.8", id="hd")
+ //WELD-224
+ public void testProcessBeanObserverThrowsException() {
+ assert false;
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/javax.enterprise.inject.spi.Extension
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/javax.enterprise.inject.spi.Extension
(rev 0)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverRegistersException/javax.enterprise.inject.spi.Extension 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.extensions.container.event.broken.processBeanObserverRegistersException.ProcessBeanObserver
\ No newline at end of file
Added:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/javax.enterprise.inject.spi.Extension
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/javax.enterprise.inject.spi.Extension
(rev 0)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/broken/processBeanObserverThrowsException/javax.enterprise.inject.spi.Extension 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.extensions.container.event.broken.processBeanObserverThrowsException.ProcessBeanObserver
\ No newline at end of file
Added:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/ejb-jar.xml
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/ejb-jar.xml
(rev 0)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/ejb-jar.xml 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar
+
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <enterprise-beans>
+ <session>
+ <ejb-name>cow</ejb-name>
+ <business-local>org.jboss.jsr299.tck.tests.extensions.container.event.CowLocal</business-local>
+ <ejb-class>org.jboss.jsr299.tck.tests.extensions.container.event.Cow</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/javax.enterprise.inject.spi.Extension
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/javax.enterprise.inject.spi.Extension
(rev 0)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/container/event/javax.enterprise.inject.spi.Extension 2009-10-22
12:45:59 UTC (rev 4223)
@@ -0,0 +1,4 @@
+org.jboss.jsr299.tck.tests.extensions.container.event.ProcessBeanObserver
+org.jboss.jsr299.tck.tests.extensions.container.event.ProcessInjectionTargetObserver
+org.jboss.jsr299.tck.tests.extensions.container.event.ProcessAnnotatedTypeObserver
+