Weld SVN: r4241 - api/trunk/cdi/src/main/java/javax/enterprise/inject.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-23 15:20:15 -0400 (Fri, 23 Oct 2009)
New Revision: 4241
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java
Log:
javadoc for @Any
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java 2009-10-23 18:41:27 UTC (rev 4240)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java 2009-10-23 19:20:15 UTC (rev 4241)
@@ -33,11 +33,31 @@
* <p>The built-in qualifier type.</p>
*
* <p>Every bean has the built-in qualifier
- * {@link javax.enterprise.inject.Any @Any}, even if
- * it does not explicitly declare this qualifier, except
- * for the special {@link javax.enterprise.inject.New @New}
+ * {@link javax.enterprise.inject.Any @Any}, even if it
+ * does not explicitly declare this qualifier, except for the
+ * special {@link javax.enterprise.inject.New @New}
* qualified beans.</p>
*
+ * <p>Every event has the qualifier
+ * {@link javax.enterprise.inject.Any @Any}, even if it
+ * does not explicitly declare this qualifier.</p>
+ *
+ * <p>The {@link javax.enterprise.inject.Any @Any}
+ * qualifier allows an injection point to refer to all
+ * beans or all events of a certain bean type.</p>
+ *
+ * <pre>
+ * @Inject @Any Instance<PaymentProcessor> anyPaymentProcessor;
+ * </pre>
+ *
+ * <pre>
+ * @Inject @Any Event<User> anyUserEvent;
+ * </pre>
+ *
+ * <pre>
+ * @Decorates @Any Logger logger;
+ * </pre>
+ *
* @author Gavin King
* @author David Allen
*/
15 years, 1 month
Weld SVN: r4240 - api/trunk/cdi/src/main/java/javax/enterprise/inject.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-23 14:41:27 -0400 (Fri, 23 Oct 2009)
New Revision: 4240
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java
Log:
javadoc
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java 2009-10-23 17:25:24 UTC (rev 4239)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Any.java 2009-10-23 18:41:27 UTC (rev 4240)
@@ -30,9 +30,14 @@
import javax.inject.Qualifier;
/**
- * A built-in binding type that is implicitly applied to all beans which do not
- * have the {@link New} built-in binding type.
+ * <p>The built-in qualifier type.</p>
*
+ * <p>Every bean has the built-in qualifier
+ * {@link javax.enterprise.inject.Any @Any}, even if
+ * it does not explicitly declare this qualifier, except
+ * for the special {@link javax.enterprise.inject.New @New}
+ * qualified beans.</p>
+ *
* @author Gavin King
* @author David Allen
*/
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java 2009-10-23 17:25:24 UTC (rev 4239)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java 2009-10-23 18:41:27 UTC (rev 4240)
@@ -30,7 +30,7 @@
import javax.inject.Qualifier;
/**
- * <p>The default qualifier.</p>
+ * <p>The default qualifier type.</p>
*
* <p>If a bean does not explicitly declare a qualifier other than
* {@link javax.inject.Named @Named}, the bean has the qualifier
15 years, 1 month
Weld SVN: r4239 - api/trunk/cdi/src/main/java/javax/enterprise/inject.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-23 13:25:24 -0400 (Fri, 23 Oct 2009)
New Revision: 4239
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java
Log:
javadoc
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java 2009-10-23 16:52:04 UTC (rev 4238)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Default.java 2009-10-23 17:25:24 UTC (rev 4239)
@@ -30,9 +30,52 @@
import javax.inject.Qualifier;
/**
- * The default binding type.
+ * <p>The default qualifier.</p>
*
+ * <p>If a bean does not explicitly declare a qualifier other than
+ * {@link javax.inject.Named @Named}, the bean has the qualifier
+ * {@link javax.enterprise.inject.Default @Default}.</p>
+ *
+ * <p>If an injection point declares no qualifier, the injection point
+ * has exactly one qualifier, the default qualifier
+ * {@link javax.enterprise.inject.Default @Default}.</p>
+ *
+ * <p>The following are equivalent:</p>
+ *
+ * <pre>
+ * @ConversationScoped
+ * public class Order {
+ *
+ * private Product product;
+ * private User customer;
+ *
+ * @Inject
+ * public void init(@Selected Product product, User customer) {
+ * this.product = product;
+ * this.customer = customer;
+ * }
+ *
+ * }
+ * </pre>
+ *
+ * <pre>
+ * @Default @ConversationScoped
+ * public class Order {
+ *
+ * private Product product;
+ * private User customer;
+ *
+ * @Inject
+ * public void init(@Selected Product product, @Default User customer) {
+ * this.product = product;
+ * this.customer = customer;
+ * }
+ *
+ * }
+ * </pre>
+ *
* @author Pete Muir
+ * @author Gavin King
*/
@Target( { TYPE, METHOD, PARAMETER, FIELD })
15 years, 1 month
Weld SVN: r4238 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent and 8 other directories.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-10-23 12:52:04 -0400 (Fri, 23 Oct 2009)
New Revision: 4238
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Employee.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/InconsistentSpecializationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Maid.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Manager.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/InjectionPointTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/TestServlet_Broken.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/web.xml
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/injectionpoint/InjectionPointTest.java
Log:
Tests for Chapter 5
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Employee.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Employee.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Employee.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.inheritance.specialization.simple.broken.inconsistent;
+
+class Employee
+{
+
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/InconsistentSpecializationTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/InconsistentSpecializationTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/InconsistentSpecializationTest.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.inheritance.specialization.simple.broken.inconsistent;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentError;
+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.testng.annotations.Test;
+
+@Artifact
+(a)ExpectedDeploymentException(DeploymentError.class)
+@SpecVersion(spec="cdi", version="20091018")
+public class InconsistentSpecializationTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "5.2.3", id = "a")
+ public void testInconsistentSpecialization() {
+ assert false;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Maid.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Maid.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Maid.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.specialization.simple.broken.inconsistent;
+
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+class Maid extends Employee
+{
+
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Manager.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Manager.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/inconsistent/Manager.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.inheritance.specialization.simple.broken.inconsistent;
+
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+class Manager extends Employee
+{
+
+}
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-23 15:33:22 UTC (rev 4237)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionTest.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -58,7 +58,10 @@
}
@Test(groups = "jboss-as-broken")
- @SpecAssertion(section = "5.6", id = "ed")
+ @SpecAssertions({
+ @SpecAssertion(section = "5.6", id = "ed"),
+ @SpecAssertion(section = "5.6.4", id = "ao")
+ })
//JBAS-7046
public void testInjectionOnEJBInterceptor()
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-10-23 15:33:22 UTC (rev 4237)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -166,7 +166,25 @@
assert getBeans(InjectionPoint.class).size() == 1;
assert getBeans(InjectionPoint.class).iterator().next().getScope().equals(Dependent.class);
}
-
+
+ @Test(groups = { "injectionPoint", "ri-broken" })
+ @SpecAssertion(section = "5.6.9", id = "eb")
+ //WELD-227
+ public void testPassivationCapability() throws Exception
+ {
+ InjectionPoint ip1 = getInstanceByType(FieldInjectionPointBean.class).getInjectedBean().getInjectedMetadata();
+ InjectionPoint ip2 = getInstanceByType(MethodInjectionPointBean.class).getInjectedBean().getInjectedMetadata();
+ InjectionPoint ip3 = getInstanceByType(ConstructorInjectionPointBean.class).getInjectedBean().getInjectedMetadata();
+
+ ip1 = (InjectionPoint) deserialize(serialize(ip1));
+ ip2 = (InjectionPoint) deserialize(serialize(ip2));
+ ip3 = (InjectionPoint) deserialize(serialize(ip3));
+
+ assert ip1.getType().equals(BeanWithInjectionPointMetadata.class);
+ assert ip2.getType().equals(BeanWithInjectionPointMetadata.class);
+ assert ip3.getType().equals(BeanWithInjectionPointMetadata.class);
+ }
+
@Test(groups = { "injectionPoint" })
@SpecAssertions({
@SpecAssertion(section = "5.6.9", id = "ea")
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/InjectionPointTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/InjectionPointTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/InjectionPointTest.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -0,0 +1,43 @@
+/*
+ * 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.injectionpoint.broken.not.bean;
+
+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.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+@Artifact
+@SpecVersion(spec="cdi", version="20091018")
+(a)ExpectedDeploymentException(DefinitionError.class)
+@IntegrationTest
+@Resource(destination = WarArtifactDescriptor.WEB_XML_DESTINATION, source = "web.xml")
+public class InjectionPointTest extends AbstractJSR299Test
+{
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section = "5.6.9", id = "ga")
+ //WELD-228
+ public void testDefinitionErrorDetected() {
+ assert false;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/TestServlet_Broken.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/TestServlet_Broken.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/TestServlet_Broken.java 2009-10-23 16:52:04 UTC (rev 4238)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.not.bean;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServlet;
+
+@SuppressWarnings("serial")
+public class TestServlet_Broken extends HttpServlet
+{
+ @SuppressWarnings("unused")
+ @Inject
+ private InjectionPoint ip;
+
+}
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/web.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/web.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/not/bean/web.xml 2009-10-23 16:52:04 UTC (rev 4238)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" 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/web-app_2_5.xsd">
+ <display-name>Dependency Injection Test</display-name>
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.not.bean.TestServlet_Broken</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>JBoss Test Harness Test Runner</servlet-name>
+ <servlet-class>org.jboss.testharness.impl.runner.servlet.ServletTestRunner</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/Test/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>JBoss Test Harness Test Runner</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+</web-app>
15 years, 1 month
Weld SVN: r4237 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer and 3 other directories.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-10-23 11:33:22 -0400 (Fri, 23 Oct 2009)
New Revision: 4237
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Car.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/ClientProxyTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Garage.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/TestServlet.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/clientProxy/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/web.xml
Log:
Test for 5.5 d)
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Car.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Car.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Car.java 2009-10-23 15:33:22 UTC (rev 4237)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.lookup.clientProxy.incontainer;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+class Car implements Serializable
+{
+ private static final long serialVersionUID = -5928715726257481259L;
+ private String make = "unknown";
+
+ public String getMake()
+ {
+ return make;
+ }
+
+ public void setMake(String name)
+ {
+ this.make = name;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/ClientProxyTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/ClientProxyTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/ClientProxyTest.java 2009-10-23 15:33:22 UTC (rev 4237)
@@ -0,0 +1,47 @@
+/*
+ * 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.clientProxy.incontainer;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+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.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+
+@Artifact
+@IntegrationTest(runLocally = true)
+@Resource(destination = WarArtifactDescriptor.WEB_XML_DESTINATION, source = "web.xml")
+@SpecVersion(spec="cdi", version="20091018")
+public class ClientProxyTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "5.5", id = "d")
+ public void testInvocationIsProcessedOnCurrentInstance() throws Exception {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ String response;
+ response = webClient.getPage(getContextPath() + "Test/Garage?make=Honda").getWebResponse().getContentAsString();
+ assert response.contains("Honda");
+ response = webClient.getPage(getContextPath() + "Test/Garage?make=Toyota").getWebResponse().getContentAsString();
+ assert response.contains("Toyota");
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Garage.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Garage.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/Garage.java 2009-10-23 15:33:22 UTC (rev 4237)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.lookup.clientProxy.incontainer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+class Garage
+{
+ @Inject
+ private Car car;
+
+ public String getMakeOfTheParkedCar()
+ {
+ return car.getMake();
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/TestServlet.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/TestServlet.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/TestServlet.java 2009-10-23 15:33:22 UTC (rev 4237)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.lookup.clientProxy.incontainer;
+
+import java.io.IOException;
+
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class TestServlet extends HttpServlet
+{
+ private static final long serialVersionUID = -4722487503814381947L;
+ @Inject
+ private Car car;
+ @Inject
+ private Garage garage;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ if (car.getMake().equals("unknown"))
+ {
+ // set the make of the car
+ car.setMake(req.getParameter("make"));
+ // make sure that the garage contains the current instance
+ resp.getWriter().append(garage.getMakeOfTheParkedCar());
+ resp.setContentType("text/plain");
+ resp.setStatus(200);
+ }
+ else
+ {
+ resp.setStatus(500);
+ }
+ }
+}
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/web.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/web.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/clientProxy/incontainer/web.xml 2009-10-23 15:33:22 UTC (rev 4237)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" 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/web-app_2_5.xsd">
+ <display-name>Dependency Injection Test</display-name>
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.lookup.clientProxy.incontainer.TestServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>JBoss Test Harness Test Runner</servlet-name>
+ <servlet-class>org.jboss.testharness.impl.runner.servlet.ServletTestRunner</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/Test/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>JBoss Test Harness Test Runner</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+</web-app>
15 years, 1 month
Weld SVN: r4236 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-10-23 11:09:45 -0400 (Fri, 23 Oct 2009)
New Revision: 4236
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Car.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Garage.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java
Log:
Test for 5.5 d)
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Car.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Car.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Car.java 2009-10-23 15:09:45 UTC (rev 4236)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.lookup.clientProxy;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+class Car implements Serializable
+{
+ private static final long serialVersionUID = -8183045197385584658L;
+ private String make = "unknown";
+
+ public String getMake()
+ {
+ return make;
+ }
+
+ public void setMake(String name)
+ {
+ this.make = name;
+ }
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java 2009-10-23 14:13:28 UTC (rev 4235)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java 2009-10-23 15:09:45 UTC (rev 4236)
@@ -62,26 +62,44 @@
assert tuna.getState().equals("tuned");
// TODO expand this test
}
- @Test
+ @Test(expectedExceptions = { ContextNotActiveException.class, IllegalStateException.class })
@SpecAssertions({
@SpecAssertion(section="5.5.2", id="ab"),
@SpecAssertion(section = "6.5.4", id="a")
})
- public void testInactiveScope() throws Exception
+ public void testInactiveScope() throws Exception
{
assert getCurrentConfiguration().getContexts().getRequestContext().isActive();
setContextInactive(getCurrentConfiguration().getContexts().getRequestContext());
assert !getCurrentConfiguration().getContexts().getRequestContext().isActive();
- try {
+ try
+ {
getInstanceByType(TunedTuna.class).getState();
- assert false;
- } catch (ContextNotActiveException cnae) {
- } catch (IllegalStateException ise) {
- } catch (Throwable t) {
- assert false;
}
-
- // need to set request scope active again, some other tests will fail otherwise
+ finally
+ {
+ // need to set request scope active again, some other tests will fail otherwise
+ setContextActive(getCurrentConfiguration().getContexts().getRequestContext());
+ }
+ }
+
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section = "5.5", id = "d")
+ //WELD-229
+ public void testInvocationIsProcessedOnCurrentInstance() {
+ // create new car
+ getInstanceByType(Car.class).setMake("Honda");
+ // check that the car is injected
+ Garage garage = getInstanceByType(Garage.class);
+ assert garage.getMakeOfTheParkedCar().equals("Honda");
+ // destroy the request context
+ setContextInactive(getCurrentConfiguration().getContexts().getRequestContext());
setContextActive(getCurrentConfiguration().getContexts().getRequestContext());
+ // check that the old instance is not in the context anymore
+ // a new one should be created
+ assert getInstanceByType(Car.class).getMake().equals("unknown");
+ getInstanceByType(Car.class).setMake("Toyota");
+ // check that the invocation is processed by the current instance of injected bean
+ assert garage.getMakeOfTheParkedCar().equals("Toyota");
}
}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Garage.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Garage.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/Garage.java 2009-10-23 15:09:45 UTC (rev 4236)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.lookup.clientProxy;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+
+
+@ApplicationScoped
+class Garage
+{
+ @Inject
+ private Car car;
+
+ public String getMakeOfTheParkedCar()
+ {
+ return car.getMake();
+ }
+}
15 years, 1 month
Weld SVN: r4235 - api/trunk/cdi/src/main/java/javax/decorator.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-23 10:13:28 -0400 (Fri, 23 Oct 2009)
New Revision: 4235
Modified:
api/trunk/cdi/src/main/java/javax/decorator/Decorates.java
Log:
extra
Modified: api/trunk/cdi/src/main/java/javax/decorator/Decorates.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/decorator/Decorates.java 2009-10-23 06:04:49 UTC (rev 4234)
+++ api/trunk/cdi/src/main/java/javax/decorator/Decorates.java 2009-10-23 14:13:28 UTC (rev 4235)
@@ -50,11 +50,10 @@
* <p>All decorators have a delegate injection point. A delegate
* injection point is an injection point of the bean class. The
* type and qualifiers of the injection point are called the
- * delegate type and delegate qualifiers.</p>
+ * delegate type and delegate qualifiers. The decorator applies to
+ * any bean that is eligible for injection to the delegate injection
+ * point.</p>
*
- * <p>The decorator applies to any bean that is eligible for injection
- * to the delegate injection point.</p>
- *
* <p>A decorator must have exactly one delegate injection point. The
* delegate injection point must be an injected field, initializer
* method parameter or bean constructor method parameter.</p>
@@ -65,8 +64,12 @@
*
* <p>The container injects a delegate object to the delegate injection
* point. The delegate object implements the delegate type and delegates
- * method invocations along the decorator stack.</p>
- *
+ * method invocations along the decorator stack. When the container calls
+ * a decorator during business method interception, the decorator may
+ * invoke any method of the delegate object. If a decorator invokes the
+ * delegate object at any other time, the invoked method throws an
+ * {@link java.lang.IllegalStateException}.</p>
+ *
* <pre>
* @Decorator
* class TimestampLogger implements Logger {
15 years, 1 month
Weld SVN: r4234 - api/trunk/cdi/src/main/java/javax/decorator.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-23 02:04:49 -0400 (Fri, 23 Oct 2009)
New Revision: 4234
Modified:
api/trunk/cdi/src/main/java/javax/decorator/package-info.java
Log:
javadoc the decorator package
Modified: api/trunk/cdi/src/main/java/javax/decorator/package-info.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/decorator/package-info.java 2009-10-23 05:58:36 UTC (rev 4233)
+++ api/trunk/cdi/src/main/java/javax/decorator/package-info.java 2009-10-23 06:04:49 UTC (rev 4234)
@@ -7,6 +7,11 @@
* conversely, unable to implement the cross-cutting concerns
* for which interceptors are optimized.</p>
*
+ * <p>A decorator is a managed bean annotated {@link
+ * javax.decorator.Decorator @Decorator} with a delegate
+ * injection point annotated {@link javax.decorator.Decorates
+ * @Decorates}.</p>
+ *
* <p>By default, a bean deployment archive has no enabled
* decorators. A decorator must be explicitly enabled by listing
* its bean class under the <tt><decorators></tt> element
15 years, 1 month
Weld SVN: r4233 - api/trunk/cdi/src/main/java/javax/decorator.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-23 01:58:36 -0400 (Fri, 23 Oct 2009)
New Revision: 4233
Modified:
api/trunk/cdi/src/main/java/javax/decorator/Decorator.java
api/trunk/cdi/src/main/java/javax/decorator/package-info.java
Log:
javadoc the decorator package
Modified: api/trunk/cdi/src/main/java/javax/decorator/Decorator.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/decorator/Decorator.java 2009-10-23 05:52:26 UTC (rev 4232)
+++ api/trunk/cdi/src/main/java/javax/decorator/Decorator.java 2009-10-23 05:58:36 UTC (rev 4233)
@@ -51,10 +51,10 @@
* for instance passivation and conversational state defined by the
* EJB specification.</p>
*
- * A decorator may be an abstract Java class, and is not required
- * to implement every method of every decorated type.
+ * <p>A decorator may be an abstract class, and is not required to
+ * implement every method of every decorated type.</p>
*
- * The decorator intercepts every method:
+ * <p>A decorator intercepts every method:</p>
* <ul>
* <li>declared by a decorated type of the decorator</li>
* <li>that is implemented by the bean class of the decorator.</li>
Modified: api/trunk/cdi/src/main/java/javax/decorator/package-info.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/decorator/package-info.java 2009-10-23 05:52:26 UTC (rev 4232)
+++ api/trunk/cdi/src/main/java/javax/decorator/package-info.java 2009-10-23 05:58:36 UTC (rev 4233)
@@ -7,6 +7,16 @@
* conversely, unable to implement the cross-cutting concerns
* for which interceptors are optimized.</p>
*
+ * <p>By default, a bean deployment archive has no enabled
+ * decorators. A decorator must be explicitly enabled by listing
+ * its bean class under the <tt><decorators></tt> element
+ * of the <tt>beans.xml</tt> file of the bean deployment archive.
+ * The order of the decorator declarations determines the decorator
+ * ordering. Decorators which occur earlier in the list are called
+ * first.</p>
+ *
+ * <p>Decorators are called after interceptors.</p>
+ *
*/
package javax.decorator;
15 years, 1 month
Weld SVN: r4232 - api/trunk/cdi/src/main/java/javax/decorator.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-23 01:52:26 -0400 (Fri, 23 Oct 2009)
New Revision: 4232
Modified:
api/trunk/cdi/src/main/java/javax/decorator/Decorates.java
api/trunk/cdi/src/main/java/javax/decorator/Decorator.java
api/trunk/cdi/src/main/java/javax/decorator/package-info.java
Log:
javadoc the decorator package
Modified: api/trunk/cdi/src/main/java/javax/decorator/Decorates.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/decorator/Decorates.java 2009-10-22 22:47:10 UTC (rev 4231)
+++ api/trunk/cdi/src/main/java/javax/decorator/Decorates.java 2009-10-23 05:52:26 UTC (rev 4232)
@@ -26,9 +26,62 @@
import java.lang.annotation.Target;
/**
- * Specifies that an injected field, initializer method parameter or bean
- * constructor parameter of a decorator class is the delegate attribute.
+ * <p>Identifies the delegate injection point of a decorator.</p>
*
+ * <pre>
+ * @Decorator
+ * class TimestampLogger implements Logger {
+ * @Decorates @Any Logger logger;
+ * ...
+ * }
+ * </pre>
+ * <pre>
+ * @Decorator
+ * class TimestampLogger implements Logger {
+ * private Logger logger;
+ *
+ * public TimestampLogger(@Decorates @Debug Logger logger) {
+ * this.logger=logger;
+ * }
+ * ...
+ * }
+ * </pre>
+ *
+ * <p>All decorators have a delegate injection point. A delegate
+ * injection point is an injection point of the bean class. The
+ * type and qualifiers of the injection point are called the
+ * delegate type and delegate qualifiers.</p>
+ *
+ * <p>The decorator applies to any bean that is eligible for injection
+ * to the delegate injection point.</p>
+ *
+ * <p>A decorator must have exactly one delegate injection point. The
+ * delegate injection point must be an injected field, initializer
+ * method parameter or bean constructor method parameter.</p>
+ *
+ * <p>The delegate type of a decorator must implement or extend every
+ * decorated type. A decorator is not required to implement the delegate
+ * type.</p>
+ *
+ * <p>The container injects a delegate object to the delegate injection
+ * point. The delegate object implements the delegate type and delegates
+ * method invocations along the decorator stack.</p>
+ *
+ * <pre>
+ * @Decorator
+ * class TimestampLogger implements Logger {
+ * @Decorates @Any Logger logger;
+ *
+ * void log(String message) {
+ * logger.log( timestamp() + ": " + message );
+ * }
+ * ...
+ * }
+ * </pre>
+ *
+ * @see javax.decorator.Decorator @Decorator specifies that a
+ * class is a decorator.
+ *
* @author Gavin King
* @author Pete Muir
*/
Modified: api/trunk/cdi/src/main/java/javax/decorator/Decorator.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/decorator/Decorator.java 2009-10-22 22:47:10 UTC (rev 4231)
+++ api/trunk/cdi/src/main/java/javax/decorator/Decorator.java 2009-10-23 05:52:26 UTC (rev 4232)
@@ -27,8 +27,42 @@
import javax.enterprise.inject.stereotype.Stereotype;
/**
- * Specifies that a class is a decorator.
+ * <p>Specifies that a class is a decorator.</p>
*
+ * <pre>
+ * @Decorator
+ * class TimestampLogger implements Logger { ... }
+ * </pre>
+ *
+ * <p>A decorator implements one or more bean types and
+ * intercepts business method invocations of beans which
+ * implement those bean types. These bean types are called
+ * decorated types.</p>
+ *
+ * <p>A decorator is a managed bean. The set of decorated types
+ * of a decorator includes all interfaces implemented directly or
+ * indirectly by the bean class, except for {@link java.io.Serializable}.
+ * The decorator bean class and its superclasses are not decorated
+ * types of the decorator. The decorator class may be abstract.</p>
+ *
+ * <p>Decorators of a session bean must comply with the bean provider
+ * programming restrictions defined by the EJB specification.
+ * Decorators of a stateful session bean must comply with the rules
+ * for instance passivation and conversational state defined by the
+ * EJB specification.</p>
+ *
+ * A decorator may be an abstract Java class, and is not required
+ * to implement every method of every decorated type.
+ *
+ * The decorator intercepts every method:
+ * <ul>
+ * <li>declared by a decorated type of the decorator</li>
+ * <li>that is implemented by the bean class of the decorator.</li>
+ * </ul>
+ *
+ * @see javax.decorator.Decorates @Decorates identifies the
+ * delegate injection point of a decorator.
+ *
* @author Gavin King
* @author Pete Muir
*/
Modified: api/trunk/cdi/src/main/java/javax/decorator/package-info.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/decorator/package-info.java 2009-10-22 22:47:10 UTC (rev 4231)
+++ api/trunk/cdi/src/main/java/javax/decorator/package-info.java 2009-10-23 05:52:26 UTC (rev 4232)
@@ -1,5 +1,12 @@
+/**
+ * <p>This package contains annotations relating to decorators.</p>
+ *
+ * <p>Decorators are superficially similar to interceptors,
+ * but because they directly implement operations with business
+ * semantics, they are able to implement business logic and,
+ * conversely, unable to implement the cross-cutting concerns
+ * for which interceptors are optimized.</p>
+ *
+ */
package javax.decorator;
-/**
- * The package javax.decorator contains annotations relating to decorators.
- */
15 years, 1 month