You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ce...@apache.org on 2005/09/21 05:41:11 UTC
svn commit: r290611 - in /xmlbeans/trunk/test:
cases/xbean/compile/scomp/schemacompiler/ src/compile/scomp/detailed/
Author: cezar
Date: Tue Sep 20 20:41:08 2005
New Revision: 290611
URL: http://svn.apache.org/viewcvs?rev=290611&view=rev
Log:
Contributed by Wing Yew Poon. Adding tests for enum redefine fix
Added:
xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1.xsd_
xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1_redefine.xsd_
xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2.xsd_
xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2_redefine.xsd_
xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3.xsd_
xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3_redefine.xsd_
Modified:
xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java
Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1.xsd_
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1.xsd_?rev=290611&view=auto
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1.xsd_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1.xsd_ Tue Sep 20 20:41:08 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:simpleType name="orderTypeCodedType">
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="newConnect"/>
+ <xs:enumeration value="changeService"/>
+ <xs:enumeration value="changeOfService"/>
+ <xs:enumeration value="disconnectService"/>
+ <xs:enumeration value="moveService"/>
+ <xs:enumeration value="error"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+</xs:schema>
Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1_redefine.xsd_
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1_redefine.xsd_?rev=290611&view=auto
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1_redefine.xsd_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum1_redefine.xsd_ Tue Sep 20 20:41:08 2005
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.example.com/IPO"
+ xmlns:ipo="http://www.example.com/IPO"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:redefine schemaLocation="enum1.xsd_">
+
+ <xs:simpleType name="orderTypeCodedType">
+ <xs:restriction base="orderTypeCodedType">
+ <xs:enumeration value="newConnect"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ </xs:redefine>
+
+</xs:schema>
Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2.xsd_
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2.xsd_?rev=290611&view=auto
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2.xsd_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2.xsd_ Tue Sep 20 20:41:08 2005
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:simpleType name="orderTypeCodedType">
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="changeService"/>
+ <xs:enumeration value="changeOfService"/>
+ <xs:enumeration value="disconnectService"/>
+ <xs:enumeration value="moveService"/>
+ <xs:enumeration value="newConnect"/>
+ <xs:enumeration value="error"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="miscServicesType">
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="dueDate"/>
+ <xs:enumeration value="orderQuery"/>
+ <xs:enumeration value="orderModify"/>
+ <xs:enumeration value="tnAssignment"/>
+ <xs:enumeration value="saQuery"/>
+ <xs:enumeration value="creditScreenReq"/>
+ <xs:enumeration value="creditReplyReq"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="requestTypeType">
+ <xs:choice>
+ <xs:element name="orderTypeCoded" type="orderTypeCodedType" minOccurs="0"/>
+ <xs:element name="miscServices" type="miscServicesType" minOccurs="0"/>
+ <xs:element name="productVldtn" type="xs:string" minOccurs="0"/>
+ <xs:element name="custProfileQuery" minOccurs="0"/>
+ <xs:element name="banClosure" minOccurs="0"/>
+ <xs:element name="qualification" minOccurs="0"/>
+ <xs:element name="dataOrderList" minOccurs="0"/>
+ <xs:element name="serviceAddressQuery" minOccurs="0"/>
+ </xs:choice>
+ </xs:complexType>
+</xs:schema>
Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2_redefine.xsd_
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2_redefine.xsd_?rev=290611&view=auto
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2_redefine.xsd_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum2_redefine.xsd_ Tue Sep 20 20:41:08 2005
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:redefine schemaLocation="enum2.xsd_">
+ <xs:simpleType name="orderTypeCodedType">
+ <xs:restriction base="orderTypeCodedType">
+ <xs:enumeration value="newConnect"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="requestTypeType">
+ <xs:complexContent>
+ <xs:restriction base="requestTypeType">
+ <xs:sequence>
+ <xs:element name="orderTypeCoded" type="orderTypeCodedType"/>
+ </xs:sequence>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:redefine>
+</xs:schema>
Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3.xsd_
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3.xsd_?rev=290611&view=auto
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3.xsd_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3.xsd_ Tue Sep 20 20:41:08 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:simpleType name="orderTypeCodedTypeNew">
+ <xs:restriction base="orderTypeCodedType">
+ <xs:enumeration value="newConnect"/>
+ <xs:enumeration value="changeService"/>
+ <xs:enumeration value="changeOfService"/>
+ <xs:enumeration value="disconnectService"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+</xs:schema>
Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3_redefine.xsd_
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3_redefine.xsd_?rev=290611&view=auto
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3_redefine.xsd_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/enum3_redefine.xsd_ Tue Sep 20 20:41:08 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:redefine schemaLocation="enum3.xsd_">
+
+ <xs:simpleType name="orderTypeCodedTypeNew">
+ <xs:restriction base="orderTypeCodedTypeNew">
+ <xs:enumeration value="newConnect"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ </xs:redefine>
+
+</xs:schema>
Modified: xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java?rev=290611&r1=290610&r2=290611&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java (original)
+++ xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java Tue Sep 20 20:41:08 2005
@@ -15,14 +15,12 @@
package compile.scomp.detailed;
import junit.framework.TestCase;
-import junit.framework.Assert;
import java.util.List;
import java.util.ArrayList;
import java.io.File;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
-import misc.common.JiraTestBase;
import common.Common;
/**
@@ -35,36 +33,76 @@
public class SchemaCompilerTests extends Common
{
public static String scompTestFilesRoot = XBEAN_CASE_ROOT + P + "compile" + P + "scomp" + P + "schemacompiler" + P;
- public static String schemaCompOutputDirPath = OUTPUTROOT+ P + "compile" + P + "scomp" + P;
+ public static String schemaCompOutputDirPath = OUTPUTROOT + P + "compile" + P + "scomp" + P;
public SchemaCompilerTests(String name){
super(name);
}
- public void testUnionRedefine()
+ private void _testCompile(File[] xsdFiles,
+ String outputDirName,
+ String testName)
{
List errors = new ArrayList();
-
SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
- params.setXsdFiles(new File[]{new File(scompTestFilesRoot + "union_initial.xsd"), new File(scompTestFilesRoot + "union_redefine.xsd")});
-
+ params.setXsdFiles(xsdFiles);
params.setErrorListener(errors);
- params.setSrcDir(new File(schemaCompOutputDirPath + "unionred" + P + "src" + P));
- params.setClassesDir(new File(schemaCompOutputDirPath + "unionred" + P +"classes" + P));
-
- // throws NPE
- try {
- SchemaCompiler.compile(params);
- } catch (NullPointerException npe) {
- npe.printStackTrace();
- fail("NPE when executing scomp");
+ params.setSrcDir(new File(schemaCompOutputDirPath + outputDirName + P + "src"));
+ params.setClassesDir(new File(schemaCompOutputDirPath + outputDirName + P + "classes"));
+ SchemaCompiler.compile(params);
+ if (printOptionErrMsgs(errors))
+ {
+ fail(testName + "(): failure when executing scomp");
}
+ }
- if (JiraTestBase.printOptionErrMsgs(errors)) {
- Assert.fail("testUnionRedefine() : failures when executing scomp");
- }
+ public void testUnionRedefine()
+ {
+ File[] xsdFiles =
+ new File[] { new File(scompTestFilesRoot + "union_initial.xsd"),
+ new File(scompTestFilesRoot + "union_redefine.xsd") };
+ String outputDirName = "unionred";
+ String testname = "testUnionRedefine";
+ _testCompile(xsdFiles, outputDirName, testname);
+ }
+ /** This tests a bug where compilation of a schema redefining a type
+ involving an enumeration fails.
+ */
+ public void testEnumerationRedefine1()
+ {
+ File[] xsdFiles =
+ new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
+ new File(scompTestFilesRoot + "enum1_redefine.xsd_") };
+ String outputDirName = "enumRedef1";
+ String testname = "testEnumerationRedefine1";
+ _testCompile(xsdFiles, outputDirName, testname);
}
+ /** This tests a bug where compilation of a schema redefining a type
+ involving an enumeration fails.
+ */
+ public void testEnumerationRedefine2()
+ {
+ File[] xsdFiles =
+ new File[] { new File(scompTestFilesRoot + "enum2.xsd_"),
+ new File(scompTestFilesRoot + "enum2_redefine.xsd_") };
+ String outputDirName = "enumRedef2";
+ String testname = "testEnumerationRedefine2";
+ _testCompile(xsdFiles, outputDirName, testname);
+ }
+ /** This tests a bug where compilation of a schema redefining a type
+ involving an enumeration fails.
+ */
+ public void testEnumerationRedefine3()
+ {
+ File[] xsdFiles =
+ new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
+ new File(scompTestFilesRoot + "enum3.xsd_"),
+ new File(scompTestFilesRoot + "enum3_redefine.xsd_") };
+ String outputDirName = "enumRedef3";
+ String testname = "testEnumerationRedefine3";
+ _testCompile(xsdFiles, outputDirName, testname);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org