[weld-commits] Weld SVN: r4053 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual and 3 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Wed Oct 14 11:10:47 EDT 2009


Author: jharting
Date: 2009-10-14 11:10:47 -0400 (Wed, 14 Oct 2009)
New Revision: 4053

Added:
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventObserver.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventTest.java
   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
   cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/
   cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/javax.enterprise.inject.spi.Extension
   cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/javax.enterprise.inject.spi.Extension
Log:
CDITCK-4 Tests for section 11.5.6

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventObserver.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventObserver.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventObserver.java	2009-10-14 15:10:47 UTC (rev 4053)
@@ -0,0 +1,30 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+public class ProcessInjectionTargetEventObserver implements Extension
+{
+
+   private static ProcessInjectionTarget<Farm> sessionBeanEvent = null; 
+   private static ProcessInjectionTarget<FarmInterceptor> ejbInterceptorEvent = null; 
+   
+   public void observeSessionBean(@Observes ProcessInjectionTarget<Farm> event) {
+      sessionBeanEvent = event;
+   }
+   
+   public void observeEJBInterceptor(@Observes ProcessInjectionTarget<FarmInterceptor> event) {
+      ejbInterceptorEvent = event;
+   }
+
+   public static ProcessInjectionTarget<Farm> getSessionBeanEvent()
+   {
+      return sessionBeanEvent;
+   }
+
+   public static ProcessInjectionTarget<FarmInterceptor> getEjbInterceptorEvent()
+   {
+      return ejbInterceptorEvent;
+   }
+}

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventTest.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/ProcessInjectionTargetEventTest.java	2009-10-14 15:10:47 UTC (rev 4053)
@@ -0,0 +1,65 @@
+/*
+ * 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.enterprise;
+
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+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.testng.annotations.Test;
+
+/**
+ * This test verifies that ProcessInjectionTarget event is fired for a session bean and EJB interceptor.
+ * @author Jozef Hartinger
+ *
+ */
+
+ at Artifact
+ at Resource(source = "javax.enterprise.inject.spi.Extension", destination = "WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension")
+ at IntegrationTest
+ at SpecVersion(spec = "cdi", version = "PFD2")
+public class ProcessInjectionTargetEventTest extends AbstractJSR299Test
+{
+   @Test(groups = "ri-broken")
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.6", id = "aab"),
+      @SpecAssertion(section = "11.5.6", id = "abb")})
+   public void testEventFiredForSessionBean()
+   {
+      ProcessInjectionTarget<Farm> event = ProcessInjectionTargetEventObserver.getSessionBeanEvent();
+      assert event != null;
+      assert event.getAnnotatedType().getBaseType().equals(Farm.class);
+      assert event.getAnnotatedType().getFields().size() == 2;
+   }
+
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.6", id = "aaf"),
+      @SpecAssertion(section = "11.5.6", id = "abf")})
+   public void testEventFiredForTagHandler()
+   {
+      ProcessInjectionTarget<FarmInterceptor> event = ProcessInjectionTargetEventObserver.getEjbInterceptorEvent();
+      assert event != null;
+      assert event.getAnnotatedType().getBaseType().equals(FarmInterceptor.class);
+      assert event.getAnnotatedType().getFields().size() == 1;
+   }
+}

Added: 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	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventObserver.java	2009-10-14 15:10:47 UTC (rev 4053)
@@ -0,0 +1,65 @@
+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;
+   }   
+}

Added: 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	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ProcessInjectionTargetEventTest.java	2009-10-14 15:10:47 UTC (rev 4053)
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+ at Artifact
+ at 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") })
+ at IntegrationTest
+ at SpecVersion(spec = "cdi", version = "PFD2")
+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);
+   }
+}

Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/javax.enterprise.inject.spi.Extension	2009-10-14 15:10:47 UTC (rev 4053)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.lookup.injection.enterprise.ProcessInjectionTargetEventObserver
\ No newline at end of file

Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/javax.enterprise.inject.spi.Extension	2009-10-14 15:10:47 UTC (rev 4053)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ProcessInjectionTargetEventObserver
\ No newline at end of file



More information about the weld-commits mailing list