You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by dm...@apache.org on 2006/06/15 19:59:37 UTC
svn commit: r414663 - in /incubator/yoko/trunk/bindings/src/test: java/org/
java/org/apache/ java/org/apache/yoko/ java/org/apache/yoko/bindings/
java/org/apache/yoko/bindings/corba/ java/org/apache/yoko/simple/
java/org/apache/yoko/simple/types/ resou...
Author: dmiddlem
Date: Thu Jun 15 12:59:36 2006
New Revision: 414663
URL: http://svn.apache.org/viewvc?rev=414663&view=rev
Log:
Adding tests for the corba binding runtime.
Added:
incubator/yoko/trunk/bindings/src/test/java/org/
incubator/yoko/trunk/bindings/src/test/java/org/apache/
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingFactoryTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingImplTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaMessageTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectHolderTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReaderTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectWriterTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStreamableTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaUtilsTest.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/Simple.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/SimpleCORBAService.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/ObjectFactory.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethod.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethodResult.java
incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/package-info.java
incubator/yoko/trunk/bindings/src/test/resources/wsdl/
incubator/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingFactoryTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingFactoryTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingFactoryTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import javax.xml.ws.Binding;
+
+import junit.framework.TestCase;
+
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.bindings.BindingFactory;
+import org.objectweb.celtix.bindings.ClientBinding;
+import org.objectweb.celtix.bindings.ServerBinding;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+
+public class CorbaBindingFactoryTest extends TestCase {
+
+ private TestUtils testUtils;
+
+ public CorbaBindingFactoryTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaBindingFactoryTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ testUtils = new TestUtils();
+ }
+
+ public void testCreateClientBinding() throws Exception {
+ Bus bus = Bus.init(new String[0]);
+ BindingFactory factory =
+ bus.getBindingManager().getBindingFactory("http://schemas.apache.org/yoko/bindings/corba");
+
+ EndpointReferenceType address = testUtils.getEndpointReference();
+
+ ClientBinding cb = factory.createClientBinding(address);
+ assertNotNull(cb);
+ assertTrue(CorbaClientBinding.class.isInstance(cb));
+
+ CorbaClientBinding clientBinding = (CorbaClientBinding)cb;
+ Binding binding = clientBinding.getBinding();
+ assertNotNull(binding);
+ assertTrue(CorbaBindingImpl.class.isInstance(binding));
+ }
+
+ public void testCreateServerBinding() throws Exception {
+ Bus bus = Bus.init(new String[0]);
+ BindingFactory factory =
+ bus.getBindingManager().getBindingFactory("http://schemas.apache.org/yoko/bindings/corba");
+
+ EndpointReferenceType address = testUtils.getEndpointReference();
+
+ ServerBinding sb = factory.createServerBinding(address, null);
+ assertNotNull(sb);
+ assertTrue(CorbaServerBinding.class.isInstance(sb));
+
+ CorbaServerBinding serverBinding = (CorbaServerBinding)sb;
+ Binding binding = serverBinding.getBinding();
+ assertNotNull(binding);
+ assertTrue(CorbaBindingImpl.class.isInstance(binding));
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingImplTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingImplTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingImplTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingImplTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,136 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.bindings.DataBindingCallback;
+import org.objectweb.celtix.context.GenericMessageContext;
+import org.objectweb.celtix.context.ObjectMessageContext;
+import org.objectweb.celtix.context.ObjectMessageContextImpl;
+import org.objectweb.celtix.bus.jaxws.JAXBDataBindingCallback;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+
+public class CorbaBindingImplTest extends TestCase {
+
+ private ObjectMessageContextImpl objContext;
+ private CorbaMessageContextImpl corbaContext;
+ private TestUtils testUtils;
+ private ORB orb;
+
+ public CorbaBindingImplTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaBindingImplTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ testUtils = new TestUtils();
+ objContext = new ObjectMessageContextImpl();
+ corbaContext = new CorbaMessageContextImpl(new GenericMessageContext());
+
+ java.util.Properties props = System.getProperties();
+ props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+ props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
+ props.put("yoko.orb.id", "Yoko-Server-Binding");
+ orb = ORB.init(new String[0], props);
+
+ Class c = Thread.currentThread().getContextClassLoader().loadClass("org.apache.yoko.simple.Simple");
+ Class[] params = { String.class };
+ objContext.setMethod(c.getMethod("testSimpleMethod", params));
+ }
+
+ protected void tearDown() throws Exception {
+ if (orb != null) {
+ try {
+ orb.destroy();
+ } catch (Exception ex) {
+ // Do nothing. Throw an Exception?
+ }
+ }
+ }
+
+ public void testMarshal() throws Exception {
+ Bus bus = Bus.init(new String[0]);
+ EndpointReferenceType endpoint = testUtils.getEndpointReference();
+ CorbaBindingImpl bindingImpl = new CorbaBindingImpl(bus, endpoint, orb, false);
+ corbaContext.put(ObjectMessageContext.MESSAGE_INPUT, true);
+
+ String arg0 = new String("TestString");
+ objContext.setMessageObjects(arg0);
+ bindingImpl.marshal(objContext,
+ corbaContext,
+ new JAXBDataBindingCallback(objContext.getMethod(),
+ DataBindingCallback.Mode.MESSAGE,
+ null));
+
+ CorbaMessage msg = corbaContext.getMessage();
+ assertNotNull(msg);
+
+ CorbaStreamable[] arguments = msg.getStreamableArguments();
+ assertTrue(arguments.length == 1);
+
+ CorbaObjectHolder arg = arguments[0].getObject();
+ assertNotNull(arg);
+ assertTrue(arg.getValueData().equals("TestString"));
+ }
+
+ public void testUnmarshal() throws Exception {
+ Bus bus = Bus.init(new String[0]);
+ EndpointReferenceType endpoint = testUtils.getEndpointReference();
+ CorbaBindingImpl bindingImpl = new CorbaBindingImpl(bus, endpoint, orb, false);
+ corbaContext.put(ObjectMessageContext.MESSAGE_INPUT, true);
+
+ QName paramName = new QName("param1");
+ QName paramIdlType = CorbaConstants.NT_CORBA_STRING;
+ TypeCode paramTC = CorbaUtils.getPrimitiveTypeCode(orb, paramIdlType);
+ CorbaObjectHolder obj = new CorbaObjectHolder(paramName, paramIdlType, paramTC, null);
+ obj.setValue("TestString");
+ CorbaStreamable streamable = new CorbaStreamable(obj, paramName);
+ CorbaMessage msg = new CorbaMessage();
+ msg.addStreamableArgument(streamable);
+ corbaContext.setMessage(msg);
+ objContext.setMessageObjects(new Object[1]);
+
+ bindingImpl.unmarshal(corbaContext,
+ objContext,
+ new JAXBDataBindingCallback(objContext.getMethod(),
+ DataBindingCallback.Mode.MESSAGE,
+ null));
+
+ Object[] arguments = objContext.getMessageObjects();
+ assertNotNull(arguments);
+ assertTrue(arguments.length == 1);
+
+ Object o = arguments[0];
+ assertTrue(o instanceof String);
+ String param1 = (String)o;
+ assertTrue(param1.equals("TestString"));
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaMessageTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaMessageTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaMessageTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+public class CorbaMessageTest extends TestCase {
+
+ private ORB orb;
+
+ public CorbaMessageTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaMessageTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ java.util.Properties props = System.getProperties();
+ props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+ props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
+ props.put("yoko.orb.id", "Yoko-Server-Binding");
+ orb = ORB.init(new String[0], props);
+ }
+
+ public void testCreateCorbaMessage() {
+ CorbaMessage msg = new CorbaMessage();
+ assertNotNull(msg);
+ }
+
+ public void testGetCorbaMessageAttributes() {
+ CorbaMessage msg = new CorbaMessage();
+
+ msg.setOperationName("TestOperationName");
+ String opName = msg.getOperationName();
+ assertTrue(opName.equals("TestOperationName"));
+
+ QName param1Name = new QName("param1");
+ QName param1IdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode param1TypeCode = orb.get_primitive_tc(TCKind.tk_long);
+ CorbaObjectHolder param1 = new CorbaObjectHolder(param1Name, param1IdlType, param1TypeCode, null);
+ CorbaStreamable p1 = new CorbaStreamable(param1, param1Name);
+
+ QName param2Name = new QName("param2");
+ QName param2IdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode param2TypeCode = orb.get_primitive_tc(TCKind.tk_string);
+ CorbaObjectHolder param2 = new CorbaObjectHolder(param2Name, param2IdlType, param2TypeCode, null);
+ CorbaStreamable p2 = new CorbaStreamable(param2, param2Name);
+
+ msg.addStreamableArgument(p1);
+ msg.addStreamableArgument(p2);
+
+ CorbaStreamable[] arguments = msg.getStreamableArguments();
+ assertTrue(arguments.length == 2);
+ assertNotNull(arguments[0]);
+ assertNotNull(arguments[1]);
+
+ QName returnName = new QName("param2");
+ QName returnIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "boolean", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode returnTypeCode = orb.get_primitive_tc(TCKind.tk_boolean);
+ CorbaObjectHolder returnValue = new CorbaObjectHolder(returnName, returnIdlType, returnTypeCode, null);
+ CorbaStreamable ret = new CorbaStreamable(returnValue, returnName);
+
+ msg.setStreamableReturn(ret);
+ CorbaStreamable retVal = msg.getStreamableReturn();
+ assertNotNull(retVal);
+
+ Exception ex = new CorbaBindingException("TestException");
+ msg.setException(ex);
+ Exception msgEx = msg.getException();
+ assertNotNull(msgEx);
+ assertTrue(msgEx.getMessage().equals(ex.getMessage()));
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectHolderTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectHolderTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectHolderTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectHolderTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,114 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+public class CorbaObjectHolderTest extends TestCase {
+
+ private ORB orb;
+
+ public CorbaObjectHolderTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaObjectHolderTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ java.util.Properties props = System.getProperties();
+ props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+ props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
+ props.put("yoko.orb.id", "Yoko-Server-Binding");
+ orb = ORB.init(new String[0], props);
+ }
+
+ protected void tearDown() throws Exception {
+ if (orb != null) {
+ try {
+ orb.destroy();
+ } catch (Exception ex) {
+ // Do nothing. Throw an Exception?
+ }
+ }
+ }
+
+ public void testCreateCorbaObjectHolder() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_long);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+ assertNotNull(obj);
+ }
+
+ public void testGetObjectAttributes() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_long);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+
+ QName name = obj.getName();
+ assertNotNull(name);
+ assertTrue(name.equals(objName));
+
+ QName idlType = obj.getIdlType();
+ assertNotNull(idlType);
+ assertTrue(idlType.equals(objIdlType));
+
+ TypeCode tc = obj.getType();
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == objTypeCode.kind().value());
+
+ Object objDef = obj.getTypeDefintion();
+ assertNull(objDef);
+ }
+
+ public void testSetObjectValue() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_long);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+
+ obj.setValue("12345678");
+
+ Object value = obj.getValue();
+ assertTrue(value instanceof Long);
+
+ String valueData = obj.getValueData();
+ assertTrue(valueData.equals("12345678"));
+ }
+
+ public void testObjectChecks() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_long);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+
+ assertTrue(obj.isPrimitiveType());
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReaderTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReaderTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReaderTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,210 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import java.math.BigInteger;
+
+import junit.framework.TestCase;
+
+import org.omg.CORBA.portable.InputStream;
+import org.apache.yoko.orb.CORBA.OutputStream;
+import org.apache.yoko.orb.OCI.Buffer;
+
+public class CorbaObjectReaderTest extends TestCase {
+
+ public CorbaObjectReaderTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaObjectReaderTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testReadBoolean() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_boolean(true);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Boolean boolValue = reader.readBoolean();
+ assertTrue(boolValue.booleanValue() == true);
+ }
+
+ public void testReadChar() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_char('c');
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Character charValue = reader.readChar();
+ assertTrue(charValue.charValue() == 'c');
+ }
+
+ public void testReadWChar() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_wchar('w');
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Character wcharValue = reader.readWChar();
+ assertTrue(wcharValue.charValue() == 'w');
+ }
+
+ public void testReadOctet() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_octet((byte)27);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Byte octetValue = reader.readOctet();
+ assertTrue(octetValue.byteValue() == (byte)27);
+ }
+
+ public void testReadShort() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_short((short)-100);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Short shortValue = reader.readShort();
+ assertTrue(shortValue.shortValue() == (short)-100);
+ }
+
+ public void testReadUShort() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_ushort((short)100);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Short ushortValue = reader.readUShort();
+ assertTrue(ushortValue.shortValue() == (short)100);
+ }
+
+ public void testReadLong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_long(-100000);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Long longValue = reader.readLong();
+ assertTrue(longValue.longValue() == -100000);
+ }
+
+ public void testReadULong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_ulong(100000);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ BigInteger ulongValue = reader.readULong();
+ assertTrue(ulongValue.longValue() == 100000);
+ }
+
+ public void testReadLongLong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_longlong(1000000000);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ BigInteger longlongValue = reader.readLongLong();
+ assertTrue(longlongValue.longValue() == 1000000000);
+ }
+
+ public void testReadULongLong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_ulonglong(-1000000000);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ BigInteger ulonglongValue = reader.readULongLong();
+ assertTrue(ulonglongValue.longValue() == -1000000000);
+ }
+
+ public void testReadFloat() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_float((float)1234.56);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Float floatValue = reader.readFloat();
+ assertTrue(floatValue.floatValue() == (float)1234.56);
+ }
+
+ public void testReadDouble() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_double(6543.21);
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ Double doubleValue = reader.readDouble();
+ assertTrue(doubleValue.doubleValue() == 6543.21);
+ }
+
+ public void testReadString() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_string("String");
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ String stringValue = reader.readString();
+ assertTrue(stringValue.equals("String"));
+ }
+
+ public void testReadWString() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_wstring("WString");
+
+ InputStream iStream = oStream.create_input_stream();
+ CorbaObjectReader reader = new CorbaObjectReader(iStream);
+
+ String wstringValue = reader.readWString();
+ assertTrue(wstringValue.equals("WString"));
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectWriterTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectWriterTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectWriterTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectWriterTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,211 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import java.math.BigInteger;
+
+import junit.framework.TestCase;
+
+import org.omg.CORBA.portable.InputStream;
+import org.apache.yoko.orb.CORBA.OutputStream;
+import org.apache.yoko.orb.OCI.Buffer;
+
+public class CorbaObjectWriterTest extends TestCase {
+
+ public CorbaObjectWriterTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaObjectWriterTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testWriteBoolean() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Boolean boolValue = new Boolean(true);
+ writer.writeBoolean(boolValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ boolean b = iStream.read_boolean();
+ assertTrue(b == boolValue.booleanValue());
+ }
+
+ public void testWriteChar() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Character charValue = new Character('c');
+ writer.writeChar(charValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ char c = iStream.read_char();
+ assertTrue(c == charValue.charValue());
+ }
+
+ public void testWriteWChar() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Character wcharValue = new Character('w');
+ writer.writeChar(wcharValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ char wc = iStream.read_char();
+ assertTrue(wc == wcharValue.charValue());
+ }
+
+ public void testWriteShort() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Short shortValue = new Short((short)-123);
+ writer.writeShort(shortValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ short s = iStream.read_short();
+ assertTrue(s == shortValue.shortValue());
+ }
+
+ public void testWriteUShort() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Short ushortValue = new Short((short)123);
+ writer.writeUShort(ushortValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ short us = iStream.read_ushort();
+ assertTrue(us == ushortValue.shortValue());
+ }
+
+ public void testWriteLong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Long longValue = new Long(-1234567);
+ writer.writeLong(longValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ long l = iStream.read_long();
+ assertTrue(l == longValue.longValue());
+ }
+
+ public void testWriteULong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ BigInteger ulongValue = new BigInteger("1234567");
+ writer.writeULong(ulongValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ long ul = iStream.read_ulong();
+ assertTrue(ul == ulongValue.longValue());
+ }
+
+ public void testWriteLongLong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ BigInteger longlongValue = new BigInteger("-12345678900");
+ writer.writeLongLong(longlongValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ long ll = iStream.read_longlong();
+ assertTrue(ll == longlongValue.longValue());
+ }
+
+ public void testWriteULongLong() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ BigInteger ulonglongValue = new BigInteger("12345678900");
+ writer.writeULongLong(ulonglongValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ long ul = iStream.read_ulonglong();
+ assertTrue(ul == ulonglongValue.longValue());
+ }
+
+ public void testWriteFloat() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Float floatValue = new Float((float)123456.78);
+ writer.writeFloat(floatValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ float f = iStream.read_float();
+ assertTrue(f == floatValue.floatValue());
+ }
+
+ public void testWriteDouble() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ Double doubleValue = new Double(987654.321);
+ writer.writeDouble(doubleValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ double d = iStream.read_double();
+ assertTrue(d == doubleValue.doubleValue());
+ }
+
+ public void testWriteString() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ String stringValue = new String("String");
+ writer.writeString(stringValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ String s = iStream.read_string();
+ assertTrue(s.equals(stringValue));
+ }
+
+ public void testWriteWString() {
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+
+ CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
+ String wstringValue = new String("String");
+ writer.writeWString(wstringValue);
+
+ InputStream iStream = oStream.create_input_stream();
+ String s = iStream.read_wstring();
+ assertTrue(s.equals(wstringValue));
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStreamableTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStreamableTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStreamableTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStreamableTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,144 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import javax.xml.namespace.QName;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+import junit.framework.TestCase;
+
+import org.apache.yoko.orb.CORBA.OutputStream;
+import org.apache.yoko.orb.OCI.Buffer;
+
+public class CorbaStreamableTest extends TestCase {
+
+ private ORB orb;
+
+ public CorbaStreamableTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaStreamableTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ java.util.Properties props = System.getProperties();
+ props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+ props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
+ props.put("yoko.orb.id", "Yoko-Server-Binding");
+ orb = ORB.init(new String[0], props);
+ }
+
+ protected void tearDown() throws Exception {
+ if (orb != null) {
+ try {
+ orb.destroy();
+ } catch (Exception ex) {
+ // Do nothing. Throw an Exception?
+ }
+ }
+ }
+
+ public void testCreateStreamable() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+ CorbaStreamable streamable = new CorbaStreamable(obj, objName);
+
+ assertNotNull(streamable);
+ }
+
+ public void testGetStreamableAttributes() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "float", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_float);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+ CorbaStreamable streamable = new CorbaStreamable(obj, objName);
+
+ TypeCode type = streamable._type();
+ assertTrue(type.kind().value() == objTypeCode.kind().value());
+
+ CorbaObjectHolder storedObj = streamable.getObject();
+ assertNotNull(storedObj);
+
+ int mode = streamable.getMode();
+ assertTrue(mode == org.omg.CORBA.ARG_OUT.value);
+
+ String name = streamable.getName();
+ assertTrue(name.equals(objName.getLocalPart()));
+ }
+
+ public void testSetStreamableAttributes() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "boolean", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_boolean);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+ CorbaStreamable streamable = new CorbaStreamable(obj, objName);
+
+ streamable.setMode(org.omg.CORBA.ARG_IN.value);
+ int mode = streamable.getMode();
+ assertTrue(mode == org.omg.CORBA.ARG_IN.value);
+ }
+
+ public void testReadStreamable() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "char", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_char);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+ CorbaStreamable streamable = new CorbaStreamable(obj, objName);
+
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ oStream.write_char('c');
+
+ InputStream iStream = oStream.create_input_stream();
+ streamable._read(iStream);
+ CorbaObjectHolder streamableObj = streamable.getObject();
+ Object o = streamableObj.getValue();
+
+ assertTrue(o instanceof Character);
+ Character charValue = (Character)o;
+ assertTrue(charValue.charValue() == 'c');
+ }
+
+ public void testWriteStreamable() {
+ QName objName = new QName("object");
+ QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "wstring", CorbaConstants.NP_WSDL_CORBA);
+ TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_wstring);
+ CorbaObjectHolder obj = new CorbaObjectHolder(objName, objIdlType, objTypeCode, null);
+ obj.setValue("TestWString");
+ CorbaStreamable streamable = new CorbaStreamable(obj, objName);
+
+ Buffer buf = new Buffer();
+ OutputStream oStream = new OutputStream(buf);
+ streamable._write(oStream);
+
+ InputStream iStream = oStream.create_input_stream();
+ String value = iStream.read_wstring();
+ assertTrue(value.equals("TestWString"));
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaUtilsTest.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaUtilsTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaUtilsTest.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,203 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+import org.apache.schemas.yoko.bindings.corba.AddressType;
+import org.apache.schemas.yoko.bindings.corba.BindingType;
+import org.apache.schemas.yoko.bindings.corba.OperationType;
+
+
+public class CorbaUtilsTest extends TestCase {
+
+ private ORB orb;
+ private TestUtils testUtils;
+
+ public CorbaUtilsTest(String arg0) {
+ super(arg0);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(CorbaUtilsTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ java.util.Properties props = System.getProperties();
+ props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+ props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
+ props.put("yoko.orb.id", "Yoko-Server-Binding");
+ orb = ORB.init(new String[0], props);
+ testUtils = new TestUtils();
+ }
+
+ protected void tearDown() throws Exception {
+ if (orb != null) {
+ try {
+ orb.destroy();
+ } catch (Exception ex) {
+ // Do nothing. Throw an Exception?
+ }
+ }
+ }
+
+ public void testBooleanTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "boolean", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_boolean);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testCharTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "char", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_char);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testWCharTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "wchar", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_wchar);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testOctetTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "octet", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_octet);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testShortTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "short", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_short);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testUShortTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "ushort", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_ushort);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testLongTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "long", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_long);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testULongTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "ulong", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_ulong);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testLongLongTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "longlong", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_longlong);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testULongLongTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "ulonglong", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_ulonglong);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testFloatTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "float", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_float);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testDoubleTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "double", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_double);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testStringTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "string", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_string);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testWStringTypeCode() {
+ QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "wstring", "corba");
+ TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
+ assertNotNull(tc);
+ assertTrue(tc.kind().value() == TCKind._tk_wstring);
+ assertTrue(CorbaUtils.isPrimitiveIdlType(type));
+ }
+
+ public void testGetCorbaAddressType() throws Exception {
+ Bus bus = Bus.init(new String[0]);
+ EndpointReferenceType endpoint = testUtils.getEndpointReference();
+ AddressType address = CorbaUtils.getCorbaAddressType(bus, endpoint);
+ assertNotNull(address);
+ }
+
+ public void testGetCorbaBindingType() throws Exception {
+ Bus bus = Bus.init(new String[0]);
+ EndpointReferenceType endpoint = testUtils.getEndpointReference();
+ BindingType binding = CorbaUtils.getCorbaBindingType(bus, endpoint);
+ assertNotNull(binding);
+ }
+
+ public void testGetCorbaOperationType() throws Exception {
+ Bus bus = Bus.init(new String[0]);
+ EndpointReferenceType endpoint = testUtils.getEndpointReference();
+ String opName = "testSimpleMethod";
+ OperationType operation = CorbaUtils.getCorbaOperationType(opName, bus, endpoint);
+ assertNotNull(operation);
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba;
+
+import java.net.URL;
+import javax.xml.namespace.QName;
+
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+import org.objectweb.celtix.wsdl.EndpointReferenceUtils;
+
+public final class TestUtils {
+
+ public EndpointReferenceType getEndpointReference() {
+ URL wsdlUrl = getClass().getResource("/wsdl/simpleIdl.wsdl");
+ QName serviceName = new QName("http://yoko.apache.org/simple", "SimpleCORBAService");
+ return EndpointReferenceUtils.getEndpointReference(wsdlUrl, serviceName, "SimpleCORBAPort");
+ }
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/Simple.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/Simple.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/Simple.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/Simple.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,34 @@
+/* Generated by WSDLToJava Compiler. */
+
+package org.apache.yoko.simple;
+
+import javax.jws.WebParam.Mode;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.WebMethod;
+import javax.jws.WebResult;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+/**
+ * This class was generated by the Celtix 1.1-SNAPSHOT
+ * Thu Jun 15 16:22:57 NDT 2006
+ * Generated source version: 1.1-SNAPSHOT
+ *
+ */
+
+@WebService(wsdlLocation = "/home/dmiddlem/dev/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl", targetNamespace = "http://yoko.apache.org/simple", name = "Simple")
+
+public interface Simple {
+
+ @ResponseWrapper(targetNamespace = "http://yoko.apache.org/simple/types", className = "org.apache.yoko.simple.types.TestSimpleMethodResult", localName = "testSimpleMethodResult")
+ @RequestWrapper(targetNamespace = "http://yoko.apache.org/simple/types", className = "org.apache.yoko.simple.types.TestSimpleMethod", localName = "testSimpleMethod")
+ @WebResult(targetNamespace = "http://yoko.apache.org/simple/types", name = "return")
+ @WebMethod(operationName = "testSimpleMethod")
+ public boolean testSimpleMethod(
+ @WebParam(targetNamespace = "http://yoko.apache.org/simple/types", name = "param1")
+ java.lang.String param1
+ );
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/SimpleCORBAService.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/SimpleCORBAService.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/SimpleCORBAService.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/SimpleCORBAService.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,51 @@
+package org.apache.yoko.simple;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import org.apache.yoko.simple.Simple;
+/**
+ * This class was generated by the Celtix 1.1-SNAPSHOT
+ * Thu Jun 15 16:22:57 NDT 2006
+ * Generated source version: 1.1-SNAPSHOT
+ *
+ */
+
+@WebServiceClient(name = "SimpleCORBAService", targetNamespace = "http://yoko.apache.org/simple", wsdlLocation = "file:/home/dmiddlem/dev/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl")
+public class SimpleCORBAService extends Service {
+
+ private final static URL WSDL_LOCATION;
+ private final static QName SERVICE = new QName("http://yoko.apache.org/simple", "SimpleCORBAService");
+ private final static QName SimpleCORBAPort = new QName("http://yoko.apache.org/simple", "SimpleCORBAPort");
+ static {
+ URL url = null;
+ try {
+ url = new URL("file:/home/dmiddlem/dev/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ WSDL_LOCATION = url;
+ }
+
+ public SimpleCORBAService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public SimpleCORBAService() {
+ super(WSDL_LOCATION, SERVICE);
+ }
+
+ /**
+ *
+ * @return
+ * returns SimpleCORBAPort
+ */
+ @WebEndpoint(name = "SimpleCORBAPort")
+ public Simple getSimpleCORBAPort() {
+ return (Simple)super.getPort(SimpleCORBAPort, Simple.class);
+ }
+
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/ObjectFactory.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/ObjectFactory.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/ObjectFactory.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,48 @@
+
+package org.apache.yoko.simple.types;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.apache.yoko.simple.types package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.yoko.simple.types
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link TestSimpleMethod }
+ *
+ */
+ public TestSimpleMethod createTestSimpleMethod() {
+ return new TestSimpleMethod();
+ }
+
+ /**
+ * Create an instance of {@link TestSimpleMethodResult }
+ *
+ */
+ public TestSimpleMethodResult createTestSimpleMethodResult() {
+ return new TestSimpleMethodResult();
+ }
+
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethod.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethod.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethod.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethod.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,66 @@
+
+package org.apache.yoko.simple.types;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for testSimpleMethod element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <element name="testSimpleMethod">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="param1" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "param1"
+})
+@XmlRootElement(name = "testSimpleMethod")
+public class TestSimpleMethod {
+
+ @XmlElement(required = true)
+ protected String param1;
+
+ /**
+ * Gets the value of the param1 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getParam1() {
+ return param1;
+ }
+
+ /**
+ * Sets the value of the param1 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setParam1(String value) {
+ this.param1 = value;
+ }
+
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethodResult.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethodResult.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethodResult.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/TestSimpleMethodResult.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,58 @@
+
+package org.apache.yoko.simple.types;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for testSimpleMethodResult element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <element name="testSimpleMethodResult">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="return" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "_return"
+})
+@XmlRootElement(name = "testSimpleMethodResult")
+public class TestSimpleMethodResult {
+
+ @XmlElement(name = "return")
+ protected boolean _return;
+
+ /**
+ * Gets the value of the return property.
+ *
+ */
+ public boolean isReturn() {
+ return _return;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ */
+ public void setReturn(boolean value) {
+ this._return = value;
+ }
+
+}
Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/package-info.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/package-info.java?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/package-info.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/simple/types/package-info.java Thu Jun 15 12:59:36 2006
@@ -0,0 +1,2 @@
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://yoko.apache.org/simple/types")
+package org.apache.yoko.simple.types;
Added: incubator/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl?rev=414663&view=auto
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl (added)
+++ incubator/yoko/trunk/bindings/src/test/resources/wsdl/simpleIdl.wsdl Thu Jun 15 12:59:36 2006
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated by <idltowsdl> Tool. Version 3.0.2 -->
+<definitions
+ targetNamespace="http://yoko.apache.org/simple"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://yoko.apache.org/simple"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd1="http://yoko.apache.org/simple/types"
+ xmlns:corba="http://schemas.apache.org/yoko/bindings/corba"
+ xmlns:corbatm="http://yoko.apache.org/simple/idl_types"
+ xmlns:references="http://schemas.iona.com/references">
+ <types>
+ <schema targetNamespace="http://yoko.apache.org/simple/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <xsd:element name="testSimpleMethod">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="param1" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="testSimpleMethodResult">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="return" type="xsd:boolean"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </schema>
+ </types>
+ <message name="testSimpleMethod">
+ <part name="parameters" element="xsd1:testSimpleMethod"/>
+ </message>
+ <message name="testSimpleMethodResponse">
+ <part name="parameters" element="xsd1:testSimpleMethodResult"/>
+ </message>
+ <portType name="Simple">
+ <operation name="testSimpleMethod">
+ <input message="tns:testSimpleMethod" name="testSimpleMethod"/>
+ <output message="tns:testSimpleMethodResponse" name="testSimpleMethodResponse"/>
+ </operation>
+ </portType>
+ <binding name="SimpleCORBABinding" type="tns:Simple">
+ <corba:binding repositoryID="IDL:Simple:1.0"/>
+ <operation name="testSimpleMethod">
+ <corba:operation name="testSimpleMethod">
+ <corba:param name="param1" mode="in" idltype="corba:string"/>
+ <corba:return name="return" idltype="corba:boolean"/>
+ </corba:operation>
+ <input/>
+ <output/>
+ </operation>
+ </binding>
+ <service name="SimpleCORBAService">
+ <port name="SimpleCORBAPort" binding="tns:SimpleCORBABinding">
+ <corba:address location="corbaloc::localhost:40000/Simple"/>
+ </port>
+ </service>
+</definitions>