[jboss-svn-commits] JBoss Common SVN: r2741 - in jbossxb/trunk/src/test: java/org/jboss/test/xb/schemaresolver and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Mar 14 08:39:13 EDT 2008
Author: alex.loubyansky at jboss.com
Date: 2008-03-14 08:39:13 -0400 (Fri, 14 Mar 2008)
New Revision: 2741
Added:
jbossxb/trunk/src/test/java/org/jboss/test/xb/schemaresolver/
jbossxb/trunk/src/test/java/org/jboss/test/xb/schemaresolver/test/
jbossxb/trunk/src/test/java/org/jboss/test/xb/schemaresolver/test/DefaultSchemaResolverUnitTestCase.java
jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefined.xsd
jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefining.xsd
Log:
a testcase for xsd:redefine and StackOverflowError
Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/schemaresolver/test/DefaultSchemaResolverUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/schemaresolver/test/DefaultSchemaResolverUnitTestCase.java (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/schemaresolver/test/DefaultSchemaResolverUnitTestCase.java 2008-03-14 12:39:13 UTC (rev 2741)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.schemaresolver.test;
+
+import java.net.URL;
+
+import org.jboss.test.xml.AbstractJBossXBTest;
+import org.jboss.xb.binding.Util;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+
+
+/**
+ * A DefaultSchemaResolverUnitTestCase.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class DefaultSchemaResolverUnitTestCase
+ extends AbstractJBossXBTest
+{
+ public DefaultSchemaResolverUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testRedefine() throws Exception
+ {
+ enableTrace("org.jboss.xb");
+ /**
+ * it *has to* be in the classpath, not found with findXML()
+ */
+ String redefiningName = getRootName() + "_" + getName() + "_redefining.xsd";
+ URL redefiningURL = Thread.currentThread().getContextClassLoader().getResource(redefiningName);
+ assertNotNull("Expected to find " + redefiningName + " in the classpath", redefiningURL);
+
+ DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+ resolver.addSchemaLocation("urn:jboss:xb:test", "DefaultSchemaResolverUnitTestCase_testRedefine_redefining.xsd");
+ Util.loadSchema(redefiningURL.toExternalForm(), resolver);
+ }
+}
Added: jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefined.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefined.xsd (rev 0)
+++ jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefined.xsd 2008-03-14 12:39:13 UTC (rev 2741)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <xsd:simpleType name="classNameType">
+ <xsd:annotation>
+ <xsd:documentation> The elements that use this type designate the name
+ of a Java class or interface. The name is in the form of a "binary
+ name", as defined in the JLS and as used in Class.forName().
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:whiteSpace value="collapse"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
Added: jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefining.xsd
===================================================================
--- jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefining.xsd (rev 0)
+++ jbossxb/trunk/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefining.xsd 2008-03-14 12:39:13 UTC (rev 2741)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:jboss:xb:test"
+ xmlns="urn:jboss:xb:test"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0"
+>
+
+ <xsd:redefine schemaLocation="DefaultSchemaResolverUnitTestCase_testRedefine_redefined.xsd">
+ <xsd:simpleType name="classNameType">
+ <xsd:restriction base="classNameType">
+ <xsd:maxLength value="40"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:redefine>
+
+</xsd:schema>
More information about the jboss-svn-commits
mailing list