[webbeans-commits] Webbeans SVN: r2167 - tck/trunk/impl/src/main/resources.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-23 22:26:39 -0400 (Mon, 23 Mar 2009)
New Revision: 2167
Modified:
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
split assertions
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-24 02:19:20 UTC (rev 2166)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-24 02:26:39 UTC (rev 2167)
@@ -2218,21 +2218,37 @@
<text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, if X is annotated with a _deployment type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a deployment type.</text>
</assertion>
- <assertion id="da">
- <text>For class X which is extended _directly_ by the bean class of a _simple_ bean Y, the scope types and deployment types explicitly declared by and inherited from the class X take precedence over default scopes and deployment types declared by stereotypes.</text>
+ <assertion id="daa">
+ <text>For class X which is extended _directly_ by the bean class of a _simple_ bean Y, the _scope types_ explicitly declared by and inherited from the class X take precedence over default _scopes_ declared by stereotypes.</text>
</assertion>
- <assertion id="db">
- <text>For class X which is extended _directly_ by the bean class of a _session_ bean Y, the scope types and deployment types explicitly declared by and inherited from the class X take precedence over default scopes and deployment types declared by stereotypes.</text>
+ <assertion id="dab">
+ <text>For class X which is extended _directly_ by the bean class of a _simple_ bean Y, the _deployment types_ explicitly declared by and inherited from the class X take precedence over deployment _deployment types_ declared by stereotypes.</text>
+ </assertion>
+
+ <assertion id="dba">
+ <text>For class X which is extended _directly_ by the bean class of a _session_ bean Y, the _scope types_ explicitly declared by and inherited from the class X take precedence over default _scopes_ declared by stereotypes.</text>
</assertion>
- <assertion id="dc">
- <text>For class X which is extended _indirectly_ by the bean class of a _simple_ bean Y, the scope types and deployment types explicitly declared by and inherited from the class X take precedence over default scopes and deployment types declared by stereotypes.</text>
+ <assertion id="dbb">
+ <text>For class X which is extended _directly_ by the bean class of a _session_ bean Y, the _deployment types_ explicitly declared by and inherited from the class X take precedence over default _deployment types_ declared by stereotypes.</text>
+ </assertion>
+
+ <assertion id="dca">
+ <text>For class X which is extended _indirectly_ by the bean class of a _simple_ bean Y, the _scope types_ explicitly declared by and inherited from the class X take precedence over default _scopes_ declared by stereotypes.</text>
</assertion>
+
+ <assertion id="dcb">
+ <text>For class X which is extended _indirectly_ by the bean class of a _simple_ bean Y, the _deployment types_ explicitly declared by and inherited from the class X take precedence over default _deployment_ types declared by stereotypes.</text>
+ </assertion>
- <assertion id="dd">
- <text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, the scope types and deployment types explicitly declared by and inherited from the class X take precedence over default scopes and deployment types declared by stereotypes.</text>
+ <assertion id="dda">
+ <text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, the _scope types_ explicitly declared by and inherited from the class X take precedence over default _scopes_ declared by stereotypes.</text>
</assertion>
+
+ <assertion id="ddb">
+ <text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, the _deployment types_ explicitly declared by and inherited from the class X take precedence over _deployment types_ declared by stereotypes.</text>
+ </assertion>
<assertion id="ea">
<text>For class X which is the bean class of a _simple_ bean Y declared using XML, if X is annotated with a _binding type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not explicitly declare an annotation of type Z using XML.</text>
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2166 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-23 22:19:20 -0400 (Mon, 23 Mar 2009)
New Revision: 2166
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/Dog.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnterpriseDeploymentTypeDefinitionTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/beans.xml
Log:
implemented tests for 4.1.cb, 4.1.cd
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/AnotherDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/AnotherDeploymentType.java 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.definition.deployment.enterprise;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+@Inherited
+@interface AnotherDeploymentType
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollie.java 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.deployment.enterprise;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class BorderCollie extends Dog implements BorderCollieLocal
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/BorderCollieLocal.java 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.deployment.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface BorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/Dog.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/Dog.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/Dog.java 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.definition.deployment.enterprise;
+
+@AnotherDeploymentType
+class Dog
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollie.java 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.deployment.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class EnglishBorderCollie extends BorderCollie implements EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnglishBorderCollieLocal.java 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.deployment.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnterpriseDeploymentTypeDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnterpriseDeploymentTypeDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/EnterpriseDeploymentTypeDefinitionTest.java 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,33 @@
+package org.jboss.jsr299.tck.tests.definition.deployment.enterprise;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@IntegrationTest
+@Artifact
+(a)Packaging(PackagingType.EAR)
+@BeansXml("beans.xml")
+public class EnterpriseDeploymentTypeDefinitionTest extends AbstractJSR299Test
+{
+ @Test(groups = { "deploymentType" })
+ @SpecAssertion(section = "4.1", id = "cb")
+ public void testDeploymentTypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert getCurrentManager().resolveByType(BorderCollieLocal.class).size() == 1;
+ assert getCurrentManager().resolveByType(BorderCollieLocal.class).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test(groups = { "deploymentType" })
+ @SpecAssertion(section = "4.1", id = "cd")
+ public void testDeploymentTypeDeclaredInheritedIsIndirectlyInherited() throws Exception
+ {
+ assert getCurrentManager().resolveByType(EnglishBorderCollieLocal.class).size() == 1;
+ assert getCurrentManager().resolveByType(EnglishBorderCollieLocal.class).iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
+ }
+}
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/deployment/enterprise/beans.xml 2009-03-24 02:19:20 UTC (rev 2166)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.definition.deployment.enterprise">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+</Beans>
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2165 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope: enterprise and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-23 22:08:18 -0400 (Mon, 23 Mar 2009)
New Revision: 2165
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/Dog.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnterpriseScopeDefinitionTest.java
Log:
implemented tests for 4.1.bb, 4.1.bd
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollie.java 2009-03-24 02:08:18 UTC (rev 2165)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.scope.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class BorderCollie extends Dog implements BorderCollieLocal
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/BorderCollieLocal.java 2009-03-24 02:08:18 UTC (rev 2165)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.scope.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface BorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/Dog.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/Dog.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/Dog.java 2009-03-24 02:08:18 UTC (rev 2165)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.scope.enterprise;
+
+import javax.context.RequestScoped;
+
+@RequestScoped
+class Dog
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollie.java 2009-03-24 02:08:18 UTC (rev 2165)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.scope.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class EnglishBorderCollie extends BorderCollie implements EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnglishBorderCollieLocal.java 2009-03-24 02:08:18 UTC (rev 2165)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.scope.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnterpriseScopeDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnterpriseScopeDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/enterprise/EnterpriseScopeDefinitionTest.java 2009-03-24 02:08:18 UTC (rev 2165)
@@ -0,0 +1,28 @@
+package org.jboss.jsr299.tck.tests.definition.scope.enterprise;
+
+import javax.context.RequestScoped;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseScopeDefinitionTest extends AbstractJSR299Test
+{
+ @Test @SpecAssertion(section="4.1", id = "bb")
+ public void testScopeTypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert getCurrentManager().resolveByType(BorderCollieLocal.class).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "4.1", id = "bd")
+ public void testScopeTypeDeclaredInheritedIsIndirectlyInherited()
+ {
+ assert getCurrentManager().resolveByType(EnglishBorderCollieLocal.class).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+}
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2164 - tck/trunk/impl/src/main/resources.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-23 22:07:40 -0400 (Mon, 23 Mar 2009)
New Revision: 2164
Modified:
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
highlighting
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-24 01:56:13 UTC (rev 2163)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-24 02:07:40 UTC (rev 2164)
@@ -2187,35 +2187,35 @@
</assertion>
<assertion id="ba">
- <text>For class X which is extended _directly_ by the bean class of a _simple_ bean Y, if X is annotated with a scope type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a scope type.</text>
+ <text>For class X which is extended _directly_ by the bean class of a _simple_ bean Y, if X is annotated with a _scope type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a scope type.</text>
</assertion>
<assertion id="bb">
- <text>For class X which is extended _directly_ by the bean class of a _session_ bean Y, if X is annotated with a scope type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a scope type.</text>
+ <text>For class X which is extended _directly_ by the bean class of a _session_ bean Y, if X is annotated with a _scope type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a scope type.</text>
</assertion>
<assertion id="bc">
- <text>For class X which is extended _indirectly_ by the bean class of a _simple_ bean Y, if X is annotated with a scope type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a scope type.</text>
+ <text>For class X which is extended _indirectly_ by the bean class of a _simple_ bean Y, if X is annotated with a _scope type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a scope type.</text>
</assertion>
<assertion id="bd">
- <text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, if X is annotated with a scope type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a scope type.</text>
+ <text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, if X is annotated with a _scope type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a scope type.</text>
</assertion>
<assertion id="ca">
- <text>For class X which is extended _directly_ by the bean class of a _simple_ bean Y, if X is annotated with a deployment type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a deployment type.</text>
+ <text>For class X which is extended _directly_ by the bean class of a _simple_ bean Y, if X is annotated with a _deployment type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a deployment type.</text>
</assertion>
<assertion id="cb">
- <text>For class X which is extended _directly_ by the bean class of a _session_ bean Y, if X is annotated with a deployment type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a deployment type.</text>
+ <text>For class X which is extended _directly_ by the bean class of a _session_ bean Y, if X is annotated with a _deployment type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and Y does not declare a deployment type.</text>
</assertion>
<assertion id="cc">
- <text>For class X which is extended _indirectly_ by the bean class of a _simple_ bean Y, if X is annotated with a deployment type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a deployment type.</text>
+ <text>For class X which is extended _indirectly_ by the bean class of a _simple_ bean Y, if X is annotated with a _deployment type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a deployment type.</text>
</assertion>
<assertion id="cd">
- <text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, if X is annotated with a deployment type Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a deployment type.</text>
+ <text>For class X which is extended _indirectly_ by the bean class of a _session_ bean Y, if X is annotated with a _deployment type_ Z then Y inherits the annotation if and only if Z declares the |@Inherited| meta-annotation and neither Y nor any intermediate class that is a subclass of X and a superclass of Y declares a deployment type.</text>
</assertion>
<assertion id="da">
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2163 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype: enterprise and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-23 21:56:13 -0400 (Mon, 23 Mar 2009)
New Revision: 2163
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/Animal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/AnimalStereotype.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnterpriseStereotypeDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/LongHairedDog.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/session/
Log:
consistent naming, implement test for 4.1.ak
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/Animal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/Animal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/Animal.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+interface Animal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/AnimalStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/AnimalStereotype.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/AnimalStereotype.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,23 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.annotation.Stereotype;
+import javax.context.RequestScoped;
+
+(a)Stereotype(requiredTypes=Animal.class)
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@RequestScoped
+@Inherited
+@interface AnimalStereotype
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollie.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class BorderCollie extends LongHairedDog implements BorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/BorderCollieLocal.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+public interface BorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollie.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class EnglishBorderCollie extends BorderCollie implements EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnglishBorderCollieLocal.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnterpriseStereotypeDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnterpriseStereotypeDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/EnterpriseStereotypeDefinitionTest.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,35 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+import javax.context.RequestScoped;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * Spec version: PRD2
+ */
+@IntegrationTest
+@Artifact
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseStereotypeDefinitionTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "4.1", id = "ae")
+ public void testStereotypeDeclaredInheritedIsInherited() throws Exception
+ {
+ assert getCurrentManager().resolveByType(BorderCollieLocal.class).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "4.1", id = "ak")
+ public void testStereotypeDeclaredInheritedIsIndirectlyInherited()
+ {
+ assert getCurrentManager().resolveByType(EnglishBorderCollieLocal.class).iterator().next().getScopeType().equals(RequestScoped.class);
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/LongHairedDog.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/LongHairedDog.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/enterprise/LongHairedDog.java 2009-03-24 01:56:13 UTC (rev 2163)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.enterprise;
+
+@AnimalStereotype
+class LongHairedDog implements Animal
+{
+
+}
\ No newline at end of file
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2162 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding: enterprise and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-23 21:44:49 -0400 (Mon, 23 Mar 2009)
New Revision: 2162
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollie.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollieLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnterpriseBindingDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/Hairy.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/HairyBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/LongHairedDog.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/session/
Log:
consistent naming, implemented 4.1.aj
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollie.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class BorderCollie extends LongHairedDog implements BorderCollieLocal
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/BorderCollieLocal.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface BorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollie.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollie.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollie.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+import javax.ejb.Stateless;
+
+@Stateless
+class EnglishBorderCollie extends BorderCollie implements EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollieLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollieLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnglishBorderCollieLocal.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface EnglishBorderCollieLocal
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnterpriseBindingDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnterpriseBindingDefinitionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/EnterpriseBindingDefinitionTest.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+@Artifact
+@IntegrationTest
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseBindingDefinitionTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "4.1", id = "ad")
+ public void testBindingDeclaredInheritedIsInherited() throws Exception
+ {
+ Set<? extends Annotation> bindings = getCurrentManager().resolveByType(BorderCollieLocal.class, new HairyBinding(false)).iterator().next().getBindings();
+ assert bindings.size() == 1;
+ assert bindings.iterator().next().annotationType().equals(Hairy.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "4.1", id = "aj")
+ public void testBindingDeclaredInheritedIsIndirectlyInherited()
+ {
+ Set<? extends Annotation> bindings = getCurrentManager().resolveByType(EnglishBorderCollieLocal.class, new HairyBinding(false)).iterator().next().getBindings();
+ assert bindings.size() == 1;
+ assert bindings.iterator().next().annotationType().equals(Hairy.class);
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/Hairy.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/Hairy.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/Hairy.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,25 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+@interface Hairy
+{
+ public boolean clipped();
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/HairyBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/HairyBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/HairyBinding.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+import javax.inject.AnnotationLiteral;
+
+public class HairyBinding extends AnnotationLiteral<Hairy> implements Hairy
+{
+ private boolean clipped;
+
+ public HairyBinding(boolean clipped)
+ {
+ this.clipped = clipped;
+ }
+
+ public boolean clipped()
+ {
+ return clipped;
+ }
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/LongHairedDog.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/LongHairedDog.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/enterprise/LongHairedDog.java 2009-03-24 01:44:49 UTC (rev 2162)
@@ -0,0 +1,7 @@
+package org.jboss.jsr299.tck.tests.definition.binding.enterprise;
+
+@Hairy(clipped=false)
+class LongHairedDog
+{
+
+}
\ No newline at end of file
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2161 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection: enterprise and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-23 21:34:51 -0400 (Mon, 23 Mar 2009)
New Revision: 2161
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/DeluxeHenHouse.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/EnterpriseBeanInjectionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Fox.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouse.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouseLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoor.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/session/
Log:
consistent naming
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/DeluxeHenHouse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/DeluxeHenHouse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/DeluxeHenHouse.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+@Stateful
+public class DeluxeHenHouse extends HenHouse implements HenHouseLocal
+{
+ public Fox getFox()
+ {
+ return fox;
+ }
+
+ @Remove
+ public void remove()
+ {
+
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/EnterpriseBeanInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/EnterpriseBeanInjectionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/EnterpriseBeanInjectionTest.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,55 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import javax.inject.manager.Bean;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * Spec version: PRD2
+ */
+@IntegrationTest
+@Artifact
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseBeanInjectionTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "4.2", id = "ab")
+ public void testFieldDeclaredInSessionBeanSuperclassInjected() throws Exception
+ {
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<HenHouseLocal> bean = getCurrentManager().resolveByType(HenHouseLocal.class).iterator().next();
+ HenHouseLocal henHouse = getCurrentManager().getInstance(bean);
+ assert henHouse.getFox() != null;
+ assert henHouse.getFox().getName().equals("gavin");
+ }
+ }.run();
+ }
+
+ @Test
+ @SpecAssertion(section = "4.2", id = "ad")
+ public void testFieldDeclaredInSessionBeanIndirectSuperclassInjected() throws Exception
+ {
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<HenHouseLocal> bean = getCurrentManager().resolveByType(HenHouseLocal.class, new MegaPoorBinding()).iterator().next();
+ HenHouseLocal henHouse = getCurrentManager().getInstance(bean);
+ assert henHouse.getFox() != null;
+ assert henHouse.getFox().getName().equals("gavin");
+ }
+ }.run();
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Fox.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Fox.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/Fox.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import java.io.Serializable;
+
+import javax.context.Dependent;
+
+@Dependent
+public class Fox implements Serializable
+{
+ public String getName()
+ {
+ return "gavin";
+ }
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouse.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import javax.inject.Current;
+
+class HenHouse
+{
+ @Current
+ public Fox fox;
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouseLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouseLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/HenHouseLocal.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface HenHouseLocal
+{
+ Fox getFox();
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoor.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoor.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,24 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+@interface MegaPoor
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorBinding.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import javax.inject.AnnotationLiteral;
+
+class MegaPoorBinding extends AnnotationLiteral<MegaPoor> implements MegaPoor
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+@MegaPoor
+@Stateful
+public class MegaPoorHenHouse extends PoorHenHouse implements HenHouseLocal
+{
+ public Fox getFox()
+ {
+ return fox;
+ }
+
+ @Remove
+ public void remove()
+ {
+
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java 2009-03-24 01:34:51 UTC (rev 2161)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.enterprise;
+
+class PoorHenHouse extends HenHouse
+{
+
+}
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2160 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bootstrap and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-23 20:16:27 -0400 (Mon, 23 Mar 2009)
New Revision: 2160
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlClass.java
ri/trunk/tests/src/test/resources/log4j.xml
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ordering/
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java
Log:
Redo ordering as cascading initializa
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -116,6 +116,13 @@
protected ManagerImpl manager;
protected boolean _serializable;
+
+ private boolean initialized;
+
+ protected boolean isInitialized()
+ {
+ return initialized;
+ }
/**
* Constructor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -20,6 +20,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
+import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -41,6 +42,7 @@
import org.jboss.webbeans.context.CreationalContextImpl;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.DependentStorageRequest;
+import org.jboss.webbeans.introspector.AnnotatedMember;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.metadata.MetaDataCache;
@@ -56,7 +58,7 @@
* @param <T>
* @param <S>
*/
-public abstract class AbstractProducerBean<T, S> extends AbstractBean<T, S>
+public abstract class AbstractProducerBean<T, S extends Member> extends AbstractBean<T, S>
{
// The declaring bean
protected AbstractClassBean<?> declaringBean;
@@ -74,6 +76,8 @@
super(manager);
this.declaringBean = declaringBean;
}
+
+ protected abstract AnnotatedMember<T, S> getAnnotatedItem();
/**
* Gets the deployment types
@@ -177,6 +181,7 @@
@Override
public void initialize(BeanDeployerEnvironment environment)
{
+ declaringBean.initialize(environment);
super.initialize(environment);
checkProducerReturnType();
}
@@ -382,7 +387,7 @@
if (other instanceof AbstractProducerBean)
{
AbstractProducerBean<?, ?> that = (AbstractProducerBean<?, ?>) other;
- return super.equals(other) && this.getDeclaringBean().equals(that.getDeclaringBean());
+ return super.equals(other) && this.getAnnotatedItem().getDeclaringClass().equals(that.getAnnotatedItem().getDeclaringClass());
}
else
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -118,12 +118,15 @@
@Override
public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize(environment);
- initProxyClass();
- initInjectionPoints();
- checkEJBTypeAllowed();
- checkConflictingRoles();
- checkObserverMethods();
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ initProxyClass();
+ initInjectionPoints();
+ checkEJBTypeAllowed();
+ checkConflictingRoles();
+ checkObserverMethods();
+ }
}
protected void initTypes()
@@ -198,17 +201,18 @@
@Override
protected void specialize(BeanDeployerEnvironment environment)
{
- if (!environment.getClassBeanMap().containsKey(getAnnotatedItem().getSuperclass()))
+ if (environment.getClassBean(getAnnotatedItem().getSuperclass()) == null)
{
throw new IllegalStateException(toString() + " does not specialize a bean");
}
- else if (!(environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()) instanceof EnterpriseBean))
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getSuperclass());
+ if (!(specializedBean instanceof EnterpriseBean))
{
- throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()));
+ throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + specializedBean);
}
else
{
- this.specializedBean = (EnterpriseBean<?>) environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass());
+ this.specializedBean = (EnterpriseBean<?>) specializedBean;
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -22,6 +22,7 @@
import javax.context.CreationalContext;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.util.Names;
@@ -65,6 +66,15 @@
initTypes();
initBindings();
}
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ }
+ }
@Override
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -47,17 +47,20 @@
{
// The underlying method
private MethodInjectionPoint<T> method;
-
+
private AnnotatedMethod<?> disposalMethod;
private ProducerMethodBean<?> specializedBean;
-
+
/**
* Creates a producer method Web Bean
*
- * @param method The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
+ * @param method
+ * The underlying method abstraction
+ * @param declaringBean
+ * The declaring bean abstraction
+ * @param manager
+ * the current manager
* @return A producer Web Bean
*/
public static <T> ProducerMethodBean<T> of(AnnotatedMethod<T> method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
@@ -73,7 +76,7 @@
initTypes();
initBindings();
}
-
+
protected T produceInstance(CreationalContext<T> creationalContext)
{
Object receiver = getReceiver(creationalContext);
@@ -86,19 +89,22 @@
return method.invoke(receiver, manager, creationalContext, CreationException.class);
}
}
-
+
/**
* Initializes the bean and its metadata
*/
@Override
public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize(environment);
- checkProducerMethod();
- //initDisposalMethod();
- initInjectionPoints();
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ checkProducerMethod();
+ // initDisposalMethod();
+ initInjectionPoints();
+ }
}
-
+
/**
* Initializes the injection points
*/
@@ -109,7 +115,7 @@
injectionPoints.add(ParameterInjectionPoint.of(this, parameter));
}
}
-
+
/**
* Validates the producer method
*/
@@ -124,7 +130,7 @@
throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
}
}
-
+
/**
* Initializes the remove method
*/
@@ -141,7 +147,7 @@
throw new DefinitionException("Cannot declare multiple disposal methods for this producer method");
}
}
-
+
/**
* Gets the annotated item representing the method
*
@@ -152,7 +158,7 @@
{
return method;
}
-
+
/**
* Returns the default name
*
@@ -163,7 +169,7 @@
{
return method.getPropertyName();
}
-
+
/**
* Returns the disposal method
*
@@ -173,7 +179,7 @@
{
return disposalMethod;
}
-
+
/**
* Gets a string representation
*
@@ -196,7 +202,7 @@
buffer.append("API types " + getTypes() + ", binding types " + getBindings());
return buffer.toString();
}
-
+
@Override
public boolean isSerializable()
{
@@ -227,11 +233,11 @@
protected void specialize(BeanDeployerEnvironment environment)
{
AnnotatedMethod<?> superClassMethod = declaringBean.getAnnotatedItem().getSuperclass().getMethod(getAnnotatedItem().getAnnotatedMethod());
- if (!environment.getMethodBeanMap().containsKey(superClassMethod))
+ if (environment.getProducerMethod(superClassMethod) == null)
{
throw new IllegalStateException(toString() + " does not specialize a bean");
}
- this.specializedBean = environment.getMethodBeanMap().get(superClassMethod);
+ this.specializedBean = environment.getProducerMethod(superClassMethod);
}
-
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -78,4 +78,5 @@
return id;
}
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -286,17 +286,20 @@
@Override
public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize(environment);
- initConstructor();
- checkType();
- initInjectionPoints();
- initPostConstruct();
- initPreDestroy();
- if (getManager().getServices().contains(EjbServices.class))
+ if (!isInitialized())
{
- initEjbInjectionPoints();
- initPersistenceUnitInjectionPoints();
- initResourceInjectionPoints();
+ super.initialize(environment);
+ initConstructor();
+ checkType();
+ initInjectionPoints();
+ initPostConstruct();
+ initPreDestroy();
+ if (getManager().getServices().contains(EjbServices.class))
+ {
+ initEjbInjectionPoints();
+ initPersistenceUnitInjectionPoints();
+ initResourceInjectionPoints();
+ }
}
}
@@ -362,20 +365,22 @@
@Override
protected void specialize(BeanDeployerEnvironment environment)
{
- if (!environment.getClassBeanMap().containsKey(getAnnotatedItem().getSuperclass()))
+ if (environment.getClassBean(getAnnotatedItem().getSuperclass()) == null)
{
throw new IllegalStateException(toString() + " does not specialize a bean");
}
- else if (!(environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()) instanceof SimpleBean))
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getSuperclass());
+ if (!(specializedBean instanceof SimpleBean))
{
- throw new IllegalStateException(toString() + " doesn't have a simple bean as a superclass " + environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()));
+ throw new IllegalStateException(toString() + " doesn't have a simple bean as a superclass " + specializedBean);
}
else
{
- this.specializedBean = (SimpleBean<?>) environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass());
+ this.specializedBean = (SimpleBean<?>) specializedBean;
}
}
+
/**
* Initializes the constructor
*/
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -1,9 +1,9 @@
package org.jboss.webbeans.bootstrap;
import java.lang.annotation.Annotation;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import java.util.TreeSet;
import javax.event.Observes;
import javax.inject.BindingType;
@@ -76,6 +76,12 @@
return this;
}
+ public BeanDeployer addClasses(Collection<AnnotatedClass<?>> classes)
+ {
+ classes.addAll(classes);
+ return this;
+ }
+
public BeanDeployer createBeans()
{
for (AnnotatedClass<?> clazz : classes)
@@ -94,8 +100,7 @@
public BeanDeployer deploy()
{
- Set<RIBean<?>> beans = new TreeSet<RIBean<?>>(new BootstrapOrderingBeanComparator());
- beans.addAll(beanDeployerEnvironment.getBeans());
+ Set<RIBean<?>> beans = beanDeployerEnvironment.getBeans();
for (RIBean<?> bean : beans)
{
bean.initialize(beanDeployerEnvironment);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -37,18 +37,37 @@
this.observers = new HashSet<ObserverImpl<?>>();
}
- public Map<AnnotatedClass<?>, AbstractClassBean<?>> getClassBeanMap()
+ public ProducerMethodBean<?> getProducerMethod(AnnotatedMethod<?> method)
{
- return Collections.unmodifiableMap(classBeanMap);
+ if (!methodBeanMap.containsKey(method))
+ {
+ return null;
+ }
+ else
+ {
+ ProducerMethodBean<?> bean = methodBeanMap.get(method);
+ bean.initialize(this);
+ return bean;
+ }
}
- public Map<AnnotatedMethod<?>, ProducerMethodBean<?>> getMethodBeanMap()
+ public AbstractClassBean<?> getClassBean(AnnotatedClass<?> clazz)
{
- return Collections.unmodifiableMap(methodBeanMap);
+ if (!classBeanMap.containsKey(clazz))
+ {
+ return null;
+ }
+ else
+ {
+ AbstractClassBean<?> bean = classBeanMap.get(clazz);
+ bean.initialize(this);
+ return bean;
+ }
}
public void addBean(RIBean<?> value)
{
+
if (value instanceof AbstractClassBean && !(value instanceof NewBean))
{
AbstractClassBean<?> bean = (AbstractClassBean<?>) value;
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -1,90 +0,0 @@
-package org.jboss.webbeans.bootstrap;
-
-import java.util.Comparator;
-
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.AbstractProducerBean;
-import org.jboss.webbeans.bean.NewBean;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.standard.AbstractStandardBean;
-
-public class BootstrapOrderingBeanComparator implements Comparator<RIBean<?>>
-{
-
- public int compare(RIBean<?> o1, RIBean<?> o2)
- {
- if (o1 instanceof AbstractClassBean && o2 instanceof AbstractProducerBean)
- {
- return -1;
- }
- else if (o1 instanceof AbstractProducerBean && o2 instanceof AbstractClassBean)
- {
- return 1;
- }
-
- if (o1 instanceof AbstractClassBean && o2 instanceof AbstractClassBean)
- {
- AbstractClassBean<?> b1 = (AbstractClassBean<?>) o1;
- AbstractClassBean<?> b2 = (AbstractClassBean<?>) o2;
- if (b1.getSuperclasses().contains(b2.getType().getName()))
- {
- // Place o1 after it's superclass
- return 1;
- }
- else if (b2.getSuperclasses().contains(b1.getType().getName()))
- {
- // Place o1 before it's subclass o2
- return -1;
- }
- else if (!(o1 instanceof NewBean) && o2 instanceof NewBean)
- {
- return -1;
- }
- else if (o1 instanceof NewBean && !(o2 instanceof NewBean))
- {
- return 1;
- }
- }
-
- if (o1 instanceof AbstractProducerBean && o2 instanceof AbstractProducerBean)
- {
- AbstractProducerBean<?, ?> b1 = (AbstractProducerBean<?, ?>) o1;
- AbstractProducerBean<?, ?> b2 = (AbstractProducerBean<?, ?>) o2;
- if (b1.getDeclaringBean().getSuperclasses().contains(b2.getDeclaringBean().getType().getName()))
- {
- return 1;
- }
- else if (b2.getDeclaringBean().getSuperclasses().contains(b1.getDeclaringBean().getType().getName()))
- {
- return -1;
- }
- }
-
- if (o1 instanceof AbstractStandardBean && !(o2 instanceof AbstractStandardBean))
- {
- return -1;
- }
- else if (!(o1 instanceof AbstractStandardBean) && o2 instanceof AbstractStandardBean)
- {
- return 1;
- }
- else if (o1 instanceof AbstractStandardBean && o2 instanceof AbstractStandardBean)
- {
- return o1.getId().compareTo(o2.getId());
- }
-
-// if (o1.getType().getName().startsWith("org.jboss.webbeans") && !o2.getType().getName().startsWith("org.jboss.webbeans"))
-// {
-// return -1;
-// }
-// else if (!o1.getType().getName().startsWith("org.jboss.webbeans") && o2.getType().getName().startsWith("org.jboss.webbeans"))
-// {
-// return 1;
-// }
-
-
-
- return o1.getId().compareTo(o2.getId());
- }
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -18,6 +18,7 @@
package org.jboss.webbeans.bootstrap;
import java.lang.annotation.Annotation;
+import java.util.Collection;
import java.util.List;
import javax.inject.ExecutionException;
@@ -48,6 +49,7 @@
import org.jboss.webbeans.conversation.ServletConversationManager;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.jsf.JSFApiAbstraction;
import org.jboss.webbeans.literal.DeployedLiteral;
import org.jboss.webbeans.literal.InitializedLiteral;
@@ -128,10 +130,11 @@
*
* @param classes The classes to register as Web Beans
*/
- protected void registerBeans(Iterable<Class<?>> classes)
+ protected void registerBeans(Iterable<Class<?>> classes, Collection<AnnotatedClass<?>> xmlClasses)
{
BeanDeployer beanDeployer = new BeanDeployer(manager);
beanDeployer.addClasses(classes);
+ beanDeployer.addClasses(xmlClasses);
beanDeployer.addBean(ManagerBean.of(manager));
beanDeployer.addBean(InjectionPointBean.of(manager));
beanDeployer.addBean(EventBean.of(manager));
@@ -178,7 +181,7 @@
manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
}
log.info("Deployment types: " + manager.getEnabledDeploymentTypes());
- registerBeans(getServices().get(WebBeanDiscovery.class).discoverWebBeanClasses());
+ registerBeans(getServices().get(WebBeanDiscovery.class).discoverWebBeanClasses(), xmlEnvironmentImpl.getClasses());
manager.fireEvent(manager, new InitializedLiteral());
log.info("Web Beans initialized. Validating beans.");
manager.getResolver().resolveInjectionPoints();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -28,4 +28,11 @@
public S getMember();
+ /**
+ * Gets an abstraction of the declaring class
+ *
+ * @return The declaring class
+ */
+ public AnnotatedType<?> getDeclaringClass();
+
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlClass.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlClass.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.xml;
+
+public interface XmlClass
+{
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java 2009-03-23 22:01:57 UTC (rev 2159)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/deploy/BeansXmlParserTest.java 2009-03-24 00:16:27 UTC (rev 2160)
@@ -7,6 +7,7 @@
import javax.inject.Standard;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.testharness.impl.packaging.Resource;
import org.jboss.testharness.impl.packaging.Resources;
import org.jboss.webbeans.mock.MockResourceLoader;
@@ -23,6 +24,7 @@
@Resource(destination="WEB-INF/classes/org/jboss/webbeans/test/unit/xml/deploy/duplicate-deployments-beans.xml", source="/org/jboss/webbeans/test/unit/xml/deploy/duplicate-deployments-beans.xml"),
@Resource(destination="WEB-INF/classes/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml", source="/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml")
})
+@Classes(packages="org.jboss.webbeans.test.unit.xml.beans")
public class BeansXmlParserTest extends AbstractWebBeansTest
{
Added: ri/trunk/tests/src/test/resources/log4j.xml
===================================================================
--- ri/trunk/tests/src/test/resources/log4j.xml (rev 0)
+++ ri/trunk/tests/src/test/resources/log4j.xml 2009-03-24 00:16:27 UTC (rev 2160)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{2}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ############### JBoss ################# -->
+ <category name="org.jboss">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="org.jboss.test">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="com.arjuna">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ############### Hibernate logging ################# -->
+
+ <category name="org.hibernate">
+ <priority value="ERROR"/>
+ </category>
+
+ <!--
+ <category name="org.hibernate.SQL">
+ <priority value="TRACE"/>
+ </category>
+
+ <category name="org.hibernate.type">
+ <priority value="TRACE"/>
+ </category>
+
+ <category name="org.hibernate.loader">
+ <priority value="TRACE"/>
+ </category>
+ <category name="org.hibernate.cache">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <category name="org.jboss.testharness">
+ <priority value="INFO"/>
+ </category>
+
+ <root>
+ <priority value="INFO"/>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: ri/trunk/tests/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2159 - in extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd: model and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-23 18:01:57 -0400 (Mon, 23 Mar 2009)
New Revision: 2159
Added:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Foo.java
Removed:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Tar.java
Modified:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/NamespaceHandler.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/PackageSchemaGenerator.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Bar.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Foo.java
Log:
refactor
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/NamespaceHandler.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/NamespaceHandler.java 2009-03-23 20:09:09 UTC (rev 2158)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/NamespaceHandler.java 2009-03-23 22:01:57 UTC (rev 2159)
@@ -34,22 +34,41 @@
*/
public class NamespaceHandler
{
+ // The packages that belong to urn:java:ee
private static final Set<String> URN_JAVA_EE = new HashSet<String>(Arrays.asList("java.lang", "java.util", "javax.annotation", "javax.inject", "javax.context", "javax.interceptor", "javax.decorator", "javax.event", "javax.ejb", "javax.persistence", "javax.xml.ws", "javax.jms", "javax.sql"));
+ // The package of the schema
private String localPackage;
+ // The namespaces currently in use mapped by package name
private Map<String, Namespace> namespaces = new HashMap<String, Namespace>();
- public Collection<Namespace> getNamespaces()
- {
- return namespaces.values();
- }
-
+ /**
+ * Creates a new namespace handler
+ *
+ * @param localPackage The local package
+ */
public NamespaceHandler(String localPackage)
{
this.localPackage = localPackage;
addNamespace(new Namespace("", localPackage));
}
+
+ /**
+ * Gets the used namespaces
+ *
+ * @return The namespaces
+ */
+ public Collection<Namespace> getNamespaces()
+ {
+ return namespaces.values();
+ }
+ /**
+ * Gets the prefix for a package
+ *
+ * @param packageName The package name
+ * @return The prefix
+ */
public String getPrefix(String packageName)
{
String shortName = getPackageName(packageName);
@@ -63,35 +82,56 @@
}
}
+ /**
+ * Gets the last part of a package name
+ *
+ * @param packageName The package name
+ * @return The part after the last dot
+ */
private String getPackageLastPart(String packageName)
{
int lastDot = packageName.lastIndexOf(".");
return lastDot < 0 ? packageName : packageName.substring(lastDot + 1);
}
+ /**
+ * Gets the package name of a FQCN
+ *
+ * @param FQCN The FQCN
+ * @return The package part
+ */
private String getPackageName(String FQCN)
{
int lastDot = FQCN.lastIndexOf(".");
return lastDot < 0 ? "nopak" : FQCN.substring(0, lastDot);
}
+ /**
+ * Adds a package to the namespace handler
+ *
+ * @param packageName The package
+ */
public void addPackage(String packageName)
{
+ // Already handled, exit early
if (namespaces.containsKey(packageName))
{
return;
}
String prefix = null;
String URI = "java:urn:" + packageName;
+ // The local package, prefix is blank and uri is package name
if (localPackage.equals(packageName))
{
prefix = "";
}
+ // EE stuff, prefix is ee and urn is ee
else if (URN_JAVA_EE.contains(packageName))
{
prefix = "ee";
URI = "java:urn:ee";
}
+ // Another package, get available prefix
else
{
prefix = getAvailablePrefix(packageName);
@@ -99,10 +139,20 @@
namespaces.put(packageName, new Namespace(prefix, URI));
}
+ /**
+ * Gets an available namespace prefix for a package name
+ *
+ * @param packageName The package name to search prefix for
+ * @return An available prefix
+ */
private String getAvailablePrefix(String packageName)
{
int suffix = 1;
boolean found = false;
+ /**
+ * If we search for a prefix for com.acme.foo, we iterate over the namespaces and see
+ * if "foo" is present, if so, we try with foo2 etc until it found to be available
+ */
while (true)
{
String prefix = getPackageLastPart(packageName) + (suffix == 1 ? "" : String.valueOf(suffix));
@@ -126,11 +176,22 @@
}
}
+ /**
+ * Adds a namespace to the map of known namespaces
+ *
+ * @param namespace The namespace to add
+ */
public void addNamespace(Namespace namespace)
{
namespaces.put(getNamespacePackage(namespace), namespace);
}
+ /**
+ * Gets the package from a namespace
+ *
+ * @param namespace The namespace to examine
+ * @return The package name
+ */
private String getNamespacePackage(Namespace namespace)
{
int urnJava = namespace.getURI().indexOf("urn:java:");
@@ -150,4 +211,12 @@
return namespaces.toString();
}
+ public static void main(String[] x) {
+ NamespaceHandler nh = new NamespaceHandler("foo");
+ nh.addPackage("org.jboss.webbeans.xsd.test.test.test");
+ nh.addPackage("org.jboss.webbeans.xsd.test.test.test");
+ nh.addPackage("org.jboss.webbeans.xsd.test.test");
+ nh.addPackage("org.jboss.webbeans.xsd.test.test");
+ }
+
}
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/PackageSchemaGenerator.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/PackageSchemaGenerator.java 2009-03-23 20:09:09 UTC (rev 2158)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/PackageSchemaGenerator.java 2009-03-23 22:01:57 UTC (rev 2159)
@@ -30,6 +30,8 @@
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeKind;
@@ -38,8 +40,10 @@
import org.dom4j.DocumentException;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.xsd.helpers.DataSetter;
import org.jboss.webbeans.xsd.model.ClassModel;
+import org.jboss.webbeans.xsd.model.ConstructorModel;
+import org.jboss.webbeans.xsd.model.FieldModel;
+import org.jboss.webbeans.xsd.model.MethodModel;
/**
* An annotation processor that updates the package-level XSD for the packages
@@ -53,7 +57,7 @@
public class PackageSchemaGenerator extends AbstractProcessor
{
private static LogProvider log = Logging.getLogProvider(PackageSchemaGenerator.class);
-
+
private Map<String, ClassModel> classModelCache;
private Map<String, Schema> schemas;
@@ -97,7 +101,7 @@
}
}
}
- return false;
+ return true;
}
private void addClassToSchema(ClassModel classModel) throws DocumentException
@@ -112,6 +116,11 @@
schema.addClass(classModel);
}
+ private boolean isPublic(Element element)
+ {
+ return element.getModifiers().contains(Modifier.PUBLIC);
+ }
+
/**
* Creates a class model from a class element
*
@@ -135,17 +144,29 @@
// Filter out the fields and populate the model
for (Element field : ElementFilter.fieldsIn(element.getEnclosedElements()))
{
- DataSetter.populateFieldModel(classModel, field);
+ if (!isPublic(field))
+ {
+ continue;
+ }
+ classModel.addField(FieldModel.of(field));
}
// Filter out the methods and populate the model
- for (Element method : ElementFilter.methodsIn(element.getEnclosedElements()))
+ for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements()))
{
- DataSetter.populateMethodModel(classModel, method);
+ if (!isPublic(method))
+ {
+ continue;
+ }
+ classModel.addMethod(MethodModel.of(method));
}
// Filter out the constructors and populate the model
- for (Element constructor : ElementFilter.constructorsIn(element.getEnclosedElements()))
+ for (ExecutableElement constructor : ElementFilter.constructorsIn(element.getEnclosedElements()))
{
- DataSetter.populateConstructorModel(classModel, constructor);
+ if (!isPublic(constructor))
+ {
+ continue;
+ }
+ classModel.addConstructor(ConstructorModel.of(constructor));
}
// Place the new class model in the cache
classModelCache.put(classModel.getName(), classModel);
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java 2009-03-23 20:09:09 UTC (rev 2158)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/FieldModel.java 2009-03-23 22:01:57 UTC (rev 2159)
@@ -17,7 +17,8 @@
package org.jboss.webbeans.xsd.model;
-import org.dom4j.Element;
+import javax.lang.model.element.Element;
+
import org.jboss.webbeans.xsd.NamespaceHandler;
/**
@@ -34,15 +35,15 @@
super(name);
}
- public static FieldModel of(String name)
+ public static FieldModel of(Element element)
{
- return new FieldModel(name);
+ return new FieldModel(element.getSimpleName().toString());
}
@Override
- public Element toXSD(NamespaceHandler namespaceHandler)
+ public org.dom4j.Element toXSD(NamespaceHandler namespaceHandler)
{
- Element field = super.toXSD(namespaceHandler);
+ org.dom4j.Element field = super.toXSD(namespaceHandler);
field.addAttribute("type", "wb:field");
return field;
}
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Bar.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Bar.java 2009-03-23 20:09:09 UTC (rev 2158)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Bar.java 2009-03-23 22:01:57 UTC (rev 2159)
@@ -2,9 +2,8 @@
public class Bar
{
- public int poo;
- public void testy() {
-
+ public org.jboss.webbeans.xsd.test.test.Foo pong(org.jboss.webbeans.xsd.test.test.test.Foo foo)
+ {
+ return null;
}
-
}
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Foo.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Foo.java 2009-03-23 20:09:09 UTC (rev 2158)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/Foo.java 2009-03-23 22:01:57 UTC (rev 2159)
@@ -1,33 +1,15 @@
package org.jboss.webbeans.xsd.test;
-import javax.inject.Current;
-import javax.inject.Initializer;
-import org.jboss.webbeans.xsd.test.test.test.Tar;
-
-@Current
public class Foo extends Bar
{
- @Current
public String foo;
public int poo;
public Bar bar;
public org.jboss.webbeans.xsd.test.test.Foo foo2;
- public org.jboss.webbeans.xsd.test.test.test.Tar tar2;
- public Tar tar;
+ public org.jboss.webbeans.xsd.test.test.test.Foo foo3;
- @Initializer
- public Foo(String foo)
- {
- }
-
- @Current
- public String foo(@Current String foo)
- {
- return foo;
- }
-
- public void testy(org.jboss.webbeans.xsd.test.test.Foo a, org.jboss.webbeans.xsd.test.test.test.Tar b) {
+ public void testy(org.jboss.webbeans.xsd.test.test.Foo a, org.jboss.webbeans.xsd.test.test.test.Foo b) {
}
Added: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Foo.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Foo.java (rev 0)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Foo.java 2009-03-23 22:01:57 UTC (rev 2159)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.xsd.test.test.test;
+
+public class Foo
+{
+
+}
Deleted: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Tar.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Tar.java 2009-03-23 20:09:09 UTC (rev 2158)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/test/test/test/Tar.java 2009-03-23 22:01:57 UTC (rev 2159)
@@ -1,6 +0,0 @@
-package org.jboss.webbeans.xsd.test.test.test;
-
-public class Tar
-{
-
-}
15 years, 7 months
[webbeans-commits] Webbeans SVN: r2158 - in ri/trunk: tests/src/test/java/org/jboss/webbeans/test/unit/context and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-23 16:09:09 -0400 (Mon, 23 Mar 2009)
New Revision: 2158
Added:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplicationScopedTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplictionScopedObject.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/RequestContext.java
Log:
WBRI-195, Thanks to Takeshi Kondo
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java 2009-03-23 19:55:17 UTC (rev 2157)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java 2009-03-23 20:09:09 UTC (rev 2158)
@@ -18,6 +18,7 @@
package org.jboss.webbeans.context;
import java.lang.annotation.Annotation;
+import java.util.concurrent.locks.ReentrantLock;
import javax.context.ContextNotActiveException;
import javax.context.Contextual;
@@ -43,6 +44,8 @@
{
private static LogProvider log = Logging.getLogProvider(AbstractMapContext.class);
+ private static ReentrantLock creationLock = new ReentrantLock();
+
/**
* Constructor
*
@@ -76,12 +79,32 @@
}
else if (creationalContext != null)
{
- instance = contextual.create(creationalContext);
- if (instance != null)
+ boolean needCreationLock = isCreationLockRequired();
+ try
{
- getBeanStore().put(contextual, instance);
+ if(needCreationLock)
+ {
+ creationLock.lock();
+ instance = getBeanStore().get(contextual);
+ if (instance != null)
+ {
+ return instance;
+ }
+ }
+ instance = contextual.create(creationalContext);
+ if (instance != null)
+ {
+ getBeanStore().put(contextual, instance);
+ }
+ return instance;
}
- return instance;
+ finally
+ {
+ if (needCreationLock)
+ {
+ creationLock.unlock();
+ }
+ }
}
else
{
@@ -125,5 +148,11 @@
* @return The bean store
*/
protected abstract BeanStore getBeanStore();
+
+ /**
+ * If Context need to inhibit concurrent instance creation then true, else false.
+ * @return need lock
+ */
+ protected abstract boolean isCreationLockRequired();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java 2009-03-23 19:55:17 UTC (rev 2157)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java 2009-03-23 20:09:09 UTC (rev 2158)
@@ -1,59 +1,64 @@
-/*
- * 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.webbeans.context;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.webbeans.context.api.BeanStore;
-
-/**
- * Abstract base class for representing contexts with thread local bean storage
- *
- * @author Pete Muir
- */
-public abstract class AbstractThreadLocalMapContext extends AbstractMapContext
-{
- private final ThreadLocal<BeanStore> beanStore;
-
- public AbstractThreadLocalMapContext(Class<? extends Annotation> scopeType)
- {
- super(scopeType);
- this.beanStore = new ThreadLocal<BeanStore>();
- }
-
- /**
- * Gets the bean store
- *
- * @returns The bean store
- */
- @Override
- public BeanStore getBeanStore()
- {
- return beanStore.get();
- }
-
- /**
- * Sets the bean store
- *
- * @param beanStore The bean store
- */
- public void setBeanStore(BeanStore beanStore)
- {
- this.beanStore.set(beanStore);
- }
-
+/*
+ * 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.webbeans.context;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.webbeans.context.api.BeanStore;
+
+/**
+ * Abstract base class for representing contexts with thread local bean storage
+ *
+ * @author Pete Muir
+ */
+public abstract class AbstractThreadLocalMapContext extends AbstractMapContext
+{
+ private final ThreadLocal<BeanStore> beanStore;
+
+ public AbstractThreadLocalMapContext(Class<? extends Annotation> scopeType)
+ {
+ super(scopeType);
+ this.beanStore = new ThreadLocal<BeanStore>();
+ }
+
+ /**
+ * Gets the bean store
+ *
+ * @returns The bean store
+ */
+ @Override
+ public BeanStore getBeanStore()
+ {
+ return beanStore.get();
+ }
+
+ /**
+ * Sets the bean store
+ *
+ * @param beanStore The bean store
+ */
+ public void setBeanStore(BeanStore beanStore)
+ {
+ this.beanStore.set(beanStore);
+ }
+
+ protected boolean isCreationLockRequired()
+ {
+ return true;
+ }
+
}
\ No newline at end of file
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ApplicationContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ApplicationContext.java 2009-03-23 19:55:17 UTC (rev 2157)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ApplicationContext.java 2009-03-23 20:09:09 UTC (rev 2158)
@@ -106,4 +106,10 @@
return active + "application context " + beanStoreInfo;
}
+ @Override
+ protected boolean isCreationLockRequired()
+ {
+ return true;
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/RequestContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/RequestContext.java 2009-03-23 19:55:17 UTC (rev 2157)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/context/RequestContext.java 2009-03-23 20:09:09 UTC (rev 2158)
@@ -51,4 +51,10 @@
return active + "request context " + beanStoreInfo;
}
+ @Override
+ protected boolean isCreationLockRequired()
+ {
+ return false;
+ }
+
}
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplicationScopedTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplicationScopedTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplicationScopedTest.java 2009-03-23 20:09:09 UTC (rev 2158)
@@ -0,0 +1,40 @@
+package org.jboss.webbeans.test.unit.context;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+@Artifact
+public class ApplicationScopedTest extends AbstractWebBeansTest
+{
+
+ @Test
+ public void testConcurrentInitilized() throws InterruptedException
+ {
+ final CountDownLatch latch = new CountDownLatch(10);
+ for (int i = 0; i < 10; i++)
+ {
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ manager.getInstanceByType(ApplictionScopedObject.class).increment();
+ }
+ finally
+ {
+ latch.countDown();
+ }
+ }
+ }).start();
+ }
+ latch.await();
+ int value = manager.getInstanceByType(ApplictionScopedObject.class).getValue();
+ System.out.println(value);
+ assert value == 10;
+ }
+
+}
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplictionScopedObject.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplictionScopedObject.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/ApplictionScopedObject.java 2009-03-23 20:09:09 UTC (rev 2158)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.unit.context;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.context.ApplicationScoped;
+
+@ApplicationScoped
+public class ApplictionScopedObject
+{
+ private AtomicInteger counter = new AtomicInteger();
+
+ public void increment()
+ {
+ counter.incrementAndGet();
+ }
+ public int getValue()
+ {
+ return counter.get();
+ }
+}
15 years, 7 months