[jboss-svn-commits] JBoss Common SVN: r2592 - in jbossxb/trunk/src: test/java/org/jboss/ejb/metadata/jboss and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 26 10:57:13 EDT 2007


Author: alex.loubyansky at jboss.com
Date: 2007-09-26 10:57:12 -0400 (Wed, 26 Sep 2007)
New Revision: 2592

Added:
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementPropertiesAndWildcard.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/NotAnnotatedElementWildcard.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcardUnitTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcardUnitTestCase.java
   jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcard.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcard.xml
Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java
   jbossxb/trunk/src/test/java/org/jboss/ejb/metadata/jboss/InvokerProxyBindingMetaData.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementWildcardWithCollectionProperty.java
Log:
JBXB-109 support for more than one property of type DOM Element but only one can be annotated with XmlAnyElement

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java	2007-09-26 13:10:22 UTC (rev 2591)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.java	2007-09-26 14:57:12 UTC (rev 2592)
@@ -791,6 +791,7 @@
       Set<PropertyInfo> properties = beanInfo.getProperties();
       if (properties != null && properties.isEmpty() == false)
       {
+         boolean seenXmlAnyElement = false;
          for (PropertyInfo property : properties)
          {
             push(typeInfo, property.getName());
@@ -815,6 +816,15 @@
             {
                if (trace)
                   log.trace("Seen @XmlAnyElement for type=" + beanInfo.getName() + " property=" + property.getName());
+               if (wildcardProperty != null && seenXmlAnyElement)
+                  throw new RuntimeException("@XmlAnyElement seen on two properties: " + property.getName() + " and " + wildcardProperty.getName());
+               wildcardProperty = property;
+               seenXmlAnyElement = true;
+            }
+            else if (!seenXmlAnyElement && wildcardProperty == null && property.getType().getName().equals(org.w3c.dom.Element.class.getName()))
+            {
+               if (trace)
+                  log.trace("Using type=" + beanInfo.getName() + " property=" + property.getName() + " as the base wildcard");
                if (wildcardProperty != null)
                   throw new RuntimeException("@XmlAnyElement seen on two properties: " + property.getName() + " and " + wildcardProperty.getName());
                wildcardProperty = property;
@@ -1500,27 +1510,34 @@
                               + property.getName() + " handler=" + propertyHandler + " wrapper=" + qName);
                   }
                }
+               // else if it's not a DOM element which is going to be treated as wildcard
                else
                {
-                  XBValueAdapter valueAdapter = null;
-                  XmlJavaTypeAdapter xmlTypeAdapter = property.getUnderlyingAnnotation(XmlJavaTypeAdapter.class);
-                  if (xmlTypeAdapter != null)
+                  // DOM elements are going to be treated as unresolved
+                  // however having the property registered
+                  if(!Element.class.getName().equals(propertyType.getName()))
                   {
-                     valueAdapter = new XBValueAdapter(xmlTypeAdapter.value(), propertyType.getTypeInfoFactory());
-                     localPropertyType = valueAdapter.getAdaptedType();
-                  }
+                     XBValueAdapter valueAdapter = null;
+                     XmlJavaTypeAdapter xmlTypeAdapter = property.getUnderlyingAnnotation(XmlJavaTypeAdapter.class);
+                     if (xmlTypeAdapter != null)
+                     {
+                        valueAdapter = new XBValueAdapter(xmlTypeAdapter.value(), propertyType.getTypeInfoFactory());
+                        localPropertyType = valueAdapter.getAdaptedType();
+                     }
 
-                  TypeBinding elementTypeBinding = resolveTypeBinding(localPropertyType);
-                  ElementBinding elementBinding = createElementBinding(localPropertyType, elementTypeBinding, qName, false);
-                  elementBinding.setNillable(nillable);
-                  elementBinding.setValueAdapter(valueAdapter);
+                     TypeBinding elementTypeBinding = resolveTypeBinding(localPropertyType);
+                     ElementBinding elementBinding = createElementBinding(localPropertyType, elementTypeBinding, qName,
+                           false);
+                     elementBinding.setNillable(nillable);
+                     elementBinding.setValueAdapter(valueAdapter);
 
-                  // Bind it to the model
-                  particle = new ParticleBinding(elementBinding, 1, 1, isCol);
-                  if (required == false)
-                     particle.setMinOccurs(0);
+                     // Bind it to the model
+                     particle = new ParticleBinding(elementBinding, 1, 1, isCol);
+                     if (required == false)
+                        particle.setMinOccurs(0);
 
-                  targetGroup.addParticle(particle);
+                     targetGroup.addParticle(particle);
+                  }
 
                   beanAdapterFactory.addProperty(qName, propertyHandler);
                   if (trace)
