Uped the module spec version number since release35 was just branched. BLD200303040100
authorcliffwd@netbeans.org
Mon, 03 Mar 2003 22:39:55 +0000
changeset 122205b827fc4261
parent 1221 3b2239842a16
child 1223 6e9dc14e220d
Uped the module spec version number since release35 was just branched.
Added ComplexContent to XML Schema elements.
Added group type handling to extension elements. So, now you can extend a complexType and add another property to it.
schema2beans/test/unit/src/TestMain.java
schema2beans/test/unit/src/data/TestExtensionSample.java
schema2beans/test/unit/src/data/TestExtensionSample.xml
schema2beans/test/unit/src/data/TestExtensionSample.xsd
schema2beans/test/unit/src/data/goldenfiles/TestMain/testExtensionSample.pass
     1.1 --- a/schema2beans/test/unit/src/TestMain.java	Mon Mar 03 16:35:15 2003 +0000
     1.2 +++ b/schema2beans/test/unit/src/TestMain.java	Mon Mar 03 22:39:55 2003 +0000
     1.3 @@ -99,6 +99,10 @@
     1.4          generalTest("TestNamespace", true, true, true);
     1.5      }
     1.6  
     1.7 +    public void testExtensionSample() throws IOException, Schema2BeansException, InterruptedException {
     1.8 +        generalTest("TestExtensionSample", true, true, true);
     1.9 +    }
    1.10 +
    1.11      public void testWebApp() throws IOException, Schema2BeansException, InterruptedException {
    1.12          generalTest("TestWebApp", true, true, true);
    1.13      }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/schema2beans/test/unit/src/data/TestExtensionSample.java	Mon Mar 03 22:39:55 2003 +0000
     2.3 @@ -0,0 +1,51 @@
     2.4 +/*
     2.5 + *	TestExtensionSample - test the basic features.
     2.6 + *
     2.7 + *	The following test assumes that we know the content of the
     2.8 + *	graph as we get elements, add and change them. Therefore, the TestExtensionSample.xml
     2.9 + *	file and this java test should be kept in sync.
    2.10 + *
    2.11 + * 	Test the following:
    2.12 + *
    2.13 + *	single String: get/set/remove/set/get
    2.14 + *	boolean (from true): get/set true/get/set false/get/set true/get
    2.15 + *	boolean (from false): get/set false/get/set true/get/set false/get
    2.16 + *	String[]: get/set (null & !null)/add/remove
    2.17 + *	Bean: remove/set(null)/create bean and graph of beans/set/add
    2.18 + *
    2.19 + */
    2.20 +
    2.21 +import java.io.*;
    2.22 +import java.util.*;
    2.23 +import org.w3c.dom.*;
    2.24 +
    2.25 +import extensionsample.*;
    2.26 +
    2.27 +
    2.28 +public class TestExtensionSample extends BaseTest {
    2.29 +    public static void main(String[] argv) {
    2.30 +        TestExtensionSample o = new TestExtensionSample();
    2.31 +        if (argv.length > 0)
    2.32 +            o.setDocumentDir(argv[0]);
    2.33 +        try {
    2.34 +            o.run();
    2.35 +        } catch (Exception e) {
    2.36 +            e.printStackTrace();
    2.37 +            System.exit(1);
    2.38 +        }
    2.39 +        System.exit(0);
    2.40 +    }
    2.41 +    
    2.42 +    public void run() throws Exception {
    2.43 +        ExtensionSample extensionSample;
    2.44 +
    2.45 +        this.readDocument();
    2.46 +
    2.47 +        out("creating the bean graph");
    2.48 +        extensionSample = ExtensionSample.read(doc);
    2.49 +	
    2.50 +        //	Check that we can read the graph an it is complete
    2.51 +        out("bean graph created");
    2.52 +        extensionSample.write(out);
    2.53 +    }
    2.54 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/schema2beans/test/unit/src/data/TestExtensionSample.xml	Mon Mar 03 22:39:55 2003 +0000
     3.3 @@ -0,0 +1,11 @@
     3.4 +<?xml version='1.0' encoding='UTF-8' ?>
     3.5 +<extensionSample xmlns='http://anything.org/extension'>
     3.6 +	<name>Cobalt</name>
     3.7 +	<more-info>
     3.8 +		<config-property>
     3.9 +	  		<config-property-name>Blue</config-property-name>
    3.10 +	  		<config-property-type>color</config-property-type>
    3.11 +	  		<is-required>false</is-required>
    3.12 +		</config-property>
    3.13 +	</more-info>
    3.14 +</extensionSample>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/schema2beans/test/unit/src/data/TestExtensionSample.xsd	Mon Mar 03 22:39:55 2003 +0000
     4.3 @@ -0,0 +1,64 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +
     4.6 +
     4.7 +<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
     4.8 +    targetNamespace="http://anything.org/extension"
     4.9 +    xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
    4.10 +    xmlns:ext="http://anything.org/extension"
    4.11 +    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    4.12 +    elementFormDefault="qualified"
    4.13 +    attributeFormDefault="unqualified"
    4.14 +    version="2.0">
    4.15 +
    4.16 +
    4.17 +<xsd:element name="extensionSample" type="ext:topLevelType">
    4.18 +</xsd:element>
    4.19 +
    4.20 +<xsd:complexType name="topLevelType">
    4.21 +
    4.22 +    <xsd:sequence>
    4.23 +        <xsd:element name="name"
    4.24 +                     type="xsd:string"/>
    4.25 +
    4.26 +        <xsd:element name="config-property"
    4.27 +                     type="ext:config-propertyType"
    4.28 +                     maxOccurs="unbounded"/>
    4.29 +
    4.30 +        <xsd:element name="more-info"
    4.31 +                     type="ext:more-infoType"/>
    4.32 +    </xsd:sequence>
    4.33 +</xsd:complexType>
    4.34 +
    4.35 +<xsd:complexType name="config-propertyType">
    4.36 +    <xsd:sequence>
    4.37 +        <xsd:element name="config-property-name"
    4.38 +                     type="xsd:string"/>
    4.39 +        <xsd:element name="config-property-type"
    4.40 +                     type="xsd:string"/>
    4.41 +    </xsd:sequence>
    4.42 +</xsd:complexType>
    4.43 +
    4.44 +<xsd:complexType name="more-infoType">
    4.45 +    <xsd:sequence>
    4.46 +        <xsd:element name="config-property"
    4.47 +                     type="ext:expanded-config-propertyType"
    4.48 +                     maxOccurs="unbounded"/>
    4.49 +
    4.50 +    </xsd:sequence>
    4.51 +</xsd:complexType>
    4.52 +
    4.53 +<xsd:complexType name="expanded-config-propertyType">
    4.54 +    <xsd:complexContent>
    4.55 +        <xsd:extension base="ext:config-propertyType">
    4.56 +            <xsd:sequence>
    4.57 +                <xsd:element name="is-required"
    4.58 +                             type="xsd:boolean"/>
    4.59 +            </xsd:sequence>
    4.60 +        </xsd:extension>
    4.61 +    </xsd:complexContent>
    4.62 +
    4.63 +</xsd:complexType>
    4.64 +
    4.65 +</xsd:schema>
    4.66 +
    4.67 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testExtensionSample.pass	Mon Mar 03 22:39:55 2003 +0000
     5.3 @@ -0,0 +1,30 @@
     5.4 +Calling GenBeans.doIt
     5.5 +Bean Tree:
     5.6 +extensionSample : ExtensionSample
     5.7 +	name : java.lang.String
     5.8 +	config-property : ConfigPropertyType[1,n]
     5.9 +		config-property-name : java.lang.String
    5.10 +		config-property-type : java.lang.String
    5.11 +	more-info : MoreInfoType
    5.12 +		config-property : ExpandedConfigPropertyType[1,n]
    5.13 +			config-property-name : java.lang.String
    5.14 +			config-property-type : java.lang.String
    5.15 +			is-required : boolean
    5.16 +
    5.17 +Compiling
    5.18 +Finished compiling: 0
    5.19 +out: TestExtensionSample - creating the DOM document
    5.20 +out: TestExtensionSample - creating the bean graph
    5.21 +out: TestExtensionSample - bean graph created
    5.22 +out: <?xml version='1.0' encoding='UTF-8' ?>
    5.23 +out: <extensionSample xmlns='http://anything.org/extension'>
    5.24 +out: 	<name>Cobalt</name>
    5.25 +out: 	<more-info>
    5.26 +out: 		<config-property>
    5.27 +out: 			<config-property-name>Blue</config-property-name>
    5.28 +out: 			<config-property-type>color</config-property-type>
    5.29 +out: 			<is-required>false</is-required>
    5.30 +out: 		</config-property>
    5.31 +out: 	</more-info>
    5.32 +out: </extensionSample>
    5.33 +Finished running TestExtensionSample: 0