Author: jharting
Date: 2009-10-26 05:02:32 -0400 (Mon, 26 Oct 2009)
New Revision: 4322
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithFinalBoundField_Broken.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithStaticBoundField_Broken.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Tuna.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/TunaFarm.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/initializer/InitializerMethodTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Farm.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/FarmInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBean.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBeanLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouseLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/Farm.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TagLibraryListener.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestFilter.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestListener.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestServlet.java
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/ws/InjectionIntoWebServiceEndPointTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/SheepWSEndPoint.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ManagedBeanTestPage.jsp
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
Tests for Chapter 5
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/initializer/InitializerMethodTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/initializer/InitializerMethodTest.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/initializer/InitializerMethodTest.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -33,7 +33,7 @@
@SpecAssertion(section = "3.9", id = "g"),
@SpecAssertion(section = "3.9.1", id = "a"),
@SpecAssertion(section = "3.9.2", id = "aa"),
- @SpecAssertion(section = "5.6.4", id = "ab"),
+ @SpecAssertion(section = "5.6.4", id = "ad"),
@SpecAssertion(section = "3.10", id = "a")
})
public void testMultipleInitializerMethodsAreCalled()
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithFinalBoundField_Broken.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithFinalBoundField_Broken.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithFinalBoundField_Broken.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -1,9 +0,0 @@
-package org.jboss.jsr299.tck.tests.lookup.injection;
-
-
-class BeanWithFinalBoundField_Broken
-{
-
- /*@Current*/ public final Tuna tuna = null;
-
-}
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithStaticBoundField_Broken.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithStaticBoundField_Broken.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/BeanWithStaticBoundField_Broken.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -1,9 +0,0 @@
-package org.jboss.jsr299.tck.tests.lookup.injection;
-
-
-class BeanWithStaticBoundField_Broken
-{
-
- /*@Current*/ public static Tuna tuna;
-
-}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -2,6 +2,7 @@
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;
@@ -23,7 +24,11 @@
}
@Test
- @SpecAssertion(section = "5.3", id = "kc")
+ @SpecAssertions({
+ @SpecAssertion(section = "5.3", id = "kc"),
+ @SpecAssertion(section = "5.6", id = "b"),
+ @SpecAssertion(section = "5.6.4", id = "ac")
+ })
public void testInjectionOfNamedBean()
{
WolfPack wolfPack = getInstanceByType(WolfPack.class);
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Tuna.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Tuna.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/Tuna.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -1,14 +0,0 @@
-package org.jboss.jsr299.tck.tests.lookup.injection;
-
-import javax.enterprise.context.RequestScoped;
-
-@RequestScoped
-class Tuna
-{
-
- public String getName()
- {
- return "Ophir";
- }
-
-}
Deleted:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/TunaFarm.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/TunaFarm.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/TunaFarm.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -1,15 +0,0 @@
-package org.jboss.jsr299.tck.tests.lookup.injection;
-
-import javax.inject.Inject;
-
-class TunaFarm
-{
-
- @SuppressWarnings("unused")
- @Inject
- public Tuna tuna;
-
- public Tuna notInjectedTuna = new Tuna();
-
-
-}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Farm.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Farm.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Farm.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -8,26 +8,28 @@
@Stateless
public class Farm implements FarmLocal
{
- @Inject private Sheep sheepField;
-
- private boolean initializerCalled;
+ @Inject
+ private Sheep sheepField;
+
+ private boolean initializerCalledAfterInjection = false;
private boolean injectionPerformedCorrectly = false;
-
- @Inject private void initialize(Sheep sheep)
+
+ @Inject
+ public void initialize(Sheep sheep)
{
- assert sheepField != null;
- initializerCalled = true;
+ initializerCalledAfterInjection = (sheepField != null) && (sheep != null);
}
@Interceptors(FarmInterceptor.class)
- public int getAnimalCount() {
+ public int getAnimalCount()
+ {
return 1;
}
-
+
@PostConstruct
- public void postConstruct() {
- assert initializerCalled;
- injectionPerformedCorrectly = true;
+ public void postConstruct()
+ {
+ injectionPerformedCorrectly = initializerCalledAfterInjection;
}
public boolean isInjectionPerformedCorrectly()
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/FarmInterceptor.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/FarmInterceptor.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/FarmInterceptor.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -9,14 +9,24 @@
@Inject
private Sheep sheep;
+ private boolean initializerCalled = false;
+ @Inject
+ public void initialize(Sheep sheep)
+ {
+ initializerCalled = sheep != null;
+ }
+
@AroundInvoke
public Object intercept(InvocationContext invocation) throws Exception
{
- if (sheep == null)
+ if ((sheep != null) && initializerCalled)
{
+ return (Integer) invocation.proceed() + 1;
+ }
+ else
+ {
throw new RuntimeException("Sheep not injected.");
}
- return (Integer)invocation.proceed() + 1;
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBean.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBean.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBean.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -2,15 +2,27 @@
import javax.ejb.EJB;
import javax.ejb.Stateless;
+import javax.inject.Inject;
@Stateless
public class InjectedSessionBean implements InjectedSessionBeanLocal
{
@EJB
private FarmLocal farm;
+ private boolean initializerCalledAfterResourceInjection = false;
public FarmLocal getFarm()
{
return farm;
}
+
+ @Inject
+ public void initialize() {
+ initializerCalledAfterResourceInjection = farm != null;
+ }
+
+ public boolean isInitializerCalledAfterResourceInjection()
+ {
+ return initializerCalledAfterResourceInjection;
+ }
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBeanLocal.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBeanLocal.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/InjectedSessionBeanLocal.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -6,4 +6,5 @@
public interface InjectedSessionBeanLocal
{
FarmLocal getFarm();
+ boolean isInitializerCalledAfterResourceInjection();
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -1,12 +1,30 @@
package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
@Stateless
public class MegaPoorHenHouse extends PoorHenHouse implements MegaPoorHenHouseLocal
{
+ private boolean postConstructCalledAfterSuperclassInitializer = false;
+
public Fox getFox()
{
return fox;
}
+
+ @PostConstruct
+ public void postConstruct() {
+ postConstructCalledAfterSuperclassInitializer =
initializerCalledAfterSuperclassInjection;
+ }
+
+ public boolean isPostConstructCalledAfterSuperclassInitializer()
+ {
+ return postConstructCalledAfterSuperclassInitializer;
+ }
+
+ public boolean isInitializerCalledAfterSuperclassInjection()
+ {
+ return initializerCalledAfterSuperclassInjection;
+ }
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouseLocal.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouseLocal.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouseLocal.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -6,4 +6,6 @@
public interface MegaPoorHenHouseLocal
{
Fox getFox();
+ boolean isPostConstructCalledAfterSuperclassInitializer();
+ boolean isInitializerCalledAfterSuperclassInjection();
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -1,6 +1,18 @@
package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+import javax.inject.Inject;
+
class PoorHenHouse extends HenHouse
{
+ protected boolean initializerCalledAfterSuperclassInjection = false;
+
+ @Inject
+ public void initialize() {
+ initializerCalledAfterSuperclassInjection = fox != null;
+ }
+ public boolean isInitializerCalledAfterSuperclassInjection()
+ {
+ return initializerCalledAfterSuperclassInjection;
+ }
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionTest.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionTest.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -60,7 +60,8 @@
@Test(groups = "jboss-as-broken")
@SpecAssertions({
@SpecAssertion(section = "5.6", id = "ed"),
- @SpecAssertion(section = "5.6.4", id = "ao")
+ @SpecAssertion(section = "5.6.4", id = "ao"),
+ @SpecAssertion(section = "5.6.4", id = "ap")
})
//JBAS-7046
public void testInjectionOnEJBInterceptor()
@@ -87,5 +88,24 @@
MegaPoorHenHouseLocal henHouse = getInstanceByType(MegaPoorHenHouseLocal.class);
assert henHouse.getFox() != null;
assert henHouse.getFox().getName().equals("gavin");
- }
+ }
+
+ @Test
+ @SpecAssertion(section = "5.6.4", id = "bb")
+ public void testInitializerCalledAfterFieldInjectionOfSuperclass() {
+ MegaPoorHenHouseLocal house = getInstanceByType(MegaPoorHenHouseLocal.class);
+ assert house.isInitializerCalledAfterSuperclassInjection();
+ }
+
+ @Test
+ @SpecAssertion(section = "5.6.4", id = "bf")
+ public void testPostConstructCalledAfterInitializerOfSuperclass() {
+ assert
getInstanceByType(MegaPoorHenHouseLocal.class).isPostConstructCalledAfterSuperclassInitializer();
+ }
+
+ @Test
+ @SpecAssertion(section = "5.6.4", id = "bc")
+ public void testInitializerCalledAfterResourceInjection() {
+ assert
getInstanceByType(InjectedSessionBeanLocal.class).isInitializerCalledAfterResourceInjection();
+ }
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/Farm.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/Farm.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/Farm.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -23,7 +23,18 @@
{
@Inject
private Sheep sheep;
+ private boolean initializerCalled = false;
+ @Inject
+ public void initialize(Sheep sheep) {
+ initializerCalled = sheep != null;
+ }
+
+ public boolean isInitializerCalled()
+ {
+ return initializerCalled;
+ }
+
public boolean isSheepInjected() {
return sheep != null;
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -51,8 +51,20 @@
{
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
- webClient.getPage(getContextPath() + "Test/Servlet");
+ webClient.getPage(getContextPath() + "Test/Servlet?test=injection");
}
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "5.6.4", id = "af"),
+ @SpecAssertion(section = "5.6.4", id = "bm")
+ })
+ public void testServletInitializerMethodCalled() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "Test/Servlet?test=initializer");
+ }
@Test
@SpecAssertions( {
@@ -64,8 +76,20 @@
{
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
- webClient.getPage(getContextPath() + "TestFilter");
+ webClient.getPage(getContextPath() + "TestFilter?test=injection");
}
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "5.6.4", id = "ah"),
+ @SpecAssertion(section = "5.6.4", id = "bp")
+ })
+ public void testFilterInitializerMethodCalled() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "TestFilter?test=initializer");
+ }
@Test
@SpecAssertions({
@@ -76,13 +100,23 @@
{
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
- webClient.getPage(getContextPath() + "Test/ServletListener");
+ webClient.getPage(getContextPath() +
"Test/ServletListener?test=injection");
}
+
+ @Test
+ @SpecAssertion(section = "5.6.4", id = "aj")
+ public void testServletListenerInitializerMethodCalled() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() +
"Test/ServletListener?test=initializer");
+ }
@Test
@SpecAssertions({
@SpecAssertion(section = "5.6", id = "eb"),
- @SpecAssertion(section = "5.6.4", id = "am")
+ @SpecAssertion(section = "5.6.4", id = "am"),
+ @SpecAssertion(section = "5.6.4", id = "an")
})
public void testInjectionIntoTagHandler() throws Exception
{
@@ -90,7 +124,8 @@
webClient.setThrowExceptionOnFailingStatusCode(false);
WebResponse response = webClient.getPage(getContextPath() +
"TagPage.jsp").getWebResponse();
assert response.getStatusCode() == 200;
- assert response.getContentAsString().contains(TestTagHandler.SUCCESS);
+ assert response.getContentAsString().contains(TestTagHandler.INJECTION_SUCCESS);
+ assert response.getContentAsString().contains(TestTagHandler.INITIALIZER_SUCCESS);
}
@Test
@@ -102,19 +137,30 @@
{
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
- webClient.getPage(getContextPath() + "Test/TagLibraryListener");
+ webClient.getPage(getContextPath() +
"Test/TagLibraryListener?test=injection");
}
@Test
+ @SpecAssertion(section = "5.6.4", id="at")
+ public void testTagLibraryListenerInitializerMethodCalled() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() +
"Test/TagLibraryListener?test=initializer");
+ }
+
+ @Test
@SpecAssertions({
+ @SpecAssertion(section = "5.6", id = "d"),
@SpecAssertion(section = "5.6.4", id = "au"),
- @SpecAssertion(section = "5.6", id = "d")
+ @SpecAssertion(section = "5.6.4", id = "av")
})
public void testInjectionIntoJSFManagedBean() throws Exception
{
WebClient webclient = new WebClient();
webclient.setThrowExceptionOnFailingStatusCode(true);
String content = webclient.getPage(getContextPath() +
"ManagedBeanTestPage.jsf").getWebResponse().getContentAsString();
- assert content.contains("It works");
+ assert content.contains("Injection works");
+ assert content.contains("Initializer works");
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TagLibraryListener.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TagLibraryListener.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TagLibraryListener.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -8,6 +8,12 @@
{
@Inject
private Sheep sheep;
+ private boolean initializerCalled = false;
+
+ @Inject
+ public void initialize(Sheep sheep) {
+ initializerCalled = sheep != null;
+ }
public void contextDestroyed(ServletContextEvent sce)
{
@@ -16,5 +22,6 @@
public void contextInitialized(ServletContextEvent sce)
{
sce.getServletContext().setAttribute("tag.library.listener.injected",
sheep != null);
+
sce.getServletContext().setAttribute("tag.library.listener.initializer.called",
initializerCalled);
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestFilter.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestFilter.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestFilter.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -17,7 +17,14 @@
@Inject
private Sheep sheep;
private boolean injectionPerformedCorrectly = false;
+ private boolean initializerCalled = false;
+ private boolean initCalledAfterInitializer = false;
+ @Inject
+ public void initialize(Sheep sheep) {
+ initializerCalled = sheep != null;
+ }
+
public void destroy()
{
}
@@ -25,11 +32,21 @@
public void doFilter(ServletRequest request, ServletResponse response, FilterChain
chain) throws IOException, ServletException
{
HttpServletResponse resp = (HttpServletResponse) response;
- resp.setStatus(injectionPerformedCorrectly ? 200 : 500);
+
+ if (request.getParameter("test").equals("injection")) {
+ // Return 200 if injection into Filter occurred, 500 otherwise
+ resp.setStatus(injectionPerformedCorrectly ? 200 : 500);
+ } else if (request.getParameter("test").equals("initializer"))
{
+ // Return 200 if initializer was called, 500 otherwise
+ resp.setStatus(initCalledAfterInitializer ? 200 : 500);
+ } else {
+ resp.setStatus(404);
+ }
}
public void init(FilterConfig filterConfig) throws ServletException
{
injectionPerformedCorrectly = sheep != null;
+ initCalledAfterInitializer = initializerCalled;
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestListener.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestListener.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestListener.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -8,7 +8,13 @@
{
@Inject
private Sheep sheep;
-
+ private boolean initializerCalled = false;
+
+ @Inject
+ public void initialize(Sheep sheep) {
+ initializerCalled = sheep != null;
+ }
+
public void contextDestroyed(ServletContextEvent sce)
{
}
@@ -16,5 +22,6 @@
public void contextInitialized(ServletContextEvent sce)
{
sce.getServletContext().setAttribute("listener.injected", sheep !=
null);
+ sce.getServletContext().setAttribute("listener.initializer.called",
initializerCalled);
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestServlet.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestServlet.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestServlet.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -14,8 +14,15 @@
@Inject
private Sheep sheep;
private boolean injectionPerformedCorrectly = false;
+ private boolean initializerCalled = false;
+ private boolean initCalledAfterInitializer = false;
private static final long serialVersionUID = -7672096092047821010L;
+
+ @Inject
+ public void initialize(Sheep sheep) {
+ initializerCalled = sheep != null;
+ }
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
@@ -32,26 +39,50 @@
}
private void testServlet(HttpServletRequest req, HttpServletResponse resp) {
- // Return 200 if injection into Servlet occurred, 500 otherwise
- resp.setStatus(injectionPerformedCorrectly ? 200 : 500);
+ if (req.getParameter("test").equals("injection")) {
+ // Return 200 if injection into Servlet occurred, 500 otherwise
+ resp.setStatus(injectionPerformedCorrectly ? 200 : 500);
+ } else if (req.getParameter("test").equals("initializer")) {
+ // Return 200 if the initializer was called, 500 otherwise
+ resp.setStatus(initCalledAfterInitializer ? 200 : 500);
+ } else {
+ resp.setStatus(404);
+ }
}
private void testListener(HttpServletRequest req, HttpServletResponse resp) {
- // Return 200 if injection into Listener occurred, 500 otherwise
- boolean result = (Boolean)
req.getSession().getServletContext().getAttribute("listener.injected");
- resp.setStatus((result) ? 200 : 500);
+ if (req.getParameter("test").equals("injection")) {
+ // Return 200 if injection into Listener occurred, 500 otherwise
+ boolean result = (Boolean)
req.getSession().getServletContext().getAttribute("listener.injected");
+ resp.setStatus((result) ? 200 : 500);
+ } else if (req.getParameter("test").equals("initializer")) {
+ // Return 200 if the initializer was called, 500 otherwise
+ boolean result = (Boolean)
req.getSession().getServletContext().getAttribute("listener.initializer.called");
+ resp.setStatus((result) ? 200 : 500);
+ } else {
+ resp.setStatus(404);
+ }
}
private void testTagLibraryListener(HttpServletRequest req, HttpServletResponse resp)
{
- // Return 200 if injection into TagLibrary Listener occurred, 500 otherwise
- boolean result = (Boolean)
req.getSession().getServletContext().getAttribute("tag.library.listener.injected");
- resp.setStatus((result) ? 200 : 500);
+ if (req.getParameter("test").equals("injection")) {
+ // Return 200 if injection into TagLibrary Listener occurred, 500 otherwise
+ boolean result = (Boolean)
req.getSession().getServletContext().getAttribute("tag.library.listener.injected");
+ resp.setStatus((result) ? 200 : 500);
+ } else if (req.getParameter("test").equals("initializer")) {
+ // Return 200 if the initializer was called, 500 otherwise
+ boolean result = (Boolean)
req.getSession().getServletContext().getAttribute("tag.library.listener.initializer.called");
+ resp.setStatus((result) ? 200 : 500);
+ } else {
+ resp.setStatus(404);
+ }
}
@Override
public void init() throws ServletException
{
injectionPerformedCorrectly = sheep != null;
+ initCalledAfterInitializer = initializerCalled;
}
@Override
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-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/TestTagHandler.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -11,22 +11,28 @@
public class TestTagHandler extends SimpleTagSupport
{
private static final long serialVersionUID = -3048065065359948044L;
- public static final String SUCCESS = "It works.";
- public static final String FAILURE = "It is broken.";
+ public static final String INJECTION_SUCCESS = "Injection works.";
+ public static final String INITIALIZER_SUCCESS = "Initializer works.";
@Inject
private Sheep sheep;
+ private boolean initializerCalled = false;
+ @Inject
+ public void initialize(Sheep sheep) {
+ initializerCalled = sheep != null;
+ }
+
@Override
public void doTag() throws JspException, IOException
{
- if (sheep == null)
+ if (sheep != null)
{
- getJspContext().getOut().write(FAILURE);
+ getJspContext().getOut().write(INJECTION_SUCCESS);
}
- else
+ if (initializerCalled)
{
- getJspContext().getOut().write(SUCCESS);
+ getJspContext().getOut().append(INITIALIZER_SUCCESS);
}
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/InjectionIntoWebServiceEndPointTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/InjectionIntoWebServiceEndPointTest.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/InjectionIntoWebServiceEndPointTest.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -20,6 +20,7 @@
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;
@@ -37,7 +38,11 @@
SheepWSEndPointService service;
@Test(groups = "jboss-as-broken")
- @SpecAssertion(section = "5.6", id = "ee")
+ @SpecAssertions({
+ @SpecAssertion(section = "5.6", id = "ee"),
+ @SpecAssertion(section = "5.6.4", id = "aq"),
+ @SpecAssertion(section = "5.6.4", id = "ar")
+ })
// JBAS-7046
public void testInjectionIntoWebServiceEndpoint() throws Exception
{
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/SheepWSEndPoint.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/SheepWSEndPoint.java 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/SheepWSEndPoint.java 2009-10-26
09:02:32 UTC (rev 4322)
@@ -9,9 +9,15 @@
{
@Inject
private Sheep sheep;
+ private boolean initializerCalled = false;
+ @Inject
+ public void initialize(Sheep sheep) {
+ initializerCalled = sheep != null;
+ }
+
@WebMethod
public boolean isSheepInjected() {
- return (sheep != null);
+ return (sheep != null) && initializerCalled;
}
}
Modified:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ManagedBeanTestPage.jsp
===================================================================
---
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ManagedBeanTestPage.jsp 2009-10-26
04:59:00 UTC (rev 4321)
+++
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ManagedBeanTestPage.jsp 2009-10-26
09:02:32 UTC (rev 4322)
@@ -7,7 +7,8 @@
<body>
<f:view>
<h1>
- <h:outputText value="#{farm.sheepInjected ? 'It works' : 'It is
broken'}"/>
+ <h:outputText value="#{farm.sheepInjected ? 'Injection works' :
'Injection is broken'}"/>
+ <h:outputText value="#{farm.initializerCalled ? 'Initializer works'
: 'Initializer is broken'}"/>
</h1>
</f:view>
</body>
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-26 04:59:00 UTC (rev
4321)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-26 09:02:32 UTC (rev
4322)
@@ -2244,17 +2244,9 @@
<text>An annotation member may be excluded from consideration using the
|@NonBinding| annotation.</text>
</assertion>
- <group>
+ <assertion id="c" testable="false">
<text>Array-valued or annotation-valued members of a qualifier type must be
annotated |@NonBinding| in a portable application. If an array-valued or annotation-valued
member of a binding type is not annotated |@NonBinding|, non-portable behavior
results.</text>
-
- <assertion id="d">
- <text>Test with an array-valued member.</text>
- </assertion>
-
- <assertion id="e">
- <text>Test with an annotation-valued member.</text>
- </assertion>
- </group>
+ </assertion>
</section>
<section id="5.3.6" title="Multiple qualifiers">