[jboss-svn-commits] JBoss Common SVN: r3428 - in jbossxb/trunk/src: test/java/org/jboss/test/xb/validator/support and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 5 06:55:47 EDT 2009
Author: alex.loubyansky at jboss.com
Date: 2009-08-05 06:55:46 -0400 (Wed, 05 Aug 2009)
New Revision: 3428
Added:
jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/UnorderedSequenceType.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.java
jbossxb/trunk/src/test/resources/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.xsd
Modified:
jbossxb/trunk/src/main/java/org/jboss/xb/util/DefaultSchemaBindingValidator.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.java
Log:
JBXB-219
Modified: jbossxb/trunk/src/main/java/org/jboss/xb/util/DefaultSchemaBindingValidator.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/util/DefaultSchemaBindingValidator.java 2009-08-05 04:36:38 UTC (rev 3427)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/util/DefaultSchemaBindingValidator.java 2009-08-05 10:55:46 UTC (rev 3428)
@@ -389,7 +389,7 @@
if(xsParticle.getMaxOccursUnbounded())
{
- if(!particleBinding.getMaxOccursUnbounded())
+ if(!particleBinding.getMaxOccursUnbounded() && !(termBinding instanceof UnorderedSequenceBinding))
handleError("XSD particle has maxOccurs unbounded but ParticleBinding of " + particleBinding.getTerm() + " does not.");
}
else if(xsParticle.getMaxOccurs() != particleBinding.getMaxOccurs())
@@ -468,7 +468,7 @@
}
}
- if(!(modelGroupBinding instanceof ChoiceBinding))
+ if(!(modelGroupBinding instanceof ChoiceBinding || modelGroupBinding instanceof UnorderedSequenceBinding))
handleError("XSD model group is choice but ModelGroupBinding is " + modelGroupBinding);
// ordering in the choice is not important
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/UnorderedSequenceType.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/UnorderedSequenceType.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/UnorderedSequenceType.java 2009-08-05 10:55:46 UTC (rev 3428)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.validator.support;
+
+import java.util.Collection;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlConstants;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import org.jboss.xb.annotations.JBossXmlType;
+
+/**
+ * A UnorderedSequenceType.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at JBossXmlSchema(namespace="urn:jboss:xb:test", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="root")
+ at JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)
+public class UnorderedSequenceType
+{
+ private Collection<String> a;
+ private Collection<String> b;
+
+ public Collection<String> getA()
+ {
+ return a;
+ }
+
+ public void setA(Collection<String> a)
+ {
+ this.a = a;
+ }
+
+ public Collection<String> getB()
+ {
+ return b;
+ }
+
+ public void setB(Collection<String> b)
+ {
+ this.b = b;
+ }
+}
Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.java 2009-08-05 04:36:38 UTC (rev 3427)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.java 2009-08-05 10:55:46 UTC (rev 3428)
@@ -22,7 +22,6 @@
package org.jboss.test.xb.validator.test;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import javax.xml.namespace.QName;
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.java 2009-08-05 10:55:46 UTC (rev 3428)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.validator.test;
+
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.test.xb.validator.support.UnorderedSequenceType;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.builder.JBossXBBuilder;
+import org.jboss.xb.util.DefaultSchemaBindingValidator;
+import org.xml.sax.InputSource;
+
+/**
+ * A UnboundedChoiceAsUnorderedSequenceUnitTestCase.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class UnboundedChoiceAsUnorderedSequenceUnitTestCase extends AbstractBuilderTest
+{
+ public UnboundedChoiceAsUnorderedSequenceUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testMain() throws Exception
+ {
+ String xsd = findXML("UnboundedChoiceAsUnorderedSequenceUnitTestCase.xsd");
+ InputSource xsdIs = new InputSource(xsd);
+
+ SchemaBinding schema = JBossXBBuilder.build(UnorderedSequenceType.class);
+
+ DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator();
+ validator.validate(xsdIs, schema);
+ }
+}
Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.xsd (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.xsd 2009-08-05 10:55:46 UTC (rev 3428)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<xsd:schema
+ targetNamespace="urn:jboss:xb:test"
+ xmlns="urn:jboss:xb:test"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="root">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="a" type="xsd:string" maxOccurs="unbounded"/>
+ <xsd:element name="b" type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
More information about the jboss-svn-commits
mailing list