@@ -1593,8 +1610,9 @@
          }
 
          XmlAnyElement xmlAnyElement = wildcardProperty.getUnderlyingAnnotation(XmlAnyElement.class);
+         boolean isLax = xmlAnyElement == null ? true : xmlAnyElement.lax();
          WildcardBinding wildcard = new WildcardBinding(schemaBinding);
-         if (xmlAnyElement.lax())
+         if (isLax)
             wildcard.setProcessContents((short) 3); // Lax
          else
             wildcard.setProcessContents((short) 1); // Strict

Modified: jbossxb/trunk/src/test/java/org/jboss/ejb/metadata/jboss/InvokerProxyBindingMetaData.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/ejb/metadata/jboss/InvokerProxyBindingMetaData.java	2007-09-26 13:10:22 UTC (rev 2591)
+++ jbossxb/trunk/src/test/java/org/jboss/ejb/metadata/jboss/InvokerProxyBindingMetaData.java	2007-09-26 14:57:12 UTC (rev 2592)
@@ -24,9 +24,7 @@
 import org.jboss.javaee.metadata.support.NamedMetaDataWithDescriptions;
 import org.w3c.dom.Element;
 
-import javax.xml.bind.annotation.XmlAnyElement;
 import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 /**
@@ -35,7 +33,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
- at XmlType(name="invoker-proxy-bindingType", propOrder={"descriptions", "name", "invokerProxyBindingName", "invokerMBean", "proxyFactory", "wildcard"})
+ at XmlType(name="invoker-proxy-bindingType", propOrder={"descriptions", "name", "invokerProxyBindingName", "invokerMBean", "proxyFactory", "proxyFactoryConfig"})
 public class InvokerProxyBindingMetaData extends NamedMetaDataWithDescriptions
 {
    /** The serialVersionUID */
@@ -123,24 +121,8 @@
       return proxyFactoryConfig;
    }
 
-   @XmlTransient
    public void setProxyFactoryConfig(Element proxyFactoryConfig)
    {
       this.proxyFactoryConfig = proxyFactoryConfig;
    }
