[jboss-svn-commits] JBoss Common SVN: r3219 - in jbossxb/trunk/src/test/java/org/jboss/test/xb/validator: test and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jun 4 05:30:31 EDT 2009
Author: alex.loubyansky at jboss.com
Date: 2009-06-04 05:30:31 -0400 (Thu, 04 Jun 2009)
New Revision: 3219
Added:
jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/EE2Root.java
Modified:
jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/ValidatorTestRoot.java
jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/ValidatingResolverUnitTestCase.java
Log:
JBXB-203
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/EE2Root.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/EE2Root.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/EE2Root.java 2009-06-04 09:30:31 UTC (rev 3219)
@@ -0,0 +1,47 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A ValidatorTestRoot.
+ *
+ * @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", namespace="urn:jboss:xb:test")
+ at XmlType(propOrder={"e1", "e2"}, name="")
+public class EE2Root extends ValidatorTestRoot
+{
+ @XmlElement(name="e")
+ public String getE1()
+ {
+ return super.getE1();
+ }
+}
Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/ValidatorTestRoot.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/ValidatorTestRoot.java 2009-06-04 09:21:47 UTC (rev 3218)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/support/ValidatorTestRoot.java 2009-06-04 09:30:31 UTC (rev 3219)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.xb.validator.support;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@@ -29,7 +28,7 @@
import org.jboss.xb.annotations.JBossXmlSchema;
/**
- * A ValidatorTestRoot.
+ * A AbstractValidatorTestRoot.
*
* @author <a href="alex at jboss.com">Alexey Loubyansky</a>
* @version $Revision: 1.1 $
@@ -41,25 +40,30 @@
{
private String e1;
private String e2;
-
- @XmlElement(name="e")
+
+ public ValidatorTestRoot()
+ {
+ super();
+ }
+
public String getE1()
{
return e1;
}
-
+
public void setE1(String e1)
{
this.e1 = e1;
}
-
+
public String getE2()
{
return e2;
}
-
+
public void setE2(String e2)
{
this.e2 = e2;
}
-}
+
+}
\ No newline at end of file
Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/ValidatingResolverUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/ValidatingResolverUnitTestCase.java 2009-06-04 09:21:47 UTC (rev 3218)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/ValidatingResolverUnitTestCase.java 2009-06-04 09:30:31 UTC (rev 3219)
@@ -22,6 +22,7 @@
package org.jboss.test.xb.validator.test;
import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.test.xb.validator.support.EE2Root;
import org.jboss.test.xb.validator.support.ValidatorTestRoot;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.resolver.MultiClassSchemaResolver;
@@ -44,14 +45,14 @@
public void testInvalidBinding() throws Exception
{
MultiClassSchemaResolver resolver = new MultiClassSchemaResolver();
- resolver.mapURIToClass("urn:jboss:xb:test", ValidatorTestRoot.class);
+ resolver.mapURIToClass("urn:jboss:xb:test", EE2Root.class);
String xsd = findXML("ValidatingResolverUnitTestCase.xsd");
resolver.mapSchemaLocation("urn:jboss:xb:test", xsd);
resolver.setValidateBinding(true);
try
{
- unmarshal("ValidatingResolverUnitTestCase.xml", ValidatorTestRoot.class, resolver);
+ unmarshal("ValidatingResolverUnitTestCase.xml", EE2Root.class, resolver);
fail("Validation expected to fail");
}
catch(JBossXBException e)
@@ -64,4 +65,17 @@
assertEquals(msg, e.getCause().getMessage());
}
}
+
+ public void testValidBinding() throws Exception
+ {
+ MultiClassSchemaResolver resolver = new MultiClassSchemaResolver();
+ resolver.mapURIToClass("urn:jboss:xb:test", ValidatorTestRoot.class);
+ String xsd = findXML("ValidatingResolverUnitTestCase.xsd");
+ resolver.mapSchemaLocation("urn:jboss:xb:test", xsd);
+ resolver.setValidateBinding(true);
+
+ ValidatorTestRoot root = (ValidatorTestRoot) unmarshal("ValidatingResolverUnitTestCase.xml", ValidatorTestRoot.class, resolver);
+ assertEquals("1", root.getE1());
+ assertEquals("2", root.getE2());
+ }
}
More information about the jboss-svn-commits
mailing list