[webbeans-commits] Webbeans SVN: r3466 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype and 4 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Aug 12 08:14:15 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-08-12 08:14:14 -0400 (Wed, 12 Aug 2009)
New Revision: 3466

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/Horse.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestPolicyStereotype.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestStereotype.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedStereotype.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/StereotypeInheritenceTest.java
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/beans.xml
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
   tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
WBRI-318

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java	2009-08-11 20:18:25 UTC (rev 3465)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java	2009-08-12 12:14:14 UTC (rev 3466)
@@ -77,6 +77,8 @@
          {
             beanNameDefaulted = true;
          }
+         // Merge in inherited stereotypes
+         merge(stereotype.getInheritedSterotypes());
       }
    }
 

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java	2009-08-11 20:18:25 UTC (rev 3465)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java	2009-08-12 12:14:14 UTC (rev 3466)
@@ -56,6 +56,8 @@
    private boolean beanNameDefaulted;
    // The interceptor bindings
    private Set<Annotation> interceptorBindings;
+   
+   private Set<Annotation> inheritedSterotypes;
 
    /**
     * Constructor
@@ -69,6 +71,7 @@
       initDefaultScopeType();
       initBeanNameDefaulted();
       initInterceptorBindings();
+      initInheritedStereotypes();
       checkBindings();
    }
 
@@ -91,6 +94,11 @@
    {
       interceptorBindings = getAnnotatedAnnotation().getMetaAnnotations(InterceptorBindingType.class);
    }
+   
+   private void initInheritedStereotypes()
+   {
+      this.inheritedSterotypes = getAnnotatedAnnotation().getMetaAnnotations(Stereotype.class);
+   }
 
    /**
     * Initializes the bean name defaulted
@@ -206,5 +214,10 @@
    {
       return policy;
    }
+   
+   public Set<Annotation> getInheritedSterotypes()
+   {
+      return inheritedSterotypes;
+   }
 
 }

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/Horse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/Horse.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/Horse.java	2009-08-12 12:14:14 UTC (rev 3466)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.definition.stereotype.inheritance;
+
+/**
+ * @author pmuir
+ *
+ */
+ at NamedRequestPolicyStereotype
+public class Horse
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/Horse.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestPolicyStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestPolicyStereotype.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestPolicyStereotype.java	2009-08-12 12:14:14 UTC (rev 3466)
@@ -0,0 +1,24 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.inheritance;
+
+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.enterprise.inject.Policy;
+import javax.enterprise.inject.stereotype.Stereotype;
+
+ at Stereotype
+ at NamedRequestStereotype
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Policy
+ at Inherited
+ at interface NamedRequestPolicyStereotype
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestPolicyStereotype.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestStereotype.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestStereotype.java	2009-08-12 12:14:14 UTC (rev 3466)
@@ -0,0 +1,24 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.inheritance;
+
+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.enterprise.context.RequestScoped;
+import javax.enterprise.inject.stereotype.Stereotype;
+
+ at Stereotype
+ at NamedStereotype
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at RequestScoped
+ at Inherited
+ at interface NamedRequestStereotype
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedRequestStereotype.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedStereotype.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedStereotype.java	2009-08-12 12:14:14 UTC (rev 3466)
@@ -0,0 +1,23 @@
+package org.jboss.jsr299.tck.tests.definition.stereotype.inheritance;
+
+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.enterprise.inject.Named;
+import javax.enterprise.inject.stereotype.Stereotype;
+
+ at Stereotype
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Named
+ at Inherited
+ at interface NamedStereotype
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/NamedStereotype.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/StereotypeInheritenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/StereotypeInheritenceTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/StereotypeInheritenceTest.java	2009-08-12 12:14:14 UTC (rev 3466)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.definition.stereotype.inheritance;
+
+import java.util.Set;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Artifact
+ at BeansXml("beans.xml")
+ at SpecVersion("20090625")
+public class StereotypeInheritenceTest extends AbstractJSR299Test
+{
+   
+   @Test
+   @SpecAssertions( {
+      @SpecAssertion(section = "2.7.1.5", id = "a"), 
+      @SpecAssertion(section = "2.7.1.5", id = "b") 
+   })
+   public void testInheritence()
+   {
+      Set<Bean<Horse>> beans = getBeans(Horse.class);
+      assert beans.size() == 1;
+      Bean<Horse> bean = beans.iterator().next();
+      assert bean.getScopeType().equals(RequestScoped.class);
+      assert bean.isPolicy();
+      assert bean.getName().equals("horse");
+   }
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/StereotypeInheritenceTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/beans.xml	                        (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/beans.xml	2009-08-12 12:14:14 UTC (rev 3466)
@@ -0,0 +1,5 @@
+<beans> 
+   <policies>
+      <class>org.jboss.jsr299.tck.tests.definition.stereotype.inheritance.NamedRequestPolicyStereotype</class>
+   </policies>
+</beans>


Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/definition/stereotype/inheritance/beans.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml	2009-08-11 20:18:25 UTC (rev 3465)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml	2009-08-12 12:14:14 UTC (rev 3466)
@@ -467,22 +467,11 @@
       <text>Stereotype declarations are transitive - a stereotype declared by a second stereotype is inherited by all beans and other stereotypes that declare the second stereotype.</text>
     </assertion>
 
-    <assertion id="c" >
-      <text>Stereotypes declared |@Target(TYPE)| may not be applied to stereotypes declared |@Target({TYPE, METHOD, FIELD})|.</text>
+    <assertion id="c" testable="false">
+      <text>Stereotypes declared |@Target(TYPE)| may not be applied to stereotypes declared |@Target({TYPE, METHOD, FIELD})|, |@Target(METHOD)|, |@Target(FIELD)|, |@Target({METHOD, FIELD})|.</text>
+      <note>No definition of what happens if you do this</note>
     </assertion>
 
-    <assertion id="d">
-      <text>Stereotypes declared |@Target(TYPE)| may not be applied to stereotypes declared |@Target(METHOD)|.</text>
-    </assertion>
-
-    <assertion id="e">
-      <text>Stereotypes declared |@Target(TYPE)| may not be applied to stereotypes declared |@Target(FIELD)|.</text>
-    </assertion>
-
-    <assertion id="f">
-      <text>Stereotypes declared |@Target(TYPE)| may not be applied to stereotypes declared |@Target({METHOD, FIELD})|.</text>
-    </assertion>
-
   </section>
 
   <section id="2.7.2" title="Declaring the stereotypes for a bean">




More information about the weld-commits mailing list