diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:11:48 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:11:48 +0000 |
commit | ece4fd35da7b7fc76264776f81705e6b5b52d3e0 (patch) | |
tree | 962794e2a2b1ab91a02c41e4927a527cade83959 /branches/java-post-M1/sdo/impl/src/test | |
parent | 76e9f96ca7f494088fe3af5a46ad0d153e961008 (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/java-post-M1/sdo/impl/src/test')
48 files changed, 0 insertions, 3477 deletions
diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar1.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar1.java deleted file mode 100644 index f862837715..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar1.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.codegen; - -/** - * @version $Rev$ $Date$ - */ -public interface Bar1 { -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar2.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar2.java deleted file mode 100644 index 35a878015f..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar2.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.codegen; - -/** - * @version $Rev$ $Date$ - */ -public interface Bar2 { -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGeneratorTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGeneratorTestCase.java deleted file mode 100644 index 7c64a42ab3..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGeneratorTestCase.java +++ /dev/null @@ -1,164 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.codegen; - -import java.lang.reflect.Method; -import java.util.List; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class BytecodeInterfaceGeneratorTestCase extends TestCase { - private MockType foo; - private BytecodeInterfaceGenerator gen; - private TestClassLoader cl; - - public void testHeaderNoBaseClass() { - gen.visitType(foo); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals("Foo", c.getName()); - assertTrue(c.isInterface()); - assertEquals(0, c.getInterfaces().length); - assertEquals(0, c.getMethods().length); - } - - public void testHeaderWithPackage() { - gen.visitType(new MockType("org.apache.Foo", null)); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals("org.apache.Foo", c.getName()); - assertEquals(0, c.getInterfaces().length); - assertEquals(0, c.getMethods().length); - } - - public void testHeaderOneBaseClass() throws NoJavaImplementationException { - foo.addBaseType(new MockType("bar1", Bar1.class)); - gen.visitType(foo); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals("Foo", c.getName()); - assertEquals(1, c.getInterfaces().length); - assertEquals(Bar1.class, c.getInterfaces()[0]); - assertEquals(0, c.getMethods().length); - } - - public void testHeaderMultipleBaseClass() throws NoJavaImplementationException { - foo.addBaseType(new MockType("bar1", Bar1.class)); - foo.addBaseType(new MockType("bar2", Bar2.class)); - gen.visitType(foo); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals("Foo", c.getName()); - assertEquals(2, c.getInterfaces().length); - assertEquals(Bar1.class, c.getInterfaces()[0]); - assertEquals(Bar2.class, c.getInterfaces()[1]); - assertEquals(0, c.getMethods().length); - } - - public void testBooleanProperty() throws NoJavaImplementationException, NoSuchMethodException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals(2, c.getMethods().length); - Method getter = c.getMethod("isTrue", new Class[0]); - assertEquals(boolean.class, getter.getReturnType()); - Method setter = c.getMethod("setTrue", new Class[] {boolean.class}); - assertEquals(void.class, setter.getReturnType()); - } - - public void testByteArrayProperty() throws NoJavaImplementationException, NoSuchMethodException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("bytes", byte[].class, false, false)); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals(2, c.getMethods().length); - Method getter = c.getMethod("getBytes", new Class[0]); - assertEquals(byte[].class, getter.getReturnType()); - Method setter = c.getMethod("setBytes", new Class[] {byte[].class}); - assertEquals(void.class, setter.getReturnType()); - } - - public void testObjectProperty() throws NoJavaImplementationException, NoSuchMethodException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("bar", Bar1.class, false, false)); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals(2, c.getMethods().length); - Method getter = c.getMethod("getBar", new Class[0]); - assertEquals(Bar1.class, getter.getReturnType()); - Method setter = c.getMethod("setBar", new Class[] {Bar1.class}); - assertEquals(void.class, setter.getReturnType()); - } - - public void testReadOnlyProperty() throws NoJavaImplementationException, NoSuchMethodException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("int", Integer.TYPE, false, true)); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals(1, c.getMethods().length); - Method getter = c.getMethod("getInt", new Class[0]); - assertEquals(int.class, getter.getReturnType()); - } - - public void testManyProperty() throws NoJavaImplementationException, NoSuchMethodException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("list", Integer.TYPE, true, false)); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals(1, c.getMethods().length); - Method getter = c.getMethod("getList", new Class[0]); - assertEquals(List.class, getter.getReturnType()); - } - - public void testTwoProperties() throws NoJavaImplementationException, NoSuchMethodException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); - gen.visitProperty(new MockProperty("int", Integer.TYPE, false, false)); - gen.visitEnd(); - Class c = cl.addClass(gen.getClassData()); - assertEquals(4, c.getMethods().length); - Method getter = c.getMethod("isTrue", new Class[0]); - assertEquals(boolean.class, getter.getReturnType()); - Method setter = c.getMethod("setTrue", new Class[] {boolean.class}); - assertEquals(void.class, setter.getReturnType()); - getter = c.getMethod("getInt", new Class[0]); - assertEquals(int.class, getter.getReturnType()); - setter = c.getMethod("setInt", new Class[] {int.class}); - assertEquals(void.class, setter.getReturnType()); - } - - protected void setUp() throws Exception { - super.setUp(); - foo = new MockType("foo", null); - gen = new BytecodeInterfaceGenerator(); - cl = new TestClassLoader(); - } - - private class TestClassLoader extends ClassLoader { - public TestClassLoader() { - super(TestClassLoader.class.getClassLoader()); - } - - Class addClass(byte[] bytes) { - return defineClass(null, bytes, 0, bytes.length); - } - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Foo.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Foo.java deleted file mode 100644 index 6a401d48bb..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Foo.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.codegen; - -/** - * @version $Rev$ $Date$ - */ -public interface Foo { -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGeneratorTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGeneratorTestCase.java deleted file mode 100644 index 9d67b61317..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGeneratorTestCase.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.codegen; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import junit.framework.TestCase; - -/** - * @version $Rev$ $Date$ - */ -public class JavaInterfaceGeneratorTestCase extends TestCase { - private static final String SEP = System.getProperty("line.separator"); - - private JavaInterfaceGenerator gen; - private StringWriter writer; - private MockType foo; - - public void testHeaderNoBaseClass() { - gen.visitType(foo); - gen.visitEnd(); - assertEquals(localize("public interface Foo {\n}\n"), writer.toString()); - } - - public void testHeaderWithPackage() { - gen.visitType(new MockType("org.apache.Foo", null)); - gen.visitEnd(); - assertEquals(localize("package org.apache;\n\npublic interface Foo {\n}\n"), writer.toString()); - } - - public void testHeaderOneBaseClass() throws NoJavaImplementationException { - foo.addBaseType(new MockType("bar1", Bar1.class)); - gen.visitType(foo); - gen.visitEnd(); - assertEquals(localize("public interface Foo extends org.apache.tuscany.sdo.codegen.Bar1 {\n}\n"), writer.toString()); - } - - public void testHeaderMultipleBaseClass() throws NoJavaImplementationException { - foo.addBaseType(new MockType("bar1", Bar1.class)); - foo.addBaseType(new MockType("bar2", Bar2.class)); - gen.visitType(foo); - gen.visitEnd(); - assertEquals(localize("public interface Foo extends org.apache.tuscany.sdo.codegen.Bar1, org.apache.tuscany.sdo.codegen.Bar2 {\n}\n"), writer.toString()); - } - - public void testBooleanProperty() throws NoJavaImplementationException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); - gen.visitEnd(); - assertEquals(localize("public interface Foo {\n\tboolean isTrue();\n\tvoid setTrue(boolean value);\n}\n"), writer.toString()); - } - - public void testByteArrayProperty() throws NoJavaImplementationException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("bytes", byte[].class, false, false)); - gen.visitEnd(); - assertEquals(localize("public interface Foo {\n\tbyte[] getBytes();\n\tvoid setBytes(byte[] value);\n}\n"), writer.toString()); - } - - public void testObjectProperty() throws NoJavaImplementationException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("bar", Bar1.class, false, false)); - gen.visitEnd(); - assertEquals(localize("public interface Foo {\n\torg.apache.tuscany.sdo.codegen.Bar1 getBar();\n\tvoid setBar(org.apache.tuscany.sdo.codegen.Bar1 value);\n}\n"), writer.toString()); - } - - public void testReadOnlyProperty() throws NoJavaImplementationException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("int", Integer.TYPE, false, true)); - gen.visitEnd(); - assertEquals(localize("public interface Foo {\n\tint getInt();\n}\n"), writer.toString()); - } - - public void testManyProperty() throws NoJavaImplementationException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("list", Integer.TYPE, true, false)); - gen.visitEnd(); - assertEquals(localize("public interface Foo {\n\tjava.util.List getList();\n}\n"), writer.toString()); - } - - public void testTwoProperties() throws NoJavaImplementationException { - gen.visitType(foo); - gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); - gen.visitProperty(new MockProperty("int", Integer.TYPE, false, false)); - gen.visitEnd(); - assertEquals(localize("public interface Foo {\n\tboolean isTrue();\n\tvoid setTrue(boolean value);\n\tint getInt();\n\tvoid setInt(int value);\n}\n"), writer.toString()); - } - - protected void setUp() throws Exception { - super.setUp(); - writer = new StringWriter(); - gen = new JavaInterfaceGenerator(new PrintWriter(writer)); - foo = new MockType("foo", null); - } - - private String localize(String s) { - StringBuffer b = new StringBuffer(s.length() + s.length()/10); - for (int i = 0; i < s.length(); i++) { - char ch = s.charAt(i); - if (ch == '\t') { - b.append(" "); - } else if (ch == '\n') { - b.append(SEP); - } else { - b.append(ch); - } - } - return b.toString(); - } - -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockProperty.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockProperty.java deleted file mode 100644 index 5cee856217..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockProperty.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.codegen; - -import java.util.List; - -import commonj.sdo.Property; -import commonj.sdo.Type; - -/** - * @version $Rev$ $Date$ - */ -class MockProperty implements Property { - private final String name; - private final Type type; - private final boolean many; - private final boolean readOnly; - - public MockProperty(String name, Class type, boolean many, boolean readOnly) { - this.name = name; - this.type = new MockType(null, type); - this.many = many; - this.readOnly = readOnly; - } - - public String getName() { - return name; - } - - public Type getType() { - return type; - } - - public boolean isMany() { - return many; - } - - public boolean isContainment() { - throw new UnsupportedOperationException(); - } - - public Type getContainingType() { - throw new UnsupportedOperationException(); - } - - public Object getDefault() { - throw new UnsupportedOperationException(); - } - - public boolean isReadOnly() { - return readOnly; - } - - public Property getOpposite() { - throw new UnsupportedOperationException(); - } - - public List /*String*/ getAliasNames() { - throw new UnsupportedOperationException(); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockType.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockType.java deleted file mode 100644 index 209d7021c0..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockType.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.codegen; - -import java.util.List; -import java.util.ArrayList; - -import commonj.sdo.Type; -import commonj.sdo.Property; - -/** - * @version $Rev$ $Date$ - */ -class MockType implements Type { - private final String name; - private final Class javaClass; - private final List baseTypes = new ArrayList(); - - public MockType(String name, Class javaClass) { - this.javaClass = javaClass; - this.name = name; - } - - public void addBaseType(Type baseType) { - baseTypes.add(baseType); - } - - public String getName() { - return name; - } - - public String getURI() { - throw new UnsupportedOperationException(); - } - - public Class getInstanceClass() { - return javaClass; - } - - public boolean isInstance(Object object) { - throw new UnsupportedOperationException(); - } - - public List /*Property*/ getProperties() { - throw new UnsupportedOperationException(); - } - - public Property getProperty(String propertyName) { - throw new UnsupportedOperationException(); - } - - public boolean isDataType() { - throw new UnsupportedOperationException(); - } - - public boolean isOpen() { - throw new UnsupportedOperationException(); - } - - public boolean isSequenced() { - throw new UnsupportedOperationException(); - } - - public boolean isAbstract() { - throw new UnsupportedOperationException(); - } - - public List /*Type*/ getBaseTypes() { - return baseTypes; - } - - public List /*Property*/ getDeclaredProperties() { - throw new UnsupportedOperationException(); - } - - public List /*String*/ getAliasNames() { - throw new UnsupportedOperationException(); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryTestCase.java deleted file mode 100644 index 4cc8c5e842..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryTestCase.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -package org.apache.tuscany.sdo.test; - - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; -import java.net.URL; - -import junit.framework.TestCase; - -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.ChangeSummary; -import commonj.sdo.DataGraph; -import commonj.sdo.DataObject; -import commonj.sdo.helper.XSDHelper; - - -public class ChangeSummaryTestCase extends TestCase { - private final String TEST_MODEL = "/simple.xsd"; - private final String TEST_DATA = "/simplechangesummary.xml"; - - /** - * Simple ChangeSummary test. - */ - public void testChangeSummary() throws IOException { - // Create an empty data graph and add a root object, an instance of type Quote - // - - DataGraph dataGraph = SDOUtil.createDataGraph(); - DataObject quote = dataGraph.createRootObject("http://www.example.com/simple", "Quote"); - - // Begin logging changes - // - ChangeSummary changeSummary = dataGraph.getChangeSummary(); - changeSummary.beginLogging(); - - // Modify the data graph in various fun and interesting ways - // - quote.setString("symbol", "fbnt"); - quote.setString("companyName", "FlyByNightTechnology"); - quote.setBigDecimal("price", new BigDecimal("1000.0")); - quote.setBigDecimal("open1", new BigDecimal("1000.0")); - quote.setBigDecimal("high", new BigDecimal("1000.0")); - quote.setBigDecimal("low", new BigDecimal("1000.0")); - quote.setDouble("volume", 1000); - quote.setDouble("change1", 1000); - - DataObject child = quote.createDataObject("quotes"); - child.setBigDecimal("price", new BigDecimal("2000.0")); - - // Stop logging changes and print the resulting data graph to stdout - // - changeSummary.endLogging(); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SDOUtil.saveDataGraph(dataGraph, baos, null); - - assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA))); - } - - protected void setUp() throws Exception { - super.setUp(); - - // Populate the meta data for the test (Stock Quote) model - URL url = getClass().getResource(TEST_MODEL); - InputStream inputStream = url.openStream(); - XSDHelper.INSTANCE.define(inputStream, url.toString()); - inputStream.close(); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DataTypeBaseTypeTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DataTypeBaseTypeTestCase.java deleted file mode 100644 index faa8782a77..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DataTypeBaseTypeTestCase.java +++ /dev/null @@ -1,65 +0,0 @@ -/**
- *
- * Copyright 2005 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.
- */
-package org.apache.tuscany.sdo.test;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import commonj.sdo.Type;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XSDHelper;
-
-
-public class DataTypeBaseTypeTestCase extends TestCase {
- private final String TEST_MODEL = "/datatype.xsd";
- private final String TEST_NAMESPACE = "http://www.example.com/datatype";
-
- public void testSimpleSDOType() throws IOException
- {
- Type type = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "SimpleSDOType");
- List baseTypes = type.getBaseTypes();
- assertTrue(baseTypes.size() == 1);
- }
-
- public void testSimpleSDOTypeInstanceClass() throws IOException
- {
- Type type = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "SimpleSDOTypeInstanceClass");
- List baseTypes = type.getBaseTypes();
- assertTrue(baseTypes.size() == 0);
- }
-
- public void testSimpleSDOTypeExtendedInstanceClass() throws IOException
- {
- Type type = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "SimpleSDOTypeExtendedInstanceClass");
- List baseTypes = type.getBaseTypes();
- assertTrue(baseTypes.size() == 1);
- }
-
- public void setUp() throws Exception
- {
- URL url = getClass().getResource(TEST_MODEL);
- InputStream inputStream = url.openStream();
- XSDHelper.INSTANCE.define(inputStream, url.toString());
- inputStream.close();
- }
-
-}
diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java deleted file mode 100644 index b77b534be6..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java +++ /dev/null @@ -1,632 +0,0 @@ -/**
- *
- * Copyright 2005 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.
- */
-package org.apache.tuscany.sdo.test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigDecimal;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Property;
-import commonj.sdo.Sequence;
-import commonj.sdo.Type;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-
-public class DefineTypeTestCase extends TestCase
-{
- private static final String CUSTOMER1_XML = "/customer1.xml";
- private static final String CUSTOMER2_XML = "/customer2.xml";
- private static final String OPEN_XML = "/open2.xml";
- private static final String MIXED_XML = "/mixed2.xml";
- private static final String MIXEDOPEN_XML = "/mixedopen.xml";
-
- public void testDefineTypeRoundTrip() throws Exception {
- TypeHelper types = SDOUtil.createTypeHelper();
- DataFactory factory = SDOUtil.createDataFactory(types);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
-
- Type intType = types.getType("commonj.sdo", "Int");
- Type stringType = types.getType("commonj.sdo", "String");
-
- // create a new Type for Customers
- DataObject customerType = factory.create("commonj.sdo",
- "Type");
- customerType.set("uri", "http://example.com/customer");
- customerType.set("name", "Customer");
-
- // create a customer number property
- DataObject custNumProperty = customerType.createDataObject("property");
- custNumProperty.set("name", "custNum");
- custNumProperty.set("type", intType);
-
- // create a first name property
- DataObject firstNameProperty =
- customerType.createDataObject("property");
- firstNameProperty.set("name", "firstName");
- firstNameProperty.set("type", stringType);
-
- // create a last name property
- DataObject lastNameProperty = customerType.createDataObject("property");
- lastNameProperty.set("name", "lastName");
- lastNameProperty.set("type", stringType);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlHelper.save(customerType, "commonj.sdo", "type", baos);
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- XMLDocument xdoc = xmlHelper.load(bais);
-
- customerType = xdoc.getRootObject();
-
- // now define the Customer type so that customers can be made
- types.define(customerType);
-
- DataObject customer1 = factory.create("http://example.com/customer",
- "Customer");
-
- customer1.setInt("custNum", 1);
- customer1.set("firstName", "John");
- customer1.set("lastName", "Adams");
- DataObject customer2 = factory.create("http://example.com/customer",
- "Customer");
- customer2.setInt("custNum", 2);
- customer2.set("firstName", "Jeremy");
- customer2.set("lastName", "Pavick");
-
- assertNotNull(customer1);
- Type type = customer1.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertEquals(type.getProperty("custNum").getType(), intType);
- assertEquals(type.getProperty("firstName").getType(), stringType);
- assertEquals(type.getProperty("lastName").getType(), stringType);
-
- assertNotNull(customer2);
- type = customer2.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertEquals(type.getProperty("custNum").getType(), intType);
- assertEquals(type.getProperty("firstName").getType(), stringType);
- assertEquals(type.getProperty("lastName").getType(), stringType);
-
- baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer1,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER1_XML)));
-
- baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer2,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER2_XML)));
- }
-
- public void testDefineType() throws Exception
- {
- TypeHelper types = SDOUtil.createTypeHelper();
- DataFactory factory = SDOUtil.createDataFactory(types);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
-
- Type intType = types.getType("commonj.sdo", "Int");
- Type stringType = types.getType("commonj.sdo", "String");
-
- // create a new Type for Customers
- DataObject customerType = factory.create("commonj.sdo",
- "Type");
- customerType.set("uri", "http://example.com/customer");
- customerType.set("name", "Customer");
-
- // create a customer number property
- DataObject custNumProperty = customerType.createDataObject("property");
- custNumProperty.set("name", "custNum");
- custNumProperty.set("type", intType);
-
- // create a first name property
- DataObject firstNameProperty =
- customerType.createDataObject("property");
- firstNameProperty.set("name", "firstName");
- firstNameProperty.set("type", stringType);
-
- // create a last name property
- DataObject lastNameProperty = customerType.createDataObject("property");
- lastNameProperty.set("name", "lastName");
- lastNameProperty.set("type", stringType);
-
- // now define the Customer type so that customers can be made
- types.define(customerType);
-
- DataObject customer1 = factory.create("http://example.com/customer",
- "Customer");
- customer1.setInt("custNum", 1);
- customer1.set("firstName", "John");
- customer1.set("lastName", "Adams");
- DataObject customer2 = factory.create("http://example.com/customer",
- "Customer");
- customer2.setInt("custNum", 2);
- customer2.set("firstName", "Jeremy");
- customer2.set("lastName", "Pavick");
-
- assertNotNull(customer1);
- Type type = customer1.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertEquals(type.getProperty("custNum").getType(), intType);
- assertEquals(type.getProperty("firstName").getType(), stringType);
- assertEquals(type.getProperty("lastName").getType(), stringType);
-
- assertNotNull(customer2);
- type = customer2.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertEquals(type.getProperty("custNum").getType(), intType);
- assertEquals(type.getProperty("firstName").getType(), stringType);
- assertEquals(type.getProperty("lastName").getType(), stringType);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer1,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER1_XML)));
-
- baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer2,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER2_XML)));
- }
-
- public void testDefineDataType() throws Exception
- {
- TypeHelper types = SDOUtil.createTypeHelper();
- DataFactory factory = SDOUtil.createDataFactory(types);
- XSDHelper xsdHelper = SDOUtil.createXSDHelper(types);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
-
- Property javaClassProperty = xsdHelper.getGlobalProperty("commonj.sdo/java", "javaClass", false);
-
- // create a data types
- DataObject intType = factory.create("commonj.sdo", "Type");
- intType.set("uri", "http://example.com/customer");
- intType.set("name", "MyIntType");
- intType.setBoolean("dataType", true);
- intType.set(javaClassProperty, "int");
-
- DataObject stringType = factory.create("commonj.sdo", "Type");
- stringType.set("uri", "http://example.com/customer");
- stringType.set("name", "MyStringType");
- stringType.setBoolean("dataType", true);
- stringType.set(javaClassProperty, "java.lang.String");
-
- // create a new Type for Customers
- DataObject customerType = factory.create("commonj.sdo",
- "Type");
- customerType.set("uri", "http://example.com/customer");
- customerType.set("name", "Customer");
-
- // create a customer number property
- DataObject custNumProperty = customerType.createDataObject("property");
- custNumProperty.set("name", "custNum");
- custNumProperty.set("type", intType);
-
- // create a first name property
- DataObject firstNameProperty =
- customerType.createDataObject("property");
- firstNameProperty.set("name", "firstName");
- firstNameProperty.set("type", stringType);
-
- // create a last name property
- DataObject lastNameProperty = customerType.createDataObject("property");
- lastNameProperty.set("name", "lastName");
- lastNameProperty.set("type", stringType);
-
- // now define the Customer type so that customers can be made
- types.define(customerType);
-
- DataObject customer1 = factory.create("http://example.com/customer",
- "Customer");
-
- customer1.setInt("custNum", 1);
- customer1.set("firstName", "John");
- customer1.set("lastName", "Adams");
- DataObject customer2 = factory.create("http://example.com/customer",
- "Customer");
- customer2.setInt("custNum", 2);
- customer2.set("firstName", "Jeremy");
- customer2.set("lastName", "Pavick");
-
- assertNotNull(customer1);
- Type type = customer1.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
-
- type = type.getProperty("custNum").getType();
- assertEquals(type.getURI(), "http://example.com/customer");
- assertEquals(type.getName(), "MyIntType");
- assertTrue(type.isDataType());
-
- assertNotNull(customer2);
- type = customer2.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer1,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER1_XML)));
-
- baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer2,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER2_XML)));
- }
-
- public void testFastDefineType() throws Exception
- {
- TypeHelper types = SDOUtil.createTypeHelper();
- DataFactory factory = SDOUtil.createDataFactory(types);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
-
- Type intType = types.getType("commonj.sdo", "Int");
- Type stringType = types.getType("commonj.sdo", "String");
-
- // create a new Type for Customers
- Type customerType = SDOUtil.createType(types, "http://example.com/customer", "Customer", false);
-
- // create a customer number property
- SDOUtil.createProperty(customerType, "custNum", intType);
-
- // create a first name property
- SDOUtil.createProperty(customerType, "firstName", stringType);
-
- // create a last name property
- SDOUtil.createProperty(customerType, "lastName", stringType);
-
- DataObject customer1 = factory.create("http://example.com/customer",
- "Customer");
- customer1.setInt("custNum", 1);
- customer1.set("firstName", "John");
- customer1.set("lastName", "Adams");
- DataObject customer2 = factory.create("http://example.com/customer",
- "Customer");
- customer2.setInt("custNum", 2);
- customer2.set("firstName", "Jeremy");
- customer2.set("lastName", "Pavick");
-
- assertNotNull(customer1);
- Type type = customer1.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertEquals(type.getProperty("custNum").getType(), intType);
- assertEquals(type.getProperty("firstName").getType(), stringType);
- assertEquals(type.getProperty("lastName").getType(), stringType);
-
- assertNotNull(customer2);
- type = customer2.getType();
- assertNotNull(type.getProperty("custNum"));
- assertNotNull(type.getProperty("firstName"));
- assertNotNull(type.getProperty("lastName"));
- assertEquals(type.getProperty("custNum").getType(), intType);
- assertEquals(type.getProperty("firstName").getType(), stringType);
- assertEquals(type.getProperty("lastName").getType(), stringType);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer1,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER1_XML)));
-
- baos = new ByteArrayOutputStream();
- xmlHelper.save(
- customer2,
- "http://example.com/customer",
- "Customer", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(CUSTOMER2_XML)));
- }
-
- public void testDefineSequencedType() throws Exception
- {
-
- TypeHelper types = SDOUtil.createTypeHelper();
- DataFactory factory = SDOUtil.createDataFactory(types);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
-
- Type stringType = types.getType("commonj.sdo", "String");
- Type decimalType = types.getType("commonj.sdo", "Decimal");
-
- // Define a new mixed type - MixedQuote
- DataObject mixedQuoteType = factory.create("commonj.sdo", "Type");
- mixedQuoteType.set("uri", "http://www.example.com/mixed");
- mixedQuoteType.set("name", "MixedQuote");
- mixedQuoteType.set("sequenced", Boolean.TRUE);
-
- DataObject symbolProperty = mixedQuoteType.createDataObject("property");
- symbolProperty.set("name", "symbol");
- symbolProperty.set("type", stringType);
-
- DataObject companyNameProperty = mixedQuoteType.createDataObject("property");
- companyNameProperty.set("name", "companyName");
- companyNameProperty.set("type", stringType);
-
- DataObject priceProperty = mixedQuoteType.createDataObject("property");
- priceProperty.set("name", "price");
- priceProperty.set("type", decimalType);
-
- DataObject quotesProperty = mixedQuoteType.createDataObject("property");
- quotesProperty.set("name", "quotes");
- quotesProperty.set("type", mixedQuoteType);
- quotesProperty.set("many", Boolean.TRUE);
- quotesProperty.set("containment", Boolean.TRUE);
-
- types.define(mixedQuoteType);
-
- DataObject quote = factory.create("http://www.example.com/mixed", "MixedQuote");
-
- assertTrue(quote.getType().isSequenced());
-
- Sequence sequence = quote.getSequence();
-
- sequence.add("\n ");
-
- quote.setString("symbol", "fbnt");
-
- sequence.add("\n ");
-
- quote.setString("companyName", "FlyByNightTechnology");
-
- sequence.add("\n some text\n ");
-
- DataObject child = quote.createDataObject("quotes");
- child.setBigDecimal("price", new BigDecimal("2000.0"));
-
- sequence.add("\n more text\n ");
-
- // quote.setBigDecimal("price", new BigDecimal("1000.0"));
- sequence.add("price", new BigDecimal("1000.0"));
-
- sequence.add("\n");
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlHelper.save(quote, "http://www.example.com/mixed", "mixedStockQuote", baos);
- assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXED_XML)));
- }
-
- public void testDefineSequencedOpenType() throws Exception
- {
-
- TypeHelper types = SDOUtil.createTypeHelper();
- DataFactory factory = SDOUtil.createDataFactory(types);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
-
- Type stringType = types.getType("commonj.sdo", "String");
- Type decimalType = types.getType("commonj.sdo", "Decimal");
-
- // Define a new mixed type - MixedQuote
- DataObject mixedQuoteType = factory.create("commonj.sdo", "Type");
- mixedQuoteType.set("uri", "http://www.example.com/mixed");
- mixedQuoteType.set("name", "MixedOpenQuote");
- mixedQuoteType.set("sequenced", Boolean.TRUE);
- mixedQuoteType.set("open", Boolean.TRUE);
-
-// DataObject symbolProperty = mixedQuoteType.createDataObject("property");
-// symbolProperty.set("name", "symbol");
-// symbolProperty.set("type", stringType);
-
- DataObject companyNameProperty = mixedQuoteType.createDataObject("property");
- companyNameProperty.set("name", "companyName");
- companyNameProperty.set("type", stringType);
-
- DataObject priceProperty = mixedQuoteType.createDataObject("property");
- priceProperty.set("name", "price");
- priceProperty.set("type", decimalType);
-
- DataObject quotesProperty = mixedQuoteType.createDataObject("property");
- quotesProperty.set("name", "quotes");
- quotesProperty.set("type", mixedQuoteType);
- quotesProperty.set("many", Boolean.TRUE);
- quotesProperty.set("containment", Boolean.TRUE);
-
- types.define(mixedQuoteType);
-
- // Define a global type
- DataObject globalType = factory.create("commonj.sdo", "Type");
- globalType.set("uri", "http://www.example.com/open");
- // Don't set the type's name - null is used for types containing global properties.
-
- DataObject symbolProperty = globalType.createDataObject("property");
- symbolProperty.set("name", "symbol");
- symbolProperty.set("type", stringType);
- symbolProperty.set("containment", Boolean.TRUE);
-
- types.define(globalType);
-
- DataObject quote = factory.create("http://www.example.com/mixed", "MixedOpenQuote");
-
- assertTrue(quote.getType().isSequenced());
-
- Sequence sequence = quote.getSequence();
-
- sequence.add("\n ");
-
- Type definedGlobalType = types.getType("http://www.example.com/open", null);
-
- Property definedSymbolProperty = definedGlobalType.getProperty("symbol");
- quote.setString(definedSymbolProperty, "fbnt");
-
- sequence.add("\n ");
-
- quote.setString("companyName", "FlyByNightTechnology");
-
- sequence.add("\n some text\n ");
-
- DataObject child = quote.createDataObject("quotes");
- child.setBigDecimal("price", new BigDecimal("2000.0"));
-
- sequence.add("\n more text\n ");
-
- // quote.setBigDecimal("price", new BigDecimal("1000.0"));
- sequence.add("price", new BigDecimal("1000.0"));
-
- sequence.add("\n");
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlHelper.save(quote, "http://www.example.com/mixed", "mixedOpenStockQuote", baos);
- assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXEDOPEN_XML)));
- }
-
-
- public void testDefineOpenType() throws Exception
- {
- TypeHelper types = SDOUtil.createTypeHelper();
- DataFactory factory = SDOUtil.createDataFactory(types);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
-
- Type stringType = types.getType("commonj.sdo", "String");
- Type decimalType = types.getType("commonj.sdo", "Decimal");
-
- // Define a new open type - OpenQuote
- DataObject openQuoteType = factory.create("commonj.sdo", "Type");
- openQuoteType.set("uri", "http://www.example.com/open");
- openQuoteType.set("name", "OpenQuote");
- openQuoteType.set("open", Boolean.TRUE);
- openQuoteType.setBoolean("open", true);
-
- types.define(openQuoteType);
-
- // Define new type - CompanyType
- DataObject companyType = factory.create("commonj.sdo", "Type");
- companyType.set("uri", "http://www.example.com/open");
- companyType.set("name", "CompanyType");
-
- // Create CompanyType property - "name"
- DataObject nameProperty = companyType.createDataObject("property");
- nameProperty.set("name", "name");
- nameProperty.set("type", stringType);
- nameProperty.set("containment", Boolean.TRUE);
-
- types.define(companyType);
-
- // Define a global type
- DataObject globalType = factory.create("commonj.sdo", "Type");
- globalType.set("uri", "http://www.example.com/open");
- // Don't set the type's name - null is used for types containing global properties.
-
- DataObject symbolProperty = globalType.createDataObject("property");
- symbolProperty.set("name", "symbol");
- symbolProperty.set("type", stringType);
- symbolProperty.set("containment", Boolean.TRUE);
-
- // Define a global property - company
- DataObject companyProperty = globalType.createDataObject("property");
- companyProperty.set("name", "company");
- companyProperty.set("type", companyType);
- companyProperty.set("containment", Boolean.TRUE);
-
- // Define a global property - price
- DataObject priceProperty = globalType.createDataObject("property");
- priceProperty.set("name", "price");
- priceProperty.set("type", decimalType);
-
- types.define(globalType);
-
- // Create DataObject instances
- DataObject openQuote = factory.create("http://www.example.com/open", "OpenQuote");
-
- assertTrue(openQuote.getType().isOpen());
-
- // Get global type
- Type definedGlobalType = types.getType("http://www.example.com/open", null);
-
- Property definedSymbolProperty = definedGlobalType.getProperty("symbol");
- openQuote.set(definedSymbolProperty, "s1");
-
- Property definedCompanyProperty = definedGlobalType.getProperty("company");
-
- DataObject company = openQuote.createDataObject(definedCompanyProperty);
- company.setString("name", "FlyByNightTechnology");
-
- Property definedPriceProperty = definedGlobalType.getProperty("price");
- openQuote.setBigDecimal(definedPriceProperty, new BigDecimal("1000.0"));
-
- assertEquals(definedPriceProperty.getType(), decimalType);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- xmlHelper.save(
- openQuote,
- "http://www.example.com/open",
- "openStockQuote", baos);
- assertTrue(
- TestUtil.equalXmlFiles(
- new ByteArrayInputStream(baos.toByteArray()),
- getClass().getResource(OPEN_XML)));
- }
-
-}
diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/MixedTypeTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/MixedTypeTestCase.java deleted file mode 100644 index e46f9858e2..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/MixedTypeTestCase.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -package org.apache.tuscany.sdo.test; - - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; -import java.net.URL; - -import commonj.sdo.DataObject; -import commonj.sdo.Sequence; -import commonj.sdo.Type; -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; -import junit.framework.TestCase; - - -public class MixedTypeTestCase extends TestCase { - private final String TEST_MODEL = "/mixed.xsd"; - private final String TEST_NAMESPACE = "http://www.example.com/mixed"; - private final String TEST_DATA = "/mixed.xml"; - - /** - * Sequenced type SDO 2 test. - */ - public void testSequencedType() throws IOException { - Type quoteType = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "MixedQuote"); - DataObject quote = DataFactory.INSTANCE.create(quoteType); - - Sequence sequence = quote.getSequence(); - - sequence.add("\n "); - - quote.setString("symbol", "fbnt"); - - sequence.add("\n "); - - quote.setString("companyName", "FlyByNightTechnology"); - - sequence.add("\n some text\n "); - - DataObject child = quote.createDataObject("quotes"); - child.setBigDecimal("price", new BigDecimal("2000.0")); - - sequence.add("\n more text\n "); - - // quote.setBigDecimal("price", new BigDecimal("1000.0")); - sequence.add("price", new BigDecimal("1000.0")); - - sequence.add("\n"); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "mixedStockQuote", baos); - - assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA))); - } - - protected void setUp() throws Exception { - super.setUp(); - - // Populate the meta data for the test (Stock Quote) model - URL url = getClass().getResource(TEST_MODEL); - InputStream inputStream = url.openStream(); - XSDHelper.INSTANCE.define(inputStream, url.toString()); - inputStream.close(); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/OpenTypeTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/OpenTypeTestCase.java deleted file mode 100644 index 7e743e296a..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/OpenTypeTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -package org.apache.tuscany.sdo.test; - - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; -import java.net.URL; -import java.util.Iterator; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.Type; -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; -import junit.framework.TestCase; - - -public class OpenTypeTestCase extends TestCase { - private final String TEST_MODEL = "/open.xsd"; - private final String TEST_NAMESPACE = "http://www.example.com/open"; - private final String TEST_DATA = "/open.xml"; - - /** - * Open content SDO 2 test. - */ - public void testOpenType() throws IOException { - Type quoteType = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "OpenQuote"); - DataObject quote = DataFactory.INSTANCE.create(quoteType); - - quote.setString("symbol", "s1"); - - for (Iterator iter = quote.getInstanceProperties().iterator(); iter.hasNext();) { - Property property = (Property) iter.next(); - } - - Property companyProperty = XSDHelper.INSTANCE.getGlobalProperty(TEST_NAMESPACE, "company", true); - DataObject company = quote.createDataObject(companyProperty); - company.setString("name", "FlyByNightTechnology"); - - Property priceProperty = XSDHelper.INSTANCE.getGlobalProperty(TEST_NAMESPACE, "price", true); - quote.getList(priceProperty).add(new BigDecimal("1000.0")); - - for (Iterator iter = quote.getInstanceProperties().iterator(); iter.hasNext();) { - Property property = (Property) iter.next(); - } - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "openStockQuote", baos); - - assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA))); - } - - protected void setUp() throws Exception { - super.setUp(); - - // Populate the meta data for the test (Stock Quote) model - URL url = getClass().getResource(TEST_MODEL); - InputStream inputStream = url.openStream(); - XSDHelper.INSTANCE.define(inputStream, url.toString()); - inputStream.close(); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleCopyTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleCopyTestCase.java deleted file mode 100644 index 2e91a1a66f..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleCopyTestCase.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -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 commonj.sdo.DataObject; -import commonj.sdo.helper.CopyHelper; -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; -import junit.framework.TestCase; - -public class SimpleCopyTestCase extends TestCase { - - private final String TEST_MODEL = "/simple.xsd"; - private final String TEST_NAMESPACE = "http://www.example.com/simple"; - private final String QUOTE_XML = "/quote.xml"; - private final String SHALLOW_QUOTE_XML = "/shallowquote.xml"; - - public void testSimpleCopy() throws IOException { - XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(QUOTE_XML)); - DataObject sdo = doc.getRootObject(); - - DataObject copiedSdo = CopyHelper.INSTANCE.copyShallow(sdo); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XMLHelper.INSTANCE.save(copiedSdo, TEST_NAMESPACE, "stockQuote", baos); - assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(SHALLOW_QUOTE_XML))); - assertFalse(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(QUOTE_XML))); - - copiedSdo = CopyHelper.INSTANCE.copy(sdo); - - baos.reset(); - XMLHelper.INSTANCE.save(copiedSdo, TEST_NAMESPACE, "stockQuote", baos); - assertFalse(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(SHALLOW_QUOTE_XML))); - assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(QUOTE_XML))); - } - - protected void setUp() throws Exception { - super.setUp(); - - // Populate the meta data for the test (Stock Quote) model - URL url = getClass().getResource(TEST_MODEL); - InputStream inputStream = url.openStream(); - XSDHelper.INSTANCE.define(inputStream, url.toString()); - inputStream.close(); - } - -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleDynamicTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleDynamicTestCase.java deleted file mode 100644 index d86b793087..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleDynamicTestCase.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -package org.apache.tuscany.sdo.test; - - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; -import java.net.URL; - -import junit.framework.TestCase; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; - - -public class SimpleDynamicTestCase extends TestCase { - private final String TEST_MODEL = "/simple.xsd"; - private final String TEST_NAMESPACE = "http://www.example.com/simple"; - private final String QUOTE_XML = "/quote.xml"; - - /** - * Simple Dynamic SDO 2 test. - */ - public void testDynamic() throws IOException { - Type quoteType = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "Quote"); - DataObject quote = DataFactory.INSTANCE.create(quoteType); - - quote.setString("symbol", "fbnt"); - quote.setString("companyName", "FlyByNightTechnology"); - quote.setBigDecimal("price", new BigDecimal("1000.0")); - quote.setBigDecimal("open1", new BigDecimal("1000.0")); - quote.setBigDecimal("high", new BigDecimal("1000.0")); - quote.setBigDecimal("low", new BigDecimal("1000.0")); - quote.setDouble("volume", 1000); - quote.setDouble("change1", 1000); - - DataObject child = quote.createDataObject("quotes"); - child.setBigDecimal("price", new BigDecimal("2000.0")); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "stockQuote", baos); - - assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(QUOTE_XML))); - } - - - protected void setUp() throws Exception { - super.setUp(); - - // Populate the meta data for the test (Stock Quote) model - URL url = getClass().getResource(TEST_MODEL); - InputStream inputStream = url.openStream(); - XSDHelper.INSTANCE.define(inputStream, url.toString()); - inputStream.close(); - } - -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleEqualityTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleEqualityTestCase.java deleted file mode 100644 index ac05b362d9..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleEqualityTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -package org.apache.tuscany.sdo.test; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.EqualityHelper; -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; -import junit.framework.TestCase; - -public class SimpleEqualityTestCase extends TestCase { - private static final String TEST_MODEL = "/simple.xsd"; - private static final String QUOTE_XML = "/quote.xml"; - private static final String SHALLOW_QUOTE_XML = "/shallowquote.xml"; - - public void testEquality() throws IOException { - - XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(QUOTE_XML)); - DataObject sdo = doc.getRootObject(); - - doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(SHALLOW_QUOTE_XML)); - DataObject shallowSdo = doc.getRootObject(); - - boolean result = EqualityHelper.INSTANCE.equalShallow(sdo, shallowSdo); - assertTrue(result); - - result = EqualityHelper.INSTANCE.equal(sdo, shallowSdo); - assertFalse(result); - } - - - protected void setUp() throws Exception { - super.setUp(); - - // Populate the meta data for the test (Stock Quote) model - URL url = getClass().getResource(TEST_MODEL); - InputStream inputStream = url.openStream(); - XSDHelper.INSTANCE.define(inputStream, url.toString()); - inputStream.close(); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SubstitutionValues.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SubstitutionValues.java deleted file mode 100644 index acc08c1056..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SubstitutionValues.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.apache.tuscany.sdo.test;
-
-import java.net.URL;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Type;
-import commonj.sdo.helper.XSDHelper;
-import commonj.sdo.helper.DataFactory;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-public final class SubstitutionValues extends junit.framework.TestCase
-{
- public void test() throws java.io.IOException
- {
- URL url = getClass().getResource("/SubstitutionValues.xsd");
- XSDHelper.INSTANCE.define(url.openStream(), url.toString());
-
- final DataObject object = DataFactory.INSTANCE.create("http://www.apache.org/tuscany/SubstitutionValues", "TestObject");
- final Type type = object.getType();
-
- assertNotNull( SDOUtil.getSubstitutionValues(object, type.getProperty("groupHead")));
- assertNull( SDOUtil.getSubstitutionValues(object, type.getProperty("nonGroupHead")));
- }
-}
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java deleted file mode 100644 index d2ac035e02..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java +++ /dev/null @@ -1,282 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -package org.apache.tuscany.sdo.test; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.FactoryConfigurationError; -import javax.xml.parsers.ParserConfigurationException; - -import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -public class TestUtil -{ - private static void getAllNodes(NodeList nodeList, List nodes) - { - int length = nodeList.getLength(); - if (length == 0) - { - return; - } - - for (int i=0; i<length; i++) - { - Node node = nodeList.item(i); - nodes.add(node); - getAllNodes(node.getChildNodes(), nodes); - } // for - } - - private static boolean equalNamedNodeMap(NamedNodeMap mapA, NamedNodeMap mapB) { - if (mapA == null) { - if (mapB == null) { - return true; - } - return false; - } - if (mapA.getLength() != mapB.getLength()) { - return false; - } - for (int i = 0; i < mapA.getLength(); i++) { - Node trialNode = mapA.item(i); - if (trialNode == null) { - return false; - } - Node checkNode = mapB.getNamedItem(trialNode.getNodeName()); - if (checkNode == null) { - return false; - } - if (!equalNode(trialNode, checkNode)) { - return false; - } - } - return true; - } - - private static boolean equalNode(Node nodeA, Node nodeB) { - if (nodeA == null) { - if (nodeB == null) { - return true; - } - return false; - } - // following is intended to provide same function as 1.5 isEqualNode() - if (nodeA.getNodeType() != nodeB.getNodeType()) { - return false; - } - if (!equalString(nodeA.getNodeName(), nodeB.getNodeName())) { - return false; - } - if (!equalString(nodeA.getLocalName(), nodeB.getLocalName())) { - return false; - } - if (!equalString(nodeA.getNamespaceURI(), nodeB.getNamespaceURI())) { - return false; - } - if (!equalString(nodeA.getNamespaceURI(), nodeB.getNamespaceURI())) { - return false; - } - if (!equalString(nodeA.getPrefix(), nodeB.getPrefix())) { - return false; - } - if (!equalString(nodeA.getNodeValue(), nodeB.getNodeValue())) { - return false; - } - if (!equalNamedNodeMap(nodeA.getAttributes(), nodeB.getAttributes())) { - return false; - } - if (!equalNodeList(nodeA.getChildNodes(), nodeB.getChildNodes())) { - return false; - } - if (nodeA.getNodeType() == Node.DOCUMENT_TYPE_NODE) { - DocumentType documentTypeA = (DocumentType) nodeA; - DocumentType documentTypeB = (DocumentType) nodeB; - if (!equalString(documentTypeA.getPublicId(), documentTypeB.getPublicId())) { - return false; - } - if (!equalString(documentTypeA.getSystemId(), documentTypeB.getSystemId())) { - return false; - } - if (!equalString(documentTypeA.getInternalSubset(), documentTypeB.getInternalSubset())) { - return false; - } - if (!equalNamedNodeMap(documentTypeA.getEntities(), documentTypeB.getEntities())) { - return false; - } - if (!equalNamedNodeMap(documentTypeA.getNotations(), documentTypeB.getNotations())) { - return false; - } - } - return true; - } - - private static boolean equalNodeList(NodeList nodeListA, NodeList nodeListB) { - if (nodeListA == null) { - if (nodeListB == null) { - return true; - } - return false; - } - return equalNodes(nodeListA, nodeListB); - } - - private static boolean equalString(String stringA, String stringB) { - if (stringA == null) { - if (stringB == null) { - return true; - } - return false; - } - return stringA.equals(stringB); - } - - private static boolean equalNodes(NodeList sourceNodeList, NodeList targetNodeList) - { - ArrayList sourceNodes = new ArrayList(); - ArrayList targetNodes = new ArrayList(); - - getAllNodes(sourceNodeList, sourceNodes); - getAllNodes(targetNodeList, targetNodes); - - int sourceLength = sourceNodes.size(); - int targetLength = targetNodes.size(); - - if (sourceLength != targetLength) - { - return false; - } - - for (int i=0; i<sourceLength; i++) - { - Node sourceNode = (Node)sourceNodes.get(i); - Node targetNode = (Node)targetNodes.get(i); - - /* remove comment when migrated to Java 1.5 - if (!sourceNode.isEqualNode(targetNode)) - { - return false; - } - */ - // following is intended as 1.4 equivalent of isEqualNode() - if (!equalNode(sourceNode, targetNode)) - { - return false; - } - } // for - - return true; - } - - public static boolean equalXmlFiles(URL source, URL target) - { - try { - return equalXmlFiles(source.openStream(), target.openStream()); - } - catch (IOException e) - { - return false; - } - } - - public static boolean equalXmlFiles(InputStream sourceStream, URL target) - { - try { - return equalXmlFiles(sourceStream, target.openStream()); - } - catch (IOException e) - { - return false; - } - } - - public static boolean equalXmlFiles(URL source, InputStream targetStream) - { - try { - return equalXmlFiles(source.openStream(), targetStream); - } - catch (IOException e) - { - return false; - } - } - - public static boolean equalXmlFiles(InputStream sourceStream, InputStream targetStream) - { - DocumentBuilder builder; - Document sourceDocument; - Document targetDocument; - - try { - builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - sourceDocument = builder.parse(sourceStream); - targetDocument = builder.parse(targetStream); - } - catch (FactoryConfigurationError fce) { - return false; - } - catch (ParserConfigurationException ce) { - return false; - } - catch (SAXException se) - { - return false; - } - catch (IOException ie) - { - return false; - } - - sourceDocument.normalize(); - targetDocument.normalize(); - - /* remove comment when migrated to Java 1.5 - if (!sourceDocument.getXmlVersion().equals(targetDocument.getXmlVersion())) - { - return false; - } - - String sourceXmlEncoding = sourceDocument.getXmlEncoding(); - String targetXmlEncoding = targetDocument.getXmlEncoding(); - - if (sourceXmlEncoding != null && targetXmlEncoding != null && - sourceXmlEncoding.equalsIgnoreCase(targetXmlEncoding)) - { - // continue - } - else - { - return false; - } - */ - - NodeList sourceNodes = sourceDocument.getChildNodes(); - NodeList targetNodes = targetDocument.getChildNodes(); - - return equalNodes(sourceNodes, targetNodes); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTest.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTest.java deleted file mode 100644 index b14ae165dc..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/**
- *
- * Copyright 2005 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.
- */
-package org.apache.tuscany.sdo.test;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-
-import commonj.sdo.Type;
-import commonj.sdo.helper.TypeHelper;
-
-public class TypeRoundTripTest extends TestCase {
-
- private static class Test {
- Type type;
- String value;
- Object obj;
- Comparator comp;
-
- Test(Type type, String value, Object obj) {
- this.type = type;
- this.value = value;
- this.obj = obj;
- }
-
- Test(Type type, String value, Object obj, Comparator comp) {
- this.type = type;
- this.value = value;
- this.obj = obj;
- this.comp = comp;
- }
- }
-
- private static class ListComparator implements Comparator {
- public int compare(Object list1, Object list2) {
- int answer = 1;
- if (list1 instanceof List && list2 instanceof List) {
- List l1 = (List) list1;
- List l2 = (List) list2;
- if (l1.size() == l2.size()) {
- for (int n = 0; n < l1.size(); n++) {
- if (!l1.get(n).equals(l2.get(n))) {
- answer = 0;
- break;
- }
- }
- } else {
- answer = 0;
- }
- } else {
- answer = 0;
- }
- return answer;
- }
- }
-
- private static class BytesComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- o2 = new String((byte[])o2);
- if (o1.equals(o2)) return 1;
- else return 0;
- }
- }
-
- private static class DateComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- int answer = 1;
- try {
- if (o1 instanceof String && o2 instanceof Date) {
- SimpleDateFormat sdf =
- new SimpleDateFormat("yyyy-MM-dd'Z'");
- o1 = sdf.parse((String)o1);
- if (!o1.equals(o2)) answer = 0;
- } else {
- answer = 0;
- }
- } catch (Exception e) {}
- return answer;
- }
- }
-
- public void testTypeRoundTrips() throws Exception {
- String URI = "commonj.sdo";
- TypeHelper types = TypeHelper.INSTANCE;
- List list = new ArrayList();
- list.add("foo");
- list.add("bar");
- list.add("test");
- Test[] tests = {
- new Test(types.getType(URI, "Boolean"), "true", new Boolean(true)),
- new Test(types.getType(URI, "Byte"), "49", new Byte((byte)49)),
- new Test(types.getType(URI, "Bytes"), "Zm9v", "foo", new BytesComparator()),
- new Test(types.getType(URI, "Character"), "a", new Character('a')),
- new Test(types.getType(URI, "Date"), "2005-12-12Z", "2005-12-12Z", new DateComparator()),
- new Test(types.getType(URI, "DateTime"), "2005-12-12T12:12:12Z", "2005-12-12T12:12:12Z"),
- new Test(types.getType(URI, "Day"), "---12", "---12"),
- new Test(types.getType(URI, "Decimal"), "12.12", new BigDecimal("12.12")),
- new Test(types.getType(URI, "Double"), "12.12", new Double(12.12)),
- new Test(types.getType(URI, "Duration"), "P5Y2M10D", "P5Y2M10D"),
- new Test(types.getType(URI, "Float"), "12.12", new Float(12.12f)),
- new Test(types.getType(URI, "Int"), "12", new Integer(12)),
- new Test(types.getType(URI, "Integer"), "12", new BigInteger("12")),
- new Test(types.getType(URI, "Long"), "12", new Long(12l)),
- new Test(types.getType(URI, "Month"), "--12", "--12"),
- new Test(types.getType(URI, "MonthDay"), "--12-12", "--12-12"),
- new Test(types.getType(URI, "Object"), "test", "test"),
- new Test(types.getType(URI, "Short"), "12", new Short((short)12)),
- new Test(types.getType(URI, "String"), "test", "test"),
- new Test(types.getType(URI, "Strings"), "foo bar test", list, new ListComparator()),
- new Test(types.getType(URI, "Time"), "12:12:12.12", "12:12:12.12"),
- new Test(types.getType(URI, "URI"), "http://example.org", "http://example.org"),
- new Test(types.getType(URI, "Year"), "2005", "2005"),
- new Test(types.getType(URI, "YearMonth"), "2005-12", "2005-12"),
- new Test(types.getType(URI, "YearMonthDay"), "2005-12-12", "2005-12-12")
- };
-
- for (int n = 0; n < tests.length; n++) {
- assertEquals(
- SDOUtil.convertToString(tests[n].type, SDOUtil.createFromString(tests[n].type, tests[n].value)),
- tests[n].value
- );
-
- //System.out.print(".");
-
- if (tests[n].comp == null) {
- assertEquals(
- SDOUtil.createFromString(tests[n].type, SDOUtil.convertToString(tests[n].type, tests[n].obj)),
- tests[n].obj
- );
- } else {
- String o1 = SDOUtil.convertToString(tests[n].type, tests[n].obj);
- Object o2 = SDOUtil.createFromString(tests[n].type, o1);
- assertEquals(tests[n].comp.compare(tests[n].obj, o2), 1);
- }
- }
-
- }
-
-}
diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLDocumentTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLDocumentTestCase.java deleted file mode 100644 index c4f2cc4586..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLDocumentTestCase.java +++ /dev/null @@ -1,107 +0,0 @@ -/**
- *
- * Copyright 2005 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.
- */
-package org.apache.tuscany.sdo.test;
-
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-
-public class XMLDocumentTestCase extends TestCase
-{
- private final String TEST_XML_DOCUMENT = "/XMLDocumentTestCase.xml";
-
- // remember that NS1... and NS2... items are expected in sorted order by name
- private final String NS1_SCHEMA_NAME = "http://www.example.com/open";
-
- private final String NS1_SCHEMA_LOCATION = "/open.xsd";
-
- private final String NS2_SCHEMA_NAME = "http://www.example.com/xmlDocumentSchemaLocation";
-
- private final String NS2_SCHEMA_LOCATION = "/XMLDocumentSchemaLocation.xsd";
-
- private final String NS_SET_NAME_LOCATION = "namespace schemaLocation";
-
- //private final String NNS_SCHEMA_LOCATION = "http://www.example.com/XMLDocumentNoNamespaceSchemaLocation.xsd";
- private final String NNS_SCHEMA_LOCATION = "/XMLDocumentNoNamespaceSchemaLocation.xsd";
-
- private final String NNS_SET_LOCATION = "noNamespaceSchemaLocation";
-
- /**
- * This method will load an xml document consisting of a xsi:schemaLocation and
- * xsi:noNamespaceSchemaLocation defined. It will then use the XMLDocument API to get and
- * set the schemaLocation property.
- *
- * @throws IOException
- */
- public void testSchemaLocation() throws IOException
- {
- // load the xml document which has xsi:noNamespaceSchemaLocation and xsi:schemaLocation defined
- XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT));
-
- // get the schemaLocation
- assertEquals(NS1_SCHEMA_NAME + " " + NS1_SCHEMA_LOCATION + " " + NS2_SCHEMA_NAME + " " + NS2_SCHEMA_LOCATION, doc.getSchemaLocation());
-
- // set the schemaLocation to another value and test to see if the value was set
- doc.setSchemaLocation(NS_SET_NAME_LOCATION);
- assertEquals(NS_SET_NAME_LOCATION, doc.getSchemaLocation());
-
- // remove the schemaLocation and ensure it returns null
- doc.setSchemaLocation(null);
- assertNull(doc.getSchemaLocation());
-
- // ensure changes to schemaLocation have not changed noNamespaceSchemaLocation
- assertEquals(NNS_SCHEMA_LOCATION, doc.getNoNamespaceSchemaLocation());
- }
-
- /**
- * This method will load an xml document consisting of a xsi:schemaLocation and
- * xsi:noNamespaceSchemaLocation defined. It will then use the XMLDocument API to get and
- * set the noNamespaceSchemaLocation property.
- *
- * @throws IOException
- */
- public void testNoNamespaceSchemaLocation() throws IOException
- {
- // load the xml document which has xsi:noNamespaceSchemaLocation and xsi:schemaLocation defined
- XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT));
-
- // get the noNamespaceSchemaLocation
- assertEquals(NNS_SCHEMA_LOCATION, doc.getNoNamespaceSchemaLocation());
-
- // set the noNameSpaceSchemaLocation to another value and test to see if the value was set
- doc.setNoNamespaceSchemaLocation(NNS_SET_LOCATION);
- assertEquals(NNS_SET_LOCATION, doc.getNoNamespaceSchemaLocation());
-
- // remove the noNameSpaceSchemaLocation and ensure it returns null
- doc.setNoNamespaceSchemaLocation(null);
- assertNull(doc.getNoNamespaceSchemaLocation());
-
- // ensure changes to noNameSpaceSchemaLocation have not changed schemaLocation
- assertEquals(NS1_SCHEMA_NAME + " " + NS1_SCHEMA_LOCATION + " " + NS2_SCHEMA_NAME + " " + NS2_SCHEMA_LOCATION, doc.getSchemaLocation());
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
-}
diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java deleted file mode 100644 index d318f4ba73..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.apache.tuscany.sdo.test; - -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.io.StringWriter; -import java.net.URL; -import java.util.List; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.sdo.helper.XMLStreamHelper; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; - -public class XMLStreamHelperTestCase extends TestCase { - - private XSDHelper xsdHelper = XSDHelper.INSTANCE; - - private TypeHelper typeHelper = TypeHelper.INSTANCE; - - private XMLStreamHelper streamHelper; - - private XMLInputFactory inputFactory; - - private XMLOutputFactory outputFactory; - - private QName module = new QName("http://foo", "module"); - - private QName name = new QName("http://bar", "implementation.mock"); - - private String testName = "foo-ext"; - // private String testName = "complex"; - - private String xml; - - // = "<module name=\"m\" xmlns=\"http://foo\" xmlns:bar=\"http://bar\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" - // xsi:schemaLocation=\"http://bar foo-ext.xsd http://foo foo.xsd \"><component name=\"c\"><bar:implementation.mock - // myAttr=\"helloworld.HelloWorldImpl\" listAttr=\"1 2\">1<bar:myElement>Dummy</bar:myElement>2</bar:implementation.mock></component></module>"; - - protected void setUp() throws Exception { - super.setUp(); - streamHelper = SDOUtil.createXMLStreamHelper(typeHelper); - URL url = getClass().getClassLoader().getResource(testName + ".xsd"); - xsdHelper.define(url.openStream(), url.toExternalForm()); - inputFactory = XMLInputFactory.newInstance(); - outputFactory = XMLOutputFactory.newInstance(); - url = getClass().getClassLoader().getResource(testName + ".xml"); - InputStreamReader reader = new InputStreamReader(url.openStream()); - StringBuffer stringBuffer = new StringBuffer(); - char buf[] = new char[1024]; - int size; - while ((size = reader.read(buf)) != -1) - stringBuffer.append(buf, 0, size); - xml = stringBuffer.toString(); - reader.close(); - } - - public void testLoadObject() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml)); - int event = reader.getEventType(); - while (!(event == XMLStreamConstants.START_ELEMENT && reader.getName().equals(name)) && reader.hasNext()) { - event = reader.next(); - } - DataObject dataObject = streamHelper.loadObject(reader); - Assert.assertNotNull(dataObject); - Assert.assertTrue(dataObject.getString("myAttr").equals("helloworld.HelloWorldImpl")); - } - - public void testLoad() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml)); - XMLDocument document = streamHelper.load(reader); - Assert.assertNotNull(document); - Assert.assertEquals(document.getRootElementURI(), module.getNamespaceURI()); - Assert.assertEquals(document.getRootElementName(), module.getLocalPart()); - DataObject moduleObject = document.getRootObject(); - List components = moduleObject.getList("component"); - DataObject componentObject = (DataObject) components.get(0); - // componentObject.getDataObject("implementation.mock"); - DataObject implObject = (DataObject) componentObject.getSequence(0).getValue(0); - Assert.assertTrue(implObject.getString("myAttr").equals("helloworld.HelloWorldImpl")); - } - - public void testSave() throws XMLStreamException { - XMLDocument document = XMLHelper.INSTANCE.load(xml); - StringWriter writer = new StringWriter(); - XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer); - streamHelper.save(document, streamWriter); - streamWriter.flush(); - String xmlStr = writer.toString(); - // System.out.println(xmlStr); - Assert.assertTrue(xmlStr.contains("myAttr=\"helloworld.HelloWorldImpl\"")); - } - - public void testSaveObject() throws XMLStreamException { - XMLDocument document = XMLHelper.INSTANCE.load(xml); - DataObject moduleObject = document.getRootObject(); - List components = moduleObject.getList("component"); - DataObject componentObject = (DataObject) components.get(0); - StringWriter writer = new StringWriter(); - XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer); - streamHelper.saveObject(componentObject, streamWriter); - streamWriter.flush(); - Assert.assertTrue(writer.toString().contains("myAttr=\"helloworld.HelloWorldImpl\"")); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - -} diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XPathTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XPathTestCase.java deleted file mode 100644 index 7940663290..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XPathTestCase.java +++ /dev/null @@ -1,125 +0,0 @@ -/**
- *
- * Copyright 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.
- */
-package org.apache.tuscany.sdo.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import junit.framework.TestCase;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-
-public class XPathTestCase extends TestCase {
-
- private final String TEST_MODEL = "/xpath.xsd";
- private final String XPATH_XML = "/xpath.xml";
-
- /**
- * The presence or absence of the @ sign in a path has no meaning.
- * Properties are always matched by name independent of their XML representation.
- * @throws IOException
- */
- public void testAtSignProperty() throws IOException {
- TypeHelper typeHelper = SDOUtil.createTypeHelper();
- XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
-
- URL url = getClass().getResource(TEST_MODEL);
- InputStream inputStream = url.openStream();
- xsdHelper.define(inputStream, url.toString());
-
- inputStream.close();
-
- XMLDocument doc = xmlHelper.load(getClass().getResourceAsStream(XPATH_XML));
-
- DataObject drive = doc.getRootObject();
- DataObject folder1 = (DataObject) drive.get("Folder.1");
- String value = folder1.getString("@creation_date");
-
- assertEquals(value, "2000-03-23");
- }
-
- public void testListIndexing() throws Exception {
- TypeHelper typeHelper = SDOUtil.createTypeHelper();
- XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
-
- URL url = getClass().getResource(TEST_MODEL);
- InputStream inputStream = url.openStream();
- xsdHelper.define(inputStream, url.toString());
-
- inputStream.close();
-
- XMLDocument doc = xmlHelper.load(getClass().getResourceAsStream(XPATH_XML));
-
- DataObject root = doc.getRootObject();
- DataObject folder1 = root.getDataObject("Folder[1]");
- assertNotNull(folder1);
- DataObject folder1a = root.getDataObject("Folder.0");
- assertEquals(folder1, folder1a);
- folder1a = root.getDataObject("Folder[FolderName=Folder00000000000]");
- assertEquals(folder1, folder1a);
-
- DataObject noFolder = null;
-
- try {
- noFolder = root.getDataObject("Folder[3]");
- assertFalse("bad indexing passed", true);
- } catch (IndexOutOfBoundsException iobe) {
- // as expected
- } catch (Exception e) {
- assertFalse("bad indexing generated wrong exception" + e, true);
- }
-
- try {
- noFolder = root.getDataObject("Folder[0]");
- assertFalse("bad indexing passed", true);
- } catch (IndexOutOfBoundsException iobe) {
- // as expected
- } catch (Exception e) {
- assertFalse("bad indexing generated wrong exception" + e, true);
- }
-
- try {
- noFolder = root.getDataObject("Folder.2");
- assertFalse("bad indexing passed", true);
- } catch (IndexOutOfBoundsException iobe) {
- // as expected
- } catch (Exception e) {
- assertFalse("bad indexing generated wrong exception" + e, true);
- }
-
- try {
- noFolder = root.getDataObject("Folder.-1");
- assertFalse("bad indexing passed", true);
- } catch (IndexOutOfBoundsException iobe) {
- // as expected
- } catch (Exception e) {
- assertFalse("bad indexing generated wrong exception" + e, true);
- }
-
- noFolder = root.getDataObject("Folder[FolderName=foo]");
- assertNull(noFolder);
- }
-}
diff --git a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XSDHelperTestCase.java b/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XSDHelperTestCase.java deleted file mode 100644 index 16a2cbd195..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XSDHelperTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 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. - */ -package org.apache.tuscany.sdo.test; - -import java.io.IOException; -import java.net.URL; -import java.util.List; - -import org.apache.tuscany.sdo.util.SDOUtil; - -import junit.framework.TestCase; - -import commonj.sdo.helper.XSDHelper; - -/** - * @version $Rev$ $Date$ - */ -public class XSDHelperTestCase extends TestCase { - private static final String TEST_MODEL = "/simple.xsd"; - private URL modelURL; - - public void testDefineWithLocation() throws IOException { - XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper()); - List types = xsdHelper.define(modelURL.openStream(), modelURL.toString()); - assertEquals(2, types.size()); - } - - public void testDefineWithNoLocation() { - XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper()); - List types = xsdHelper.define(getClass().getResourceAsStream(TEST_MODEL), null); - assertEquals(2, types.size()); - } - - public void testDuplicateDefineWithLocation() throws IOException { - XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper()); - List types = xsdHelper.define(modelURL.openStream(), modelURL.toString()); - assertEquals(2, types.size()); - - List types2 = xsdHelper.define(modelURL.openStream(), modelURL.toString()); - assertEquals(0, types2.size()); - } - - protected void setUp() throws Exception { - super.setUp(); - modelURL = getClass().getResource(TEST_MODEL); - } -} diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/SubstitutionValues.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/SubstitutionValues.xsd deleted file mode 100644 index ec4a25740f..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/SubstitutionValues.xsd +++ /dev/null @@ -1,12 +0,0 @@ -<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.apache.org/tuscany/SubstitutionValues"
- xmlns:sv="http://www.apache.org/tuscany/SubstitutionValues">
- <element name="groupHead" type="string"/>
- <complexType name="TestObject">
- <sequence>
- <element ref="sv:groupHead"/>
- <element name="nonGroupHead" type="string"/>
- </sequence>
- </complexType>
- <element name="groupMember" type="string" substitutionGroup="sv:groupHead"/>
-</schema>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentNoNamespaceSchemaLocation.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentNoNamespaceSchemaLocation.xsd deleted file mode 100644 index 42f9555d44..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentNoNamespaceSchemaLocation.xsd +++ /dev/null @@ -1,28 +0,0 @@ -<?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:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:element name="aNoNamespaceSchemaLocationElement">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="anElement" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="date" type="xsd:date"/>
- </xsd:complexType>
- </xsd:element>
-
-</xsd:schema>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentSchemaLocation.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentSchemaLocation.xsd deleted file mode 100644 index 268ea375f0..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentSchemaLocation.xsd +++ /dev/null @@ -1,32 +0,0 @@ -<?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:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.example.com/xmlDocumentSchemaLocation"
- xmlns:sl="http://www.example.com/xmlDocumentSchemaLocation">
-
- <xsd:element name="schemaLocationElement" type="xsd:string" />
-
- <xsd:element name="purchaseReport">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:any minOccurs="1" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="periodEnding" type="xsd:date"/>
- </xsd:complexType>
- </xsd:element>
-
-</xsd:schema>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentTestCase.xml b/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentTestCase.xml deleted file mode 100644 index 34e1648429..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/XMLDocumentTestCase.xml +++ /dev/null @@ -1,14 +0,0 @@ -<sl:purchaseReport
- xmlns:sl="http://www.example.com/xmlDocumentSchemaLocation"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.example.com/xmlDocumentSchemaLocation
- /XMLDocumentSchemaLocation.xsd
- http://www.example.com/open
- /open.xsd"
- xsi:noNamespaceSchemaLocation="/XMLDocumentNoNamespaceSchemaLocation.xsd"
- periodEnding="2007-12-31">
- <sl:schemaLocationElement>some string</sl:schemaLocationElement>
- <aNoNamespaceSchemaLocationElement date="2006-04-01">
- <anElement>another string</anElement>
- </aNoNamespaceSchemaLocationElement>
-</sl:purchaseReport>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/customer1.xml b/branches/java-post-M1/sdo/impl/src/test/resources/customer1.xml deleted file mode 100644 index 0c18fa47fa..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/customer1.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<customer:Customer
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:customer="http://example.com/customer"
- xsi:type="customer:Customer"
- custNum="1"
- firstName="John"
- lastName="Adams"/>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/customer2.xml b/branches/java-post-M1/sdo/impl/src/test/resources/customer2.xml deleted file mode 100644 index 5b74c06c73..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/customer2.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<customer:Customer
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:customer="http://example.com/customer"
- xsi:type="customer:Customer"
- custNum="2"
- firstName="Jeremy"
- lastName="Pavick"/>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/datatype.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/datatype.xsd deleted file mode 100644 index 032f026137..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/datatype.xsd +++ /dev/null @@ -1,31 +0,0 @@ -<?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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:datatype="http://www.example.com/datatype" xmlns:sdoJava="commonj.sdo/java" targetNamespace="http://www.example.com/datatype">
-
- <xsd:simpleType name="SimpleSDOType">
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
- <xsd:simpleType name="SimpleSDOTypeInstanceClass" sdoJava:instanceClass="java.lang.Integer">
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
- <xsd:simpleType name="SimpleSDOTypeExtendedInstanceClass" sdoJava:extendedInstanceClass="java.lang.String">
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
-</xsd:schema>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/foo-ext.xml b/branches/java-post-M1/sdo/impl/src/test/resources/foo-ext.xml deleted file mode 100644 index 000909a52e..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/foo-ext.xml +++ /dev/null @@ -1,9 +0,0 @@ -<module name="m" xmlns="http://foo" xmlns:bar="http://bar" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://bar foo-ext.xsd http://foo foo.xsd "> - <component name="c"> - <bar:implementation.mock myAttr="helloworld.HelloWorldImpl" - listAttr="1 2">1<bar:myElement>Dummy</bar:myElement>2 - </bar:implementation.mock> - </component> -</module>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/foo-ext.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/foo-ext.xsd deleted file mode 100644 index cb74df8fa3..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/foo-ext.xsd +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 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. ---> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://bar" - elementFormDefault="qualified" - xmlns:foo="http://foo" xmlns:bar="http://bar"> - - <import namespace="http://foo" - schemaLocation="foo.xsd" /> - - <element name="implementation.mock" type="bar:MockImplementation" - substitutionGroup="foo:implementation" /> - <complexType name="MockImplementation" mixed="true"> - <complexContent> - <extension base="foo:Implementation"> - <sequence> - <element name="myElement" type="string"/> - <any namespace="##other" processContents="lax" - minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="myAttr" type="NCName" use="required" /> - <attribute name="listAttr" type="NMTOKENS" use="optional" /> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/foo.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/foo.xsd deleted file mode 100644 index fec090de71..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/foo.xsd +++ /dev/null @@ -1,229 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://foo" - elementFormDefault="qualified" xmlns:foo="http://foo"> - - <element name="componentType" type="foo:ComponentType"/> - <complexType name="ComponentType"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="service" type="foo:Service"/> - <element minOccurs="0" maxOccurs="unbounded" name="reference" type="foo:Reference"/> - <element minOccurs="0" maxOccurs="unbounded" name="property" type="foo:Property"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="Service"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="foo:interface"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="interface" type="foo:Interface"/> - <complexType name="Interface"/> - - <complexType name="Reference"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="foo:interface"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="multiplicity" type="foo:Multiplicity" use="optional" default="1..1"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="Property"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="type" type="QName" use="required"/> - <attribute name="many" type="boolean" default="false" use="optional"/> - <attribute name="required" type="boolean" default="false" use="optional"/> - <attribute name="default" type="string" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <element name="moduleFragment" type="foo:ModuleFragment"/> - <complexType name="ModuleFragment"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="foo:EntryPoint"/> - <element minOccurs="0" maxOccurs="unbounded" name="component" type="foo:Component"/> - <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="foo:ExternalService"/> - <element minOccurs="0" maxOccurs="unbounded" name="wire" type="foo:ModuleWire"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="module" type="foo:Module"/> - <complexType name="Module"> - <complexContent> - <extension base="foo:ModuleFragment"/> - </complexContent> - </complexType> - - <complexType name="EntryPoint"> - <sequence> - <element minOccurs="0" maxOccurs="1" ref="foo:interface"/> - <element minOccurs="1" maxOccurs="unbounded" ref="foo:binding"/> - <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="multiplicity" type="foo:Multiplicity" use="optional" default="1..1"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - <!-- a multiplicity 1..1 or 0..n sample - <reference>StockQuoteComponent</reference> - type must be URI - a multiplicity 1..n or 0..n sample - <reference>StockQuoteComponent1</reference> - type must be URI - <reference>StockQuoteComponent2</reference> - --> - - <element name="binding" type="foo:Binding"/> - <complexType name="Binding"> - <attribute name="uri" type="anyURI" use="optional"/> - </complexType> - - <complexType name="Component"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="foo:implementation"/> - <element minOccurs="0" maxOccurs="1" name="properties" type="foo:PropertyValues"/> - <element minOccurs="0" maxOccurs="1" name="references" type="foo:ReferenceValues"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - <!-- a multiplicity 1..1 or 0..1 sample - <references> - <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI - </references> - a multiplicity 1..n or 0..n sample - <references> - <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI - <v:stockQuote>StockQuoteComponent2</v:stockQuote> - </references> - --> - - <element name="implementation" type="foo:Implementation"/> - <complexType name="Implementation"/> - - <complexType name="PropertyValues"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="ReferenceValues"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <complexType name="ExternalService"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="foo:interface"/> - <element minOccurs="0" maxOccurs="unbounded" ref="foo:binding"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="overridable" type="foo:OverrideOptions" default="may" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <complexType name="ModuleWire"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="foo:source.uri"/> - <element minOccurs="1" maxOccurs="1" ref="foo:target.uri"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="source"/> - <element name="target"/> - - <element name="source.uri" type="anyURI" substitutionGroup="foo:source"/> - <element name="target.uri" type="anyURI" substitutionGroup="foo:target"/> - - <element name="subsystem" type="foo:Subsystem"/> - <complexType name="Subsystem"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="foo:EntryPoint"/> - <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="foo:ModuleComponent"/> - <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="foo:ExternalService"/> - <element minOccurs="0" maxOccurs="unbounded" name="wire" type="foo:SystemWire"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="uri" type="anyURI" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="ModuleComponent"> - <sequence> - <element minOccurs="0" maxOccurs="1" name="properties" type="foo:PropertyValues"/> - <element minOccurs="0" maxOccurs="1" name="references" type="foo:ReferenceValues"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="module" type="NCName" use="required"/> - <attribute name="uri" type="anyURI" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="SystemWire"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="foo:source"/> - <element minOccurs="1" maxOccurs="1" ref="foo:target"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - </complexType> - - <element name="source.epr" substitutionGroup="foo:source"/> - <element name="target.epr" substitutionGroup="foo:target"/> - - <simpleType name="Multiplicity"> - <restriction base="string"> - <enumeration value="0..1"/> - <enumeration value="1..1"/> - <enumeration value="0..n"/> - <enumeration value="1..n"/> - </restriction> - </simpleType> - - <simpleType name="OverrideOptions"> - <restriction base="string"> - <enumeration value="no"/> - <enumeration value="may"/> - <enumeration value="must"/> - </restriction> - </simpleType> - -</schema> diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/mixed.xml b/branches/java-post-M1/sdo/impl/src/test/resources/mixed.xml deleted file mode 100644 index 42ff3a3a5b..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/mixed.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<mixed:mixedStockQuote xmlns:mixed="http://www.example.com/mixed"> - <symbol>fbnt</symbol> - <companyName>FlyByNightTechnology</companyName> - some text - <quotes><price>2000.0</price></quotes> - more text - <price>1000.0</price> -</mixed:mixedStockQuote>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/mixed.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/mixed.xsd deleted file mode 100644 index c45fc87de2..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/mixed.xsd +++ /dev/null @@ -1,38 +0,0 @@ -<?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 - targetNamespace="http://www.example.com/mixed" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:simple="http://www.example.com/mixed"> - - <xsd:element name="mixedStockQuote" type="simple:MixedQuote"/> - - <xsd:complexType name="MixedQuote" mixed="true"> - <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:MixedQuote" minOccurs="0" maxOccurs="unbounded"/> - </xsd:sequence> - </xsd:complexType> - -</xsd:schema> diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/mixed2.xml b/branches/java-post-M1/sdo/impl/src/test/resources/mixed2.xml deleted file mode 100644 index 723d7bb891..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/mixed2.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<mixed:mixedStockQuote
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:mixed="http://www.example.com/mixed"
- xsi:type="mixed:MixedQuote">
- <symbol>fbnt</symbol>
- <companyName>FlyByNightTechnology</companyName>
- some text
- <quotes><price>2000.0</price></quotes>
- more text
- <price>1000.0</price>
-</mixed:mixedStockQuote>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/mixedopen.xml b/branches/java-post-M1/sdo/impl/src/test/resources/mixedopen.xml deleted file mode 100644 index 2409ce85a6..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/mixedopen.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<mixed:mixedOpenStockQuote
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:mixed="http://www.example.com/mixed"
- xmlns:open="http://www.example.com/open"
- xsi:type="mixed:MixedOpenQuote">
- <open:symbol>fbnt</open:symbol>
- <companyName>FlyByNightTechnology</companyName>
- some text
- <quotes><price>2000.0</price></quotes>
- more text
- <price>1000.0</price>
-</mixed:mixedOpenStockQuote>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/names.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/names.xsd deleted file mode 100644 index 601ecc5f6a..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/names.xsd +++ /dev/null @@ -1,30 +0,0 @@ -<?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
- targetNamespace="http://www.example.com/names"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:names="http://www.example.com/names">
-
- <xsd:element name="class" type="names:class"/>
- <xsd:element name="test.element" type="names:test.element" />
- <xsd:element name="void" type="names:void" />
-
- <xsd:complexType name="class" />
- <xsd:complexType name="test.element" />
- <xsd:complexType name="void" />
-
-</xsd:schema>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/open.xml b/branches/java-post-M1/sdo/impl/src/test/resources/open.xml deleted file mode 100644 index d4a5b92e0c..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/open.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?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:openStockQuote>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/open.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/open.xsd deleted file mode 100644 index 06881e3f05..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/open.xsd +++ /dev/null @@ -1,41 +0,0 @@ -<?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:simple="http://www.example.com/open" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.example.com/open"> - - <xsd:element name="openStockQuote" type="simple:OpenQuote"/> - - <xsd:element name="price" type="xsd:decimal"/> - - <xsd:element name="company"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="name" type="xsd:string"/> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="OpenQuote"> - <xsd:sequence> - <xsd:element name="symbol" type="xsd:string"/> - <xsd:any maxOccurs="unbounded" namespace="##any"/> - </xsd:sequence> - </xsd:complexType> - -</xsd:schema> diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/open2.xml b/branches/java-post-M1/sdo/impl/src/test/resources/open2.xml deleted file mode 100644 index 5bd70af711..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/open2.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<open:openStockQuote
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:open="http://www.example.com/open"
- xsi:type="open:OpenQuote">
- <open:symbol>s1</open:symbol>
- <open:company name="FlyByNightTechnology"/>
- <open:price>1000.0</open:price>
-</open:openStockQuote>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/quote.xml b/branches/java-post-M1/sdo/impl/src/test/resources/quote.xml deleted file mode 100644 index d7b5969e23..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/quote.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<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 diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/sdoannotations.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/sdoannotations.xsd deleted file mode 100644 index 355e9e2ba3..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/sdoannotations.xsd +++ /dev/null @@ -1,57 +0,0 @@ -<?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
- targetNamespace="http://www.example.com/sdoannotations"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:sdoa="http://www.example.com/sdoannotations"
- xmlns:sdo="commonj.sdo/xml"
- xmlns:sdoj="commonj.sdo/java">
-
- <!-- simple element with no annotations -->
- <xsd:element name="foo0" type="xsd:string" />
-
- <!-- simple element with sdo:name -->
- <xsd:element name="foo1" type="xsd:string" sdo:name="foo2" />
-
- <!-- simple element with sdo:type -->
- <xsd:element
- name="foo3" type="xsd:int"
- sdo:dataType="xsd:string"
- sdo:aliasName="foo4"
- sdo:readOnly="true" />
-
- <xsd:element
- name="foo5" type="sdoa:foo6" />
-
- <!-- complex type with no annotations -->
- <xsd:complexType name="foo6">
- <xsd:sequence>
- <xsd:element name="bar1" type="xsd:int" />
- </xsd:sequence>
- <xsd:attribute name="bar2" type="xsd:int" />
- </xsd:complexType>
-
- <xsd:element
- name="foo7" type="sdoa:foo8" />
-
- <xsd:complexType name="foo8" sdo:name="foo9" sdoj:instanceClass="org.apache.tuscany.sdo.test.XSDHelperTestCase">
- <xsd:sequence>
- <xsd:element name="bar3" type="xsd:int" sdo:string="true" />
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/sdotypes.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/sdotypes.xsd deleted file mode 100644 index aa0def2be6..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/sdotypes.xsd +++ /dev/null @@ -1,68 +0,0 @@ -<?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
- targetNamespace="http://www.example.com/sdotypes"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:sdot="http://www.example.com/sdotypes">
-
- <xsd:element name="foo0" type="xsd:anySimpleType"/>
- <xsd:element name="foo2" type="xsd:anyURI"/>
- <xsd:element name="foo3" type="xsd:base64Binary"/>
- <xsd:element name="foo4" type="xsd:boolean"/>
- <xsd:element name="foo5" type="xsd:byte"/>
- <xsd:element name="foo6" type="xsd:date"/>
- <xsd:element name="foo7" type="xsd:dateTime"/>
- <xsd:element name="foo8" type="xsd:decimal"/>
- <xsd:element name="foo9" type="xsd:double"/>
- <xsd:element name="foo10" type="xsd:duration"/>
- <xsd:element name="foo11" type="xsd:ENTITIES"/>
- <xsd:element name="foo12" type="xsd:ENTITY"/>
- <xsd:element name="foo13" type="xsd:float"/>
- <xsd:element name="foo14" type="xsd:gDay"/>
- <xsd:element name="foo15" type="xsd:gMonth"/>
- <xsd:element name="foo16" type="xsd:gMonthDay"/>
- <xsd:element name="foo17" type="xsd:gYear"/>
- <xsd:element name="foo18" type="xsd:gYearMonth"/>
- <xsd:element name="foo19" type="xsd:hexBinary"/>
- <xsd:element name="foo20" type="xsd:ID"/>
- <xsd:element name="foo21" type="xsd:IDREF"/>
- <xsd:element name="foo22" type="xsd:IDREFS"/>
- <xsd:element name="foo23" type="xsd:int"/>
- <xsd:element name="foo24" type="xsd:integer"/>
- <xsd:element name="foo25" type="xsd:language"/>
- <xsd:element name="foo26" type="xsd:long"/>
- <xsd:element name="foo27" type="xsd:Name"/>
- <xsd:element name="foo28" type="xsd:NCName"/>
- <xsd:element name="foo29" type="xsd:negativeInteger"/>
- <xsd:element name="foo30" type="xsd:NMTOKEN"/>
- <xsd:element name="foo31" type="xsd:NMTOKENS"/>
- <xsd:element name="foo32" type="xsd:nonNegativeInteger"/>
- <xsd:element name="foo33" type="xsd:nonPositiveInteger"/>
- <xsd:element name="foo34" type="xsd:normalizedString"/>
- <xsd:element name="foo35" type="xsd:NOTATION"/>
- <xsd:element name="foo36" type="xsd:positiveInteger"/>
- <xsd:element name="foo37" type="xsd:QName"/>
- <xsd:element name="foo38" type="xsd:short"/>
- <xsd:element name="foo39" type="xsd:string"/>
- <xsd:element name="foo40" type="xsd:time"/>
- <xsd:element name="foo41" type="xsd:token"/>
- <xsd:element name="foo42" type="xsd:unsignedByte"/>
- <xsd:element name="foo43" type="xsd:unsignedInt"/>
- <xsd:element name="foo44" type="xsd:unsignedLong"/>
- <xsd:element name="foo45" type="xsd:unsignedShort"/>
-
-</xsd:schema>
diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/shallowquote.xml b/branches/java-post-M1/sdo/impl/src/test/resources/shallowquote.xml deleted file mode 100644 index a56f2fe2b7..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/shallowquote.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<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>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/simple.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/simple.xsd deleted file mode 100644 index 5310f7e1f3..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/simple.xsd +++ /dev/null @@ -1,38 +0,0 @@ -<?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 - 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/branches/java-post-M1/sdo/impl/src/test/resources/simplechangesummary.xml b/branches/java-post-M1/sdo/impl/src/test/resources/simplechangesummary.xml deleted file mode 100644 index 1a34e0bf80..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/simplechangesummary.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdo="commonj.sdo" - xmlns:sdo_1="http://www.apache.org/tuscany/2005/SDO" xmlns:simple="http://www.example.com/simple"> - <changeSummary xmlns="" - logging="false"> - <objectChanges key="#//@eRootObject"> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="symbol" set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="companyName" set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="price" set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="open1" set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="high" set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="low" set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="volume" dataValue="0.0" - set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="change1" dataValue="0.0" - set="false"/> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="quotes" set="false"/> - </objectChanges> - <objectChanges key="#//@eRootObject/@quotes.0"> - <value xsi:type="sdo_1:ChangeSummarySetting" featureName="price" set="false"/> - </objectChanges> - </changeSummary> - <simple:Quote> - <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:Quote> -</sdo:datagraph> diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/xpath.xml b/branches/java-post-M1/sdo/impl/src/test/resources/xpath.xml deleted file mode 100644 index b1972b7260..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/xpath.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<xpath:drive xmlns:xpath="http://www.example.com/xpath" id="0">
- <Folder creation_date="1999-10-20" creator="Hasan" type="FolderType">
- <FolderName>Folder00000000000</FolderName>
- <description>marries inflamed apprehended beseeming bustle</description>
- <SecurityObject name="secure1">
- <Allows>
- <Allow>
- <User>Brian</User>
- <Permissions>rw</Permissions>
- </Allow>
- <Allow>
- <User>Fuhwei</User>
- <Permissions>r</Permissions>
- </Allow>
- </Allows>
- <Denies>
- <Deny>
- <User>Hasan</User>
- </Deny>
- <Deny>
- <User>Frank</User>
- </Deny>
- </Denies>
- </SecurityObject>
- </Folder>
- <Folder creation_date="2000-03-23" creator="Kapil" type="FileType">
- <FolderName>Folder00000000011</FolderName>
- <description>Mumbling Jumblin Pink Panther goofs it up</description>
- <SecurityObject name="secure2">
- <Allows>
- <Allow>
- <User>Imad</User>
- <Permissions>x</Permissions>
- </Allow>
- <Allow>
- <User>Robbie</User>
- <Permissions>rwx</Permissions>
- </Allow>
- </Allows>
- <Denies>
- <Deny>
- <User>Yang</User>
- </Deny>
- <Deny>
- <User>Art</User>
- </Deny>
- </Denies>
- </SecurityObject>
- </Folder>
-</xpath:drive>
\ No newline at end of file diff --git a/branches/java-post-M1/sdo/impl/src/test/resources/xpath.xsd b/branches/java-post-M1/sdo/impl/src/test/resources/xpath.xsd deleted file mode 100644 index 258d1b40e6..0000000000 --- a/branches/java-post-M1/sdo/impl/src/test/resources/xpath.xsd +++ /dev/null @@ -1,58 +0,0 @@ -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://www.example.com/xpath" targetNamespace="http://www.example.com/xpath">
-
- <xsd:element name="drive" type="DriveType"/>
-
- <xsd:complexType name="DriveType">
- <xsd:sequence>
- <xsd:element name="Folder" type="FolderType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:int"/>
- </xsd:complexType>
-
- <xsd:complexType name="FolderType">
- <xsd:sequence>
- <xsd:element name="FolderName" type="xsd:string"/>
- <xsd:element name="description" type="xsd:string"/>
- <xsd:element name="SecurityObject" type="SecurityObjectType"/>
- </xsd:sequence>
- <xsd:attribute name="creation_date" type="xsd:date" minOccurs="0"/>
- <xsd:attribute name="creator" type="xsd:string" minOccurs="0"/>
- <xsd:attribute name="type" type="xsd:string" minOccurs="0"/>
-
- </xsd:complexType>
-
- <xsd:complexType name="AllowsObjectType">
- <xsd:sequence>
- <xsd:element name="Allow" minOccurs="0" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="User" type="xsd:string"/>
- <xsd:element name="Permissions" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="DeniesObjectType">
- <xsd:sequence>
- <xsd:element name="Deny" minOccurs="0" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="User" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="SecurityObjectType">
- <xsd:sequence>
- <xsd:element name="Allows" type="AllowsObjectType"/>
- <xsd:element name="Denies" type="DeniesObjectType"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string"/>
- </xsd:complexType>
-
-</xsd:schema>
|