From 7f87032072bad92962601c8f9ece5f71b2d4a1ef Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 18 Jul 2008 18:29:28 +0000 Subject: Apply the patch from Wojtek for TUSCANY-2397 (operations-mapping-jira-2357-15-july.patch) git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@677993 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/test/corba/ScenarioThreeTestCase.java | 127 +++++++++++++++++++ .../sca/test/corba/ScenarioTwoTestCase.java | 136 +++++++++++++++++++++ .../sca/test/corba/generated/ScenarioTwo.java | 34 ++++++ .../test/corba/generated/ScenarioTwoHelper.java | 106 ++++++++++++++++ .../test/corba/generated/ScenarioTwoHolder.java | 59 +++++++++ .../corba/generated/ScenarioTwoOperations.java | 36 ++++++ .../test/corba/generated/_ScenarioTwoImplBase.java | 93 ++++++++++++++ .../sca/test/corba/generated/_ScenarioTwoStub.java | 99 +++++++++++++++ .../sca/test/corba/types/ScenarioTwoServant.java | 41 +++++++ .../sca/test/corba/types/TScenarioThree.java | 41 +++++++ .../test/corba/types/TScenarioThreeComponent.java | 40 ++++++ .../test/corba/types/TScenarioThreeServant.java | 51 ++++++++ .../tuscany/sca/test/corba/types/TScenarioTwo.java | 31 +++++ .../test/corba/types/TScenarioTwoComponent.java | 40 ++++++ .../sca/test/corba/types/TScenarioTwoServant.java | 37 ++++++ .../src/test/resources/ScenarioThree.composite | 43 +++++++ .../corba/src/test/resources/ScenarioTwo.composite | 43 +++++++ .../corba/src/test/resources/itest_scenario.idl | 10 ++ 18 files changed, 1067 insertions(+) create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java create mode 100644 java/sca/itest/corba/src/test/resources/ScenarioThree.composite create mode 100644 java/sca/itest/corba/src/test/resources/ScenarioTwo.composite (limited to 'java/sca/itest/corba/src') diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java new file mode 100644 index 0000000000..eb0ac60ef1 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java @@ -0,0 +1,127 @@ +/* + * 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.test.corba; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.corba.naming.TransientNameServer; +import org.apache.tuscany.sca.host.corba.naming.TransientNameService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.test.corba.types.TScenarioThree; +import org.apache.tuscany.sca.test.corba.types.TScenarioThreeComponent; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Tests various mapping scenarios. + */ +public class ScenarioThreeTestCase { + + // note that those values are also used in resources/*.composite file + private static int ORB_INITIAL_PORT = 5060; + private static SCADomain domain; + private static TransientNameServer server; + + /** + * Sets up name service, creates and registers traditional CORBA service, + * obtains SCADomain + */ + @BeforeClass + public static void setUp() { + try { + try { + server = + new TransientNameServer("localhost", ORB_INITIAL_PORT, TransientNameService.DEFAULT_SERVICE_NAME); + Thread t = server.start(); + if (t == null) { + Assert.fail("The naming server cannot be started"); + } + } catch (Throwable e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } + // obtain domain + domain = SCADomain.newInstance("ScenarioThree.composite"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Kills previously spawned name service. + */ + @AfterClass + public static void tearDown() { + server.stop(); + } + + /** + * Tests mapping for getters and setters + */ + @Test + public void test_getterSetter() { + try { + TScenarioThree ref = + domain.getService(TScenarioThreeComponent.class, "ScenarioThreeReference").getScenarioThree(); + ref.getIntField(); + ref.setIntField(1); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Tests mapping the same operation names but with different cases + */ + @Test + public void test_nameCase() { + try { + TScenarioThree ref = + domain.getService(TScenarioThreeComponent.class, "ScenarioThreeReference").getScenarioThree(); + assertEquals(0, ref.caseDifferent()); + assertEquals(1, ref.CaseDifferent()); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Tests mappings for operations with overloaded names + */ + @Test + public void test_overloadedNames() { + try { + TScenarioThree ref = + domain.getService(TScenarioThreeComponent.class, "ScenarioThreeReference").getScenarioThree(); + ref.overloadedName(); + ref.overloadedName(""); + ref.overloadedName("", 0); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java new file mode 100644 index 0000000000..6d59e50566 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java @@ -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.tuscany.sca.test.corba; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.corba.naming.TransientNameServer; +import org.apache.tuscany.sca.host.corba.naming.TransientNameService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.test.corba.generated.ScenarioTwo; +import org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper; +import org.apache.tuscany.sca.test.corba.types.ScenarioTwoServant; +import org.apache.tuscany.sca.test.corba.types.TScenarioTwo; +import org.apache.tuscany.sca.test.corba.types.TScenarioTwoComponent; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.omg.CORBA.ORB; +import org.omg.CosNaming.NameComponent; +import org.omg.CosNaming.NamingContext; +import org.omg.CosNaming.NamingContextHelper; + +/** + * Tests attribute get/set mapping using cooperation between traditional CORBA + * and Tuscany CORBA + */ +public class ScenarioTwoTestCase { + + // note that those values are also used in resources/*.composite file + private static int ORB_INITIAL_PORT = 5060; + + private static SCADomain domain; + + private static TransientNameServer server; + private static ORB orb; + private static String TUSCANY_SERVICE_NAME = "ScenarioTwo"; + private static String GENERATED_SERVICE_NAME = "ScenarioTwoGenerated"; + + /** + * Sets up name service, creates and registers traditional CORBA service, + * obtains SCADomain + */ + @BeforeClass + public static void setUp() { + try { + try { + server = + new TransientNameServer("localhost", ORB_INITIAL_PORT, TransientNameService.DEFAULT_SERVICE_NAME); + Thread t = server.start(); + if (t == null) { + Assert.fail("The naming server cannot be started"); + } + orb = server.getORB(); + org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); + NamingContext ncRef = NamingContextHelper.narrow(objRef); + NameComponent nc = new NameComponent(GENERATED_SERVICE_NAME, ""); + NameComponent path[] = {nc}; + ScenarioTwo scenarioTwo = new ScenarioTwoServant(); + ncRef.rebind(path, scenarioTwo); + } catch (Throwable e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } + // obtain domain + domain = SCADomain.newInstance("ScenarioTwo.composite"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Kills previously spawned name service. + */ + @AfterClass + public static void tearDown() { + server.stop(); + } + + /** + * Tests using objects attribute (which is server in traditional way) by + * Tuscany CORBA binding + */ + @Test + public void test_tuscanyGetSetAttribute() { + try { + TScenarioTwo ref = domain.getService(TScenarioTwoComponent.class, "ScenarioTwo").getScenarioTwo(); + String strVal = "Whatever"; + ref.setStringField(strVal); + assertEquals(strVal, ref.getStringField()); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Tests using objects attribute (which is served by Tuscany) in traditional + * way (by idlj generated code) + */ + @Test + public void test_getneratedGetSetAttribute() { + try { + orb = server.getORB(); + org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); + NamingContext ncRef = NamingContextHelper.narrow(objRef); + NameComponent nc = new NameComponent(TUSCANY_SERVICE_NAME, ""); + NameComponent path[] = {nc}; + ScenarioTwo st = ScenarioTwoHelper.narrow(ncRef.resolve(path)); + st.stringField(""); + assertEquals("", st.stringField()); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java new file mode 100644 index 0000000000..b57e098a56 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java @@ -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.tuscany.sca.test.corba.generated; + + +/** +* org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from itest_scenario.idl +* wtorek, 15 lipiec 2008 13:36:31 CEST +*/ + + +// objects for ScenarioTwo +public interface ScenarioTwo extends ScenarioTwoOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity +{ +} // interface ScenarioTwo diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java new file mode 100644 index 0000000000..8ddfa10575 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java @@ -0,0 +1,106 @@ +/* + * 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.test.corba.generated; + + +/** +* org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from itest_scenario.idl +* wtorek, 15 lipiec 2008 13:36:31 CEST +*/ + + +// objects for ScenarioTwo +abstract public class ScenarioTwoHelper +{ + private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioTwo:1.0"; + + public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.ScenarioTwo 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.test.corba.generated.ScenarioTwo 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.test.corba.generated.ScenarioTwoHelper.id (), "ScenarioTwo"); + } + return __typeCode; + } + + public static String id () + { + return _id; + } + + public static org.apache.tuscany.sca.test.corba.generated.ScenarioTwo read (org.omg.CORBA.portable.InputStream istream) + { + return narrow (istream.read_Object (_ScenarioTwoStub.class)); + } + + public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.ScenarioTwo value) + { + ostream.write_Object ((org.omg.CORBA.Object) value); + } + + public static org.apache.tuscany.sca.test.corba.generated.ScenarioTwo narrow (org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioTwo) + return (org.apache.tuscany.sca.test.corba.generated.ScenarioTwo)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.test.corba.generated._ScenarioTwoStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioTwoStub (); + stub._set_delegate(delegate); + return stub; + } + } + + public static org.apache.tuscany.sca.test.corba.generated.ScenarioTwo unchecked_narrow (org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioTwo) + return (org.apache.tuscany.sca.test.corba.generated.ScenarioTwo)obj; + else + { + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); + org.apache.tuscany.sca.test.corba.generated._ScenarioTwoStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioTwoStub (); + stub._set_delegate(delegate); + return stub; + } + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java new file mode 100644 index 0000000000..9717629711 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java @@ -0,0 +1,59 @@ +/* + * 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.test.corba.generated; + +/** +* org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from itest_scenario.idl +* wtorek, 15 lipiec 2008 13:36:31 CEST +*/ + + +// objects for ScenarioTwo +public final class ScenarioTwoHolder implements org.omg.CORBA.portable.Streamable +{ + public org.apache.tuscany.sca.test.corba.generated.ScenarioTwo value = null; + + public ScenarioTwoHolder () + { + } + + public ScenarioTwoHolder (org.apache.tuscany.sca.test.corba.generated.ScenarioTwo initialValue) + { + value = initialValue; + } + + public void _read (org.omg.CORBA.portable.InputStream i) + { + value = org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper.read (i); + } + + public void _write (org.omg.CORBA.portable.OutputStream o) + { + org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper.write (o, value); + } + + public org.omg.CORBA.TypeCode _type () + { + return org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper.type (); + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java new file mode 100644 index 0000000000..1247b4618d --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java @@ -0,0 +1,36 @@ +/* + * 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.test.corba.generated; + + +/** +* org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from itest_scenario.idl +* wtorek, 15 lipiec 2008 13:36:31 CEST +*/ + + +// objects for ScenarioTwo +public interface ScenarioTwoOperations +{ + String stringField (); + void stringField (String newStringField); +} // interface ScenarioTwoOperations diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java new file mode 100644 index 0000000000..750006cec6 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java @@ -0,0 +1,93 @@ +/* + * 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.test.corba.generated; + + +/** +* org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from itest_scenario.idl +* wtorek, 15 lipiec 2008 13:36:31 CEST +*/ + + +// objects for ScenarioTwo +public abstract class _ScenarioTwoImplBase extends org.omg.CORBA.portable.ObjectImpl + implements org.apache.tuscany.sca.test.corba.generated.ScenarioTwo, org.omg.CORBA.portable.InvokeHandler +{ + + // Constructors + public _ScenarioTwoImplBase () + { + } + + private static java.util.Hashtable _methods = new java.util.Hashtable (); + static + { + _methods.put ("_get_stringField", new java.lang.Integer (0)); + _methods.put ("_set_stringField", new java.lang.Integer (1)); + } + + 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/test/corba/generated/ScenarioTwo/_get_stringField + { + String $result = null; + $result = this.stringField (); + out = $rh.createReply(); + out.write_string ($result); + break; + } + + case 1: // org/apache/tuscany/sca/test/corba/generated/ScenarioTwo/_set_stringField + { + String newStringField = in.read_string (); + this.stringField (newStringField); + out = $rh.createReply(); + 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/test/corba/generated/ScenarioTwo:1.0"}; + + public String[] _ids () + { + return (String[])__ids.clone (); + } + + +} // class _ScenarioTwoImplBase diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java new file mode 100644 index 0000000000..ef9f561d1b --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.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.test.corba.generated; + + +/** +* org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from itest_scenario.idl +* wtorek, 15 lipiec 2008 13:36:31 CEST +*/ + + +// objects for ScenarioTwo +public class _ScenarioTwoStub extends org.omg.CORBA.portable.ObjectImpl implements org.apache.tuscany.sca.test.corba.generated.ScenarioTwo +{ + + public String stringField () + { + org.omg.CORBA.portable.InputStream $in = null; + try { + org.omg.CORBA.portable.OutputStream $out = _request ("_get_stringField", true); + $in = _invoke ($out); + String $result = $in.read_string (); + 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 stringField ( ); + } finally { + _releaseReply ($in); + } + } // stringField + + public void stringField (String newStringField) + { + org.omg.CORBA.portable.InputStream $in = null; + try { + org.omg.CORBA.portable.OutputStream $out = _request ("_set_stringField", true); + $out.write_string (newStringField); + $in = _invoke ($out); + return; + } 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) { + stringField (newStringField ); + } finally { + _releaseReply ($in); + } + } // stringField + + // Type-specific CORBA::Object operations + private static String[] __ids = { + "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioTwo: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 _ScenarioTwoStub diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java new file mode 100644 index 0000000000..996546ae41 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java @@ -0,0 +1,41 @@ +/* + * 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.test.corba.types; + +import org.apache.tuscany.sca.test.corba.generated._ScenarioTwoImplBase; + +/** + * Servant for generated interface. + */ +public class ScenarioTwoServant extends _ScenarioTwoImplBase { + + private static final long serialVersionUID = 1L; + + private String stringField = ""; + + public String stringField() { + return stringField; + } + + public void stringField(String newStringField) { + this.stringField = newStringField; + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java new file mode 100644 index 0000000000..aafe0ebc78 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java @@ -0,0 +1,41 @@ +/* + * 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.test.corba.types; + +/** + * Operations for ScenarioThree. + */ +public interface TScenarioThree { + + int getIntField(); + + void setIntField(int intField); + + void overloadedName(); + + void overloadedName(String arg1); + + void overloadedName(String arg1, int arg2); + + int caseDifferent(); + + int CaseDifferent(); + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java new file mode 100644 index 0000000000..9fb1cfa52b --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java @@ -0,0 +1,40 @@ +/* + * 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.test.corba.types; + +import org.osoa.sca.annotations.Reference; + +/** + * Component for obtaining ScenartioThree reference. + */ +public class TScenarioThreeComponent { + + private TScenarioThree scenarionThree; + + @Reference + public void setScenarioThree(TScenarioThree scenarioThree) { + this.scenarionThree = scenarioThree; + } + + public TScenarioThree getScenarioThree() { + return scenarionThree; + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java new file mode 100644 index 0000000000..59f591210d --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java @@ -0,0 +1,51 @@ +/* + * 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.test.corba.types; + +/** + * Servant for user provided interface. + */ +public class TScenarioThreeServant implements TScenarioThree { + + public int getIntField() { + return 0; + } + + public void overloadedName() { + } + + public void overloadedName(String arg1) { + } + + public void overloadedName(String arg1, int arg2) { + } + + public void setIntField(int intField) { + } + + public int CaseDifferent() { + return 1; + } + + public int caseDifferent() { + return 0; + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java new file mode 100644 index 0000000000..58fd3c22ca --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java @@ -0,0 +1,31 @@ +/* + * 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.test.corba.types; + +/** + * Operations for ScenarioTwo. + */ +public interface TScenarioTwo { + + String getStringField(); + + void setStringField(String stringField); + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java new file mode 100644 index 0000000000..3678b67b6f --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java @@ -0,0 +1,40 @@ +/* + * 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.test.corba.types; + +import org.osoa.sca.annotations.Reference; + +/** + * Component for obtaining ScenartioTwo reference. + */ +public class TScenarioTwoComponent { + + private TScenarioTwo scenarioTwo; + + @Reference + public void setScenarioTwo(TScenarioTwo scenarioTwo) { + this.scenarioTwo = scenarioTwo; + } + + public TScenarioTwo getScenarioTwo() { + return scenarioTwo; + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java new file mode 100644 index 0000000000..cc7fe5ac7a --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.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.test.corba.types; + +/** + * Servant for user provided interface. + */ +public class TScenarioTwoServant implements TScenarioTwo { + + private static String stringField = ""; + + public String getStringField() { + return stringField; + } + + public void setStringField(String stringField) { + TScenarioTwoServant.stringField = stringField; + } + +} diff --git a/java/sca/itest/corba/src/test/resources/ScenarioThree.composite b/java/sca/itest/corba/src/test/resources/ScenarioThree.composite new file mode 100644 index 0000000000..f43e4a3f7a --- /dev/null +++ b/java/sca/itest/corba/src/test/resources/ScenarioThree.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/itest/corba/src/test/resources/ScenarioTwo.composite b/java/sca/itest/corba/src/test/resources/ScenarioTwo.composite new file mode 100644 index 0000000000..dc5ddc50d3 --- /dev/null +++ b/java/sca/itest/corba/src/test/resources/ScenarioTwo.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/itest/corba/src/test/resources/itest_scenario.idl b/java/sca/itest/corba/src/test/resources/itest_scenario.idl index fc806efb54..f38f49ceab 100644 --- a/java/sca/itest/corba/src/test/resources/itest_scenario.idl +++ b/java/sca/itest/corba/src/test/resources/itest_scenario.idl @@ -30,6 +30,8 @@ module org { module corba { module generated { + // objects for ScenarioOne + enum Color {red, yellow, green}; typedef sequence StringSequence; @@ -62,6 +64,14 @@ module org { RichStruct setRichStruct(in RichStruct richStruct) raises (WrongColor, UnexpectedException); }; + + // objects for ScenarioTwo + + interface ScenarioTwo { + + attribute string stringField; + + }; }; }; }; -- cgit v1.2.3