Author: jharting
Date: 2009-10-22 07:53:26 -0400 (Thu, 22 Oct 2009)
New Revision: 4220
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessAnnotatedTypeObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetObserver.java
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventTest.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestTagHandler.java
Log:
Tests for 11.5.6 and 12.3
Copied:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java
(from rev 4053,
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventTest.java)
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java 2009-10-22
11:53:26 UTC (rev 4220)
@@ -0,0 +1,234 @@
+/*
+ * 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.lookup.injection.non.contextual;
+
+import java.util.EventListener;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.inject.Inject;
+import javax.servlet.Filter;
+import javax.servlet.GenericServlet;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContextListener;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.jsp.tagext.JspTag;
+import javax.servlet.jsp.tagext.SimpleTag;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+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.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+/**
+ * This test verifies that ProcessAnnotatedType and ProcessInjectionTarget events are
fired
+ * for various Java EE components and tests the AnnotatedType implementation.
+ * @author Jozef Hartinger
+ *
+ */
+@Artifact
+@Resources( {
+ @Resource(destination = WarArtifactDescriptor.WEB_XML_DESTINATION, source =
"web.xml"),
+ @Resource(destination = "WEB-INF/faces-config.xml", source =
"faces-config.xml"),
+ @Resource(destination = "WEB-INF/TestLibrary.tld", source =
"TestLibrary.tld"),
+ @Resource(destination = "TagPage.jsp", source = "TagPage.jsp"),
+ @Resource(destination = "ManagedBeanTestPage.jsp", source =
"ManagedBeanTestPage.jsp"),
+ @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 ContainerEventTest extends AbstractJSR299Test
+{
+ @Test(groups = "ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aac"),
+ @SpecAssertion(section = "11.5.6", id = "abc"),
+ @SpecAssertion(section = "12.3", id = "de")})
+ //WELD-204
+ public void testProcessInjectionTargetEventFiredForServletListener()
+ {
+ assert ProcessInjectionTargetObserver.getListenerEvent() != null;
+
validateServletListenerAnnotatedType(ProcessInjectionTargetObserver.getListenerEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aad"),
+ @SpecAssertion(section = "11.5.6", id = "abd"),
+ @SpecAssertion(section = "12.3", id = "df")})
+ public void testProcessInjectionTargetEventFiredForTagHandler()
+ {
+ assert ProcessInjectionTargetObserver.getTagHandlerEvent() != null;
+
validateTagHandlerAnnotatedType(ProcessInjectionTargetObserver.getTagHandlerEvent().getAnnotatedType());
+ }
+
+ @Test(groups = "ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aae"),
+ @SpecAssertion(section = "11.5.6", id = "abe"),
+ @SpecAssertion(section = "12.3", id = "dg")})
+ //WELD-204
+ public void testProcessInjectionTargetEventFiredForTagLibraryListener()
+ {
+ assert ProcessInjectionTargetObserver.getTagLibraryListenerEvent() != null;
+
validateTagLibraryListenerAnnotatedType(ProcessInjectionTargetObserver.getTagLibraryListenerEvent().getAnnotatedType());
+ }
+
+ @Test(groups = "ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aah"),
+ @SpecAssertion(section = "11.5.6", id = "abh"),
+ @SpecAssertion(section = "12.3", id = "dj")})
+ //WELD-204
+ public void testProcessInjectionTargetEventFiredForServlet()
+ {
+ assert ProcessInjectionTargetObserver.getServletEvent() != null;
+
validateServletAnnotatedType(ProcessInjectionTargetObserver.getServletEvent().getAnnotatedType());
+ }
+
+ @Test(groups = "ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aai"),
+ @SpecAssertion(section = "11.5.6", id = "abi"),
+ @SpecAssertion(section = "12.3", id = "dk")})
+ //WELD-204
+ public void testProcessInjectionTargetEventFiredForFilter()
+ {
+ assert ProcessInjectionTargetObserver.getFilterEvent() != null;
+
validateFilterAnnotatedType(ProcessInjectionTargetObserver.getFilterEvent().getAnnotatedType());
+ }
+
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section = "12.3", id = "dd")
+ public void testProcessInjectionTargetEventFiredForJsfManagedBean()
+ {
+ assert ProcessInjectionTargetObserver.getJsfManagedBeanEvent() != null;
+
validateJsfManagedBeanAnnotatedType(ProcessInjectionTargetObserver.getJsfManagedBeanEvent().getAnnotatedType());
+ }
+
+ @Test(groups = "ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.6", id = "aas"),
+ @SpecAssertion(section = "11.5.6", id = "aao"),
+ @SpecAssertion(section = "11.5.6", id = "aan"),
+ @SpecAssertion(section = "11.5.6", id = "aap")})
+ //WELD-204
+ public void testTypeOfProcessInjectionTargetParameter() {
+ assert !ProcessInjectionTargetObserver.isStringObserved();
+ assert ProcessInjectionTargetObserver.isTagHandlerSubTypeObserved();
+ assert !ProcessInjectionTargetObserver.isTagHandlerSuperTypeObserved();
+ assert !ProcessInjectionTargetObserver.isServletSuperTypeObserved();
+ assert ProcessInjectionTargetObserver.isServletSubTypeObserved();
+ assert !ProcessInjectionTargetObserver.isListenerSuperTypeObserved();
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id = "be")
+ public void testProcessAnnotatedTypeEventFiredForServletListener() {
+ assert ProcessAnnotatedTypeObserver.getListenerEvent() != null;
+
validateServletListenerAnnotatedType(ProcessAnnotatedTypeObserver.getListenerEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id = "bf")
+ public void testProcessAnnotatedTypeEventFiredForTagHandler() {
+ assert ProcessAnnotatedTypeObserver.getTagHandlerEvent() != null;
+
validateTagHandlerAnnotatedType(ProcessAnnotatedTypeObserver.getTagHandlerEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id = "bg")
+ public void testProcessAnnotatedTypeEventFiredForTagLibraryListener() {
+ assert ProcessAnnotatedTypeObserver.getTagLibraryListenerEvent() != null;
+
validateTagLibraryListenerAnnotatedType(ProcessAnnotatedTypeObserver.getTagLibraryListenerEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id = "bj")
+ public void testProcessAnnotatedTypeEventFiredForServlet() {
+ assert ProcessAnnotatedTypeObserver.getServletEvent() != null;
+
validateServletAnnotatedType(ProcessAnnotatedTypeObserver.getServletEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id = "bk")
+ public void testProcessAnnotatedTypeEventFiredForFilter() {
+ assert ProcessAnnotatedTypeObserver.getFilterEvent() != null;
+
validateFilterAnnotatedType(ProcessAnnotatedTypeObserver.getFilterEvent().getAnnotatedType());
+ }
+
+ @Test
+ @SpecAssertion(section = "12.3", id = "bd")
+ public void testProcessAnnotatedTypeEventFiredForJsfManagedBean() {
+ assert ProcessAnnotatedTypeObserver.getJsfManagedBeanEvent() != null;
+
validateJsfManagedBeanAnnotatedType(ProcessAnnotatedTypeObserver.getJsfManagedBeanEvent().getAnnotatedType());
+ }
+
+ private void validateServletListenerAnnotatedType(AnnotatedType<TestListener>
type) {
+ assert type.getBaseType().equals(TestListener.class);
+ assert type.getAnnotations().isEmpty();
+ assert type.getMethods().size() == 2;
+ assert type.getFields().iterator().next().isAnnotationPresent(Inject.class);
+ assert type.getAnnotations().isEmpty();
+ }
+
+ private void validateTagHandlerAnnotatedType(AnnotatedType<TestTagHandler> type)
{
+ assert type.getBaseType().equals(TestTagHandler.class);
+ assert typeSetMatches(type.getTypeClosure(), TestTagHandler.class,
SimpleTagSupport.class, SimpleTag.class, JspTag.class);
+ assert type.getAnnotations().size() == 1;
+ assert type.isAnnotationPresent(Any.class);
+ }
+
+ private void
validateTagLibraryListenerAnnotatedType(AnnotatedType<TagLibraryListener> type) {
+ assert type.getBaseType().equals(TagLibraryListener.class);
+ assert typeSetMatches(type.getTypeClosure(), TagLibraryListener.class,
ServletContextListener.class, EventListener.class, Object.class);
+ assert type.getFields().size() == 1;
+ assert
type.getFields().iterator().next().getJavaMember().getName().equals("sheep");
+ assert type.getConstructors().size() == 1;
+ assert type.getMethods().size() == 2;
+ }
+
+ private void validateServletAnnotatedType(AnnotatedType<TestServlet> type) {
+ assert type.getBaseType().equals(TestServlet.class);
+ assert typeSetMatches(type.getTypeClosure(), TestServlet.class, HttpServlet.class,
GenericServlet.class, Servlet.class, ServletConfig.class, Object.class);
+ assert type.getAnnotations().isEmpty();
+ }
+
+ private void validateFilterAnnotatedType(AnnotatedType<TestFilter> type) {
+ assert type.getBaseType().equals(TestFilter.class);
+ assert typeSetMatches(type.getTypeClosure(), TestFilter.class, Filter.class,
Object.class);
+ assert type.getFields().size() == 2;
+ assert type.getConstructors().size() == 1;
+ assert type.getConstructors().iterator().next().getParameters().isEmpty();
+ assert type.getMethods().size() == 3;
+ }
+
+ private void validateJsfManagedBeanAnnotatedType(AnnotatedType<Farm> type) {
+ assert type.getFields().size() == 1;
+ assert
type.getFields().iterator().next().getJavaMember().getName().equals("sheep");
+ assert type.getFields().iterator().next().isAnnotationPresent(Inject.class);
+ assert type.getMethods().size() == 1;
+ assert type.getMethods().iterator().next().getBaseType().equals(boolean.class);
+ }
+}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessAnnotatedTypeObserver.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessAnnotatedTypeObserver.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessAnnotatedTypeObserver.java 2009-10-22
11:53:26 UTC (rev 4220)
@@ -0,0 +1,69 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.non.contextual;
+
+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<TestServlet> servletEvent = null;
+ private static ProcessAnnotatedType<TestListener> listenerEvent = null;
+ private static ProcessAnnotatedType<TestFilter> filterEvent = null;
+ private static ProcessAnnotatedType<TagLibraryListener> tagLibraryListenerEvent
= null;
+ private static ProcessAnnotatedType<TestTagHandler> tagHandlerEvent = null;
+ private static ProcessAnnotatedType<Farm> jsfManagedBeanEvent = null;
+
+ public void observeServlet(@Observes ProcessAnnotatedType<TestServlet> event) {
+ servletEvent = event;
+ }
+
+ public void observeFilter(@Observes ProcessAnnotatedType<TestFilter> event) {
+ filterEvent = event;
+ }
+
+ public void observeListener(@Observes ProcessAnnotatedType<TestListener> event)
{
+ listenerEvent = event;
+ }
+
+ public void observeTagHandler(@Observes ProcessAnnotatedType<TestTagHandler>
event) {
+ tagHandlerEvent = event;
+ }
+
+ public void observeTagLibraryListener(@Observes
ProcessAnnotatedType<TagLibraryListener> event) {
+ tagLibraryListenerEvent = event;
+ }
+
+ public void observeJsfManagedBean(@Observes ProcessAnnotatedType<Farm> event) {
+ jsfManagedBeanEvent = event;
+ }
+
+ public static ProcessAnnotatedType<TestServlet> getServletEvent()
+ {
+ return servletEvent;
+ }
+
+ public static ProcessAnnotatedType<TestListener> getListenerEvent()
+ {
+ return listenerEvent;
+ }
+
+ public static ProcessAnnotatedType<TestFilter> getFilterEvent()
+ {
+ return filterEvent;
+ }
+
+ public static ProcessAnnotatedType<TagLibraryListener>
getTagLibraryListenerEvent()
+ {
+ return tagLibraryListenerEvent;
+ }
+
+ public static ProcessAnnotatedType<TestTagHandler> getTagHandlerEvent()
+ {
+ return tagHandlerEvent;
+ }
+
+ public static ProcessAnnotatedType<Farm> getJsfManagedBeanEvent()
+ {
+ return jsfManagedBeanEvent;
+ }
+}
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventObserver.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventObserver.java 2009-10-22
11:29:58 UTC (rev 4219)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventObserver.java 2009-10-22
11:53:26 UTC (rev 4220)
@@ -1,65 +0,0 @@
-package org.jboss.jsr299.tck.tests.lookup.injection.non.contextual;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import javax.servlet.Filter;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContextListener;
-import javax.servlet.jsp.tagext.SimpleTag;
-
-public class ProcessInjectionTargetEventObserver implements Extension
-{
-
- private static ProcessInjectionTarget<Servlet> servletEvent = null;
- private static ProcessInjectionTarget<ServletContextListener> listenerEvent =
null;
- private static ProcessInjectionTarget<Filter> filterEvent = null;
- private static ProcessInjectionTarget<ServletContextListener>
tagLibraryListenerEvent = null;
- private static ProcessInjectionTarget<SimpleTag> tagHandlerEvent = null;
-
- public void observeServlet(@Observes ProcessInjectionTarget<Servlet> event) {
- servletEvent = event;
- }
-
- public void observeFilter(@Observes ProcessInjectionTarget<Filter> event) {
- filterEvent = event;
- }
-
- public void observeListener(@Observes
ProcessInjectionTarget<ServletContextListener> event) {
- listenerEvent = event;
- }
-
- public void observeTagHandler(@Observes ProcessInjectionTarget<SimpleTag> event)
{
- tagHandlerEvent = event;
- }
-
- public void observeTagLibraryListener(@Observes
ProcessInjectionTarget<ServletContextListener> event) {
- tagLibraryListenerEvent = event;
- }
-
- public static ProcessInjectionTarget<Servlet> getServletEvent()
- {
- return servletEvent;
- }
-
- public static ProcessInjectionTarget<ServletContextListener> getListenerEvent()
- {
- return listenerEvent;
- }
-
- public static ProcessInjectionTarget<Filter> getFilterEvent()
- {
- return filterEvent;
- }
-
- public static ProcessInjectionTarget<ServletContextListener>
getTagLibraryListenerEvent()
- {
- return tagLibraryListenerEvent;
- }
-
- public static ProcessInjectionTarget<SimpleTag> getTagHandlerEvent()
- {
- return tagHandlerEvent;
- }
-}
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventTest.java 2009-10-22
11:29:58 UTC (rev 4219)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventTest.java 2009-10-22
11:53:26 UTC (rev 4220)
@@ -1,101 +0,0 @@
-/*
- * 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.lookup.injection.non.contextual;
-
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import javax.servlet.Filter;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContextListener;
-import javax.servlet.jsp.tagext.SimpleTag;
-
-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.Resource;
-import org.jboss.testharness.impl.packaging.Resources;
-import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
-import org.testng.annotations.Test;
-
-@Artifact
-@Resources( { @Resource(destination = WarArtifactDescriptor.WEB_XML_DESTINATION, source =
"web.xml"),
- @Resource(destination = "WEB-INF/faces-config.xml", source =
"faces-config.xml"),
- @Resource(destination = "WEB-INF/TestLibrary.tld", source =
"TestLibrary.tld"),
- @Resource(destination = "TagPage.jsp", source = "TagPage.jsp"),
- @Resource(destination = "ManagedBeanTestPage.jsp", source =
"ManagedBeanTestPage.jsp"),
- @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 ProcessInjectionTargetEventTest extends AbstractJSR299Test
-{
- @Test(groups = "ri-broken")
- @SpecAssertions({
- @SpecAssertion(section = "11.5.6", id = "aac"),
- @SpecAssertion(section = "11.5.6", id = "abc")})
- public void testEventFiredForServletListener()
- {
- ProcessInjectionTarget<ServletContextListener> event =
ProcessInjectionTargetEventObserver.getListenerEvent();
- assert event != null;
- assert event.getAnnotatedType().getBaseType().equals(TestListener.class);
- }
-
- @Test
- @SpecAssertions({
- @SpecAssertion(section = "11.5.6", id = "aad"),
- @SpecAssertion(section = "11.5.6", id = "abd")})
- public void testEventFiredForTagHandler()
- {
- ProcessInjectionTarget<SimpleTag> event =
ProcessInjectionTargetEventObserver.getTagHandlerEvent();
- assert event != null;
- assert event.getAnnotatedType().getBaseType().equals(TestTagHandler.class);
- }
-
- @Test(groups = "ri-broken")
- @SpecAssertions({
- @SpecAssertion(section = "11.5.6", id = "aae"),
- @SpecAssertion(section = "11.5.6", id = "abe")})
- public void testEventFiredForTagLibraryListener()
- {
- ProcessInjectionTarget<ServletContextListener> event =
ProcessInjectionTargetEventObserver.getTagLibraryListenerEvent();
- assert event != null;
- assert event.getAnnotatedType().getBaseType().equals(TagLibraryListener.class);
- }
-
- @Test(groups = "ri-broken")
- @SpecAssertions({
- @SpecAssertion(section = "11.5.6", id = "aah"),
- @SpecAssertion(section = "11.5.6", id = "abh")})
- public void testEventFiredForServlet()
- {
- ProcessInjectionTarget<Servlet> event =
ProcessInjectionTargetEventObserver.getServletEvent();
- assert event != null;
- assert event.getAnnotatedType().getBaseType().equals(TestServlet.class);
- }
-
- @Test(groups = "ri-broken")
- @SpecAssertions({
- @SpecAssertion(section = "11.5.6", id = "aai"),
- @SpecAssertion(section = "11.5.6", id = "abi")})
- public void testEventFiredForFilter()
- {
- ProcessInjectionTarget<Filter> event =
ProcessInjectionTargetEventObserver.getFilterEvent();
- assert event != null;
- assert event.getAnnotatedType().getBaseType().equals(TestFilter.class);
- }
-}
Copied:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetObserver.java
(from rev 4053,
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventObserver.java)
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetObserver.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetObserver.java 2009-10-22
11:53:26 UTC (rev 4220)
@@ -0,0 +1,135 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.non.contextual;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.servlet.ServletContextListener;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.jsp.tagext.SimpleTag;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+public class ProcessInjectionTargetObserver implements Extension
+{
+
+ private static ProcessInjectionTarget<TestServlet> servletEvent = null;
+ private static ProcessInjectionTarget<TestListener> listenerEvent = null;
+ private static ProcessInjectionTarget<TestFilter> filterEvent = null;
+ private static ProcessInjectionTarget<TagLibraryListener>
tagLibraryListenerEvent = null;
+ private static ProcessInjectionTarget<TestTagHandler> tagHandlerEvent = null;
+ private static ProcessInjectionTarget<Farm> jsfManagedBeanEvent = null;
+
+ private static boolean servletSuperTypeObserved = false;
+ private static boolean servletSubTypeObserved = false;
+ private static boolean listenerSuperTypeObserved = false;
+ private static boolean tagHandlerSuperTypeObserved = false;
+ private static boolean tagHandlerSubTypeObserved = false;
+ private static boolean stringObserved = false;
+
+ public void observeServlet(@Observes ProcessInjectionTarget<TestServlet> event)
{
+ servletEvent = event;
+ }
+
+ public void observeFilter(@Observes ProcessInjectionTarget<TestFilter> event) {
+ filterEvent = event;
+ }
+
+ public void observeListener(@Observes ProcessInjectionTarget<TestListener>
event) {
+ listenerEvent = event;
+ }
+
+ public void observeTagHandler(@Observes ProcessInjectionTarget<TestTagHandler>
event) {
+ tagHandlerEvent = event;
+ }
+
+ public void observeTagLibraryListener(@Observes
ProcessInjectionTarget<TagLibraryListener> event) {
+ tagLibraryListenerEvent = event;
+ }
+
+ public void observeJsfManagedBean(@Observes ProcessInjectionTarget<Farm> event)
{
+ jsfManagedBeanEvent = event;
+ }
+
+ public void observeServletSuperType(@Observes ProcessInjectionTarget<? super
HttpServlet> event) {
+ servletSuperTypeObserved = true;
+ }
+
+ public void observeServletSubType(@Observes ProcessInjectionTarget<? extends
HttpServlet> event) {
+ servletSubTypeObserved = true;
+ }
+
+ public void observeListenerSuperType(@Observes ProcessInjectionTarget<? super
ServletContextListener> event) {
+ listenerSuperTypeObserved = true;
+ }
+
+ public void tagHandlerSuperType(@Observes ProcessInjectionTarget<? super
SimpleTagSupport> event) {
+ tagHandlerSuperTypeObserved = true;
+ }
+
+ public void tagHandlerSubType(@Observes ProcessInjectionTarget<? extends
SimpleTag> event) {
+ tagHandlerSubTypeObserved = true;
+ }
+
+ public void stringObserver(@Observes ProcessInjectionTarget<String> event) {
+ stringObserved = true;
+ }
+
+ public static ProcessInjectionTarget<TestServlet> getServletEvent()
+ {
+ return servletEvent;
+ }
+
+ public static ProcessInjectionTarget<TestListener> getListenerEvent()
+ {
+ return listenerEvent;
+ }
+
+ public static ProcessInjectionTarget<TestFilter> getFilterEvent()
+ {
+ return filterEvent;
+ }
+
+ public static ProcessInjectionTarget<TagLibraryListener>
getTagLibraryListenerEvent()
+ {
+ return tagLibraryListenerEvent;
+ }
+
+ public static ProcessInjectionTarget<TestTagHandler> getTagHandlerEvent()
+ {
+ return tagHandlerEvent;
+ }
+
+ public static ProcessInjectionTarget<Farm> getJsfManagedBeanEvent()
+ {
+ return jsfManagedBeanEvent;
+ }
+
+ public static boolean isServletSuperTypeObserved()
+ {
+ return servletSuperTypeObserved;
+ }
+
+ public static boolean isServletSubTypeObserved()
+ {
+ return servletSubTypeObserved;
+ }
+
+ public static boolean isListenerSuperTypeObserved()
+ {
+ return listenerSuperTypeObserved;
+ }
+
+ public static boolean isTagHandlerSuperTypeObserved()
+ {
+ return tagHandlerSuperTypeObserved;
+ }
+
+ public static boolean isTagHandlerSubTypeObserved()
+ {
+ return tagHandlerSubTypeObserved;
+ }
+
+ public static boolean isStringObserved()
+ {
+ return stringObserved;
+ }
+}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestTagHandler.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestTagHandler.java 2009-10-22
11:29:58 UTC (rev 4219)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestTagHandler.java 2009-10-22
11:53:26 UTC (rev 4220)
@@ -2,10 +2,12 @@
import java.io.IOException;
+import javax.enterprise.inject.Any;
import javax.inject.Inject;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
+@Any
public class TestTagHandler extends SimpleTagSupport
{
private static final long serialVersionUID = -3048065065359948044L;