Some fixes to allow generation for the default package.
1.1 --- a/schema2beans/test/unit/src/TestMain.java Tue Sep 03 10:38:25 2002 +0000
1.2 +++ b/schema2beans/test/unit/src/TestMain.java Wed Sep 04 00:07:03 2002 +0000
1.3 @@ -35,6 +35,14 @@
1.4 return suite;
1.5 }
1.6
1.7 + public void testPurchaseOrder() throws IOException, Schema2BeansException, InterruptedException {
1.8 + generalTest("TestPurchaseOrder");
1.9 + }
1.10 +
1.11 + public void testBookXMLSchema() throws IOException, Schema2BeansException, InterruptedException {
1.12 + generalTest("TestBook", true);
1.13 + }
1.14 +
1.15 public void testBook() throws IOException, Schema2BeansException, InterruptedException {
1.16 generalTest("TestBook");
1.17 }
1.18 @@ -84,6 +92,10 @@
1.19 }
1.20
1.21 public void generalTest(String testName) throws IOException, Schema2BeansException, InterruptedException {
1.22 + generalTest(testName, false);
1.23 + }
1.24 +
1.25 + public void generalTest(String testName, boolean xmlSchema) throws IOException, Schema2BeansException, InterruptedException {
1.26 String testOnly = System.getProperty("TestMain.testOnly");
1.27 if (testOnly != null && !testOnly.equals(testName))
1.28 return;
1.29 @@ -96,9 +108,16 @@
1.30 //config.setTraceParse(true);
1.31 //config.setTraceGen(true);
1.32 //config.setThrowErrors(true);
1.33 - InputStream dtdIn = new FileInputStream(new File(dataDir, testName+".dtd"));
1.34 System.out.println("workDir="+workDir.toString());
1.35 - config.setDTDIn(dtdIn);
1.36 + if (xmlSchema) {
1.37 + InputStream dtdIn = new FileInputStream(new File(dataDir, testName+".xsd"));
1.38 + config.setDTDIn(dtdIn);
1.39 + config.setSchemaType(GenBeans.Config.XML_SCHEMA);
1.40 + } else {
1.41 + InputStream dtdIn = new FileInputStream(new File(dataDir, testName+".dtd"));
1.42 + config.setDTDIn(dtdIn);
1.43 + config.setSchemaType(GenBeans.Config.DTD);
1.44 + }
1.45 try {
1.46 InputStream mddIn = new FileInputStream(new File(dataDir, testName+".mdd"));
1.47 System.out.println("Found mdd file");
1.48 @@ -117,6 +136,7 @@
1.49 int result = runCommand(cmd);
1.50 ref("Finished compiling: "+result);
1.51
1.52 + //runCommand("ls -l "+dataDir);
1.53 cmd = "java -classpath "+workDir.toString()+":"+dataDir.toString()+":"+theClassPath+" "+testName+" "+dataDir.toString()+"/";
1.54 result = runCommand(cmd);
1.55 ref("Finished running "+testName+": "+result);
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/schema2beans/test/unit/src/data/TestPurchaseOrder.xsd Wed Sep 04 00:07:03 2002 +0000
2.3 @@ -0,0 +1,69 @@
2.4 +<?xml version="1.0" ?>
2.5 +
2.6 +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2.7 +
2.8 + <xsd:annotation>
2.9 + <xsd:documentation xml:lang="en">
2.10 + Purchase order schema for Example.com.
2.11 + Copyright 2000 Example.com. All rights reserved.
2.12 + </xsd:documentation>
2.13 + </xsd:annotation>
2.14 +
2.15 + <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
2.16 +
2.17 + <xsd:element name="comment" type="xsd:string"/>
2.18 +
2.19 + <xsd:complexType name="PurchaseOrderType">
2.20 + <xsd:sequence>
2.21 + <xsd:element name="shipTo" type="USAddress"/>
2.22 + <xsd:element name="billTo" type="USAddress"/>
2.23 + <xsd:element ref="comment" minOccurs="0"/>
2.24 + <xsd:element name="items" type="Items"/>
2.25 + </xsd:sequence>
2.26 + <xsd:attribute name="orderDate" type="xsd:date"/>
2.27 + </xsd:complexType>
2.28 +
2.29 + <xsd:complexType name="USAddress">
2.30 + <xsd:sequence>
2.31 + <xsd:element name="name" type="xsd:string"/>
2.32 + <xsd:element name="street" type="xsd:string"/>
2.33 + <xsd:element name="city" type="xsd:string"/>
2.34 + <xsd:element name="state" type="xsd:string"/>
2.35 + <xsd:element name="zip" type="xsd:decimal"/>
2.36 + </xsd:sequence>
2.37 + <xsd:attribute name="country" type="xsd:NMTOKEN"
2.38 + fixed="US"/>
2.39 + </xsd:complexType>
2.40 +
2.41 + <xsd:complexType name="Items">
2.42 + <xsd:sequence>
2.43 + <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
2.44 + <xsd:complexType>
2.45 + <xsd:sequence>
2.46 + <xsd:element name="productName" type="xsd:string"/>
2.47 + <xsd:element name="quantity">
2.48 + <xsd:simpleType>
2.49 + <xsd:restriction base="xsd:positiveInteger">
2.50 + <xsd:maxExclusive value="100"/>
2.51 + </xsd:restriction>
2.52 + </xsd:simpleType>
2.53 + </xsd:element>
2.54 + <xsd:element name="USPrice" type="xsd:decimal"/>
2.55 + <xsd:element ref="comment" minOccurs="0"/>
2.56 + <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
2.57 + </xsd:sequence>
2.58 + <xsd:attribute name="partNum" type="SKU" use="required"/>
2.59 + </xsd:complexType>
2.60 + </xsd:element>
2.61 + </xsd:sequence>
2.62 + </xsd:complexType>
2.63 +
2.64 + <!-- Stock Keeping Unit, a code for identifying products -->
2.65 + <xsd:simpleType name="SKU">
2.66 + <xsd:restriction base="xsd:string">
2.67 + <xsd:pattern value="\d{3}-[A-Z]{2}"/>
2.68 + </xsd:restriction>
2.69 + </xsd:simpleType>
2.70 +
2.71 +</xsd:schema>
2.72 +
3.1 --- a/schema2beans/test/unit/src/data/goldenfiles/TestMain/testBook.pass Tue Sep 03 10:38:25 2002 +0000
3.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testBook.pass Wed Sep 04 00:07:03 2002 +0000
3.3 @@ -353,12 +353,12 @@
3.4 out: TestBook check if the root has any choice prop (none found on index prop) -> OK
3.5 out: TestBook test extra prop (at least one) -> OK
3.6 out: TestBook - Getting a set of choice properties:
3.7 -out: TestBook test extra prop weight-lb -> OK
3.8 -out: TestBook test extra prop weight-kg -> OK
3.9 -out: TestBook - Getting a set of choice properties:
3.10 out: TestBook test extra prop size-cm -> OK
3.11 out: TestBook test extra prop size-inches -> OK
3.12 out: TestBook test extra prop size -> OK
3.13 +out: TestBook - Getting a set of choice properties:
3.14 +out: TestBook test extra prop weight-lb -> OK
3.15 +out: TestBook test extra prop weight-kg -> OK
3.16 out: TestBook - Getting the same list 3 times:
3.17 out: TestBook test extra prop size-cm -> OK
3.18 out: TestBook test extra prop size-inches -> OK