[jboss-svn-commits] JBoss Common SVN: r4187 - in jbossxb/trunk/src: test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 19 06:18:45 EDT 2010


Author: alex.loubyansky at jboss.com
Date: 2010-03-19 06:18:45 -0400 (Fri, 19 Mar 2010)
New Revision: 4187

Added:
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/XmlElementsAndXmlAnyElementArray.java
Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/XmlElementsAndXmlAnyElementUnitTestCase.java
Log:
another test and some comments

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java	2010-03-18 13:37:28 UTC (rev 4186)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java	2010-03-19 10:18:45 UTC (rev 4187)
@@ -1569,7 +1569,8 @@
             if(!repeatableChoice)
                particleBinding.setMaxOccursUnbounded(true);
             wildcardHandler = new PropertyWildcardHandler(property, propertyType);
-            // TODO test this!
+            // this is actually currently not kicking in because most probably it's a choice (XmlElements)
+            // and the choice's repeatable handler will be used instead
             wildcard.setRepeatableHandler(new ArrayWrapperRepeatableParticleHandler(wildcardHandler));
             wildcardType = ((ArrayInfo) propertyType).getComponentType();
             if (trace)
@@ -1582,6 +1583,8 @@
             if(currentRepeatableHandlers)
             {
                wildcardHandler = new PropertyWildcardHandler(property, propertyType);
+               // this is actually currently not kicking in because most probably it's a choice (XmlElements)
+               // and the choice's repeatable handler will be used instead
                wildcard.setRepeatableHandler(new CollectionRepeatableParticleHandler(wildcardHandler, (ClassInfo) propertyType, null));
             }
             else

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/XmlElementsAndXmlAnyElementArray.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/XmlElementsAndXmlAnyElementArray.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/XmlElementsAndXmlAnyElementArray.java	2010-03-19 10:18:45 UTC (rev 4187)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder.object.type.xmlanyelement.support;
+
+
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * XmlElementsAndXmlAnyElement.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+// apprently if there is no propOrder the test fails
+//@XmlType(propOrder="list")
+ at XmlRootElement(name="xml-elements-and-xml-any-element")
+public class XmlElementsAndXmlAnyElementArray
+{
+   private Object[] array;
+
+   public Object[] getArray()
+   {
+      return array;
+   }
+
+   @XmlElements
+   ({
+      @XmlElement(name="a", type=Integer.class),
+      @XmlElement(name="b", type=String.class)
+   })
+   @XmlAnyElement
+   public void setArray(Object[] wildcard)
+   {
+      this.array = wildcard;
+   }
+}

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/XmlElementsAndXmlAnyElementUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/XmlElementsAndXmlAnyElementUnitTestCase.java	2010-03-18 13:37:28 UTC (rev 4186)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/XmlElementsAndXmlAnyElementUnitTestCase.java	2010-03-19 10:18:45 UTC (rev 4187)
@@ -27,6 +27,7 @@
 
 import org.jboss.test.xb.builder.AbstractBuilderTest;
 import org.jboss.test.xb.builder.object.type.xmlanyelement.support.XmlElementsAndXmlAnyElement;
+import org.jboss.test.xb.builder.object.type.xmlanyelement.support.XmlElementsAndXmlAnyElementArray;
 
 
 /**
@@ -47,7 +48,7 @@
       super(name);
    }
 
-   public void testUnmarshalling() throws Exception
+   public void testList() throws Exception
    {
       XmlElementsAndXmlAnyElement o = unmarshalObject(XmlElementsAndXmlAnyElement.class);
       List<Object> list = o.getList();
@@ -57,4 +58,15 @@
       assertEquals("22", list.get(1));
       assertTrue(list.get(2) instanceof XmlElementsAndXmlAnyElement);
    }
+
+   public void testArray() throws Exception
+   {
+      XmlElementsAndXmlAnyElementArray o = unmarshalObject(XmlElementsAndXmlAnyElementArray.class);
+      Object[] array = o.getArray();
+      assertNotNull(array);
+      assertEquals(3, array.length);
+      assertEquals(11, array[0]);
+      assertEquals("22", array[1]);
+      assertTrue(array[2] instanceof XmlElementsAndXmlAnyElementArray);
+   }
 }



More information about the jboss-svn-commits mailing list