From 132aa8a77685ec92bc90c03f987650d275a7b639 Mon Sep 17 00:00:00 2001 From: lresende Date: Mon, 30 Sep 2013 06:59:11 +0000 Subject: 2.0.1 RC1 release tag git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1527464 13f79535-47bb-0310-9956-ffa450edef68 --- .../corba/jee/testing/JEECorbaHostTestCase.java | 208 +++++++++++++++++++++ .../sca/host/corba/jee/testing/TestContext.java | 174 +++++++++++++++++ .../jee/testing/TestInitialContextFactory.java | 37 ++++ .../corba/jee/testing/general/TestInterface.java | 29 +++ .../jee/testing/general/TestInterfaceHelper.java | 99 ++++++++++ .../jee/testing/general/TestInterfaceHolder.java | 50 +++++ .../testing/general/TestInterfaceOperations.java | 30 +++ .../testing/general/_TestInterfaceImplBase.java | 73 ++++++++ .../jee/testing/general/_TestInterfaceStub.java | 72 +++++++ .../jee/testing/servants/TestInterfaceServant.java | 35 ++++ .../host-corba-jee/src/test/resources/general.idl | 45 +++++ 11 files changed, 852 insertions(+) create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/resources/general.idl (limited to 'sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test') diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java new file mode 100644 index 0000000000..fd952a02c7 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java @@ -0,0 +1,208 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertTrue; +import static junit.framework.Assert.fail; + +import javax.naming.Context; + +import org.apache.tuscany.sca.host.corba.CorbaHostException; +import org.apache.tuscany.sca.host.corba.jee.JEECorbaHost; +import org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface; +import org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper; +import org.apache.tuscany.sca.host.corba.jee.testing.servants.TestInterfaceServant; +import org.apache.tuscany.sca.host.corba.naming.TransientNameServer; +import org.apache.tuscany.sca.host.corba.naming.TransientNameService; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * General tests for JEECorbaHost. Uses host-corba-jdk as mock for JEE + * environment ORB. + */ +public class JEECorbaHostTestCase { + + public static final String LOCALHOST = "localhost"; + public static final int DEFAULT_PORT = 11100; + private static JEECorbaHost host; + private static TransientNameServer server; + private static String factoryClassName; + + private String createCorbanameURI(String name) { + return "corbaname:#" + name; + } + + @BeforeClass + public static void start() { + try { + server = new TransientNameServer(LOCALHOST, DEFAULT_PORT, TransientNameService.DEFAULT_SERVICE_NAME); + Thread t = server.start(); + if (t == null) { + fail("The naming server cannot be started"); + } + factoryClassName = System.getProperty(Context.INITIAL_CONTEXT_FACTORY); + System.setProperty(Context.INITIAL_CONTEXT_FACTORY, TestInitialContextFactory.class.getName()); + host = new JEECorbaHost(); + host.start(); + } catch (Throwable e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + + @AfterClass + public static void stop() { + server.stop(); + if (factoryClassName != null) { + System.setProperty(Context.INITIAL_CONTEXT_FACTORY, factoryClassName); + } else { + System.clearProperty(Context.INITIAL_CONTEXT_FACTORY); + } + } + + /** + * Tests registering and lookup CORBA services + */ + @Test + public void test_registerServant() { + try { + String uri = createCorbanameURI("Nested/Test"); + TestInterface servant = new TestInterfaceServant(); + host.registerServant(uri, servant); + TestInterface ref = TestInterfaceHelper.narrow(host.lookup(uri)); + assertEquals(2, ref.getInt(2)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Tests unregistering servants + */ + @Test + public void test_unregisterServant() { + try { + String uri = createCorbanameURI("Unregistering/Test"); + TestInterface servant = new TestInterfaceServant(); + + // creating and releasing using corbaname URI + host.registerServant(uri, servant); + host.unregisterServant(uri); + host.registerServant(uri, servant); + host.unregisterServant(uri); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Tests situation when name is already registered + */ + @Test + public void test_nameAlreadyRegistered() { + // test using URI + try { + TestInterface servant = new TestInterfaceServant(); + String uri = createCorbanameURI("AlreadyRegisteredTest2"); + host.registerServant(uri, servant); + host.registerServant(uri, servant); + fail(); + } catch (CorbaHostException e) { + assertTrue(e.getMessage().equals(CorbaHostException.BINDING_IN_USE)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Tests getting non existing reference + */ + @Test + public void test_getNonExistingObject() { + // try to fetch object with corbaname URI + try { + host.lookup(createCorbanameURI("NonExistingOne")); + fail(); + } catch (CorbaHostException e) { + // The message is JDK-specific + // assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT)); + } catch (Exception e) { + // e.printStackTrace(); + fail(); + } + } + + /** + * Tests unregistering non existing reference + */ + @Test + public void test_unregisterNonExistentObject() { + // test using URI + try { + String uri = createCorbanameURI("NonExistingReference1"); + host.unregisterServant(uri); + fail(); + } catch (CorbaHostException e) { + assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT)); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Tests unregistering servants on host stop + */ + @Test + public void test_unregisterOnStop() { + try { + String uri1 = createCorbanameURI("TempService1"); + String uri2 = createCorbanameURI("TempService2"); + JEECorbaHost innerHost = new JEECorbaHost(); + innerHost.start(); + TestInterfaceServant servant = new TestInterfaceServant(); + innerHost.registerServant(uri1, servant); + innerHost.registerServant(uri2, servant); + innerHost.stop(); + try { + innerHost.lookup(uri1); + fail(); + } catch (CorbaHostException e) { + assertEquals(CorbaHostException.NO_SUCH_OBJECT, e.getMessage()); + } + try { + innerHost.lookup(uri2); + fail(); + } catch (CorbaHostException e) { + assertEquals(CorbaHostException.NO_SUCH_OBJECT, e.getMessage()); + } + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java new file mode 100644 index 0000000000..a0b9b7c514 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing; + +import java.util.Hashtable; + +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +import org.apache.tuscany.sca.host.corba.jee.JEECorbaHost; +import org.omg.CORBA.ORB; + +/** + * Mock implementation of javax.naming.Context interface. + */ +public class TestContext implements Context { + + private ORB orb; + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + return null; + } + + public void bind(Name name, Object obj) throws NamingException { + + } + + public void bind(String name, Object obj) throws NamingException { + + } + + public void close() throws NamingException { + + } + + public Name composeName(Name name, Name prefix) throws NamingException { + return null; + } + + public String composeName(String name, String prefix) throws NamingException { + return null; + } + + public Context createSubcontext(Name name) throws NamingException { + return null; + } + + public Context createSubcontext(String name) throws NamingException { + return null; + } + + public void destroySubcontext(Name name) throws NamingException { + + } + + public void destroySubcontext(String name) throws NamingException { + + } + + public Hashtable getEnvironment() throws NamingException { + return null; + } + + public String getNameInNamespace() throws NamingException { + return null; + } + + public NameParser getNameParser(Name name) throws NamingException { + return null; + } + + public NameParser getNameParser(String name) throws NamingException { + return null; + } + + public NamingEnumeration list(Name name) throws NamingException { + return null; + } + + public NamingEnumeration list(String name) throws NamingException { + return null; + } + + public NamingEnumeration listBindings(Name name) throws NamingException { + return null; + } + + public NamingEnumeration listBindings(String name) throws NamingException { + return null; + } + + public Object lookup(Name name) throws NamingException { + return null; + } + + public Object lookup(String name) throws NamingException { + try { + if (name.equals(JEECorbaHost.ORB_NAME)) { + if (orb == null) { + // get ORB which was spawned under host and port declared in + // test class + String[] args = + {"-ORBInitialHost", JEECorbaHostTestCase.LOCALHOST, "-ORBInitialPort", + "" + JEECorbaHostTestCase.DEFAULT_PORT}; + orb = ORB.init(args, null); + } + } else { + throw new NamingException("Unknown name: " + name); + } + } catch (Exception e) { + throw new NamingException(e.getMessage()); + } + return orb; + } + + public Object lookupLink(Name name) throws NamingException { + return null; + } + + public Object lookupLink(String name) throws NamingException { + return null; + } + + public void rebind(Name name, Object obj) throws NamingException { + + } + + public void rebind(String name, Object obj) throws NamingException { + + } + + public Object removeFromEnvironment(String propName) throws NamingException { + return null; + } + + public void rename(Name oldName, Name newName) throws NamingException { + + } + + public void rename(String oldName, String newName) throws NamingException { + + } + + public void unbind(Name name) throws NamingException { + + } + + public void unbind(String name) throws NamingException { + + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java new file mode 100644 index 0000000000..f480235fa8 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.spi.InitialContextFactory; + +/** + * Factory for mock implementation of javax.naming.Context interface. + */ +public class TestInitialContextFactory implements InitialContextFactory { + + public Context getInitialContext(Hashtable environment) throws NamingException { + return new TestContext(); + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java new file mode 100644 index 0000000000..c868329f10 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing.general; + +/** +* org/apache/tuscany/sca/host/corba/testing/general/TestInterface.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from general_tests.idl +*/ + +public interface TestInterface extends TestInterfaceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity { +} // interface TestInterface diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java new file mode 100644 index 0000000000..e00b2429da --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing.general; + +/** +* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from general_tests.idl +*/ + +abstract public class TestInterfaceHelper { + private static String _id = "IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"; + + public static void insert(org.omg.CORBA.Any a, + org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } + + public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); + } + + private static org.omg.CORBA.TypeCode __typeCode = null; + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = + org.omg.CORBA.ORB + .init() + .create_interface_tc(org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.id(), + "TestInterface"); + } + return __typeCode; + } + + public static String id() { + return _id; + } + + public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface read(org.omg.CORBA.portable.InputStream istream) { + return narrow(istream.read_Object(_TestInterfaceStub.class)); + } + + public static void write(org.omg.CORBA.portable.OutputStream ostream, + org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface value) { + ostream.write_Object((org.omg.CORBA.Object)value); + } + + public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface narrow(org.omg.CORBA.Object obj) { + if (obj == null) + return null; + else if (obj instanceof org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface) + return (org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)obj; + else if (!obj._is_a(id())) + throw new org.omg.CORBA.BAD_PARAM(); + else { + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate(); + org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub stub = + new org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub(); + stub._set_delegate(delegate); + return stub; + } + } + + public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface unchecked_narrow(org.omg.CORBA.Object obj) { + if (obj == null) + return null; + else if (obj instanceof org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface) + return (org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)obj; + else { + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate(); + org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub stub = + new org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub(); + stub._set_delegate(delegate); + return stub; + } + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java new file mode 100644 index 0000000000..292e1d09ab --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing.general; + +/** +* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from general_tests.idl +*/ + +public final class TestInterfaceHolder implements org.omg.CORBA.portable.Streamable { + public org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface value = null; + + public TestInterfaceHolder() { + } + + public TestInterfaceHolder(org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface initialValue) { + value = initialValue; + } + + public void _read(org.omg.CORBA.portable.InputStream i) { + value = org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.read(i); + } + + public void _write(org.omg.CORBA.portable.OutputStream o) { + org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.write(o, value); + } + + public org.omg.CORBA.TypeCode _type() { + return org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.type(); + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java new file mode 100644 index 0000000000..8d66535eb2 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing.general; + +/** +* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from general_tests.idl +*/ + +public interface TestInterfaceOperations { + int getInt(int arg); +} // interface TestInterfaceOperations diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java new file mode 100644 index 0000000000..4f75c045ca --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing.general; + +/** +* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from general_tests.idl +*/ + +public abstract class _TestInterfaceImplBase extends org.omg.CORBA.portable.ObjectImpl implements + org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface, org.omg.CORBA.portable.InvokeHandler { + + // Constructors + public _TestInterfaceImplBase() { + } + + private static java.util.Hashtable _methods = new java.util.Hashtable(); + static { + _methods.put("getInt", new java.lang.Integer(0)); + } + + public org.omg.CORBA.portable.OutputStream _invoke(String $method, + org.omg.CORBA.portable.InputStream in, + org.omg.CORBA.portable.ResponseHandler $rh) { + org.omg.CORBA.portable.OutputStream out = null; + java.lang.Integer __method = (java.lang.Integer)_methods.get($method); + if (__method == null) + throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); + + switch (__method.intValue()) { + case 0: // org/apache/tuscany/sca/host/corba/testing/general/TestInterface/getInt + { + int arg = in.read_long(); + int $result = (int)0; + $result = this.getInt(arg); + out = $rh.createReply(); + out.write_long($result); + break; + } + + default: + throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); + } + + return out; + } // _invoke + + // Type-specific CORBA::Object operations + private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"}; + + public String[] _ids() { + return (String[])__ids.clone(); + } + +} // class _TestInterfaceImplBase diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java new file mode 100644 index 0000000000..cc6d137109 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing.general; + +/** +* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from general_tests.idl +*/ + +public class _TestInterfaceStub extends org.omg.CORBA.portable.ObjectImpl implements + org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface { + + public int getInt(int arg) { + org.omg.CORBA.portable.InputStream $in = null; + try { + org.omg.CORBA.portable.OutputStream $out = _request("getInt", true); + $out.write_long(arg); + $in = _invoke($out); + int $result = $in.read_long(); + return $result; + } catch (org.omg.CORBA.portable.ApplicationException $ex) { + $in = $ex.getInputStream(); + String _id = $ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); + } catch (org.omg.CORBA.portable.RemarshalException $rm) { + return getInt(arg); + } finally { + _releaseReply($in); + } + } // getInt + + // Type-specific CORBA::Object operations + private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"}; + + public String[] _ids() { + return (String[])__ids.clone(); + } + + private void readObject(java.io.ObjectInputStream s) throws java.io.IOException { + String str = s.readUTF(); + String[] args = null; + java.util.Properties props = null; + org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str); + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate(); + _set_delegate(delegate); + } + + private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { + String[] args = null; + java.util.Properties props = null; + String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this); + s.writeUTF(str); + } +} // class _TestInterfaceStub diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java new file mode 100644 index 0000000000..6195f3af9c --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.host.corba.jee.testing.servants; + +import org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceImplBase; + +/** + * Testing servant + */ +public class TestInterfaceServant extends _TestInterfaceImplBase { + + private static final long serialVersionUID = 1L; + + public int getInt(int arg) { + return arg; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/resources/general.idl b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/resources/general.idl new file mode 100644 index 0000000000..9194a37334 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/modules/host-corba-jee/src/test/resources/general.idl @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * compile by + * idlj -fall -oldImplBase general.idl + */ + +module org { + module apache { + module tuscany { + module sca { + module host { + module corba { + module jee { + module testing { + module general { + interface TestInterface { + long getInt(in long arg); + }; + }; + }; + }; + }; + }; + }; + }; + }; +}; -- cgit v1.2.3