You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2008/03/31 16:55:48 UTC
svn commit: r643011 [17/23] - in
/incubator/tuscany/branches/sdo-1.1-incubating: ./
distribution/src/main/assembly/ distribution/src/main/release/bin/
distribution/src/main/release/bin/samples/
impl/src/main/java/org/apache/tuscany/sdo/helper/ impl/src...
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/TypeHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/TypeHelperTestCase.java?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/TypeHelperTestCase.java (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/TypeHelperTestCase.java Mon Mar 31 07:55:36 2008
@@ -1,45 +1,45 @@
-/**
- *
- * 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 commonj.sdo.helper.HelperContext;
-
-
-public class TypeHelperTestCase extends TestCase {
-
-
- HelperContext hc;
-
- protected void setUp() throws Exception {
- super.setUp();
- hc = SDOUtil.createHelperContext();
- }
-
- public void testGetType() {
- assertTrue(hc.getTypeHelper().getType(List.class) == null );
- }
-
-}
+/**
+ *
+ * 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 commonj.sdo.helper.HelperContext;
+
+
+public class TypeHelperTestCase extends TestCase {
+
+
+ HelperContext hc;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ hc = SDOUtil.createHelperContext();
+ }
+
+ public void testGetType() {
+ assertTrue(hc.getTypeHelper().getType(List.class) == null );
+ }
+
+}
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/TypeHelperTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLLoadOptionsTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLLoadOptionsTestCase.java?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLLoadOptionsTestCase.java (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLLoadOptionsTestCase.java Mon Mar 31 07:55:36 2008
@@ -1,192 +1,192 @@
-/**
- *
- * 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.StringReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.SDOPackage;
-import org.apache.tuscany.sdo.api.SDOHelper;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
-import org.eclipse.emf.ecore.resource.Resource;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-public class XMLLoadOptionsTestCase extends TestCase {
- XMLHelper xmlHelper;
- Map options;
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- //SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl
- public void testXMLOptionsSchema1() throws IOException{
- final String TEST_XML_DOCUMENT = "/SchemaLocationTestCase.xml";
-
- options = new HashMap();
- options.put(SDOHelper.XMLOptions.XML_LOAD_SCHEMA, Boolean.TRUE);
-
- final XMLHelper xmlHelper = SDOUtil.createHelperContext(true, options).getXMLHelper();
-
- final XMLDocument xmlDoc = xmlHelper.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT), "whatever", null);
- final DataObject root = xmlDoc.getRootObject();
- assertNotSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
- }
-
-// SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl
- public void testXMLOptionsSchema2() throws IOException{
- final String TEST_XML_DOCUMENT = "/SchemaLocationTestCase.xml";
-
- options = new HashMap();
- options.put(SDOHelper.XMLOptions.XML_LOAD_SCHEMA, Boolean.FALSE);
- final XMLHelper xmlHelper = SDOUtil.createHelperContext(true, options).getXMLHelper();
- final XMLDocument xmlDoc = xmlHelper.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT), "whatever", null);
- final DataObject root = xmlDoc.getRootObject();
- assertSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
- }
-
- public void testXMLOptionsLax1() throws IOException{
- options = new HashMap();
- /*
- * turn off default behaviour of tolerating malformed xml
- * tests using this option and bad xml should demonstrate failure to load
- */
- options.put(SDOHelper.XMLOptions.XML_LOAD_LAX_FORM, new Integer(0));
- final HelperContext hc = SDOUtil.createHelperContext(true, options);
- hc.getXSDHelper().define(
- "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">"+
- "<element name=\"root\">"+
- "<complexType>"+
- "<sequence>"+
- "<element name=\"unqualifiedElement\" type=\"string\"/>"+
- "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"+
- "</sequence>"+
- "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"+
- "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"+
- "</complexType>"+
- "</element>"+
- "</schema>");
-
- final String xml="<p:root xmlns:p=\"testNS\">"+
- "<p:unqualifiedElement/>"+
-"</p:root>";
-
- /*
- * this malformed xml will not load, as lax is forced OFF
- * changing p:unqualifiedElement to unqualifiedElement
- * will work */
- try{
- hc.getXMLHelper().load(new StringReader(xml), null, null);
- fail();
- } catch (final Resource.IOWrappedException featureNotFound) {
- assertTrue(true);
- }
-
- }
-
- public void testXMLOptionsLax2() throws IOException{
- options = new HashMap();
- /*
- * turn on default behaviour of tolerating malformed xml
- * tests using this option and bad xml will load
- */
- options.put(SDOHelper.XMLOptions.XML_LOAD_LAX_FORM, new Integer(1));
- final HelperContext hc = SDOUtil.createHelperContext(true, options);
- hc.getXSDHelper().define(
- "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">"+
- "<element name=\"root\">"+
- "<complexType>"+
- "<sequence>"+
- "<element name=\"unqualifiedElement\" type=\"string\"/>"+
- "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"+
- "</sequence>"+
- "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"+
- "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"+
- "</complexType>"+
- "</element>"+
- "</schema>");
-
- final String xml="<p:root xmlns:p=\"testNS\" p:unqualifiedAttribute=\"u\" qualifiedAttribute=\"q\">"+
- "<p:unqualifiedElement/>"+
- "<qualifiedElement/>"+
- "</p:root>";
-
- /*
- * this malformed xml will load, as lax is forced ON
- */
- assertNotNull(hc.getXMLHelper().load(new StringReader(xml), null, null).getRootObject());
- }
-
- //SDOUtil->SDOHelper->SDOHelperImpl->XMLStreamHelperImpl->XMLDocumentImpl
- public void testXMLStreamHelper() throws IOException, XMLStreamException{
- options = new HashMap();
- /*
- * turn off default behaviour of tolerating malformed xml
- * tests using this option and bad xml will load
- */
- options.put(SDOHelper.XMLOptions.XML_LOAD_LAX_FORM, new Integer(1));
- final HelperContext hc = SDOUtil.createHelperContext(false, options);
- final XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(hc);
- hc.getXSDHelper().define(
- "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">"+
- "<element name=\"root\">"+
- "<complexType>"+
- "<sequence>"+
- "<element name=\"unqualifiedElement\" type=\"string\"/>"+
- "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"+
- "</sequence>"+
- "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"+
- "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"+
- "</complexType>"+
- "</element>"+
- "</schema>");
-
- final String xml="<p:root xmlns:p=\"testNS\" p:unqualifiedAttribute=\"u\" qualifiedAttribute=\"q\">"+
- "<p:unqualifiedElement/>"+
- "<qualifiedElement/>"+
- "</p:root>";
-
- final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- final XMLStreamReader reader1 = inputFactory.createXMLStreamReader(new StringReader(xml));
- int event = reader1.getEventType();
- while (!(event == XMLStreamConstants.START_ELEMENT)){
- event = reader1.next();
- }
- final DataObject dataObject = streamHelper.loadObject(reader1);
- /*
- * this malformed xml will load, as lax is forced ON
- */
- assertNotNull(dataObject);
- }
-}
+/**
+ *
+ * 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.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.SDOPackage;
+import org.apache.tuscany.sdo.api.SDOHelper;
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.XMLStreamHelper;
+import org.eclipse.emf.ecore.resource.Resource;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class XMLLoadOptionsTestCase extends TestCase {
+ XMLHelper xmlHelper;
+ Map options;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ //SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl
+ public void testXMLOptionsSchema1() throws IOException{
+ final String TEST_XML_DOCUMENT = "/SchemaLocationTestCase.xml";
+
+ options = new HashMap();
+ options.put(SDOHelper.XMLOptions.XML_LOAD_SCHEMA, Boolean.TRUE);
+
+ final XMLHelper xmlHelper = SDOUtil.createHelperContext(true, options).getXMLHelper();
+
+ final XMLDocument xmlDoc = xmlHelper.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT), "whatever", null);
+ final DataObject root = xmlDoc.getRootObject();
+ assertNotSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
+ }
+
+// SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl
+ public void testXMLOptionsSchema2() throws IOException{
+ final String TEST_XML_DOCUMENT = "/SchemaLocationTestCase.xml";
+
+ options = new HashMap();
+ options.put(SDOHelper.XMLOptions.XML_LOAD_SCHEMA, Boolean.FALSE);
+ final XMLHelper xmlHelper = SDOUtil.createHelperContext(true, options).getXMLHelper();
+ final XMLDocument xmlDoc = xmlHelper.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT), "whatever", null);
+ final DataObject root = xmlDoc.getRootObject();
+ assertSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
+ }
+
+ public void testXMLOptionsLax1() throws IOException{
+ options = new HashMap();
+ /*
+ * turn off default behaviour of tolerating malformed xml
+ * tests using this option and bad xml should demonstrate failure to load
+ */
+ options.put(SDOHelper.XMLOptions.XML_LOAD_LAX_FORM, new Integer(0));
+ final HelperContext hc = SDOUtil.createHelperContext(true, options);
+ hc.getXSDHelper().define(
+ "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">"+
+ "<element name=\"root\">"+
+ "<complexType>"+
+ "<sequence>"+
+ "<element name=\"unqualifiedElement\" type=\"string\"/>"+
+ "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"+
+ "</sequence>"+
+ "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"+
+ "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"+
+ "</complexType>"+
+ "</element>"+
+ "</schema>");
+
+ final String xml="<p:root xmlns:p=\"testNS\">"+
+ "<p:unqualifiedElement/>"+
+"</p:root>";
+
+ /*
+ * this malformed xml will not load, as lax is forced OFF
+ * changing p:unqualifiedElement to unqualifiedElement
+ * will work */
+ try{
+ hc.getXMLHelper().load(new StringReader(xml), null, null);
+ fail();
+ } catch (final Resource.IOWrappedException featureNotFound) {
+ assertTrue(true);
+ }
+
+ }
+
+ public void testXMLOptionsLax2() throws IOException{
+ options = new HashMap();
+ /*
+ * turn on default behaviour of tolerating malformed xml
+ * tests using this option and bad xml will load
+ */
+ options.put(SDOHelper.XMLOptions.XML_LOAD_LAX_FORM, new Integer(1));
+ final HelperContext hc = SDOUtil.createHelperContext(true, options);
+ hc.getXSDHelper().define(
+ "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">"+
+ "<element name=\"root\">"+
+ "<complexType>"+
+ "<sequence>"+
+ "<element name=\"unqualifiedElement\" type=\"string\"/>"+
+ "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"+
+ "</sequence>"+
+ "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"+
+ "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"+
+ "</complexType>"+
+ "</element>"+
+ "</schema>");
+
+ final String xml="<p:root xmlns:p=\"testNS\" p:unqualifiedAttribute=\"u\" qualifiedAttribute=\"q\">"+
+ "<p:unqualifiedElement/>"+
+ "<qualifiedElement/>"+
+ "</p:root>";
+
+ /*
+ * this malformed xml will load, as lax is forced ON
+ */
+ assertNotNull(hc.getXMLHelper().load(new StringReader(xml), null, null).getRootObject());
+ }
+
+ //SDOUtil->SDOHelper->SDOHelperImpl->XMLStreamHelperImpl->XMLDocumentImpl
+ public void testXMLStreamHelper() throws IOException, XMLStreamException{
+ options = new HashMap();
+ /*
+ * turn off default behaviour of tolerating malformed xml
+ * tests using this option and bad xml will load
+ */
+ options.put(SDOHelper.XMLOptions.XML_LOAD_LAX_FORM, new Integer(1));
+ final HelperContext hc = SDOUtil.createHelperContext(false, options);
+ final XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(hc);
+ hc.getXSDHelper().define(
+ "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">"+
+ "<element name=\"root\">"+
+ "<complexType>"+
+ "<sequence>"+
+ "<element name=\"unqualifiedElement\" type=\"string\"/>"+
+ "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"+
+ "</sequence>"+
+ "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"+
+ "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"+
+ "</complexType>"+
+ "</element>"+
+ "</schema>");
+
+ final String xml="<p:root xmlns:p=\"testNS\" p:unqualifiedAttribute=\"u\" qualifiedAttribute=\"q\">"+
+ "<p:unqualifiedElement/>"+
+ "<qualifiedElement/>"+
+ "</p:root>";
+
+ final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ final XMLStreamReader reader1 = inputFactory.createXMLStreamReader(new StringReader(xml));
+ int event = reader1.getEventType();
+ while (!(event == XMLStreamConstants.START_ELEMENT)){
+ event = reader1.next();
+ }
+ final DataObject dataObject = streamHelper.loadObject(reader1);
+ /*
+ * this malformed xml will load, as lax is forced ON
+ */
+ assertNotNull(dataObject);
+ }
+}
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLLoadOptionsTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLSaveOptionsTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLSaveOptionsTestCase.java?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLSaveOptionsTestCase.java (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLSaveOptionsTestCase.java Mon Mar 31 07:55:36 2008
@@ -1,147 +1,147 @@
-/**
- *
- * 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.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.HashMap;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.api.SDOHelper;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
-
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-
-public class XMLSaveOptionsTestCase extends TestCase {
- HelperContext hc;
- private XSDHelper xsdHelper;
- XMLHelper xmlh;
- XMLStreamHelper xmlStreamHelper;
- static final String INDENT = " ", MARGIN = " ", LINE_BREAK = "\n";
- String formatted1 = MARGIN+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +LINE_BREAK+
- MARGIN+ "<cs:stockQuote xmlns:cs=\"http://www.example.com/simpleCS\">" +LINE_BREAK+
- MARGIN+INDENT+ "<symbol>FBNT</symbol>" +LINE_BREAK+
- MARGIN+INDENT+ "<companyName>FlyByNightTechnology</companyName>" +LINE_BREAK+
- MARGIN+INDENT+ "<price>999.0</price>" +LINE_BREAK+
- MARGIN+INDENT+ "<volume>1000.0</volume>" +LINE_BREAK+
- MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
- MARGIN+INDENT+INDENT+ "<price>1500.0</price>" +LINE_BREAK+
- MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
- MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
- MARGIN+INDENT+INDENT+ "<price>2500.0</price>" +LINE_BREAK+
- MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
- MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
- MARGIN+INDENT+INDENT+ "<price>3000.0</price>" +LINE_BREAK+
- MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
- MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
- MARGIN+INDENT+INDENT+ "<price>4000.0</price>" +LINE_BREAK+
- MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
- MARGIN+INDENT+ "<changes create=\"#//quotes[3] #//quotes[4]\" delete=\"#//changes/stockQuote[1]/quotes[2]\" logging=\"false\" xmlns:sdo=\"commonj.sdo\">" +LINE_BREAK+
- MARGIN+INDENT+INDENT+ "<cs:stockQuote sdo:ref=\"#/stockQuote\" sdo:unset=\"volume\">" +LINE_BREAK+
- MARGIN+INDENT+INDENT+INDENT+ "<symbol>fbnt</symbol>" +LINE_BREAK+
- MARGIN+INDENT+INDENT+INDENT+ "<price>1000.0</price>" +LINE_BREAK+
- MARGIN+INDENT+INDENT+INDENT+ "<quotes sdo:ref=\"#//quotes[1]\" />" +LINE_BREAK+
- MARGIN+INDENT+INDENT+INDENT+ "<quotes><price>2000.0</price><quotes><price>2000.99</price></quotes></quotes>" +LINE_BREAK+
- MARGIN+INDENT+INDENT+INDENT+ "<quotes sdo:ref=\"#//quotes[2]\" />" +LINE_BREAK+
- MARGIN+INDENT+INDENT+ "</cs:stockQuote>" +LINE_BREAK+
- MARGIN+INDENT+ "</changes>" +LINE_BREAK+
- MARGIN+ "</cs:stockQuote>";
-
- String formatted2 =
- //MARGIN+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>" +LINE_BREAK+
- MARGIN+ "<p0:stockQuote xmlns:p0=\"http://www.example.com/simple\">" +LINE_BREAK+
- MARGIN+INDENT+"<symbol>fbnt</symbol>" +LINE_BREAK+
- MARGIN+INDENT+"<companyName>FlyByNightTechnology</companyName>" +LINE_BREAK+
- MARGIN+INDENT+"<price>1000.0</price>" +LINE_BREAK+
- MARGIN+INDENT+"<open1>1000.0</open1>" +LINE_BREAK+
- MARGIN+INDENT+"<high>1000.0</high>" +LINE_BREAK+
- MARGIN+INDENT+"<low>1000.0</low>" +LINE_BREAK+
- MARGIN+INDENT+"<volume>1000.0</volume>" +LINE_BREAK+
- MARGIN+INDENT+"<change1>1000.0</change1>" +LINE_BREAK+
- MARGIN+"</p0:stockQuote>" +LINE_BREAK;
-
- void define(final String model) throws IOException {
- // Populate the meta data for the test model
- final URL url = getClass().getResource(model);
- xsdHelper.define(url.openStream(), url.toString());
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- //use XMLHelper
- public void testSaveXMLDocumentXMLHelper() throws IOException {
- final HashMap options = new HashMap();
- options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_INDENT, INDENT);
- options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_MARGIN, MARGIN);
- options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_LINE_BREAK, LINE_BREAK);
- hc = SDOUtil.createHelperContext(false,options);
- xsdHelper = hc.getXSDHelper();
- xmlh = hc.getXMLHelper();
-
- // Populate the meta data for the test (Stock Quote) model
- define("/simpleWithChangeSummary.xsd");
- final XMLDocument doc = xmlh.load(getClass().getResource("/simpleWithChangeSummary.xml").openStream());
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlh.save(xmlh.createDocument(doc.getRootObject(), doc.getRootElementURI(), doc.getRootElementName()), baos, null);
- assertEquals(formatted1, baos.toString());
- }
-
- //use XMLStreamHelper
- public void testSaveXMLDocumentXMLStreamHelper() throws Exception {
- final HashMap options = new HashMap();
- options.put(SDOHelper.XMLOptions.XML_LOAD_SCHEMA, Boolean.FALSE);
- options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_INDENT, INDENT);
- options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_MARGIN, MARGIN);
- options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_LINE_BREAK, LINE_BREAK);
- final HelperContext hc = SDOUtil.createHelperContext(false, options);
- xmlStreamHelper = SDOUtil.createXMLStreamHelper(hc);
-
- xsdHelper = hc.getXSDHelper();
- define("/simple.xsd");
-
- final InputStream inStrm = getClass().getResourceAsStream("/shallowquote.xml");
- final XMLDocument document = hc.getXMLHelper().load(inStrm, null, null);
-
- final XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- final StringWriter writer = new StringWriter();
- final XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
-
- xmlStreamHelper.save(document, streamWriter, null);
- streamWriter.flush();
- assertEquals(formatted2, writer.toString());
- }
-}
+/**
+ *
+ * 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.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.HashMap;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOHelper;
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.XMLStreamHelper;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+public class XMLSaveOptionsTestCase extends TestCase {
+ HelperContext hc;
+ private XSDHelper xsdHelper;
+ XMLHelper xmlh;
+ XMLStreamHelper xmlStreamHelper;
+ static final String INDENT = " ", MARGIN = " ", LINE_BREAK = "\n";
+ String formatted1 = MARGIN+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +LINE_BREAK+
+ MARGIN+ "<cs:stockQuote xmlns:cs=\"http://www.example.com/simpleCS\">" +LINE_BREAK+
+ MARGIN+INDENT+ "<symbol>FBNT</symbol>" +LINE_BREAK+
+ MARGIN+INDENT+ "<companyName>FlyByNightTechnology</companyName>" +LINE_BREAK+
+ MARGIN+INDENT+ "<price>999.0</price>" +LINE_BREAK+
+ MARGIN+INDENT+ "<volume>1000.0</volume>" +LINE_BREAK+
+ MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+ "<price>1500.0</price>" +LINE_BREAK+
+ MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
+ MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+ "<price>2500.0</price>" +LINE_BREAK+
+ MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
+ MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+ "<price>3000.0</price>" +LINE_BREAK+
+ MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
+ MARGIN+INDENT+ "<quotes>" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+ "<price>4000.0</price>" +LINE_BREAK+
+ MARGIN+INDENT+ "</quotes>" +LINE_BREAK+
+ MARGIN+INDENT+ "<changes create=\"#//quotes[3] #//quotes[4]\" delete=\"#//changes/stockQuote[1]/quotes[2]\" logging=\"false\" xmlns:sdo=\"commonj.sdo\">" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+ "<cs:stockQuote sdo:ref=\"#/stockQuote\" sdo:unset=\"volume\">" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+INDENT+ "<symbol>fbnt</symbol>" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+INDENT+ "<price>1000.0</price>" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+INDENT+ "<quotes sdo:ref=\"#//quotes[1]\" />" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+INDENT+ "<quotes><price>2000.0</price><quotes><price>2000.99</price></quotes></quotes>" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+INDENT+ "<quotes sdo:ref=\"#//quotes[2]\" />" +LINE_BREAK+
+ MARGIN+INDENT+INDENT+ "</cs:stockQuote>" +LINE_BREAK+
+ MARGIN+INDENT+ "</changes>" +LINE_BREAK+
+ MARGIN+ "</cs:stockQuote>";
+
+ String formatted2 =
+ //MARGIN+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>" +LINE_BREAK+
+ MARGIN+ "<p0:stockQuote xmlns:p0=\"http://www.example.com/simple\">" +LINE_BREAK+
+ MARGIN+INDENT+"<symbol>fbnt</symbol>" +LINE_BREAK+
+ MARGIN+INDENT+"<companyName>FlyByNightTechnology</companyName>" +LINE_BREAK+
+ MARGIN+INDENT+"<price>1000.0</price>" +LINE_BREAK+
+ MARGIN+INDENT+"<open1>1000.0</open1>" +LINE_BREAK+
+ MARGIN+INDENT+"<high>1000.0</high>" +LINE_BREAK+
+ MARGIN+INDENT+"<low>1000.0</low>" +LINE_BREAK+
+ MARGIN+INDENT+"<volume>1000.0</volume>" +LINE_BREAK+
+ MARGIN+INDENT+"<change1>1000.0</change1>" +LINE_BREAK+
+ MARGIN+"</p0:stockQuote>" +LINE_BREAK;
+
+ void define(final String model) throws IOException {
+ // Populate the meta data for the test model
+ final URL url = getClass().getResource(model);
+ xsdHelper.define(url.openStream(), url.toString());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ //use XMLHelper
+ public void testSaveXMLDocumentXMLHelper() throws IOException {
+ final HashMap options = new HashMap();
+ options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_INDENT, INDENT);
+ options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_MARGIN, MARGIN);
+ options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_LINE_BREAK, LINE_BREAK);
+ hc = SDOUtil.createHelperContext(false,options);
+ xsdHelper = hc.getXSDHelper();
+ xmlh = hc.getXMLHelper();
+
+ // Populate the meta data for the test (Stock Quote) model
+ define("/simpleWithChangeSummary.xsd");
+ final XMLDocument doc = xmlh.load(getClass().getResource("/simpleWithChangeSummary.xml").openStream());
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ xmlh.save(xmlh.createDocument(doc.getRootObject(), doc.getRootElementURI(), doc.getRootElementName()), baos, null);
+ assertEquals(formatted1, baos.toString());
+ }
+
+ //use XMLStreamHelper
+ public void testSaveXMLDocumentXMLStreamHelper() throws Exception {
+ final HashMap options = new HashMap();
+ options.put(SDOHelper.XMLOptions.XML_LOAD_SCHEMA, Boolean.FALSE);
+ options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_INDENT, INDENT);
+ options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_MARGIN, MARGIN);
+ options.put(org.apache.tuscany.sdo.api.SDOHelper.XMLOptions.XML_SAVE_LINE_BREAK, LINE_BREAK);
+ final HelperContext hc = SDOUtil.createHelperContext(false, options);
+ xmlStreamHelper = SDOUtil.createXMLStreamHelper(hc);
+
+ xsdHelper = hc.getXSDHelper();
+ define("/simple.xsd");
+
+ final InputStream inStrm = getClass().getResourceAsStream("/shallowquote.xml");
+ final XMLDocument document = hc.getXMLHelper().load(inStrm, null, null);
+
+ final XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ final StringWriter writer = new StringWriter();
+ final XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
+
+ xmlStreamHelper.save(document, streamWriter, null);
+ streamWriter.flush();
+ assertEquals(formatted2, writer.toString());
+ }
+}
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLSaveOptionsTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLUnknownPropertiesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLUnknownPropertiesTestCase.java?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLUnknownPropertiesTestCase.java (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLUnknownPropertiesTestCase.java Mon Mar 31 07:55:36 2008
@@ -1,132 +1,132 @@
-/**
- *
- * 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.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.SDOPackage;
-import org.apache.tuscany.sdo.api.SDOHelper;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-public class XMLUnknownPropertiesTestCase extends TestCase {
- XMLHelper xmlHelper;
- Map options;
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- // SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl
- public void testOptionUnknownProperties() throws IOException {
- options = new HashMap();
- options.put(SDOHelper.XMLOptions.XML_LOAD_UNKNOWN_PROPERTIES, Boolean.TRUE);
-
- final HelperContext hc = SDOUtil.createHelperContext(true);
- hc
- .getXSDHelper()
- .define("<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">" + "<element name=\"root\">"
- + "<complexType>"
- + "<sequence>"
- + "<element name=\"unqualifiedElement\" type=\"string\"/>"
- + "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"
- + "</sequence>"
- + "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"
- + "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"
- + "</complexType>"
- + "</element>"
- + "</schema>");
-
- final String xml =
- "<p:root xmlns:p=\"testNS\">" + "<unqualifiedElement/>"
- + "<telem>my test data0</telem>"
- + "<zap>my test data1</zap>"
- + "</p:root>";
-
- try {
- final XMLDocument xmlDoc = hc.getXMLHelper().load(new StringReader(xml), null, options);// pass
- // during
- // invoke
-
- final DataObject root = xmlDoc.getRootObject();
- assertNotSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- hc.getXMLHelper().save(xmlDoc, baos, null);
- assertTrue(baos.toString().indexOf("<telem>my test data0</telem>") != -1);
- assertTrue(baos.toString().indexOf("<zap>my test data1</zap>") != -1);
- } catch (final Exception e) {// (Resource.IOWrappedException featureNotFound)
- e.printStackTrace();
- }
- }
-
- public void testOptionUnknownProperties2() throws IOException {
- options = new HashMap();
- options.put(SDOHelper.XMLOptions.XML_LOAD_UNKNOWN_PROPERTIES, Boolean.FALSE);
-
- final HelperContext hc = SDOUtil.createHelperContext(true);
- hc
- .getXSDHelper()
- .define("<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">" + "<element name=\"root\">"
- + "<complexType>"
- + "<sequence>"
- + "<element name=\"unqualifiedElement\" type=\"string\"/>"
- + "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"
- + "</sequence>"
- + "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"
- + "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"
- + "</complexType>"
- + "</element>"
- + "</schema>");
-
- final String xml =
- "<p:root xmlns:p=\"testNS\">" + "<unqualifiedElement/>"
- + "<telem>my test data</telem>"
- + "<telem1>my test data</telem1>"
- + "</p:root>";
-
- try {
- final XMLDocument xmlDoc = hc.getXMLHelper().load(new StringReader(xml), null, options);// pass
- // on
- // invokation
- final DataObject root = xmlDoc.getRootObject();
- assertNotSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
- fail();
- } catch (final Exception e) {// (Resource.IOWrappedException featureNotFound)
- // e.printStackTrace();
- if (e.getMessage().indexOf("telem") != -1) {
- Assert.assertTrue(true);
- }
- }
- }
-}
+/**
+ *
+ * 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.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.SDOPackage;
+import org.apache.tuscany.sdo.api.SDOHelper;
+import org.apache.tuscany.sdo.api.SDOUtil;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class XMLUnknownPropertiesTestCase extends TestCase {
+ XMLHelper xmlHelper;
+ Map options;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ // SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl
+ public void testOptionUnknownProperties() throws IOException {
+ options = new HashMap();
+ options.put(SDOHelper.XMLOptions.XML_LOAD_UNKNOWN_PROPERTIES, Boolean.TRUE);
+
+ final HelperContext hc = SDOUtil.createHelperContext(true);
+ hc
+ .getXSDHelper()
+ .define("<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">" + "<element name=\"root\">"
+ + "<complexType>"
+ + "<sequence>"
+ + "<element name=\"unqualifiedElement\" type=\"string\"/>"
+ + "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"
+ + "</sequence>"
+ + "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"
+ + "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"
+ + "</complexType>"
+ + "</element>"
+ + "</schema>");
+
+ final String xml =
+ "<p:root xmlns:p=\"testNS\">" + "<unqualifiedElement/>"
+ + "<telem>my test data0</telem>"
+ + "<zap>my test data1</zap>"
+ + "</p:root>";
+
+ try {
+ final XMLDocument xmlDoc = hc.getXMLHelper().load(new StringReader(xml), null, options);// pass
+ // during
+ // invoke
+
+ final DataObject root = xmlDoc.getRootObject();
+ assertNotSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ hc.getXMLHelper().save(xmlDoc, baos, null);
+ assertTrue(baos.toString().indexOf("<telem>my test data0</telem>") != -1);
+ assertTrue(baos.toString().indexOf("<zap>my test data1</zap>") != -1);
+ } catch (final Exception e) {// (Resource.IOWrappedException featureNotFound)
+ e.printStackTrace();
+ }
+ }
+
+ public void testOptionUnknownProperties2() throws IOException {
+ options = new HashMap();
+ options.put(SDOHelper.XMLOptions.XML_LOAD_UNKNOWN_PROPERTIES, Boolean.FALSE);
+
+ final HelperContext hc = SDOUtil.createHelperContext(true);
+ hc
+ .getXSDHelper()
+ .define("<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"testNS\">" + "<element name=\"root\">"
+ + "<complexType>"
+ + "<sequence>"
+ + "<element name=\"unqualifiedElement\" type=\"string\"/>"
+ + "<element name=\"qualifiedElement\" form=\"qualified\" type=\"string\"/>"
+ + "</sequence>"
+ + "<attribute name=\"unqualifiedAttribute\" type=\"string\"/>"
+ + "<attribute name=\"qualifiedAttribute\" form=\"qualified\" type=\"string\"/>"
+ + "</complexType>"
+ + "</element>"
+ + "</schema>");
+
+ final String xml =
+ "<p:root xmlns:p=\"testNS\">" + "<unqualifiedElement/>"
+ + "<telem>my test data</telem>"
+ + "<telem1>my test data</telem1>"
+ + "</p:root>";
+
+ try {
+ final XMLDocument xmlDoc = hc.getXMLHelper().load(new StringReader(xml), null, options);// pass
+ // on
+ // invokation
+ final DataObject root = xmlDoc.getRootObject();
+ assertNotSame(root.getType(), SDOPackage.eINSTANCE.getAnyTypeDataObject());
+ fail();
+ } catch (final Exception e) {// (Resource.IOWrappedException featureNotFound)
+ // e.printStackTrace();
+ if (e.getMessage().indexOf("telem") != -1) {
+ Assert.assertTrue(true);
+ }
+ }
+ }
+}
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/java/org/apache/tuscany/sdo/test/XMLUnknownPropertiesTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/TypePropertyMetadataInfo.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/TypePropertyMetadataInfo.xsd?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/TypePropertyMetadataInfo.xsd (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/TypePropertyMetadataInfo.xsd Mon Mar 31 07:55:36 2008
@@ -1,97 +1,97 @@
-<?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"
- targetNamespace="http://www.example.com/metadata/retrievaltest"
- xmlns:metadata="http://www.example.com/metadata/retrievaltest">
-
-<annotation>
- <appinfo source="http://www.example.com/metadata/annotation">
- <p1:annotationSet xmlns:p1="http://www.example.com/metadata/annotation" name="test"/>
- </appinfo>
-</annotation>
-
-<complexType name="Example">
- <annotation>
- <appinfo source="http://www.example.com/metadata/annotation">
- <p1:example xmlns:p1="http://www.example.com/metadata/annotation">
- <p1:picture>forest.jpg</p1:picture>
- </p1:example>
- </appinfo>
- </annotation>
-
- <sequence>
- <element name="number" type="integer" minOccurs="0" maxOccurs="1">
- <annotation>
- <appinfo source="http://www.example.com/metadata/annotation">
- <p1:AttributeTypeMetadata xmlns:p1="http://www.example.com/metadata/annotation">
- <p1:getter>getNumber</p1:getter>
- <p1:setter>setNumber</p1:setter>
- </p1:AttributeTypeMetadata>
- </appinfo>
- </annotation>
- </element>
-
- <element name="Exampletype" type="string">
- <annotation>
- <appinfo source="http://www.example.com/metadata/annotation">
- <p1:AttributeTypeMetadata xmlns:p1="http://www.example.com/metadata/annotation">
- <p1:getter>getPhonetype</p1:getter>
- <p1:setter>setPhonetype</p1:setter>
- </p1:AttributeTypeMetadata>
- </appinfo>
- </annotation>
- </element>
- </sequence>
-</complexType>
-
-<simpleType name="ExampleNumber">
- <annotation>
- <appinfo source="http://www.example.com/metadata/annotation">
- This is the metadata for defining the ExampleNumber type.
- </appinfo>
- </annotation>
- <restriction base="integer">
- <minInclusive value="1"/>
- <maxInclusive value="29035"/>
- </restriction>
-</simpleType>
-
-<simpleType name="PhoneNumber">
- <annotation>
- <appinfo source="http://www.example.com/metadata/annotation">
- This is the metadata for defining the PhoneNumber type.
- </appinfo>
- </annotation>
- <restriction base="string">
- <length value="8"/>
- <pattern value="\d{3}-\d{4}"/>
- <pattern value="\d{6}-\d{8}"/>
- </restriction>
-</simpleType>
-
-<simpleType name="ExampleRating">
- <restriction base="string">
- <enumeration value=""/>
- <enumeration value="Good"/>
- <enumeration value="Bad"/>
- </restriction>
-</simpleType>
-
-</schema>
+<?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"
+ targetNamespace="http://www.example.com/metadata/retrievaltest"
+ xmlns:metadata="http://www.example.com/metadata/retrievaltest">
+
+<annotation>
+ <appinfo source="http://www.example.com/metadata/annotation">
+ <p1:annotationSet xmlns:p1="http://www.example.com/metadata/annotation" name="test"/>
+ </appinfo>
+</annotation>
+
+<complexType name="Example">
+ <annotation>
+ <appinfo source="http://www.example.com/metadata/annotation">
+ <p1:example xmlns:p1="http://www.example.com/metadata/annotation">
+ <p1:picture>forest.jpg</p1:picture>
+ </p1:example>
+ </appinfo>
+ </annotation>
+
+ <sequence>
+ <element name="number" type="integer" minOccurs="0" maxOccurs="1">
+ <annotation>
+ <appinfo source="http://www.example.com/metadata/annotation">
+ <p1:AttributeTypeMetadata xmlns:p1="http://www.example.com/metadata/annotation">
+ <p1:getter>getNumber</p1:getter>
+ <p1:setter>setNumber</p1:setter>
+ </p1:AttributeTypeMetadata>
+ </appinfo>
+ </annotation>
+ </element>
+
+ <element name="Exampletype" type="string">
+ <annotation>
+ <appinfo source="http://www.example.com/metadata/annotation">
+ <p1:AttributeTypeMetadata xmlns:p1="http://www.example.com/metadata/annotation">
+ <p1:getter>getPhonetype</p1:getter>
+ <p1:setter>setPhonetype</p1:setter>
+ </p1:AttributeTypeMetadata>
+ </appinfo>
+ </annotation>
+ </element>
+ </sequence>
+</complexType>
+
+<simpleType name="ExampleNumber">
+ <annotation>
+ <appinfo source="http://www.example.com/metadata/annotation">
+ This is the metadata for defining the ExampleNumber type.
+ </appinfo>
+ </annotation>
+ <restriction base="integer">
+ <minInclusive value="1"/>
+ <maxInclusive value="29035"/>
+ </restriction>
+</simpleType>
+
+<simpleType name="PhoneNumber">
+ <annotation>
+ <appinfo source="http://www.example.com/metadata/annotation">
+ This is the metadata for defining the PhoneNumber type.
+ </appinfo>
+ </annotation>
+ <restriction base="string">
+ <length value="8"/>
+ <pattern value="\d{3}-\d{4}"/>
+ <pattern value="\d{6}-\d{8}"/>
+ </restriction>
+</simpleType>
+
+<simpleType name="ExampleRating">
+ <restriction base="string">
+ <enumeration value=""/>
+ <enumeration value="Good"/>
+ <enumeration value="Bad"/>
+ </restriction>
+</simpleType>
+
+</schema>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/TypePropertyMetadataInfo.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/bounds.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/bounds.xsd?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/bounds.xsd (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/bounds.xsd Mon Mar 31 07:55:36 2008
@@ -1,45 +1,45 @@
-<?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:bounds="http://www.example.com/bounds"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.example.com/bounds">
-
- <xsd:element name="price" type="xsd:decimal"/>
-
- <xsd:complexType name="OpenQuote">
- <xsd:sequence>
- <xsd:element name="symbol" type="xsd:string" maxOccurs="2" minOccurs="0" />
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="OpenQuote2">
- <xsd:sequence>
- <xsd:element name="symbol" type="xsd:string" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="OpenQuote3">
- <xsd:sequence>
- <xsd:element name="symbol" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
+<?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:bounds="http://www.example.com/bounds"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.com/bounds">
+
+ <xsd:element name="price" type="xsd:decimal"/>
+
+ <xsd:complexType name="OpenQuote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string" maxOccurs="2" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="OpenQuote2">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="OpenQuote3">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/bounds.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/dupelement.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/dupelement.xsd?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/dupelement.xsd (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/dupelement.xsd Mon Mar 31 07:55:36 2008
@@ -1,39 +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.
- -->
-<xsd:schema
- targetNamespace="http://www.example.com/dupelement"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:simple="http://www.example.com/dupelement"
- xmlns:sdoXML="commonj.sdo/xml">
-
- <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="companyName" type="xsd:int" sdoXML:aliasName="companyNameInInt"/>
- <xsd:element name="quotes" type="simple:Quote" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
-
- <xsd:attribute name="symbol" type="xsd:int" sdoXML:aliasName="symbolInInt"/>
- </xsd:complexType>
-
-</xsd:schema>
+<?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/dupelement"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:simple="http://www.example.com/dupelement"
+ xmlns:sdoXML="commonj.sdo/xml">
+
+ <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="companyName" type="xsd:int" sdoXML:aliasName="companyNameInInt"/>
+ <xsd:element name="quotes" type="simple:Quote" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="symbol" type="xsd:int" sdoXML:aliasName="symbolInInt"/>
+ </xsd:complexType>
+
+</xsd:schema>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/dupelement.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/expectedExceptions.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/expectedExceptions.xsd?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/expectedExceptions.xsd (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/expectedExceptions.xsd Mon Mar 31 07:55:36 2008
@@ -1,67 +1,67 @@
-<?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"
- xmlns:sdo="commonj.sdo"
- xmlns:sdoXML="commonj.sdo/xml"
- xmlns:expect="http://example.com/ExpectedException"
- targetNamespace="http://example.com/ExpectedException">
-
- <xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/>
- <xsd:import namespace="commonj.sdo/xml" schemaLocation="sdoModel.xsd"/>
-
- <xsd:element name="expectedExceptionsElem" type="expect:ExpectedExceptionType"/>
-
- <xsd:complexType name="ExpectedExceptionType">
- <xsd:sequence>
- <xsd:element name="stringVal" type="xsd:string"/>
- <xsd:element name="booleanVal" type="xsd:boolean"/>
- <xsd:element name="byteVal" type="xsd:byte"/>
- <xsd:element name="decimalVal" type="xsd:decimal"/>
- <xsd:element name="intVal" type="xsd:int"/>
- <xsd:element name="floatVal" type="xsd:float"/>
- <xsd:element name="doubleVal" type="xsd:double"/>
- <xsd:element name="dateVal" type="xsd:dateTime"/>
- <xsd:element name="shortVal" type="xsd:short"/>
- <xsd:element name="longVal" type="xsd:long"/>
- <xsd:element maxOccurs="unbounded" minOccurs="0" name="listVal" type="xsd:string"/>
- <xsd:element name="bytesVal" type="xsd:hexBinary"/>
- <xsd:element name="integerVal" type="xsd:integer"/>
- <xsd:element name="charVal" type="expect:char"/>
- <xsd:element name="readOnlyVal" sdoXML:readOnly="true" type="xsd:string"/>
- <xsd:element name="readOnlyListVal" sdoXML:readOnly="true" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:simpleType name="char">
- <xsd:restriction base="xsd:string">
- <xsd:length value="1"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:element name="sequencedReadOnlyElem" type="expect:SequenceReadOnlyType"/>
-
- <xsd:complexType mixed="true" name="SequenceReadOnlyType">
- <xsd:sequence>
- <xsd:element name="readOnlyVal" sdoXML:readOnly="true" type="xsd:string"/>
- <xsd:element name="readOnlyListVal" sdoXML:readOnly = "true" type="xsd:string"/>
- <xsd:element name="uniqueName" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-</xsd:schema>
+<?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"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoXML="commonj.sdo/xml"
+ xmlns:expect="http://example.com/ExpectedException"
+ targetNamespace="http://example.com/ExpectedException">
+
+ <xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/>
+ <xsd:import namespace="commonj.sdo/xml" schemaLocation="sdoModel.xsd"/>
+
+ <xsd:element name="expectedExceptionsElem" type="expect:ExpectedExceptionType"/>
+
+ <xsd:complexType name="ExpectedExceptionType">
+ <xsd:sequence>
+ <xsd:element name="stringVal" type="xsd:string"/>
+ <xsd:element name="booleanVal" type="xsd:boolean"/>
+ <xsd:element name="byteVal" type="xsd:byte"/>
+ <xsd:element name="decimalVal" type="xsd:decimal"/>
+ <xsd:element name="intVal" type="xsd:int"/>
+ <xsd:element name="floatVal" type="xsd:float"/>
+ <xsd:element name="doubleVal" type="xsd:double"/>
+ <xsd:element name="dateVal" type="xsd:dateTime"/>
+ <xsd:element name="shortVal" type="xsd:short"/>
+ <xsd:element name="longVal" type="xsd:long"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="listVal" type="xsd:string"/>
+ <xsd:element name="bytesVal" type="xsd:hexBinary"/>
+ <xsd:element name="integerVal" type="xsd:integer"/>
+ <xsd:element name="charVal" type="expect:char"/>
+ <xsd:element name="readOnlyVal" sdoXML:readOnly="true" type="xsd:string"/>
+ <xsd:element name="readOnlyListVal" sdoXML:readOnly="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:simpleType name="char">
+ <xsd:restriction base="xsd:string">
+ <xsd:length value="1"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:element name="sequencedReadOnlyElem" type="expect:SequenceReadOnlyType"/>
+
+ <xsd:complexType mixed="true" name="SequenceReadOnlyType">
+ <xsd:sequence>
+ <xsd:element name="readOnlyVal" sdoXML:readOnly="true" type="xsd:string"/>
+ <xsd:element name="readOnlyListVal" sdoXML:readOnly = "true" type="xsd:string"/>
+ <xsd:element name="uniqueName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/expectedExceptions.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/openContentProperty.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/openContentProperty.xml?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/openContentProperty.xml (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/openContentProperty.xml Mon Mar 31 07:55:36 2008
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="ASCII"?>
-<open:openStockQuote xmlns:open="http://www.example.com/open">
- <symbol>s1</symbol>
- <open:company>
- <name>FlyByNightTechnology</name>
- </open:company>
- <open:price>1000.0</open:price>
- <open:highPrice>1100.0</open:highPrice>
- <open:mutualFundQuote>
- <symbol>mutual-1</symbol>
- </open:mutualFundQuote>
+<?xml version="1.0" encoding="ASCII"?>
+<open:openStockQuote xmlns:open="http://www.example.com/open">
+ <symbol>s1</symbol>
+ <open:company>
+ <name>FlyByNightTechnology</name>
+ </open:company>
+ <open:price>1000.0</open:price>
+ <open:highPrice>1100.0</open:highPrice>
+ <open:mutualFundQuote>
+ <symbol>mutual-1</symbol>
+ </open:mutualFundQuote>
</open:openStockQuote>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/openContentProperty.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/sdoModel.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/sdoModel.xsd?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/sdoModel.xsd (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/sdoModel.xsd Mon Mar 31 07:55:36 2008
@@ -1,28 +1,28 @@
-<?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" xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" targetNamespace="commonj.sdo">
-
- <!-- Dummy XSD definition of special SDO ChangeSummaryType -->
- <xsd:simpleType name="ChangeSummaryType" sdoJava:instanceClass="commonj.sdo.ChangeSummary">
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
-
-</xsd:schema>
+<?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" xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" targetNamespace="commonj.sdo">
+
+ <!-- Dummy XSD definition of special SDO ChangeSummaryType -->
+ <xsd:simpleType name="ChangeSummaryType" sdoJava:instanceClass="commonj.sdo.ChangeSummary">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+
+</xsd:schema>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/sdoModel.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/shallowquote1.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/shallowquote1.xml?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/shallowquote1.xml (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/shallowquote1.xml Mon Mar 31 07:55:36 2008
@@ -1,29 +1,29 @@
-<?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.
--->
-<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>
- </simple:stockQuote>
+<?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.
+-->
+<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>
+ </simple:stockQuote>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/shallowquote1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simple2.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simple2.xsd?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simple2.xsd (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simple2.xsd Mon Mar 31 07:55:36 2008
@@ -1,41 +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
- "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:simple="http://www.example.com/simple" xmlns:simple2="http://www.example.com/simple2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/simple2">
-
- <xsd:import namespace="http://www.example.com/simple"/>
-
- <xsd:element name="stockQuote" type="simple2:Quote2"/>
-
- <xsd:complexType name="Quote2">
- <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"/>
- <!-- temporarily removing this until we find a way to do this test without causing eclipse to light up
- due to missing import -->
- <!-- <xsd:element maxOccurs="unbounded" minOccurs="0" name="quotes" type="simple:Quote"/> -->
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
+<?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
+ "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:simple="http://www.example.com/simple" xmlns:simple2="http://www.example.com/simple2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/simple2">
+
+ <xsd:import namespace="http://www.example.com/simple"/>
+
+ <xsd:element name="stockQuote" type="simple2:Quote2"/>
+
+ <xsd:complexType name="Quote2">
+ <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"/>
+ <!-- temporarily removing this until we find a way to do this test without causing eclipse to light up
+ due to missing import -->
+ <!-- <xsd:element maxOccurs="unbounded" minOccurs="0" name="quotes" type="simple:Quote"/> -->
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simple2.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummary.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummary.xml?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummary.xml (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummary.xml Mon Mar 31 07:55:36 2008
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="ASCII"?>
-<cs:stockQuote xmlns:cs="http://www.example.com/simpleCS">
- <symbol>FBNT</symbol>
- <companyName>FlyByNightTechnology</companyName>
- <price>999.0</price>
- <volume>1000.0</volume>
- <quotes>
- <price>1500.0</price>
- </quotes>
- <quotes>
- <price>2500.0</price>
- </quotes>
- <quotes>
- <price>3000.0</price>
- </quotes>
- <quotes>
- <price>4000.0</price>
- </quotes>
- <changes create="#//quotes[3] #//quotes[4]" delete="#//changes/stockQuote[1]/quotes[2]" logging="false" xmlns:sdo="commonj.sdo">
- <cs:stockQuote sdo:ref="#/stockQuote" sdo:unset="volume">
- <symbol>fbnt</symbol>
- <price>1000.0</price>
- <quotes sdo:ref="#//quotes[1]" />
- <quotes><price>2000.0</price><quotes><price>2000.99</price></quotes></quotes>
- <quotes sdo:ref="#//quotes[2]" />
- </cs:stockQuote>
- </changes>
+<?xml version="1.0" encoding="ASCII"?>
+<cs:stockQuote xmlns:cs="http://www.example.com/simpleCS">
+ <symbol>FBNT</symbol>
+ <companyName>FlyByNightTechnology</companyName>
+ <price>999.0</price>
+ <volume>1000.0</volume>
+ <quotes>
+ <price>1500.0</price>
+ </quotes>
+ <quotes>
+ <price>2500.0</price>
+ </quotes>
+ <quotes>
+ <price>3000.0</price>
+ </quotes>
+ <quotes>
+ <price>4000.0</price>
+ </quotes>
+ <changes create="#//quotes[3] #//quotes[4]" delete="#//changes/stockQuote[1]/quotes[2]" logging="false" xmlns:sdo="commonj.sdo">
+ <cs:stockQuote sdo:ref="#/stockQuote" sdo:unset="volume">
+ <symbol>fbnt</symbol>
+ <price>1000.0</price>
+ <quotes sdo:ref="#//quotes[1]" />
+ <quotes><price>2000.0</price><quotes><price>2000.99</price></quotes></quotes>
+ <quotes sdo:ref="#//quotes[2]" />
+ </cs:stockQuote>
+ </changes>
</cs:stockQuote>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummary.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummaryUndone.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummaryUndone.xml?rev=643011&r1=643010&r2=643011&view=diff
==============================================================================
--- incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummaryUndone.xml (original)
+++ incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummaryUndone.xml Mon Mar 31 07:55:36 2008
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="ASCII"?>
-<cs:stockQuote xmlns:cs="http://www.example.com/simpleCS">
- <symbol>fbnt</symbol>
- <companyName>FlyByNightTechnology</companyName>
- <price>1000.0</price>
- <quotes>
- <price>1500.0</price>
- </quotes>
- <quotes>
- <price>2000.0</price>
- <quotes>
- <price>2000.99</price>
- </quotes>
- </quotes>
- <quotes>
- <price>2500.0</price>
- </quotes>
- <changes logging="false" />
+<?xml version="1.0" encoding="ASCII"?>
+<cs:stockQuote xmlns:cs="http://www.example.com/simpleCS">
+ <symbol>fbnt</symbol>
+ <companyName>FlyByNightTechnology</companyName>
+ <price>1000.0</price>
+ <quotes>
+ <price>1500.0</price>
+ </quotes>
+ <quotes>
+ <price>2000.0</price>
+ <quotes>
+ <price>2000.99</price>
+ </quotes>
+ </quotes>
+ <quotes>
+ <price>2500.0</price>
+ </quotes>
+ <changes logging="false" />
</cs:stockQuote>
Propchange: incubator/tuscany/branches/sdo-1.1-incubating/impl/src/test/resources/simpleWithChangeSummaryUndone.xml
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org