diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /java/sdo/tools-test/src |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sdo/tools-test/src')
38 files changed, 2250 insertions, 0 deletions
diff --git a/java/sdo/tools-test/src/main/resources/CustomerAccount.xsd b/java/sdo/tools-test/src/main/resources/CustomerAccount.xsd new file mode 100644 index 0000000000..a720670e3b --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/CustomerAccount.xsd @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:stn_1="http://example.com/customer"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified"
+ targetNamespace="http://example.com/customer">
+
+ <xs:complexType abstract="false" name="Account">
+ <xs:sequence />
+ <xs:attribute default="0" name="accountNum" type="xs:int" />
+ <xs:attribute default="0" name="balance" type="xs:float" />
+ </xs:complexType>
+
+ <xs:element name="account" type="stn_1:Account" />
+
+ <xs:complexType abstract="false" name="Customer">
+ <xs:sequence>
+ <xs:element name="account" type="stn_1:Account" />
+ </xs:sequence>
+ <xs:attribute name="firstName" type="xs:string" />
+ </xs:complexType>
+
+ <xs:element name="customer" type="stn_1:Customer" />
+
+</xs:schema>
diff --git a/java/sdo/tools-test/src/main/resources/InternalInElement.xsd b/java/sdo/tools-test/src/main/resources/InternalInElement.xsd new file mode 100644 index 0000000000..6144b1e117 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/InternalInElement.xsd @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ -->
+ <xsd:schema xmlns:tns="http://www.example.com/internal"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.com/internal">
+
+ <xsd:element name="Wrapper" type="tns:Wrapper" />
+ <xsd:complexType name="Wrapper" >
+ <xsd:sequence>
+ <xsd:element name="abc" type="xsd:integer"/>
+ <xsd:element name="internalAbc" type="xsd:integer"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/Open.xsd b/java/sdo/tools-test/src/main/resources/Open.xsd new file mode 100644 index 0000000000..0f158e591a --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/Open.xsd @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. + -->
+<xsd:schema xmlns:open="http://www.example.com/open" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/open">
+
+
+ <xsd:attribute name="globAttribute" type="xsd:string"/>
+
+ <xsd:complexType name="OneElementAndAnyAttr">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:anyAttribute processContents="lax"/>
+ </xsd:complexType>
+
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/extensible/customer.xsd b/java/sdo/tools-test/src/main/resources/extensible/customer.xsd new file mode 100644 index 0000000000..1a0531e040 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/extensible/customer.xsd @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:schema xmlns="http://www.example.com/extensible/customer"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://www.example.com/extensible/customer">
+
+ <xsd:complexType name="CustomersType">
+ <xsd:sequence>
+ <xsd:element name="customer" type="CustomerType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="CustomerType">
+ <xsd:all>
+ <xsd:element name="name" type="CustNameType" />
+ <xsd:element name="number" type="xsd:integer" />
+ <xsd:element form="unqualified" name="info" type="InfoType" />
+ </xsd:all>
+ </xsd:complexType>
+
+ <xsd:simpleType name="CustNameType">
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+
+ <xsd:complexType name="InfoType" />
+
+ <xsd:element name="customers" type="CustomersType" />
+ <xsd:element name="customer" type="CustomerType" />
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/extensible/customers.xml b/java/sdo/tools-test/src/main/resources/extensible/customers.xml new file mode 100644 index 0000000000..40558f6cf8 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/extensible/customers.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <customers xmlns="http://www.example.com/extensible/customer"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.com/extensible/customer customer.xsd">
+ <customer>
+ <name>Pat Walmsley</name>
+ <info xsi:type="ns1:InfoType" xmlns=""
+ xmlns:ns1="http://www.example.com/extensible/info/zipcode">
+ <zipcode>21043</zipcode>
+ </info>
+ <number>15465</number>
+ </customer>
+ <customer>
+ <name>Priscilla Walmsley</name>
+ <number>15466</number>
+ <info xsi:type="ns1:InfoType" xmlns=""
+ xmlns:ns1="http://www.example.com/extensible/info/street">
+ <street>341 Duckworth Way</street>
+ </info>
+ </customer>
+</customers>
diff --git a/java/sdo/tools-test/src/main/resources/extensible/infostreet.xml b/java/sdo/tools-test/src/main/resources/extensible/infostreet.xml new file mode 100644 index 0000000000..c57b0b98c1 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/extensible/infostreet.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <info xsi:type="ns1:InfoType" xmlns=""
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns1="http://www.example.com/extensible/info/street">
+ <street>21043 Jones Way</street>
+</info>
diff --git a/java/sdo/tools-test/src/main/resources/extensible/infostreet.xsd b/java/sdo/tools-test/src/main/resources/extensible/infostreet.xsd new file mode 100644 index 0000000000..4b71628c89 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/extensible/infostreet.xsd @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:schema xmlns="http://www.example.com/extensible/info/street"
+ xmlns:customer="http://www.example.com/extensible/customer"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="unqualified"
+ targetNamespace="http://www.example.com/extensible/info/street">
+ <xsd:import namespace="http://www.example.com/extensible/customer"
+ schemaLocation="customer.xsd" />
+ <xsd:complexType name="InfoType">
+ <xsd:complexContent>
+ <xsd:extension base="customer:InfoType">
+ <xsd:sequence>
+ <xsd:element name="street" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/extensible/infozipcode.xml b/java/sdo/tools-test/src/main/resources/extensible/infozipcode.xml new file mode 100644 index 0000000000..a5f551908a --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/extensible/infozipcode.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <info xsi:type="ns1:InfoType" xmlns=""
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns1="http://www.example.com/extensible/info/zipcode">
+ <zipcode>21043</zipcode>
+</info>
diff --git a/java/sdo/tools-test/src/main/resources/extensible/infozipcode.xsd b/java/sdo/tools-test/src/main/resources/extensible/infozipcode.xsd new file mode 100644 index 0000000000..cd1c55c138 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/extensible/infozipcode.xsd @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:schema xmlns="http://www.example.com/extensible/info/zipcode"
+ xmlns:customer="http://www.example.com/extensible/customer"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="unqualified"
+ targetNamespace="http://www.example.com/extensible/info/zipcode">
+ <xsd:import namespace="http://www.example.com/extensible/customer"
+ schemaLocation="customer.xsd" />
+ <xsd:complexType name="InfoType">
+ <xsd:complexContent>
+ <xsd:extension base="customer:InfoType">
+ <xsd:sequence>
+ <xsd:element name="zipcode" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/extensible/nonamespace.xsd b/java/sdo/tools-test/src/main/resources/extensible/nonamespace.xsd new file mode 100644 index 0000000000..b551c8aae2 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/extensible/nonamespace.xsd @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:schema xmlns:customer="http://www.example.com/extensible/customer"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:import namespace="http://www.example.com/extensible/customer"
+ schemaLocation="customer.xsd" />
+ <xsd:element name="info" type="customer:InfoType"></xsd:element>
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/listAccess.xsd b/java/sdo/tools-test/src/main/resources/listAccess.xsd new file mode 100644 index 0000000000..917ce78f8a --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/listAccess.xsd @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:schema
+ xmlns:getList="http://www.example.com/getList"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.com/getList">
+
+
+ <xsd:element name="company" type="getList:Company"/>
+ <xsd:element name="employee" type="xsd:string"/>
+
+ <xsd:complexType name="Company">
+ <xsd:sequence>
+ <xsd:element name="openCompany" type="getList:OpenCompany"/>
+ <xsd:element name="closeCompany" type="getList:CloseCompany"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="OpenCompany">
+ <xsd:sequence>
+ <xsd:element name="company" type="xsd:string"/>
+ <xsd:element name="employees" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:any maxOccurs="unbounded" namespace="##any"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="CloseCompany">
+ <xsd:sequence>
+ <xsd:element name="company" type="xsd:string"/>
+ <xsd:element name="employees" maxOccurs="unbounded" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file diff --git a/java/sdo/tools-test/src/main/resources/mixedTypesStatic.xsd b/java/sdo/tools-test/src/main/resources/mixedTypesStatic.xsd new file mode 100644 index 0000000000..436c1ec9a4 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/mixedTypesStatic.xsd @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:schema xmlns:statictypes="http://www.example.com/mixedtypes/statictypes"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://www.example.com/mixedtypes/statictypes">
+
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="number" type="xsd:integer" />
+ <xsd:element name="account" type="statictypes:Account" />
+ <xsd:element name="address" type="statictypes:Address" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Account" abstract="true" />
+
+ <xsd:complexType name="Address">
+ <xsd:sequence>
+ <xsd:element name="street" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/simple.xsd b/java/sdo/tools-test/src/main/resources/simple.xsd new file mode 100644 index 0000000000..aff9f9c5bf --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/simple.xsd @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<xsd:schema
+ targetNamespace="http://www.example.com/simple"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:simple="http://www.example.com/simple">
+
+ <xsd:element name="stockQuote" type="simple:Quote"/>
+
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ <xsd:element name="companyName" type="xsd:string"/>
+ <xsd:element name="price" type="xsd:decimal"/>
+ <xsd:element name="open1" type="xsd:decimal"/>
+ <xsd:element name="high" type="xsd:decimal"/>
+ <xsd:element name="low" type="xsd:decimal"/>
+ <xsd:element name="volume" type="xsd:double"/>
+ <xsd:element name="change1" type="xsd:double"/>
+ <xsd:element name="quotes" type="simple:Quote" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/simpleNoIF.xsd b/java/sdo/tools-test/src/main/resources/simpleNoIF.xsd new file mode 100644 index 0000000000..aff9f9c5bf --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/simpleNoIF.xsd @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<xsd:schema
+ targetNamespace="http://www.example.com/simple"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:simple="http://www.example.com/simple">
+
+ <xsd:element name="stockQuote" type="simple:Quote"/>
+
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ <xsd:element name="companyName" type="xsd:string"/>
+ <xsd:element name="price" type="xsd:decimal"/>
+ <xsd:element name="open1" type="xsd:decimal"/>
+ <xsd:element name="high" type="xsd:decimal"/>
+ <xsd:element name="low" type="xsd:decimal"/>
+ <xsd:element name="volume" type="xsd:double"/>
+ <xsd:element name="change1" type="xsd:double"/>
+ <xsd:element name="quotes" type="simple:Quote" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/simpleNoTns.xsd b/java/sdo/tools-test/src/main/resources/simpleNoTns.xsd new file mode 100644 index 0000000000..4702f57251 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/simpleNoTns.xsd @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<xsd:schema
+ xmlns="http://www.example.com/simpleNoTns"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ <xsd:element name="companyName" type="xsd:string"/>
+ <xsd:element name="price" type="xsd:decimal"/>
+ <xsd:element name="open1" type="xsd:decimal"/>
+ <xsd:element name="high" type="xsd:decimal"/>
+ <xsd:element name="low" type="xsd:decimal"/>
+ <xsd:element name="volume" type="xsd:double"/>
+ <xsd:element name="change1" type="xsd:double"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/simpleWithChangeSummary.xsd b/java/sdo/tools-test/src/main/resources/simpleWithChangeSummary.xsd new file mode 100644 index 0000000000..c81e10ee00 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/simpleWithChangeSummary.xsd @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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.
+ -->
+<xsd:schema xmlns:sdo="commonj.sdo" xmlns:simpleCS="http://www.example.com/simpleCS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://www.example.com/simpleCS">
+
+
+ <xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/>
+
+ <xsd:complexType name="QuoteBase">
+ <xsd:complexContent>
+ <xsd:extension base="simpleCS:Quote">
+ <xsd:sequence>
+ <xsd:element name="changes" type="sdo:ChangeSummaryType"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+
+ </xsd:complexType>
+
+ <xsd:element name="stockQuote" type="simpleCS:QuoteBase"/>
+
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ <xsd:element name="companyName" type="xsd:string"/>
+ <xsd:element name="price" type="xsd:decimal"/>
+ <xsd:element name="open1" type="xsd:decimal"/>
+ <xsd:element name="high" type="xsd:decimal"/>
+ <xsd:element name="low" type="xsd:decimal"/>
+ <xsd:element name="volume" type="xsd:double"/>
+ <xsd:element name="change1" type="xsd:double"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="quotes" type="simpleCS:Quote"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/subgroup.xsd b/java/sdo/tools-test/src/main/resources/subgroup.xsd new file mode 100644 index 0000000000..61e0642dfa --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/subgroup.xsd @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:sg="http://example.com/subgroup" elementFormDefault="qualified" targetNamespace="http://example.com/subgroup">
+
+ <element name="a" type="sg:A"/>
+
+ <complexType name="A">
+ <sequence>
+ <element maxOccurs="1" minOccurs="1" ref="sg:ge1"/>
+ </sequence>
+ </complexType>
+
+ <element name="ge1" type="sg:B"/>
+ <element name="se1" substitutionGroup="sg:ge1" type="sg:Bprime"/>
+
+ <complexType name="B">
+ <sequence>
+ <element maxOccurs="1" name="imInTypeB" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="Bprime">
+ <complexContent>
+ <extension base="sg:B">
+ <sequence>
+ <element name="imInTypeBprime" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/java/sdo/tools-test/src/main/resources/subgroup1.xml b/java/sdo/tools-test/src/main/resources/subgroup1.xml new file mode 100644 index 0000000000..007aef9aa3 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/subgroup1.xml @@ -0,0 +1,23 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ -->
+<subgroup:a xmlns:subgroup="http://example.com/subgroup">
+ <subgroup:ge1>
+ <subgroup:imInTypeB>thisIsElB</subgroup:imInTypeB>
+ </subgroup:ge1>
+</subgroup:a>
diff --git a/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues.xsd b/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues.xsd new file mode 100644 index 0000000000..72474a62eb --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues.xsd @@ -0,0 +1,105 @@ +<xsd:schema
+ targetNamespace="http://www.example.com/substitutionEV"
+ xmlns="http://www.example.com/substitutionEV"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sev="http://www.example.com/substitutionEV"
+ elementFormDefault="qualified">
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:element name="results" type="sev:ResultsType" />
+
+ <xsd:element name="result" type="sev:ResultType" />
+ <xsd:element name="myResult" type="sev:MyResultType"
+ substitutionGroup="sev:result" />
+
+ <xsd:complexType name="ResultsType">
+ <xsd:sequence>
+ <xsd:element name="id" type="sev:IdType" />
+ <xsd:element ref="sev:result" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="comment" type="sev:CommentType" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ResultType">
+ <xsd:sequence>
+ <xsd:element name="id" type="sev:IdType" />
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="value" type="sev:ValueType" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="MyResultType">
+ <xsd:complexContent>
+ <xsd:extension base="sev:ResultType" />
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="IdType">
+ <xsd:restriction base="sev:AsciiStringType">
+ <xsd:maxLength value="32" />
+ <xsd:pattern value="[0-9a-fA-F]*" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="AsciiStringType">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\p{IsBasicLatin}*" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="ValueType">
+ <xsd:simpleContent>
+ <xsd:extension base="sev:Integer32Bit" />
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="Integer32Bit">
+ <xsd:restriction base="xsd:integer">
+ <xsd:minInclusive value="0" />
+ <xsd:maxInclusive value="4290000000" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="CommentType">
+ <xsd:simpleContent>
+ <xsd:extension base="sev:AsciiStringType">
+ <xsd:attribute name="language" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="English" />
+ <xsd:enumeration value="French" />
+ <xsd:enumeration value="Spanish" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="MyCommentType">
+ <xsd:simpleContent>
+ <xsd:restriction base="sev:CommentType">
+ <xsd:minLength value="0" />
+ <xsd:maxLength value="40" />
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues1.xml b/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues1.xml new file mode 100644 index 0000000000..45c592a333 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues1.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<sev2:allResults xmlns:sev2="http://www.example.com/substitutionEV2">
+ <sev2:id>ZZZZZZZZZZZZZZZZZZZZ</sev2:id>
+ <sev2:results xmlns:sev="http://www.example.com/substitutionEV">
+ <sev:id>00000000000000000000</sev:id>
+ <sev:result>
+ <sev:id>11111111111111111111</sev:id>
+ <sev:name>name1</sev:name>
+ <sev:value>1</sev:value>
+ </sev:result>
+ <sev:myResult>
+ <sev:id>22222222222222222222</sev:id>
+ <sev:name>myName2</sev:name>
+ <sev:value>2</sev:value>
+ </sev:myResult>
+ <sev:comment>comment0</sev:comment>
+ </sev2:results>
+ <sev2:results xmlns:sev="http://www.example.com/substitutionEV">
+ <sev:id>AAAAAAAAAAAAAAAAAAAA</sev:id>
+ <sev:myResult>
+ <sev:id>BBBBBBBBBBBBBBBBBBBB</sev:id>
+ <sev:name>myNameB</sev:name>
+ <sev:value>11</sev:value>
+ </sev:myResult>
+ <sev:comment>commentA</sev:comment>
+ </sev2:results>
+ <sev2:comment language="English">
+ commentZZZZZZZZZZZZZZZZZZ
+ </sev2:comment>
+</sev2:allResults>
diff --git a/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues2.xsd b/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues2.xsd new file mode 100644 index 0000000000..769cce4f65 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/substitutionWithExtensionValues2.xsd @@ -0,0 +1,62 @@ +<xsd:schema
+ targetNamespace="http://www.example.com/substitutionEV2"
+ xmlns="http://www.example.com/substitutionEV2"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sev2="http://www.example.com/substitutionEV2"
+ xmlns:sev="http://www.example.com/substitutionEV"
+ elementFormDefault="qualified">
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+
+ <xsd:import namespace="http://www.example.com/substitutionEV"
+ schemaLocation="substitutionWithExtensionValues.xsd" />
+
+ <xsd:element name="allResults" type="sev2:AllResultsType" />
+
+ <xsd:complexType name="AllResultsType">
+ <xsd:sequence>
+ <xsd:element name="id" type="sev2:Id2Type" />
+ <xsd:element name="results" minOccurs="0" maxOccurs="unbounded"
+ type="sev2:Results2Type" />
+ <xsd:element name="comment" type="sev2:Comment2Type" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Results2Type">
+ <xsd:complexContent>
+ <xsd:extension base="sev:ResultsType" />
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="Id2Type">
+ <xsd:restriction base="sev:IdType">
+ <xsd:maxLength value="10" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="Comment2Type">
+ <xsd:simpleContent>
+ <xsd:restriction base="sev:CommentType">
+ <xsd:minLength value="0" />
+ <xsd:maxLength value="20" />
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/main/resources/xsdImportOnly.wsdl b/java/sdo/tools-test/src/main/resources/xsdImportOnly.wsdl new file mode 100644 index 0000000000..576997a0a4 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/xsdImportOnly.wsdl @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xsdImportOnly/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="EchoService" targetNamespace="http://xsdImportOnly/">
+ <types>
+ <xsd:schema>
+ <xsd:import namespace="http://xsdImportOnly/" schemaLocation="xsdImportOnly_1.xsd"/>
+ </xsd:schema>
+ </types>
+ <message name="echo">
+ <part element="tns:echo" name="parameters"/>
+ </message>
+ <message name="echoResponse">
+ <part element="tns:echoResponse" name="parameters"/>
+ </message>
+ <portType name="Echo">
+ <operation name="echo">
+ <input message="tns:echo"/>
+ <output message="tns:echoResponse"/>
+ </operation>
+ </portType>
+ <binding name="EchoPortBinding" type="tns:Echo">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="echo">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="EchoService">
+ <port binding="tns:EchoPortBinding" name="EchoPort">
+ <soap:address location="http://localhost:9080/w1/EchoService"/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file diff --git a/java/sdo/tools-test/src/main/resources/xsdImportOnly_1.xsd b/java/sdo/tools-test/src/main/resources/xsdImportOnly_1.xsd new file mode 100644 index 0000000000..a62c26d948 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/xsdImportOnly_1.xsd @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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:tns="http://xsdImportOnly/" targetNamespace="http://xsdImportOnly/" version="1.0">
+
+ <xs:element name="echo" type="tns:echo"/>
+
+ <xs:element name="echoResponse" type="tns:echoResponse"/>
+
+ <xs:complexType name="echo">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="echoResponse">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
\ No newline at end of file diff --git a/java/sdo/tools-test/src/main/resources/xsdlistitem.xsd b/java/sdo/tools-test/src/main/resources/xsdlistitem.xsd new file mode 100644 index 0000000000..e416efaa25 --- /dev/null +++ b/java/sdo/tools-test/src/main/resources/xsdlistitem.xsd @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/AddressWithList" xmlns:address="http://www.example.org/AddressWithList" elementFormDefault="qualified">
+
+ <xsd:element name="Address" type="address:AddressType" />
+
+ <xsd:complexType name="SubCategoryType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="categoryType" type="address:CategoryType" default="myCat"/>
+ <xsd:attribute name="displayable" type="xsd:boolean" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="CategoryType">
+ <xsd:list itemType="xsd:string" />
+ </xsd:simpleType>
+ <xsd:simpleType name="CategoryType2">
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+
+
+
+ <xsd:complexType name="AddressType">
+ <xsd:sequence>
+ <xsd:element name="Street" type="xsd:string"></xsd:element>
+ <xsd:element name="City" type="xsd:string"></xsd:element>
+ <xsd:element name="Zip" type="xsd:string"></xsd:element>
+ <xsd:element name="SubCategory" type="address:SubCategoryType"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
\ No newline at end of file diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/AllTests.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/AllTests.java new file mode 100644 index 0000000000..7c10cb2c62 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/AllTests.java @@ -0,0 +1,57 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.tuscany.sdo.test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class AllTests extends TestCase {
+
+
+ public static TestSuite suite() {
+
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(ChangeSummaryGenTestCase.class);
+ suite.addTestSuite(ExtensibleTestCase.class);
+ suite.addTestSuite(GenPatternsTestCase.class);
+ suite.addTestSuite(InheritanceTestCase.class);
+ suite.addTestSuite(OpenContentTestCase.class);
+ suite.addTestSuite(SimpleStaticTestCase.class);
+ suite.addTestSuite(MixedTypesTestCase.class);
+ suite.addTestSuite(DataObjectGetListTestCase.class);
+ suite.addTestSuite(ListWithDefaultTestCase.class);
+ suite.addTestSuite(SubstitutionWithExtensionValuesTestCase.class);
+ suite.addTestSuite(InternalInElementTestCase.class);
+ return suite;
+ }
+
+
+
+ /**
+ * Runs the test suite using the textual runner.
+ */
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
+
+
+
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java new file mode 100644 index 0000000000..37759458b9 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java @@ -0,0 +1,131 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.List;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import junit.framework.TestCase;
+
+import com.example.customer.Account;
+import com.example.customer.Customer;
+import com.example.customer.CustomerFactory;
+import com.example.simple.cs.CSFactory;
+import com.example.simple.cs.Quote;
+import com.example.simple.cs.QuoteBase;
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+
+public class ChangeSummaryGenTestCase extends TestCase {
+
+ public void testMixedQuoteType() throws IOException {
+ QuoteBase quote = CSFactory.INSTANCE.createQuoteBase();
+ DataObject dQuote = (DataObject)quote;
+
+ // ChangeSummary csp = quote.getChanges();
+ ChangeSummary cs = dQuote.getChangeSummary();
+ ChangeSummary csp = quote.getChanges();
+ cs.beginLogging();
+
+ assertSame(cs, csp);
+
+ quote.setSymbol("fbnt");
+ quote.setCompanyName("FlyByNightTechnology");
+ quote.setPrice(new BigDecimal("1000.0"));
+ quote.setOpen1(new BigDecimal("1000.0"));
+ quote.setHigh(new BigDecimal("1000.0"));
+ quote.setLow(new BigDecimal("1000.0"));
+ quote.setVolume(1000);
+ quote.setChange1(1000);
+
+ List quotes = quote.getQuotes();
+ Quote innerQuote = CSFactory.INSTANCE.createQuote();
+
+ quotes.add(innerQuote);
+ innerQuote.setPrice(new BigDecimal("2000.0"));
+
+ cs.endLogging();
+
+ //XMLHelper.INSTANCE.save(dQuote, "http://www.example.com/simpleCS", "quoteBase", System.out);
+
+ cs.undoChanges();
+
+ //System.out.println("\nAfter Undo Changes:");
+ //XMLHelper.INSTANCE.save(dQuote, "http://www.example.com/simpleCS", "quoteBase", System.out);
+ }
+
+ public void testChangeSummaryOnDatagraphWithContainmentStatic() throws Exception {
+
+ HelperContext hc = HelperProvider.getDefaultContext();
+ CustomerFactory.INSTANCE.register(hc);
+
+ Type customerType = hc.getTypeHelper().getType(Customer.class);
+ DataGraph dataGraph = SDOUtil.createDataGraph();
+ Customer customer = (Customer) dataGraph.createRootObject(customerType);
+
+ Account account = CustomerFactory.INSTANCE.createAccount();
+ customer.setAccount(account);
+ customer.setFirstName("John");
+ customer.getAccount().setAccountNum(1234);
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ SDOUtil.saveDataGraph(dataGraph, outputStream, null);
+ DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
+
+ loadDataGraph.getChangeSummary().beginLogging();
+
+ customer = (Customer) loadDataGraph.getRootObject();
+ customer.getAccount().setAccountNum(987);
+
+ loadDataGraph.getChangeSummary().endLogging();
+
+ List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
+ assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
+ }
+
+ public void testChangeSummaryOnDataGraphWithIntAndFloat() throws Exception {
+
+ HelperContext hc = HelperProvider.getDefaultContext();
+ CustomerFactory factory = CustomerFactory.INSTANCE;
+ factory.register(hc);
+ Customer customer = factory.createCustomer();
+ Account account = factory.createAccount();
+ customer.setAccount(account);
+ DataObject customerDO = (DataObject) customer;
+ DataGraph dg = SDOUtil.createDataGraph();
+ SDOUtil.setRootObject(dg, customerDO);
+ dg.getChangeSummary().beginLogging();
+ dg.getRootObject().getDataObject(0).delete();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ SDOUtil.saveDataGraph(dg, baos, null);
+ }
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/DataObjectGetListTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/DataObjectGetListTestCase.java new file mode 100644 index 0000000000..b6650cade3 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/DataObjectGetListTestCase.java @@ -0,0 +1,99 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import com.example.get.list.ListFactory;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import junit.framework.TestCase;
+
+public class DataObjectGetListTestCase extends TestCase {
+ private HelperContext hc;
+ private DataObject companyDataObject;
+
+ private final String TEST_NAMESPACE = "http://www.example.com/getList";
+
+
+ /**
+ * Test DataObject.getList() on open type
+ */
+ public void testUnknownPropertyOnOpenType() throws IOException {
+ String companyName = companyDataObject.getString("openCompany/company");
+ assertEquals(companyName, "OpenCompany");
+ List unknownProperty = companyDataObject.getList("openCompany/unknownProperty");
+ assertNotNull(unknownProperty);
+ assertTrue(unknownProperty instanceof List);
+
+ List unknownProperty2 = companyDataObject.getList("openCompany/unknownProperty");
+ assertNotNull(unknownProperty2);
+ assertTrue(unknownProperty2 instanceof List);
+
+ // unknownProperty and unknownProperty2 are in fact the same value for the same property
+
+ unknownProperty.add("employee1");
+ assertTrue(unknownProperty.size() == 1);
+
+ unknownProperty2.add("employee2");
+ assertTrue(unknownProperty2.size() == 2);
+
+ unknownProperty.remove(0);
+ assertTrue(unknownProperty.size() == 1);
+
+ assertEquals(unknownProperty.get(0), "employee2");
+ }
+
+ /**
+ * Test DataObject.getList() on non-open type
+ */
+ public void testUnknownPropertyOnClosedType() throws IOException {
+ String companyName = companyDataObject.getString("closeCompany/company");
+ assertEquals(companyName, "CloseCompany");
+ List unknownProperty = companyDataObject.getList("closeCompany/unknownProperty");
+ assertNotNull(unknownProperty);
+ assertTrue(unknownProperty instanceof List);
+
+ try {
+ unknownProperty.add("employee1");
+ fail("An exception should have been thrown.");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ hc = SDOUtil.createHelperContext();
+ ListFactory.INSTANCE.register(hc);
+
+ companyDataObject = hc.getDataFactory().create(TEST_NAMESPACE, "Company");
+ DataObject openCompany = companyDataObject.createDataObject("openCompany");
+ openCompany.setString("company", "OpenCompany");
+ DataObject closeCompany = companyDataObject.createDataObject("closeCompany");
+ closeCompany.setString("company", "CloseCompany");
+ }
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ExtensibleTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ExtensibleTestCase.java new file mode 100644 index 0000000000..c9cc384beb --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ExtensibleTestCase.java @@ -0,0 +1,96 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import com.example.extensible.customer.CustomerFactory;
+import com.example.extensible.customer.CustomersType;
+import com.example.extensible.customer.InfoType;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class ExtensibleTestCase extends TestCase {
+
+ private final String[] MODELS = new String[] {
+ "/extensible/nonamespace.xsd",
+ "/extensible/infostreet.xsd",
+ "/extensible/infozipcode.xsd"
+ };
+
+ private final String CUSTOMERS_XML = "/extensible/customers.xml";
+ private final String INFOSTREET_XML = "/extensible/infostreet.xml";
+ private final String INFOZIPCODE_XML = "/extensible/infozipcode.xml";
+
+ private HelperContext scope;
+
+ public void testCustomersLoad() throws IOException {
+ XMLDocument doc = scope.getXMLHelper().load(
+ getClass().getResourceAsStream(CUSTOMERS_XML));
+ assertEquals("customers", doc.getRootElementName());
+ assertTrue("RootObject of " + CUSTOMERS_XML + " should be instanceof CustomersType",
+ doc.getRootObject() instanceof CustomersType);
+ String strdoc = scope.getXMLHelper().save(
+ doc.getRootObject(), doc.getRootElementURI(), doc.getRootElementName());
+ assertTrue(strdoc.indexOf("<street>341 Duckworth Way</street>") != -1);
+ }
+
+ public void testInfoLoad() throws IOException {
+ String[] infoXmls = new String[] {INFOSTREET_XML, INFOZIPCODE_XML};
+ for (int i = 0; i < infoXmls.length; i++) {
+ String infoXml = infoXmls[i];
+ XMLDocument doc = scope.getXMLHelper().load(
+ getClass().getResourceAsStream(infoXml));
+ assertEquals("info", doc.getRootElementName());
+ assertTrue("RootObject of " + infoXml + " should be instanceof InfoType",
+ doc.getRootObject() instanceof InfoType);
+ String strdoc = scope.getXMLHelper().save(
+ doc.getRootObject(), doc.getRootElementURI(), doc.getRootElementName());
+ String elementName = (i == 0) ? "street" : "zipcode";
+ String valuePrefix = "21043";
+ assertTrue(strdoc.indexOf("<" + elementName + ">") != -1);
+ assertTrue(strdoc.indexOf("</" + elementName + ">") != -1);
+ assertTrue(strdoc.indexOf(">" + valuePrefix) != -1);
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ scope = SDOUtil.createHelperContext();
+
+ CustomerFactory.INSTANCE.register(scope);
+
+ // Populate the meta data for the models
+ for (int i = 0; i < MODELS.length; i++) {
+ String model = MODELS[i];
+ URL url = getClass().getResource(model);
+ InputStream inputStream = url.openStream();
+ scope.getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+ }
+ }
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/GenPatternsTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/GenPatternsTestCase.java new file mode 100644 index 0000000000..e63697738e --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/GenPatternsTestCase.java @@ -0,0 +1,115 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.math.BigDecimal;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import com.example.simple.SimpleFactory;
+import commonj.sdo.helper.HelperContext;
+
+
+public class GenPatternsTestCase extends TestCase
+{
+ /**
+ * Simple Default Generation Pattern Static SDO 2.1 test.
+ */
+ public void testSimpleDefaultGeneratedClasses()
+ {
+ try
+ {
+ HelperContext scope = SDOUtil.createHelperContext();
+ com.example.simple.SimpleFactory.INSTANCE.register(scope);
+
+ com.example.simple.Quote quote =
+ (com.example.simple.Quote)scope.getDataFactory().create(com.example.simple.Quote.class);
+
+ quote.setSymbol("fbnt");
+ quote.setCompanyName("FlyByNightTechnology");
+ quote.setPrice(new BigDecimal("1000.0"));
+ quote.setOpen1(new BigDecimal("1000.0"));
+ quote.setHigh(new BigDecimal("1000.0"));
+ quote.setLow(new BigDecimal("1000.0"));
+ quote.setVolume(1000);
+ quote.setChange1(1000);
+
+ com.example.simple.Quote child =
+ (com.example.simple.Quote)scope.getDataFactory().create(com.example.simple.Quote.class);
+ quote.getQuotes().add(child);
+ child.setPrice(new BigDecimal("2000.0"));
+
+ //XMLHelper.INSTANCE.save((DataObject)quote, "http://www.example.com/simple", "stockQuote", System.out);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Simple Default Generation Pattern Static SDO 2.1 test.
+ */
+ public void testSimpleNoInterfaceGeneratedClasses()
+ {
+ try
+ {
+ HelperContext scope = SDOUtil.createHelperContext();
+ com.example.noInterfaces.simple.SimpleFactory.INSTANCE.register(scope);
+
+ com.example.noInterfaces.simple.Quote quote =
+ (com.example.noInterfaces.simple.Quote)scope.getDataFactory().create(com.example.noInterfaces.simple.Quote.class);
+
+ quote.setSymbol("fbnt");
+ quote.setCompanyName("FlyByNightTechnology");
+ quote.setPrice(new BigDecimal("1000.0"));
+ quote.setOpen1(new BigDecimal("1000.0"));
+ quote.setHigh(new BigDecimal("1000.0"));
+ quote.setLow(new BigDecimal("1000.0"));
+ quote.setVolume(1000);
+ quote.setChange1(1000);
+
+ com.example.noInterfaces.simple.Quote child =
+ (com.example.noInterfaces.simple.Quote)scope.getDataFactory().create(com.example.noInterfaces.simple.Quote.class);
+ quote.getQuotes().add(child);
+ child.setPrice(new BigDecimal("2000.0"));
+
+ //XMLHelper.INSTANCE.save((DataObject)quote, "http://www.example.com/simple", "stockQuote", System.out);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void testFailureOnNullScope() {
+ try {
+ SimpleFactory.INSTANCE.register(null);
+ assertTrue("Should not be able to register in null scope", false);
+ }
+ catch (Exception e) {
+ // caught expected exception
+ }
+ }
+
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/InheritanceTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/InheritanceTestCase.java new file mode 100644 index 0000000000..0b291b3365 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/InheritanceTestCase.java @@ -0,0 +1,102 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import com.example.subgroup.A;
+import com.example.subgroup.B;
+import com.example.subgroup.Bprime;
+import com.example.subgroup.SubgroupFactory;
+import com.example.subgroup.impl.AImpl;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class InheritanceTestCase extends TestCase {
+
+ private HelperContext scope;
+
+ public void testSubGroupLoad() throws IOException {
+ XMLDocument doc = scope.getXMLHelper().load(
+ getClass().getResourceAsStream("/subgroup1.xml"));
+ assertEquals("a", doc.getRootElementName());
+ String strdoc = scope.getXMLHelper().save(
+ doc.getRootObject(), doc.getRootElementURI(), doc.getRootElementName());
+ assertTrue(strdoc.indexOf("<sg:imInTypeB>thisIsElB</sg:imInTypeB>") != -1);
+ }
+
+ public void testSubGroup_AcontainsB() {
+ A a = (A) scope.getDataFactory().create(A.class);
+ B b = (B) scope.getDataFactory().create(B.class);
+ b.setImInTypeB("thisIsElB");
+ a.setGe1(b);
+
+ assertSame(b, a.getGe1());
+ assertSame(b, ((AImpl) a).get(AImpl.GE1));
+
+ String doc = scope.getXMLHelper().save((DataObject) a,
+ "http://example.com/subgroup", "a");
+ assertTrue(doc.indexOf("<sg:imInTypeB>thisIsElB</sg:imInTypeB>") != -1);
+
+ }
+
+ public void testSubGroup_AcontainsBprime() {
+ A a = (A) scope.getDataFactory().create(A.class);
+ Bprime bp = (Bprime) scope.getDataFactory().create(Bprime.class);
+ bp.setImInTypeBprime("thisIsElBprime");
+ a.setGe1(bp);
+
+ assertSame(bp, a.getGe1());
+ assertSame(bp, ((AImpl) a).get(AImpl.GE1));
+
+ String doc = scope.getXMLHelper().save((DataObject) a,
+ "http://example.com/subgroup", "a");
+
+ assertTrue(doc.indexOf("<sg:imInTypeBprime>thisIsElBprime</sg:imInTypeBprime>") != -1);
+
+ }
+
+ public void testSubGroup_Bprime() {
+ Bprime bp = (Bprime) scope.getDataFactory().create(Bprime.class);
+ bp.setImInTypeB("bValue");
+ bp.setImInTypeBprime("bpvalue");
+ String doc = scope.getXMLHelper().save((DataObject) bp,
+ "http://example.com/subgroup", "bp");
+ assertTrue(doc.indexOf("<sg:imInTypeB>bValue</sg:imInTypeB>") != -1);
+ assertTrue(doc.indexOf("<sg:imInTypeBprime>bpvalue</sg:imInTypeBprime>") != -1);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ scope = SDOUtil.createHelperContext();
+
+ SubgroupFactory.INSTANCE.register(scope);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/InternalInElementTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/InternalInElementTestCase.java new file mode 100644 index 0000000000..dfa4b02221 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/InternalInElementTestCase.java @@ -0,0 +1,63 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.generate.XSD2JavaGenerator;
+
+import com.example.internal.InternalFactory;
+import com.example.internal.Wrapper;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+public class InternalInElementTestCase extends TestCase {
+ HelperContext scope;
+
+ /*TUSCANy-1483 check correct code generation for internalAbc */
+ public void testPackageValidityWithInternalInElement() throws Exception {
+ //if dob is instantiated, it proves that the code got generated without any duplicates
+ //without the fix,
+ //public final static int INTERNAL_ABC = 1;
+ //public final static int INTERNAL_ABC = 0;
+ //was getting generated and so invalid java class WrapperImpl.java.
+ InternalFactory.INSTANCE.register(scope);
+ DataObject dob = scope.getDataFactory().create(Wrapper.class);
+
+ assertTrue(true);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ scope = SDOUtil.createHelperContext();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ListWithDefaultTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ListWithDefaultTestCase.java new file mode 100644 index 0000000000..59799bf23e --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/ListWithDefaultTestCase.java @@ -0,0 +1,53 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.example.address.with.list.LIFactory;
+import org.example.address.with.list.SubCategoryType;
+
+import commonj.sdo.helper.HelperContext;
+
+public class ListWithDefaultTestCase extends TestCase {
+ HelperContext scope = null;
+
+ public void testListWithDefault() {
+ SubCategoryType sct = (SubCategoryType)scope.getDataFactory().create(SubCategoryType.class);
+ List l = sct.getCategoryType();
+ assertTrue(l.size() == 1);
+ assertEquals((String)l.get(0), "myCat");
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ scope = SDOUtil.createHelperContext();
+
+ LIFactory.INSTANCE.register(scope);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/MixedTypesTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/MixedTypesTestCase.java new file mode 100644 index 0000000000..e716076366 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/MixedTypesTestCase.java @@ -0,0 +1,86 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import com.example.mixedtypes.statictypes.StatictypesFactory;
+import com.example.mixedtypes.statictypes.Address;
+import com.example.mixedtypes.statictypes.Customer;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
+
+public class MixedTypesTestCase extends TestCase {
+
+ private final String[] MODELS = new String[] {
+ "/mixedTypesDynamic.xsd"
+ };
+
+ private final String NS_DYNAMIC = "http://www.example.com/mixedtypes/dynamictypes";
+
+ private HelperContext scope;
+
+ public void testSetDynamicToStatic() {
+ DataFactory factory = scope.getDataFactory();
+
+ DataObject staticCustomer = factory.create(Customer.class);
+ assertTrue("The account property type has to be abstract, pre condition to this test.",
+ staticCustomer.getInstanceProperty("account").getType().isAbstract());
+
+ DataObject dynamicSavingsAccount = factory.create(NS_DYNAMIC, "SavingsAccount");
+ staticCustomer.set("account", dynamicSavingsAccount);
+ assertNotNull("The account property in the static customer has to be set",
+ ((Customer)staticCustomer).getAccount());
+ }
+
+ public void testSetStaticToDynamic() {
+ DataFactory factory = scope.getDataFactory();
+
+ DataObject dynamicSavingsAccount = factory.create(NS_DYNAMIC, "SavingsAccount");
+ DataObject staticAddress = factory.create(Address.class);
+
+ dynamicSavingsAccount.set("alternateAddress", staticAddress);
+ assertTrue("The address property on the dynamic account object has to be set",
+ dynamicSavingsAccount.isSet("alternateAddress"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ scope = SDOUtil.createHelperContext();
+
+ StatictypesFactory.INSTANCE.register(scope);
+
+ // Populate the meta data for the models
+ for (int i = 0; i < MODELS.length; i++) {
+ String model = MODELS[i];
+ URL url = getClass().getResource(model);
+ InputStream inputStream = url.openStream();
+ scope.getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+ }
+ }
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/OpenContentTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/OpenContentTestCase.java new file mode 100644 index 0000000000..cff0c3ba85 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/OpenContentTestCase.java @@ -0,0 +1,75 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import com.example.open.OneElementAndAnyAttr;
+import com.example.open.OpenFactory;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.helper.HelperContext;
+
+
+public class OpenContentTestCase extends TestCase
+{
+
+ HelperContext scope;
+
+ public void testAnyAttribute() throws IOException
+ {
+
+ OpenFactory.INSTANCE.register(scope);
+ DataObject dob = scope.getDataFactory().create(OneElementAndAnyAttr.class);
+ OneElementAndAnyAttr staticDob = (OneElementAndAnyAttr)dob;
+
+ staticDob.setName("fred");
+
+ assertEquals(1, dob.getInstanceProperties().size());
+ Sequence s = ((OneElementAndAnyAttr)dob).getAnyAttribute();
+
+ assertFalse(dob.getType().isSequenced());
+ assertTrue(dob.getType().isOpen());
+ assertNull(dob.getSequence());
+
+ Property prop = scope.getTypeHelper().getOpenContentProperty("http://www.example.com/open", "globAttribute");
+ s.add(prop, "foo");
+ assertEquals(2, dob.getInstanceProperties().size());
+ assertTrue(dob.getInstanceProperties().contains(prop));
+
+ // scope.getXMLHelper().save((DataObject)dob, "http://www.example.com/open", "bar", System.out);
+ }
+
+ protected void setUp() throws Exception {
+ scope = SDOUtil.createHelperContext();
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/SimpleStaticTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/SimpleStaticTestCase.java new file mode 100644 index 0000000000..c085245f13 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/SimpleStaticTestCase.java @@ -0,0 +1,110 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.InputStream;
+import java.math.BigDecimal;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import com.example.simple.Quote;
+import com.example.simple.SimpleFactory;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.impl.HelperProvider;
+
+
+public class SimpleStaticTestCase extends TestCase
+{
+
+ HelperContext scope;
+ /**
+ * Simple Static SDO 2 test.
+ */
+ public void testSimpleStatic()
+ {
+ try
+ {
+ Quote quote = SimpleFactory.INSTANCE.createQuote();
+
+ quote.setSymbol("fbnt");
+ quote.setCompanyName("FlyByNightTechnology");
+ quote.setPrice(new BigDecimal("1000.0"));
+ quote.setOpen1(new BigDecimal("1000.0"));
+ quote.setHigh(new BigDecimal("1000.0"));
+ quote.setLow(new BigDecimal("1000.0"));
+ quote.setVolume(1000);
+ quote.setChange1(1000);
+
+ //Quote child = (Quote)((DataObject)quote).createDataObject(8);
+ Quote child = SimpleFactory.INSTANCE.createQuote();
+ quote.getQuotes().add(child);
+ child.setPrice(new BigDecimal("2000.0"));
+
+ // scope.getXMLHelper().save((DataObject)quote, "http://www.example.com/simple", "stockQuote", System.out);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void testSimpleStaticViaDomSource() throws Exception {
+ // created for TUSCANY-2080
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+
+ java.net.URL url = getClass().getResource("/stockquote.xml");
+ InputStream inputStream = url.openStream();
+ org.w3c.dom.Document dom = builder.parse(inputStream);
+
+ // Now load from dom to object
+ DOMSource source = new DOMSource(dom);
+
+ XMLDocument xml = scope.getXMLHelper().load(source, null, null);
+ assertTrue("Root element is not an instance of the generated class", xml
+ .getRootObject() instanceof Quote);
+
+ }
+
+ protected void setUp() throws Exception {
+ scope = SDOUtil.createHelperContext();
+ SimpleFactory.INSTANCE.register(scope);
+
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+}
diff --git a/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/SubstitutionWithExtensionValuesTestCase.java b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/SubstitutionWithExtensionValuesTestCase.java new file mode 100644 index 0000000000..92cef546a6 --- /dev/null +++ b/java/sdo/tools-test/src/test/java/org/apache/tuscany/sdo/test/SubstitutionWithExtensionValuesTestCase.java @@ -0,0 +1,155 @@ +/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+
+import com.example.substitution.ev.SEVFactory;
+import com.example.substitution.ev.impl.SEVFactoryImpl;
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.impl.HelperProvider;
+
+public final class SubstitutionWithExtensionValuesTestCase extends TestCase
+{
+ private static String sev2NamespaceURI;
+ private HelperContext hc;
+ private DataObject dataObject;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ hc = HelperProvider.getDefaultContext();
+ registerSEV(hc, true);
+
+ InputStream inputStream = null;
+ URL url = getClass().getResource("/substitutionWithExtensionValues2.xsd");
+ inputStream = url.openStream();
+ List sev2TypeList = hc.getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+
+ inputStream = getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml");
+ dataObject = hc.getXMLHelper().load(inputStream).getRootObject();
+ inputStream.close();
+
+ if (sev2NamespaceURI == null)
+ {
+ sev2NamespaceURI = ((Type) sev2TypeList.get(0)).getURI();
+ }
+ }
+
+ private void registerSEV(HelperContext hc, boolean useStaticRegistration) throws IOException
+ {
+ if (useStaticRegistration)
+ {
+ SEVFactory.INSTANCE.register(hc);
+ }
+ else
+ {
+ InputStream inputStream = null;
+ URL url = getClass().getResource("/substitutionWithExtensionValues.xsd");
+ inputStream = url.openStream();
+ hc.getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+ }
+ }
+
+ public void testComplexTypeWithSubstitutionExtension() throws IOException
+ {
+ TypeHelper typeHelper = hc.getTypeHelper();
+
+ Type resultsType = typeHelper.getType(SEVFactoryImpl.NAMESPACE_URI, "ResultsType");
+ Type results2Type = typeHelper.getType(sev2NamespaceURI, "Results2Type");
+ assertTrue("Results2 type does not report Results as a base type",
+ results2Type.getBaseTypes().contains(resultsType));
+
+ assertEquals("results.1/myResult.0/id has unexpected value",
+ "BBBBBBBBBBBBBBBBBBBB", dataObject.getString("results.1/myResult.0/id"));
+ }
+
+ public void testComplexTypeWithSimpleContentExtensionMetaData()
+ {
+ TypeHelper typeHelper = hc.getTypeHelper();
+
+ Type commentType = typeHelper.getType(SEVFactoryImpl.NAMESPACE_URI, "CommentType");
+ Type myCommentType = typeHelper.getType(SEVFactoryImpl.NAMESPACE_URI, "MyCommentType");
+ Type _myCommentType = typeHelper.getType(SEVFactoryImpl.NAMESPACE_URI, "_MyCommentType");
+ Type comment2Type = typeHelper.getType(sev2NamespaceURI, "Comment2Type");
+ Type _comment2Type = typeHelper.getType(sev2NamespaceURI, "_Comment2Type");
+ assertTrue("MyComment type does not report Comment as a base type",
+ myCommentType.getBaseTypes().contains(commentType));
+ assertTrue("Comment2 type does not report Comment as a base type",
+ comment2Type.getBaseTypes().contains(commentType));
+
+ // Test length facets - resort to EMF APIs until Tuscany SDO exposes these directly
+ ExtendedMetaData extendedMetaData = ExtendedMetaData.INSTANCE;
+
+ EStructuralFeature simpleFeature = null;
+ EDataType commentSimpleType = null;
+
+ // FIXME Work-around EMF's lack of support for re-definable features - SEE TUSCANY-1832
+ commentSimpleType = (EDataType) _myCommentType;
+ assertEquals(40, extendedMetaData.getMaxLengthFacet(commentSimpleType));
+
+ // FIXME Work-around EMF's lack of support for re-definable features - SEE TUSCANY-1832
+ commentSimpleType = (EDataType) _comment2Type;
+ assertEquals(20, extendedMetaData.getMaxLengthFacet(commentSimpleType));
+ }
+
+ public void testComplexTypeWithSimpleContentExtensionChangeSummary() throws IOException
+ {
+ DataGraph dg = SDOUtil.createDataGraph();
+ SDOUtil.setRootObject(dg, dataObject);
+ dg.getChangeSummary().beginLogging();
+ dataObject.getDataObject("results.1/myResult.0").delete();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ SDOUtil.saveDataGraph(dg, baos, null);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ SDOUtil.loadDataGraph(bais, null, hc);
+ }
+
+ public void testSimpleTypeExtension()
+ {
+ TypeHelper typeHelper = hc.getTypeHelper();
+
+ Type asciiStringType = typeHelper.getType(SEVFactoryImpl.NAMESPACE_URI, "AsciiStringType");
+ Type idType = typeHelper.getType(SEVFactoryImpl.NAMESPACE_URI, "IdType");
+ assertTrue("IdType does not report AsciiStringType as a base type",
+ idType.getBaseTypes().contains(asciiStringType));
+
+ Type id2Type = typeHelper.getType(sev2NamespaceURI, "Id2Type");
+ assertTrue("Id2Type does not report IdType as a base type",
+ id2Type.getBaseTypes().contains(idType));
+ }
+}
diff --git a/java/sdo/tools-test/src/test/resources/mixedTypesDynamic.xsd b/java/sdo/tools-test/src/test/resources/mixedTypesDynamic.xsd new file mode 100644 index 0000000000..25276792fc --- /dev/null +++ b/java/sdo/tools-test/src/test/resources/mixedTypesDynamic.xsd @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <xsd:schema xmlns:dynamictypes="http://www.example.com/mixedtypes/dynamictypes"
+ xmlns:statictypes="http://www.example.com/mixedtypes/statictypes"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://www.example.com/mixedtypes/dynamictypes">
+
+ <xsd:import namespace="http://www.example.com/mixedtypes/statictypes"
+ schemaLocation="mixedtypesstatictypes.xsd" />
+
+ <xsd:complexType name="SavingsAccount">
+ <xsd:complexContent>
+ <xsd:extension base="statictypes:Account">
+ <xsd:sequence>
+ <xsd:element name="interest" type="xsd:int" />
+ <xsd:element name="alternateAddress" type="statictypes:Address" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="HomeAddress">
+ <xsd:complexContent>
+ <xsd:extension base="statictypes:Address">
+ <xsd:sequence>
+ <xsd:element name="email" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/java/sdo/tools-test/src/test/resources/stockquote.xml b/java/sdo/tools-test/src/test/resources/stockquote.xml new file mode 100644 index 0000000000..526743868d --- /dev/null +++ b/java/sdo/tools-test/src/test/resources/stockquote.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. + --> +<simple:stockQuote xmlns:simple="http://www.example.com/simple"> + <symbol>fbnt</symbol> + <companyName>FlyByNightTechnology</companyName> + <price>1000.0</price> + <open1>1000.0</open1> + <high>1000.0</high> + <low>1000.0</low> + <volume>1000.0</volume> + <change1>1000.0</change1> + <quotes> + <price>2000.0</price> + </quotes> +</simple:stockQuote>
\ No newline at end of file |