[jboss-svn-commits] JBoss Common SVN: r3540 - 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
Fri Sep 25 06:05:19 EDT 2009


Author: alex.loubyansky at jboss.com
Date: 2009-09-25 06:05:19 -0400 (Fri, 25 Sep 2009)
New Revision: 3540

Added:
   jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/JavaBeanBindingValidationUnitTestCase.java
Modified:
   jbossxb/trunk/src/main/resources/schema/javabean_1_0.xsd
Log:
JBXB-221 the testcase

Modified: jbossxb/trunk/src/main/resources/schema/javabean_1_0.xsd
===================================================================
--- jbossxb/trunk/src/main/resources/schema/javabean_1_0.xsd	2009-09-24 19:24:49 UTC (rev 3539)
+++ jbossxb/trunk/src/main/resources/schema/javabean_1_0.xsd	2009-09-25 10:05:19 UTC (rev 3540)
@@ -71,7 +71,15 @@
          </xsd:documentation>
       </xsd:annotation>
       <xsd:complexContent>
-         <xsd:extension base="valueType"/>
+         <xsd:extension base="valueType">
+            <xsd:sequence>
+            <xsd:any namespace="##other" processContents="strict">
+               <xsd:annotation>
+                  <xsd:documentation>An extension value</xsd:documentation>
+               </xsd:annotation>
+            </xsd:any>
+            </xsd:sequence>
+         </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
 

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/JavaBeanBindingValidationUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/JavaBeanBindingValidationUnitTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/validator/test/JavaBeanBindingValidationUnitTestCase.java	2009-09-25 10:05:19 UTC (rev 3540)
@@ -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.test;
+
+import java.io.InputStream;
+
+import org.jboss.javabean.plugins.jaxb.JavaBean10;
+import org.jboss.javabean.plugins.jaxb.JavaBean20;
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+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 JavaBean10BindingValidationUnitTestCase.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class JavaBeanBindingValidationUnitTestCase extends AbstractBuilderTest
+{
+   public JavaBeanBindingValidationUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testJavaBean10() throws Exception
+   {
+      InputStream xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream("schema/javabean_1_0.xsd");
+      assertNotNull(xsd);      
+      InputSource xsdIs = new InputSource(xsd);
+      SchemaBinding schema = JBossXBBuilder.build(JavaBean10.class);      
+      DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator();
+      validator.validate(xsdIs, schema);
+   }
+
+   public void testJavaBean20() throws Exception
+   {
+      InputStream xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream("schema/javabean_2_0.xsd");
+      assertNotNull(xsd);
+      InputSource xsdIs = new InputSource(xsd);
+      SchemaBinding schema = JBossXBBuilder.build(JavaBean20.class);      
+      DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator();
+      validator.validate(xsdIs, schema);
+   }
+}



More information about the jboss-svn-commits mailing list