summaryrefslogtreecommitdiffstats
path: root/sandbox/jboynes/sdoproxy/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/jboynes/sdoproxy/src/test/java/org')
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DOMHelperTestCase.java94
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DataTypesTestCase.java130
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/GetSetOnlyTestCase.java49
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/ListTestCase.java45
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/PrimitivesTestCase.java202
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/SimpleNestingTestCase.java64
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/DataTypes.java37
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/GetSetOnly.java27
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/ListTypes.java27
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/Primitives.java55
-rw-r--r--sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/SimpleNesting.java29
11 files changed, 759 insertions, 0 deletions
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DOMHelperTestCase.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DOMHelperTestCase.java
new file mode 100644
index 0000000000..3898f02a66
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DOMHelperTestCase.java
@@ -0,0 +1,94 @@
+/**
+ *
+ * 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.proxy;
+
+import java.io.IOException;
+import java.util.Date;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+import org.osoa.sdo.DataObject;
+import org.osoa.sdo.Type;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.tuscany.sdo.helper.DOMHelperImpl;
+import org.apache.tuscany.sdo.impl.DataFactoryImpl;
+import org.apache.tuscany.sdo.impl.TypeHelperImpl;
+import org.apache.tuscany.sdo.proxy.interfaces.DataTypes;
+import org.apache.tuscany.sdo.proxy.interfaces.Primitives;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DOMHelperTestCase extends TestCase {
+ private Primitives primitives;
+ private DataTypes dataTypes;
+ private DOMHelperImpl domHelper;
+ private Document doc;
+
+ public void testSavePrimitives() throws IOException {
+ domHelper.save((DataObject<Primitives>) primitives, doc);
+ Element e = doc.getDocumentElement();
+ assertEquals(Type.JAVA_NAMESPACE, e.getNamespaceURI());
+ assertEquals(Primitives.class.getName(), e.getLocalName());
+ assertEquals(8, e.getChildNodes().getLength());
+// domHelper.writeTo(System.out, doc);
+ }
+
+ public void testLoadPrimitives() {
+ Element rootElement = doc.createElementNS(Type.JAVA_NAMESPACE, Primitives.class.getName());
+ appendElement(rootElement, "boolean", "true");
+ doc.appendChild(rootElement);
+ Primitives primitives = (Primitives) domHelper.load(doc);
+ assertNotNull(primitives);
+ assertEquals(true, primitives.isBoolean());
+ }
+
+ private void appendElement(Element parent, String name, String text) {
+ Element e = doc.createElementNS(null, name);
+ e.appendChild(doc.createTextNode(text));
+ parent.appendChild(e);
+ }
+
+ public void testSaveDataTypes() throws IOException {
+ dataTypes.setString("Hello World");
+ dataTypes.setBytes(new byte[]{ 0 , 1, 2, 3});
+ dataTypes.setDate(new Date());
+ domHelper.save((DataObject<DataTypes>) dataTypes, doc);
+ Element e = doc.getDocumentElement();
+ assertEquals(Type.JAVA_NAMESPACE, e.getNamespaceURI());
+ assertEquals(DataTypes.class.getName(), e.getLocalName());
+ assertEquals(3, e.getChildNodes().getLength());
+// domHelper.writeTo(System.out, doc);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TypeHelperImpl typeHelper = new TypeHelperImpl(getClass().getClassLoader());
+ DataFactoryImpl dataFactory = new DataFactoryImpl(typeHelper);
+ domHelper = new DOMHelperImpl(dataFactory);
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ doc = builder.newDocument();
+
+ primitives = typeHelper.define(Primitives.class).newInstance();
+ dataTypes = typeHelper.define(DataTypes.class).newInstance();
+ }
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DataTypesTestCase.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DataTypesTestCase.java
new file mode 100644
index 0000000000..d097b22f17
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/DataTypesTestCase.java
@@ -0,0 +1,130 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy;
+
+import java.util.Arrays;
+import java.util.Date;
+
+import junit.framework.TestCase;
+import org.osoa.sdo.Type;
+import org.osoa.sdo.Property;
+import org.osoa.sdo.DataObject;
+import org.osoa.sdo.helper.TypeHelper;
+
+import org.apache.tuscany.sdo.impl.TypeHelperImpl;
+import org.apache.tuscany.sdo.proxy.interfaces.DataTypes;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings({"CastToIncompatibleInterface"})
+public class DataTypesTestCase extends TestCase {
+ private DataTypes dataTypes;
+ private Type<DataTypes> type;
+
+ public void testString() {
+ dataTypes.setString("Hello World");
+ assertEquals("Hello World", dataTypes.getString());
+ }
+
+ public void testBytes() {
+ byte[] bytes = new byte[]{0, 1, 2, 3};
+ dataTypes.setBytes(bytes );
+ assertTrue(Arrays.equals(bytes, dataTypes.getBytes()));
+ }
+
+ public void testDate() {
+ Date date = new Date();
+ dataTypes.setDate(date);
+ assertEquals(date, dataTypes.getDate());
+ }
+
+ public void testGetIndex() {
+ DataObject o = (DataObject) dataTypes;
+ int i = 0;
+ for (Property<?> property : type.getProperties()) {
+ String name = property.getName();
+ if ("string".equals(name)) {
+ dataTypes.setString("Hello World");
+ assertEquals("Hello World", o.get(i));
+ } else if ("bytes".equals(name)) {
+ byte[] bytes = new byte[]{0, 1, 2, 3};
+ dataTypes.setBytes(bytes );
+ assertTrue(Arrays.equals(bytes, (byte[]) o.get(i)));
+ } else if ("date".equals(name)) {
+ Date date = new Date();
+ dataTypes.setDate(date);
+ assertEquals(date, o.get(i));
+ } else {
+ fail();
+ }
+ i++;
+ }
+ }
+
+ public void testSetIndex() {
+ DataObject o = (DataObject) dataTypes;
+ int i = 0;
+ for (Property<?> property : type.getProperties()) {
+ String name = property.getName();
+ if ("string".equals(name)) {
+ o.set(i, "Hello World");
+ assertEquals("Hello World", dataTypes.getString());
+ } else if ("bytes".equals(name)) {
+ byte[] bytes = new byte[]{0, 1, 2, 3};
+ o.set(i, bytes);
+ assertTrue(Arrays.equals(bytes, dataTypes.getBytes()));
+ } else if ("date".equals(name)) {
+ Date date = new Date();
+ o.set(i, date);
+ assertEquals(date, dataTypes.getDate());
+ } else {
+ fail();
+ }
+ i++;
+ }
+ }
+
+ public void testSetNull() {
+ DataObject o = (DataObject) dataTypes;
+ int i = 0;
+ for (Property<?> property : type.getProperties()) {
+ String name = property.getName();
+ if ("string".equals(name)) {
+ o.set(i, null);
+ assertNull(dataTypes.getString());
+ } else if ("bytes".equals(name)) {
+ o.set(i, null);
+ assertNull(dataTypes.getBytes());
+ } else if ("date".equals(name)) {
+ o.set(i, null);
+ assertNull(dataTypes.getDate());
+ } else {
+ fail();
+ }
+ i++;
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TypeHelper typeHelper = new TypeHelperImpl(getClass().getClassLoader());
+ type = typeHelper.define(DataTypes.class);
+ dataTypes = type.newInstance();
+ }
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/GetSetOnlyTestCase.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/GetSetOnlyTestCase.java
new file mode 100644
index 0000000000..dae76dd099
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/GetSetOnlyTestCase.java
@@ -0,0 +1,49 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.osoa.sdo.helper.TypeHelper;
+import org.osoa.sdo.Type;
+import org.osoa.sdo.Property;
+
+import org.apache.tuscany.sdo.impl.TypeHelperImpl;
+import org.apache.tuscany.sdo.proxy.interfaces.GetSetOnly;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GetSetOnlyTestCase extends TestCase {
+ private Type<GetSetOnly> type;
+ private List<Property> properties;
+
+ public void testProperties() {
+ assertEquals(2, properties.size());
+ assertNotNull(type.getProperty("readOnly"));
+ assertNotNull(type.getProperty("writeOnly"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TypeHelper typeHelper = new TypeHelperImpl(getClass().getClassLoader());
+ type = typeHelper.define(GetSetOnly.class);
+ properties = type.getProperties();
+ }
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/ListTestCase.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/ListTestCase.java
new file mode 100644
index 0000000000..87d2786778
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/ListTestCase.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy;
+
+import junit.framework.TestCase;
+import org.osoa.sdo.Type;
+import org.osoa.sdo.helper.TypeHelper;
+
+import org.apache.tuscany.sdo.impl.TypeHelperImpl;
+import org.apache.tuscany.sdo.proxy.interfaces.ListTypes;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ListTestCase extends TestCase {
+ private Type<ListTypes> type;
+ private ListTypes listTypes;
+
+ public void testDefaultList() throws NoSuchMethodException {
+ assertNotNull(listTypes.getBooleans());
+ assertTrue(listTypes.getBooleans().isEmpty());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TypeHelper typeHelper = new TypeHelperImpl(getClass().getClassLoader());
+ type = typeHelper.define(ListTypes.class);
+ listTypes = type.newInstance();
+ }
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/PrimitivesTestCase.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/PrimitivesTestCase.java
new file mode 100644
index 0000000000..ea2c031d8b
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/PrimitivesTestCase.java
@@ -0,0 +1,202 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy;
+
+import junit.framework.TestCase;
+import org.osoa.sdo.Type;
+import org.osoa.sdo.DataObject;
+import org.osoa.sdo.Property;
+import org.osoa.sdo.helper.TypeHelper;
+
+import org.apache.tuscany.sdo.impl.TypeHelperImpl;
+import org.apache.tuscany.sdo.proxy.interfaces.Primitives;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings({"InstanceofIncompatibleInterface", "CastToIncompatibleInterface"})
+public class PrimitivesTestCase extends TestCase {
+ private Primitives primitives;
+ private Type<Primitives> type;
+
+ public void testIsDataObject() {
+ assertTrue(primitives instanceof DataObject);
+ DataObject<Primitives> o = (DataObject<Primitives>) primitives;
+ Type<Primitives> type = o.getType();
+ assertNotNull(type);
+ assertEquals(this.type, type);
+ assertEquals(Primitives.class, type.getJavaType());
+ }
+
+ public void testBoolean() {
+ primitives.setBoolean(false);
+ assertEquals(false, primitives.isBoolean());
+ primitives.setBoolean(true);
+ assertEquals(true, primitives.isBoolean());
+ }
+
+ public void testCharacter() {
+ primitives.setCharacter('A');
+ assertEquals('A', primitives.getCharacter());
+ }
+
+ public void testByte() {
+ primitives.setByte((byte) 12);
+ assertEquals((byte) 12, primitives.getByte());
+ }
+
+ public void testShort() {
+ primitives.setShort((short) 1234);
+ assertEquals((short) 1234, primitives.getShort());
+ }
+
+ public void testInt() {
+ primitives.setInt(1234);
+ assertEquals(1234, primitives.getInt());
+ }
+
+ public void testLong() {
+ primitives.setLong(1234l);
+ assertEquals(1234l, primitives.getLong());
+ }
+
+ public void testFloat() {
+ primitives.setFloat(1234f);
+ assertEquals(1234f, primitives.getFloat());
+ }
+
+ public void testDouble() {
+ primitives.setDouble(1234d);
+ assertEquals(1234d, primitives.getDouble());
+ }
+
+ public void testGetIndex() {
+ DataObject o = (DataObject) primitives;
+ int i = 0;
+ for (Property<?> prop : type.getProperties()) {
+ String name = prop.getName();
+ if ("boolean".equals(name)) {
+ primitives.setBoolean(true);
+ assertEquals(true, o.get(i));
+ } else if ("character".equals(name)) {
+ primitives.setCharacter('A');
+ assertEquals('A', o.get(i));
+ } else if ("byte".equals(name)) {
+ primitives.setByte((byte) 12);
+ assertEquals((byte) 12, o.get(i));
+ } else if ("short".equals(name)) {
+ primitives.setShort((short) 123);
+ assertEquals((short)123, o.get(i));
+ } else if ("int".equals(name)) {
+ primitives.setInt(1234);
+ assertEquals(1234, o.get(i));
+ } else if ("long".equals(name)) {
+ primitives.setLong(12345l);
+ assertEquals(12345l, o.get(i));
+ } else if ("float".equals(name)) {
+ primitives.setFloat(1234.56f);
+ assertEquals(1234.56f, o.get(i));
+ } else if ("double".equals(name)) {
+ primitives.setDouble(1234.5678d);
+ assertEquals(1234.5678d, o.get(i));
+ } else {
+ fail();
+ }
+ i++;
+ }
+ }
+
+ public void testSetIndex() {
+ DataObject o = (DataObject) primitives;
+ int i = 0;
+ for (Property<?> prop : type.getProperties()) {
+ String name = prop.getName();
+ if ("boolean".equals(name)) {
+ o.set(i, true);
+ assertEquals(true, primitives.isBoolean());
+ } else if ("character".equals(name)) {
+ o.set(i, 'A');
+ assertEquals('A', primitives.getCharacter());
+ } else if ("byte".equals(name)) {
+ o.set(i, (byte) 12);
+ assertEquals((byte)12, primitives.getByte());
+ } else if ("short".equals(name)) {
+ o.set(i, (short)123);
+ assertEquals((short)123, primitives.getShort());
+ } else if ("int".equals(name)) {
+ o.set(i, 1234);
+ assertEquals(1234, primitives.getInt());
+ } else if ("long".equals(name)) {
+ o.set(i, 12345l);
+ assertEquals(12345l, primitives.getLong());
+ } else if ("float".equals(name)) {
+ o.set(i, 1234.56f);
+ assertEquals(1234.56f, primitives.getFloat());
+ } else if ("double".equals(name)) {
+ o.set(i, 1234.5678d);
+ assertEquals(1234.5678d, primitives.getDouble());
+ } else {
+ fail();
+ }
+ i++;
+ }
+ }
+
+ public void testCannotSetNull() {
+ DataObject o = (DataObject) primitives;
+ assertNotNull(o);
+ for (int i=0 ; i < type.getProperties().size(); i++) {
+ try {
+ o.set(i, null);
+ fail();
+ } catch (NullPointerException e) {
+ }
+ }
+ }
+
+ public void testIndexRange() {
+ DataObject o = (DataObject) primitives;
+ try {
+ o.get(-1);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+ try {
+ o.get(8);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+ try {
+ o.set(-1, null);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+ try {
+ o.set(8, null);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ TypeHelper typeHelper = new TypeHelperImpl(getClass().getClassLoader());
+ type = typeHelper.define(Primitives.class);
+ primitives = type.newInstance();
+ }
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/SimpleNestingTestCase.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/SimpleNestingTestCase.java
new file mode 100644
index 0000000000..ddcd98ae97
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/SimpleNestingTestCase.java
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+import org.osoa.sdo.Property;
+import org.osoa.sdo.Type;
+import org.osoa.sdo.helper.TypeHelper;
+
+import org.apache.tuscany.sdo.impl.TypeHelperImpl;
+import org.apache.tuscany.sdo.proxy.interfaces.Primitives;
+import org.apache.tuscany.sdo.proxy.interfaces.SimpleNesting;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimpleNestingTestCase extends TestCase {
+ private Type<SimpleNesting> simpleNestingType;
+ private SimpleNesting simpleNesting;
+ private TypeHelper typeHelper;
+
+ public void testGetSetPrimitives() {
+ Primitives prim = simpleNesting.getPrimitives();
+ assertNull(prim);
+ prim = typeHelper.getType(Primitives.class).newInstance();
+ simpleNesting.setPrimitives(prim);
+ assertSame(prim, simpleNesting.getPrimitives());
+ }
+
+ public void testPropertyType() {
+ Property<Primitives> prop = (Property<Primitives>) simpleNestingType.getProperty("primitives");
+ assertNotNull(prop);
+ assertEquals("primitives", prop.getName());
+ Type<Primitives> primType = prop.getType();
+ assertEquals(new QName(Type.JAVA_NAMESPACE, Primitives.class.getName()), primType.getName());
+ assertEquals(Primitives.class, primType.getJavaType());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ typeHelper = new TypeHelperImpl(getClass().getClassLoader());
+ simpleNestingType = typeHelper.define(SimpleNesting.class);
+
+ simpleNesting = simpleNestingType.newInstance();
+ }
+
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/DataTypes.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/DataTypes.java
new file mode 100644
index 0000000000..3549fb0ead
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/DataTypes.java
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy.interfaces;
+
+import java.util.Date;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface DataTypes {
+ String getString();
+
+ void setString(String value);
+
+ byte[] getBytes();
+
+ void setBytes(byte[] value);
+
+ Date getDate();
+
+ void setDate(Date value);
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/GetSetOnly.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/GetSetOnly.java
new file mode 100644
index 0000000000..da846c4938
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/GetSetOnly.java
@@ -0,0 +1,27 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy.interfaces;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface GetSetOnly {
+ int getReadOnly();
+
+ void setWriteOnly(int value);
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/ListTypes.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/ListTypes.java
new file mode 100644
index 0000000000..ea19f7ea36
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/ListTypes.java
@@ -0,0 +1,27 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy.interfaces;
+
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ListTypes {
+ List<Boolean> getBooleans();
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/Primitives.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/Primitives.java
new file mode 100644
index 0000000000..257076c4a1
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/Primitives.java
@@ -0,0 +1,55 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy.interfaces;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Primitives {
+ boolean isBoolean();
+
+ void setBoolean(boolean value);
+
+ char getCharacter();
+
+ void setCharacter(char value);
+
+ byte getByte();
+
+ void setByte(byte value);
+
+ int getInt();
+
+ void setInt(int value);
+
+ short getShort();
+
+ void setShort(short value);
+
+ long getLong();
+
+ void setLong(long value);
+
+ float getFloat();
+
+ void setFloat(float value);
+
+ double getDouble();
+
+ void setDouble(double value);
+}
diff --git a/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/SimpleNesting.java b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/SimpleNesting.java
new file mode 100644
index 0000000000..c5db66fe64
--- /dev/null
+++ b/sandbox/jboynes/sdoproxy/src/test/java/org/apache/tuscany/sdo/proxy/interfaces/SimpleNesting.java
@@ -0,0 +1,29 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * 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.proxy.interfaces;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface SimpleNesting {
+ Primitives getPrimitives();
+ void setPrimitives(Primitives primitives);
+
+ DataTypes getDataTypes();
+ void setDataTypes(DataTypes dataTypes);
+}