[webbeans-commits] Webbeans SVN: r2327 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl and 6 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Apr 7 05:39:36 EDT 2009


Author: vitold
Date: 2009-04-07 05:39:36 -0400 (Tue, 07 Apr 2009)
New Revision: 2327

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/AnotherDeploymentType.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
   tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/namespace
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java
Log:
add tests for 9.2.1

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java	2009-04-07 00:03:19 UTC (rev 2326)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java	2009-04-07 09:39:36 UTC (rev 2327)
@@ -57,4 +57,6 @@
    public static final String PRODUCES = "Produces";
    
    public static final String VALUE = "value";
+   
+   public static final String ARRAY = "Array";
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java	2009-04-07 00:03:19 UTC (rev 2326)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java	2009-04-07 09:39:36 UTC (rev 2327)
@@ -61,6 +61,7 @@
          Document document = createDocument(url);
          if (document != null)
          {
+            parseForArrays(document);
             parseForAnnotationTypes(document);
             parseForBeans(document);
             parseForDeploy(document);
@@ -68,6 +69,32 @@
       }
    }
    
+   private void parseForArrays(Document document)
+   {
+      Element root = document.getRootElement();
+      checkChildrenForArray(root);
+   }
+   
+   private void checkChildrenForArray(Element element)
+   {
+      Iterator<?> childIterator = element.elementIterator();
+      while(childIterator.hasNext())
+      {
+         Element child = (Element)childIterator.next();
+         
+         if(child.getName().equalsIgnoreCase(XmlConstants.ARRAY))
+         {
+            if(child.elements().size() != 1)
+               throw new DefinitionException("<Array> element must have only one child");
+            
+            Element arrayChild = (Element)child.elements().get(0);
+            ParseXmlHelper.loadElementClass(arrayChild, Object.class, environment, packagesMap);
+         }
+         else
+            checkChildrenForArray(child);
+      }
+   }
+   
    private void parseForAnnotationTypes(Document document)
    {
       Element root = document.getRootElement();         

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java	2009-04-07 00:03:19 UTC (rev 2326)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java	2009-04-07 09:39:36 UTC (rev 2327)
@@ -96,6 +96,8 @@
    {
       try
       {
+         if(beanChildElement.getName().equalsIgnoreCase(XmlConstants.ARRAY))
+            return;
          AnnotatedClass<?> beanChildClass = ParseXmlHelper.loadElementClass(beanChildElement, Object.class, environment, packagesMap);
          Class<?> beanChildType = beanChildClass.getRawType();
          boolean isJavaClass = !beanChildType.isEnum() && !beanChildType.isPrimitive() && !beanChildType.isInterface();

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java	2009-04-07 00:03:19 UTC (rev 2326)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java	2009-04-07 09:39:36 UTC (rev 2327)
@@ -17,7 +17,7 @@
 @Artifact
 @Resources({
    @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/namespace"),
-   @Resource(source="schema.xsd", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/namespace")
+   @Resource(source="schema.xsd", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd")
 })
 @Classes({Order.class})
 @BeansXml("beans.xml")

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java	2009-04-07 09:39:36 UTC (rev 2327)
@@ -0,0 +1,35 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.javaee;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.metadata.foo.Order;
+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.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+ at Artifact
+ at Resources({
+   @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/namespace")
+})
+ at Classes({Order.class})
+ at BeansXml("beans.xml")
+//@ExpectedDeploymentException(DefinitionException.class)
+public class JavaEeNamespaceTest extends AbstractJSR299Test
+{
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section="9.2.1", id="a"),
+      @SpecAssertion(section="9.2.1", id="b"),
+      @SpecAssertion(section="9.2.1", id="c"),
+      @SpecAssertion(section="9.2.1", id="d"),
+      @SpecAssertion(section="9.2.1", id="e")
+   })
+   public void testJavaEeNamespace()
+   {
+      assert true;
+   }
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/AnotherDeploymentType.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/AnotherDeploymentType.java	2009-04-07 09:39:36 UTC (rev 2327)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.javaee.foo;
+
+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.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at DeploymentType
+public @interface AnotherDeploymentType
+{
+
+}
\ No newline at end of file

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/foo/Order.java	2009-04-07 09:39:36 UTC (rev 2327)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.javaee.foo;
+
+public class Order
+{   
+   public Integer val;
+   
+   public Order(Integer val)
+   {
+      this.val = val;
+   }
+}

Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml	                        (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml	2009-04-07 09:39:36 UTC (rev 2327)
@@ -0,0 +1,21 @@
+<Beans xmlns="urn:java:ee" 
+		xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.namespace.javaee">
+	<Deploy>
+		<Standard />
+		<Production />
+		<test:AnotherDeploymentType />
+	</Deploy>
+	<test:Order>
+		<RequestScoped />
+		<Integer />
+		<Array>
+			<String />
+		</Array>
+	</test:Order>
+	<Decorators>
+		<test:TestDecorator />	
+	</Decorators>
+	<Interceptors>
+		<test:TestInterceptor />
+	</Interceptors>
+</Beans>
\ No newline at end of file

Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/namespace
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/namespace	                        (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/namespace	2009-04-07 09:39:36 UTC (rev 2327)
@@ -0,0 +1,2 @@
+org.jboss.jsr299.tck.tests.xml.namespace.javaee
+org.jboss.jsr299.tck.tests.xml.namespace.javaee.foo
\ No newline at end of file




More information about the weld-commits mailing list