-   
-   public Element getWildcard()
-   {
-      return getProxyFactoryConfig();
-   }
-
-   /**
-    * This is a hack to make proxy-factory-config parsed as
-    * unresolved element of a wildcard
-    */
-   @XmlAnyElement(lax=true)
-   public void setWildcard(Element e)
-   {
-      setProxyFactoryConfig(e);
-   }
 }

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementPropertiesAndWildcard.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementPropertiesAndWildcard.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementPropertiesAndWildcard.java	2007-09-26 14:57:12 UTC (rev 2592)
@@ -0,0 +1,72 @@
+/*
+* 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.XmlType;
+
+import org.w3c.dom.Element;
+
+/**
+ * ElementWildcard.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlType(propOrder={"e1", "e2", "other"})
+public class ElementPropertiesAndWildcard
+{
+   private Element e1;
+   private Element e2;
+   private Element other;
+
+   public Element getE1()
+   {
+      return e1;
+   }
+   
+   public void setE1(Element e1)
+   {
+      this.e1 = e1;
+   }
+   
+   public Element getE2()
+   {
+      return e2;
+   }
+   
+   public void setE2(Element e2)
+   {
+      this.e2 = e2;
+   }
+   
+   public Element getOther()
+   {
+      return other;
+   }
+
+   @XmlAnyElement(lax=true)
+   public void setOther(Element other)
+   {
+      this.other = other;
+   }
+}

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementWildcardWithCollectionProperty.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementWildcardWithCollectionProperty.java	2007-09-26 13:10:22 UTC (rev 2591)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementWildcardWithCollectionProperty.java	2007-09-26 14:57:12 UTC (rev 2592)
@@ -25,6 +25,7 @@
 
 import javax.xml.bind.annotation.XmlAnyElement;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
 
 import org.w3c.dom.Element;
 
@@ -34,6 +35,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
+ at XmlType(propOrder={"properties", "wildcard"})
 public class ElementWildcardWithCollectionProperty
 {
    private Element wildcard;

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/NotAnnotatedElementWildcard.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/NotAnnotatedElementWildcard.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/NotAnnotatedElementWildcard.java	2007-09-26 14:57:12 UTC (rev 2592)
@@ -0,0 +1,46 @@
+/*
+* 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 org.w3c.dom.Element;
+
+/**
+ * ElementWildcard.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class NotAnnotatedElementWildcard
+{
+   private Element element;
+
+   public Element getElement()
+   {
+      return element;
+   }
+
+   public void setElement(Element element)
+   {
+      this.element = element;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcardUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcardUnitTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcardUnitTestCase.java	2007-09-26 14:57:12 UTC (rev 2592)
@@ -0,0 +1,122 @@
+/*
+* 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.test;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+import junit.framework.Test;
+
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ElementPropertiesAndWildcard;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding;
+import org.jboss.xb.builder.JBossXBBuilder;
+import org.jboss.xb.builder.runtime.DOMHandler;
+import org.jboss.xb.builder.runtime.PropertyWildcardHandler;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * ElementWildcardUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ElementPropertiesAndWildcardUnitTestCase extends AbstractBuilderTest
+{
+   public static Test suite()
+   {
+      return suite(ElementPropertiesAndWildcardUnitTestCase.class);
+   }
+   
+   public ElementPropertiesAndWildcardUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testUnmarshalWildcard() throws Exception
+   {
+      ElementPropertiesAndWildcard result = unmarshalObject(ElementPropertiesAndWildcard.class);
+      
+      Element element = result.getE1();
+      assertNotNull(element);
+      assertEquals("e1", element.getNodeName());
+      NodeList childNodes = element.getChildNodes();
+      assertNotNull(childNodes);
+      assertEquals(1, childNodes.getLength());
+      element = (Element) childNodes.item(0);
+      assertEquals("e1-child", element.getNodeName());
+
+      element = result.getE2();
+      assertNotNull(element);
+      assertEquals("e2", element.getNodeName());
+      childNodes = element.getChildNodes();
+      assertNotNull(childNodes);
+      assertEquals(1, childNodes.getLength());
+      element = (Element) childNodes.item(0);
+      assertEquals("e2-child", element.getNodeName());
+      
+      element = result.getOther();
+      assertNotNull(element);
+      assertEquals("e3", element.getNodeName());
+      childNodes = element.getChildNodes();
+      assertNotNull(childNodes);
+      assertEquals(1, childNodes.getLength());
+      element = (Element) childNodes.item(0);
+      assertEquals("e3-child", element.getNodeName());
+   }
+
+   public void testWildcardBinding() throws Exception
+   {
+      SchemaBinding schemaBinding = JBossXBBuilder.build(ElementPropertiesAndWildcard.class);
+      assertNotNull(schemaBinding);
+      
+      QName qName = new QName(XMLConstants.NULL_NS_URI, "element-properties-and-wildcard");
+      ElementBinding element = schemaBinding.getElement(qName);
+      assertNotNull(element);
+      TypeBinding type = element.getType();
+      assertNotNull(type);
+      ParticleBinding particle = type.getParticle();
+      assertNotNull(particle);
+      TermBinding term = particle.getTerm();
+      assertNotNull(term);
+      assertTrue(term instanceof SequenceBinding);
+      term = assertSingleSequence(term);
+      assertTrue(term instanceof WildcardBinding);
+      WildcardBinding wildcardBinding = type.getWildcard();
+      assertNotNull(wildcardBinding);
+      assertTrue(term == wildcardBinding);
+      assertTrue(wildcardBinding.isProcessContentsLax());
+      assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler());
+      assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler());
+      ParticleHandler particleHandler = wildcardBinding.getWildcardHandler();
+      assertNotNull(particleHandler);
+      assertTrue(particleHandler instanceof PropertyWildcardHandler);
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcardUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcardUnitTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcardUnitTestCase.java	2007-09-26 14:57:12 UTC (rev 2592)
@@ -0,0 +1,103 @@
+/*
+* 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.test;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+import junit.framework.Test;
+
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.test.xb.builder.object.type.xmlanyelement.support.NotAnnotatedElementWildcard;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding;
+import org.jboss.xb.builder.JBossXBBuilder;
+import org.jboss.xb.builder.runtime.DOMHandler;
+import org.jboss.xb.builder.runtime.PropertyWildcardHandler;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * ElementWildcardUnitTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class NotAnnotatedElementWildcardUnitTestCase extends AbstractBuilderTest
+{
+   public static Test suite()
+   {
+      return suite(NotAnnotatedElementWildcardUnitTestCase.class);
+   }
+   
+   public NotAnnotatedElementWildcardUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testUnmarshalWildcard() throws Exception
+   {
+      NotAnnotatedElementWildcard result = unmarshalObject(NotAnnotatedElementWildcard.class);
+      Element element = result.getElement();
+      assertNotNull(element);
+      assertEquals("element", element.getNodeName());
+      NodeList childNodes = element.getChildNodes();
+      assertNotNull(childNodes);
+      assertEquals(1, childNodes.getLength());
+      element = (Element) childNodes.item(0);
+      assertEquals("test-child-element", element.getNodeName());
+   }
+
+   public void testWildcardBinding() throws Exception
+   {
+      SchemaBinding schemaBinding = JBossXBBuilder.build(NotAnnotatedElementWildcard.class);
+      assertNotNull(schemaBinding);
+      
+      QName qName = new QName(XMLConstants.NULL_NS_URI, "not-annotated-element-wildcard");
+      ElementBinding element = schemaBinding.getElement(qName);
+      assertNotNull(element);
+      TypeBinding type = element.getType();
+      assertNotNull(type);
+      ParticleBinding particle = type.getParticle();
+      assertNotNull(particle);
+      TermBinding term = particle.getTerm();
+      assertNotNull(term);
+      assertTrue(term instanceof SequenceBinding);
+      term = assertSingleSequence(term);
+      assertTrue(term instanceof WildcardBinding);
+      WildcardBinding wildcardBinding = type.getWildcard();
+      assertNotNull(wildcardBinding);
+      assertTrue(term == wildcardBinding);
+      assertTrue(wildcardBinding.isProcessContentsLax());
+      assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler());
+      assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler());
+      ParticleHandler particleHandler = wildcardBinding.getWildcardHandler();
+      assertNotNull(particleHandler);
+      assertTrue(particleHandler instanceof PropertyWildcardHandler);
+   }
+}

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcard.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcard.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcard.xml	2007-09-26 14:57:12 UTC (rev 2592)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<element-properties-and-wildcard>
+   <e1><e1-child/></e1>
+   <e2><e2-child/></e2>
+   <e3><e3-child/></e3>
+</element-properties-and-wildcard>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcard.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcard.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcard.xml	2007-09-26 14:57:12 UTC (rev 2592)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<not-annotated-element-wildcard>
+   <element>
+      <test-child-element/>
+   </element>
+</not-annotated-element-wildcard>




More information about the jboss-svn-commits mailing list