Fix a bug with groupInstance, and one around groupInstance and choice. So, "(a|b|c)*" should work a bit better. BLD200304090100
authorcliffwd@netbeans.org
Tue, 08 Apr 2003 21:54:47 +0000
changeset 1271304cab71b21d
parent 1270 5d8fad0a2f16
child 1272 5b40eb915df3
Fix a bug with groupInstance, and one around groupInstance and choice. So, "(a|b|c)*" should work a bit better.
schema2beans/test/unit/src/TestMain.java
schema2beans/test/unit/src/data/TestGroupUnbounded.java
schema2beans/test/unit/src/data/TestGroupUnbounded.xml
schema2beans/test/unit/src/data/TestGroupUnbounded.xsd
schema2beans/test/unit/src/data/goldenfiles/TestMain/testGroupUnbounded.pass
     1.1 --- a/schema2beans/test/unit/src/TestMain.java	Tue Apr 08 20:10:57 2003 +0000
     1.2 +++ b/schema2beans/test/unit/src/TestMain.java	Tue Apr 08 21:54:47 2003 +0000
     1.3 @@ -164,6 +164,14 @@
     1.4          generalTest("TestOr", false, config);
     1.5      }
     1.6  
     1.7 +    public void testGroupUnbounded() throws IOException, Schema2BeansException, InterruptedException {
     1.8 +        GenBeans.Config config = new GenBeans.Config();
     1.9 +        config.setOutputType(GenBeans.Config.OUTPUT_JAVABEANS);
    1.10 +        config.setAttributesAsProperties(true);
    1.11 +        config.setGenerateValidate(true);
    1.12 +        generalTest("TestGroupUnbounded", true, config);
    1.13 +    }
    1.14 +
    1.15      public void testApplication1_4() throws IOException, Schema2BeansException, InterruptedException {
    1.16          generalTest("TestApplication1_4", true, true, true);
    1.17      }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/schema2beans/test/unit/src/data/TestGroupUnbounded.java	Tue Apr 08 21:54:47 2003 +0000
     2.3 @@ -0,0 +1,48 @@
     2.4 +/*
     2.5 + *                 Sun Public License Notice
     2.6 + * 
     2.7 + * The contents of this file are subject to the Sun Public License
     2.8 + * Version 1.0 (the "License"). You may not use this file except in
     2.9 + * compliance with the License. A copy of the License is available at
    2.10 + * http://www.sun.com/
    2.11 + * 
    2.12 + * The Original Code is NetBeans. The Initial Developer of the original
    2.13 + * Code is Sun Microsystems, Inc. PGroupUnboundedtions Copyright 1997-2003 Sun
    2.14 + * Microsystems, Inc. All Rights Reserved.
    2.15 + */
    2.16 +
    2.17 +import java.io.*;
    2.18 +import java.util.*;
    2.19 +import org.w3c.dom.*;
    2.20 +
    2.21 +import groupunbounded.*;
    2.22 +
    2.23 +public class TestGroupUnbounded extends BaseTest {
    2.24 +    public static void main(String[] argv) {
    2.25 +        TestGroupUnbounded o = new TestGroupUnbounded();
    2.26 +        if (argv.length > 0)
    2.27 +            o.setDocumentDir(argv[0]);
    2.28 +        try {
    2.29 +            o.run();
    2.30 +        } catch (Exception e) {
    2.31 +            e.printStackTrace();
    2.32 +            System.exit(1);
    2.33 +        }
    2.34 +        System.exit(0);
    2.35 +    }
    2.36 +    
    2.37 +    public void run() throws Exception {
    2.38 +        GroupUnbounded t;
    2.39 +
    2.40 +        this.readDocument();
    2.41 +
    2.42 +        out("creating the bean graph");
    2.43 +        t = GroupUnbounded.read(doc);
    2.44 +	
    2.45 +        //	Check that we can read the graph an it is complete
    2.46 +        out("bean graph created");
    2.47 +        t.write(out);
    2.48 +
    2.49 +        t.validate();
    2.50 +    }
    2.51 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/schema2beans/test/unit/src/data/TestGroupUnbounded.xml	Tue Apr 08 21:54:47 2003 +0000
     3.3 @@ -0,0 +1,9 @@
     3.4 +<?xml version='1.0' encoding='UTF-8' ?>
     3.5 +<group-unbounded xmlns='http://foo.com/xml/group-unbounded' version=''>
     3.6 +	<object id='b' type='green'>
     3.7 +	</object>
     3.8 +	<iobject id='a' type='blue' value='stuff'>
     3.9 +	</iobject>
    3.10 +	<object id='a' type='blue'>
    3.11 +	</object>
    3.12 +</group-unbounded>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/schema2beans/test/unit/src/data/TestGroupUnbounded.xsd	Tue Apr 08 21:54:47 2003 +0000
     4.3 @@ -0,0 +1,74 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +<xsd:schema
     4.6 +        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     4.7 +        xmlns:tns="http://foo.com/xml/group-unbounded"
     4.8 +        targetNamespace="http://foo.com/xml/group-unbounded"
     4.9 +        elementFormDefault="unqualified"
    4.10 +        attributeFormDefault="unqualified"
    4.11 +        version="1.0">
    4.12 +
    4.13 +    <xsd:annotation>
    4.14 +        <xsd:documentation>
    4.15 +	  This is a test.
    4.16 +        </xsd:documentation>
    4.17 +    </xsd:annotation>
    4.18 +
    4.19 +    <xsd:element name="group-unbounded" form="qualified">
    4.20 +        <xsd:annotation>
    4.21 +            <xsd:documentation>
    4.22 +            A group-unbounded is a sequence of definitions, which can be of three kinds:
    4.23 +            </xsd:documentation>
    4.24 +        </xsd:annotation>
    4.25 +
    4.26 +        <xsd:complexType>
    4.27 +            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
    4.28 +                <xsd:choice>
    4.29 +                    <xsd:element name="object" type="tns:objectType"/>
    4.30 +                    <xsd:element name="iobject" type="tns:iobjectType"/>
    4.31 +                    <xsd:element name="property" type="tns:propertyType"/>
    4.32 +                </xsd:choice>
    4.33 +            </xsd:sequence>
    4.34 +            <xsd:attribute name="version" type="xsd:string" use="required"/>
    4.35 +        </xsd:complexType>
    4.36 +    </xsd:element>
    4.37 +
    4.38 +    <xsd:complexType name="objectType">
    4.39 +        <xsd:annotation>
    4.40 +            <xsd:documentation>
    4.41 +            Object definition. Contains a unique id as well as a type name for the object.
    4.42 +            </xsd:documentation>
    4.43 +        </xsd:annotation>
    4.44 +
    4.45 +        <xsd:sequence/>
    4.46 +        <xsd:attribute name="id" type="xsd:string" use="required"/>
    4.47 +        <xsd:attribute name="type" type="xsd:string" use="required"/>
    4.48 +    </xsd:complexType>
    4.49 +
    4.50 +    <xsd:complexType  name="iobjectType">
    4.51 +        <xsd:annotation>
    4.52 +            <xsd:documentation>
    4.53 +            Immediate object definition. In addition to id and type, it contains a value.
    4.54 +            </xsd:documentation>
    4.55 +        </xsd:annotation>
    4.56 +
    4.57 +        <xsd:sequence/>
    4.58 +        <xsd:attribute name="id" type="xsd:string" use="required"/>
    4.59 +        <xsd:attribute name="type" type="xsd:string" use="required"/>
    4.60 +        <xsd:attribute name="value" type="xsd:string" use="required"/>
    4.61 +    </xsd:complexType>
    4.62 +
    4.63 +    <xsd:complexType  name="propertyType">
    4.64 +        <xsd:annotation>
    4.65 +            <xsd:documentation>
    4.66 +            Property definition. It says that the "subject" (identified by id) has a property
    4.67 +            called "name" with the object of id "value" as its value.
    4.68 +            </xsd:documentation>
    4.69 +        </xsd:annotation>
    4.70 +
    4.71 +        <xsd:sequence/>
    4.72 +        <xsd:attribute name="name" type="xsd:string" use="required"/>
    4.73 +        <xsd:attribute name="subject" type="xsd:string" use="required"/>
    4.74 +        <xsd:attribute name="value" type="xsd:string" use="required"/>
    4.75 +    </xsd:complexType>
    4.76 +
    4.77 +</xsd:schema>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testGroupUnbounded.pass	Tue Apr 08 21:54:47 2003 +0000
     5.3 @@ -0,0 +1,33 @@
     5.4 +Calling GenBeans.doIt
     5.5 +Bean Tree:
     5.6 +group-unbounded : GroupUnbounded
     5.7 +	[attr: version CDATA #REQUIRED  : java.lang.String]
     5.8 +	(
     5.9 +	  | object : ObjectType
    5.10 +	  | 	[attr: id CDATA #REQUIRED  : java.lang.String]
    5.11 +	  | 	[attr: type CDATA #REQUIRED  : java.lang.String]
    5.12 +	  | iobject : IobjectType
    5.13 +	  | 	[attr: id CDATA #REQUIRED  : java.lang.String]
    5.14 +	  | 	[attr: type CDATA #REQUIRED  : java.lang.String]
    5.15 +	  | 	[attr: value CDATA #REQUIRED  : java.lang.String]
    5.16 +	  | property : PropertyType
    5.17 +	  | 	[attr: name CDATA #REQUIRED  : java.lang.String]
    5.18 +	  | 	[attr: subject CDATA #REQUIRED  : java.lang.String]
    5.19 +	  | 	[attr: value CDATA #REQUIRED  : java.lang.String]
    5.20 +	)[0,n]
    5.21 +
    5.22 +Compiling
    5.23 +Finished compiling: 0
    5.24 +out: TestGroupUnbounded - creating the DOM document
    5.25 +out: TestGroupUnbounded - creating the bean graph
    5.26 +out: TestGroupUnbounded - bean graph created
    5.27 +out: <?xml version='1.0' encoding='UTF-8' ?>
    5.28 +out: <group-unbounded xmlns='http://foo.com/xml/group-unbounded' version=''>
    5.29 +out: 	<object id='b' type='green'>
    5.30 +out: 	</object>
    5.31 +out: 	<object id='a' type='blue'>
    5.32 +out: 	</object>
    5.33 +out: 	<iobject id='a' type='blue' value='stuff'>
    5.34 +out: 	</iobject>
    5.35 +out: </group-unbounded>
    5.36 +Finished running TestGroupUnbounded: 0