summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-18 18:29:28 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-18 18:29:28 +0000
commit7f87032072bad92962601c8f9ece5f71b2d4a1ef (patch)
treef5d675f60fb31c7ed6d61d3d7f2fa007eb5f2f07 /java/sca
parent3d43862fc293982f39996fe09d94971b20521a2b (diff)
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
Diffstat (limited to '')
-rw-r--r--java/sca/itest/corba/pom.xml48
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java127
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java136
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java34
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java106
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java59
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java36
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java93
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java99
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java41
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java41
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java40
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java51
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java31
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java40
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java37
-rw-r--r--java/sca/itest/corba/src/test/resources/ScenarioThree.composite43
-rw-r--r--java/sca/itest/corba/src/test/resources/ScenarioTwo.composite43
-rw-r--r--java/sca/itest/corba/src/test/resources/itest_scenario.idl10
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java29
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java32
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java38
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java33
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl127
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite37
-rw-r--r--java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java65
-rw-r--r--java/sca/modules/binding-corba-runtime/pom.xml55
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java11
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java11
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java75
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java2
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java5
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java91
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java2
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java96
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java516
-rw-r--r--java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java18
-rw-r--r--java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.java45
-rw-r--r--java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java69
-rw-r--r--java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.java66
-rw-r--r--java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java47
-rw-r--r--java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java2
42 files changed, 2478 insertions, 109 deletions
diff --git a/java/sca/itest/corba/pom.xml b/java/sca/itest/corba/pom.xml
index 8adb3694f2..910c5ca7cc 100644
--- a/java/sca/itest/corba/pom.xml
+++ b/java/sca/itest/corba/pom.xml
@@ -27,51 +27,35 @@
</parent>
<artifactId>itest-corba-binding</artifactId>
<name>Apache Tuscany SCA CORBA Binding Integration Tests</name>
-
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-embedded</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
-
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>1.4-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba-runtime</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.4-SNAPSHOT</version>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-corba-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba-jdk</artifactId>
- <version>1.4-SNAPSHOT</version>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jdk</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
</dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.2</version>
- <scope>compile</scope>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
</dependency>
-
</dependencies>
-</project>
+</project> \ No newline at end of file
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 @@
+<!--
+ * 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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <!-- note that some binding configuration (like port or host name) is also used in JUnit test class -->
+
+ <component name="ScenarioThreeService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioThreeServant" />
+ </component>
+ <service name="ScenarioThreeServiceTuscany" promote="ScenarioThreeService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.TScenarioThree"/>
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioThree"/>
+ </service>
+
+ <component name="ScenarioThreeReference">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioThreeComponent" />
+ <reference name="scenarioThree">
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioThree"/>
+ </reference>
+ </component>
+
+</composite>
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 @@
+<!--
+ * 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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <!-- note that some binding configuration (like port or host name) is also used in JUnit test class -->
+
+ <component name="ScenarioTwoService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioTwoServant" />
+ </component>
+ <service name="ScenarioTwoServiceTuscany" promote="ScenarioTwoService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.TScenarioTwo"/>
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioTwo" id="IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioTwo:1.0"/>
+ </service>
+
+ <component name="ScenarioTwo">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioTwoComponent" />
+ <reference name="scenarioTwo">
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioTwoGenerated"/>
+ </reference>
+ </component>
+
+</composite>
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<string> StringSequence;
@@ -62,6 +64,14 @@ module org {
RichStruct setRichStruct(in RichStruct richStruct) raises (WrongColor, UnexpectedException);
};
+
+ // objects for ScenarioTwo
+
+ interface ScenarioTwo {
+
+ attribute string stringField;
+
+ };
};
};
};
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java
new file mode 100644
index 0000000000..7f9b62f9b4
--- /dev/null
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.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.itest.databindings.jaxb;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AClientService.
+ */
+@Remotable
+public interface AClientService {
+ public String getGreetingsForward(String name);
+}
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java
new file mode 100644
index 0000000000..1762812c1f
--- /dev/null
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java
@@ -0,0 +1,32 @@
+/*
+ * 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.itest.databindings.jaxb;
+
+import javax.jws.soap.SOAPBinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface AService {
+ public String getGreetings(String name);
+}
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java
new file mode 100644
index 0000000000..8b484e93f0
--- /dev/null
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.AClientService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.AService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AClientService.class)
+public class AClientServiceImpl implements AClientService {
+
+ @Reference
+ protected AService aService;
+
+ public String getGreetingsForward(String name) {
+ return aService.getGreetings(name);
+ }
+}
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java
new file mode 100644
index 0000000000..4a35d41c04
--- /dev/null
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java
@@ -0,0 +1,33 @@
+/*
+ * 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.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.AService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl b/java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl
new file mode 100644
index 0000000000..10a242be4d
--- /dev/null
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<wsdl:definitions targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:ns0="http://jaxb.databindings.itest.sca.tuscany.apache.org"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://org.apache.axis2/xsd"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org" xmlns:ns="http://jaxb.databindings.itest.sca.tuscany.apache.org">
+ <xs:element name="getGreetings" nillable="true" type="xs:string"/>
+ <xs:element name="getGreetingsResponse" nillable="true" type="xs:string"/>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part name="parameters" element="ns0:getGreetings"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="parameters" element="ns0:getGreetingsResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="AServicePortType">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="ns0:getGreetingsRequest" wsaw:Action="urn:getGreetings"/>
+ <wsdl:output message="ns0:getGreetingsResponse" wsaw:Action="urn:getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AServiceSOAP12Binding" type="ns0:AServicePortType">
+ <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap12:operation soapAction="urn:getGreetings" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServicePortTypeBinding" type="ns0:AServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction=""/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServiceHttpBinding" type="ns0:AServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="getGreetings">
+ <http:operation location="AService/getGreetings"/>
+ <wsdl:input>
+ <mime:content part="getGreetings" type="text/xml"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="getGreetings" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServiceSOAP11Binding" type="ns0:AServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction="urn:getGreetings" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AServicePortTypeService">
+ <wsdl:port name="AServicePortTypePort" binding="ns0:AServicePortTypeBinding">
+ <soap:address location="http://localhost:8080/AService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:service name="AService">
+ <wsdl:port name="AServiceHttpport" binding="ns0:AServiceHttpBinding">
+ <http:address location="http://localhost:8080/AService/httpport"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location="http://localhost:8080/AService/soap12port"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP11port_http" binding="ns0:AServiceSOAP11Binding">
+ <soap:address location="http://localhost:8080/AService/soap11port"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http_null" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location=""/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http_wsdl" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location="inWsdl"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite b/java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite
new file mode 100644
index 0000000000..5ecbb9edee
--- /dev/null
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://itest" name="doclitbarewsdltest">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.AServiceImpl"/>
+ <service name="AService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org#wsdl.interface(AServicePortType)"/>
+ <binding.ws uri="http://localhost:8085/AService/endpointref"/>
+ </service>
+ </component>
+ <component name="AClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <!--interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org#wsdl.interface(AServicePortType)"/-->
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.AService"/>
+ <binding.ws uri="http://localhost:8085/AService/endpointref"/>
+ </reference>
+ </component>
+</composite>
diff --git a/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java b/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
new file mode 100644
index 0000000000..e58acfcfe2
--- /dev/null
+++ b/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
@@ -0,0 +1,65 @@
+/*
+ * 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.itest.databindings.jaxb;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DocLitBareWsdlTestCase {
+
+ private static SCADomain domain;
+
+ /**
+ * Runs once before running the tests
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("doclitbarewsdl.composite");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Runs once after running the tests
+ */
+ @AfterClass
+ public static void tearDown() {
+ domain.close();
+ }
+
+ @Ignore("TUSCANY-2398")
+ @Test
+ public void testDocLitBareWsdl() throws Exception {
+ AClientService client = domain.getService(AClientService.class, "AClientComponent");
+ String name = "Pandu";
+ String resp = client.getGreetingsForward(name);
+ Assert.assertEquals("Hello "+name, resp);
+ }
+}
diff --git a/java/sca/modules/binding-corba-runtime/pom.xml b/java/sca/modules/binding-corba-runtime/pom.xml
index a54ddc1444..1d3c0c84b0 100644
--- a/java/sca/modules/binding-corba-runtime/pom.xml
+++ b/java/sca/modules/binding-corba-runtime/pom.xml
@@ -29,32 +29,37 @@
<name>Apache Tuscany SCA CORBA Binding Runtime</name>
<dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba-jdk</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-corba</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.1_3</version>
- <scope>compile</scope>
- </dependency>
-
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jdk</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java
index 43c471d3bc..f1640329e8 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java
@@ -19,6 +19,9 @@
package org.apache.tuscany.sca.binding.corba.impl;
+import java.lang.reflect.Method;
+import java.util.Map;
+
import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaRequest;
import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaResponse;
@@ -34,9 +37,13 @@ import org.osoa.sca.ServiceRuntimeException;
public class CorbaInvoker implements Invoker {
private Object remoteObject;
+ private Class<?> referenceClass;
+ private Map<Method, String> operationsMap;
- public CorbaInvoker(Object remoteObject) {
+ public CorbaInvoker(Object remoteObject, Class<?> referenceClass, Map<Method, String> operationsMap) {
this.remoteObject = remoteObject;
+ this.referenceClass = referenceClass;
+ this.operationsMap = operationsMap;
}
/**
@@ -45,6 +52,8 @@ public class CorbaInvoker implements Invoker {
public Message invoke(Message msg) {
try {
DynaCorbaRequest request = new DynaCorbaRequest(remoteObject, msg.getOperation().getName());
+ request.setReferenceClass(referenceClass);
+ request.setOperationsMap(operationsMap);
if (msg.getOperation().getOutputType() != null) {
request.setOutputType(msg.getOperation().getOutputType().getPhysical());
}
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
index dec015be38..3eb665d599 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
@@ -19,10 +19,15 @@
package org.apache.tuscany.sca.binding.corba.impl;
+import java.lang.reflect.Method;
+import java.util.Map;
+
import org.apache.tuscany.sca.binding.corba.CorbaBinding;
+import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
import org.apache.tuscany.sca.host.corba.CorbaHost;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -37,11 +42,15 @@ public class CorbaReferenceBindingProvider implements ReferenceBindingProvider {
private CorbaHost host;
private RuntimeComponentReference reference;
private Object remoteObject;
+ private Class<?> referenceClass;
+ private Map<Method, String> operationsMap = null;
public CorbaReferenceBindingProvider(CorbaBinding binding, CorbaHost host, RuntimeComponentReference reference) {
this.binding = binding;
this.host = host;
this.reference = reference;
+ this.referenceClass = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
+ operationsMap = OperationMapper.mapMethodToOperation(referenceClass);
}
/**
@@ -52,7 +61,7 @@ public class CorbaReferenceBindingProvider implements ReferenceBindingProvider {
if (remoteObject == null) {
remoteObject = host.lookup(binding.getCorbaname());
}
- return new CorbaInvoker(remoteObject);
+ return new CorbaInvoker(remoteObject, referenceClass, operationsMap);
} catch (Exception e) {
}
return null;
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java
index fd310a85a8..f4f82c9b88 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java
@@ -19,7 +19,10 @@
package org.apache.tuscany.sca.binding.corba.impl.reference;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.tuscany.sca.binding.corba.impl.exceptions.CorbaException;
@@ -28,6 +31,7 @@ import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
import org.apache.tuscany.sca.binding.corba.impl.types.util.TypeHelpersProxy;
import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
+import org.apache.tuscany.sca.binding.corba.impl.util.MethodFinder;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.Object;
@@ -44,10 +48,13 @@ public class DynaCorbaRequest {
private TypeTree returnTree;
private Map<String, TypeTree> exceptions = new HashMap<String, TypeTree>();
- private OutputStream outputStream;
private InputStream inputStream;
private ObjectImpl remoteObject;
private String operation;
+ private List<java.lang.Object> arguments = new ArrayList<java.lang.Object>();
+ private List<TypeTree> argumentsTypes = new ArrayList<TypeTree>();
+ private Class<?> referenceClass;
+ private Map<Method, String> operationsMap;
/**
* Creates request.
@@ -56,20 +63,48 @@ public class DynaCorbaRequest {
* @param operation operation to invoke
*/
public DynaCorbaRequest(Object remoteObject, String operation) {
- outputStream = ((ObjectImpl)remoteObject)._request(operation, true);
this.remoteObject = (ObjectImpl)remoteObject;
this.operation = operation;
+ }
+
+ /**
+ * Sets class which will be backed by this reference request
+ * @param referenceClass
+ */
+ public void setReferenceClass(Class<?> referenceClass) {
+ this.referenceClass = referenceClass;
+ }
+ /**
+ * Sets method to operation names mapping
+ * @param operationsMap
+ */
+ public void setOperationsMap(Map<Method, String> operationsMap) {
+ this.operationsMap = operationsMap;
}
/**
- * Adds operation argument
+ * Adds operation argument - stores arguments and caches its TypeTree
*
* @param argument
*/
public void addArgument(java.lang.Object argument) throws RequestConfigurationException {
TypeTree tree = TypeTreeCreator.createTypeTree(argument.getClass());
- TypeHelpersProxy.write(tree.getRootNode(), outputStream, argument);
+ argumentsTypes.add(tree);
+ arguments.add(argument);
+ }
+
+ /**
+ * Passing stored arguments to CORBA communication output stream
+ *
+ * @param outputStream
+ * @throws RequestConfigurationException
+ */
+ private void passArguments(OutputStream outputStream) throws RequestConfigurationException {
+ for (int i = 0; i < arguments.size(); i++) {
+ TypeTree tree = argumentsTypes.get(i);
+ TypeHelpersProxy.write(tree.getRootNode(), outputStream, arguments.get(i));
+ }
}
/**
@@ -88,7 +123,7 @@ public class DynaCorbaRequest {
*/
public void addExceptionType(Class<?> forClass) throws RequestConfigurationException {
TypeTree tree = TypeTreeCreator.createTypeTree(forClass);
- String exceptionId = Utils.getExceptionId(forClass);
+ String exceptionId = Utils.getTypeId(forClass);
exceptions.put(exceptionId, tree);
}
@@ -142,12 +177,35 @@ public class DynaCorbaRequest {
}
/**
+ * Gets operation name which is includes mapping rules
+ * @return
+ */
+ private String getFinalOperationName() {
+ String result = operation;
+ if (referenceClass != null) {
+ Class<?>[] argumentTypes = new Class<?>[arguments.size()];
+ for (int i = 0; i < arguments.size(); i++) {
+ argumentTypes[i] = arguments.get(i).getClass();
+ }
+ Method method = MethodFinder.findMethod(referenceClass, operation, argumentTypes);
+ String newOperation = (String)operationsMap.get(method);
+ if (newOperation != null) {
+ result = newOperation;
+ }
+ }
+ return result;
+ }
+
+ /**
* Invokes previously configured request
*
* @return
*/
public DynaCorbaResponse invoke() throws Exception {
DynaCorbaResponse response = new DynaCorbaResponse();
+ String finalOperationName = getFinalOperationName();
+ OutputStream outputStream = ((ObjectImpl)remoteObject)._request(finalOperationName, true);
+ passArguments(outputStream);
try {
inputStream = remoteObject._invoke(outputStream);
if (inputStream != null && returnTree != null) {
@@ -164,8 +222,11 @@ public class DynaCorbaRequest {
}
return response;
}
-
- public void release() {
+
+ /**
+ * Releases request resources
+ */
+ private void release() {
remoteObject._releaseReply(inputStream);
}
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java
index 7965ecb86a..514d7055a8 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java
@@ -59,7 +59,7 @@ public class InterfaceInstanceCreator {
enhancer.setCallbackTypes(new Class[] {NoOp.class, MethodInterceptor.class});
Class<?> newClass = enhancer.createClass();
Enhancer.registerStaticCallbacks(newClass, new Callback[] {NoOp.INSTANCE,
- new InterfaceMethodInterceptor(reference)});
+ new InterfaceMethodInterceptor(reference, forClass)});
result = newClass.newInstance();
} catch (Exception e) {
e.printStackTrace();
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java
index 2642601057..7fba091b41 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java
@@ -33,9 +33,11 @@ import org.omg.CORBA.Object;
public class InterfaceMethodInterceptor implements MethodInterceptor {
private Object reference;
+ private Class<?> javaClass;
- public InterfaceMethodInterceptor(Object reference) {
+ public InterfaceMethodInterceptor(Object reference, Class<?> javaClass) {
this.reference = reference;
+ this.javaClass = javaClass;
}
/**
@@ -47,6 +49,7 @@ public class InterfaceMethodInterceptor implements MethodInterceptor {
java.lang.Object[] arguments,
MethodProxy arg3) throws Throwable {
DynaCorbaRequest request = new DynaCorbaRequest(reference, method.getName());
+ request.setReferenceClass(javaClass);
for (int i = 0; i < arguments.length; i++) {
request.addArgument(arguments[i]);
}
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
index cece057baa..6c7e2b1238 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
@@ -20,6 +20,7 @@
package org.apache.tuscany.sca.binding.corba.impl.service;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -31,8 +32,10 @@ import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
import org.apache.tuscany.sca.binding.corba.impl.types.util.TypeHelpersProxy;
import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
+import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.InputStream;
@@ -46,19 +49,63 @@ import org.omg.CORBA.portable.ResponseHandler;
*/
public class DynaCorbaServant extends ObjectImpl implements InvokeHandler {
- private static String[] DEFAULT_IDS = {"IDL:default:1.0"};
private RuntimeComponentService service;
private Binding binding;
- private String[] ids = DEFAULT_IDS;
- private Map<String, OperationTypes> operationsCache = new HashMap<String, OperationTypes>();
+ private String[] ids;
+ private Map<Operation, OperationTypes> operationsCache = new HashMap<Operation, OperationTypes>();
+ private Class<?> javaClass;
+ private Map<String, Method> operationsMap;
+ private Map<Method, Operation> methodOperationMapping;
public DynaCorbaServant(RuntimeComponentService service, Binding binding) throws RequestConfigurationException {
this.service = service;
this.binding = binding;
+ this.javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
+ this.operationsMap = OperationMapper.mapOperationToMethod(javaClass);
cacheOperationTypes(service.getInterfaceContract().getInterface().getOperations());
+ createMethod2OperationMapping();
+ setDefaultIds();
+ }
+ /**
+ * Maps Java methods to Tuscany operations
+ */
+ private void createMethod2OperationMapping() {
+ // for every operation find all methods with the same name, then
+ // compare operations and methods parameters
+ this.methodOperationMapping = new HashMap<Method, Operation>();
+ for (Operation operation : service.getInterfaceContract().getInterface().getOperations()) {
+ List<DataType> inputTypes = operation.getInputType().getLogical();
+ Method[] methods = javaClass.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals(operation.getName()) && inputTypes.size() == methods[i]
+ .getParameterTypes().length) {
+ Class<?>[] parameterTypes = methods[i].getParameterTypes();
+ int j = 0;
+ boolean parameterMatch = true;
+ for (DataType dataType : inputTypes) {
+ if (!dataType.getPhysical().equals(parameterTypes[j])) {
+ parameterMatch = false;
+ break;
+ }
+ j++;
+ }
+ if (parameterMatch) {
+ // match found
+ methodOperationMapping.put(methods[i], operation);
+ break;
+ }
+ }
+ }
+
+ }
}
+ /**
+ * Caches TypeTree for every operation in backed component
+ * @param operations
+ * @throws RequestConfigurationException
+ */
private void cacheOperationTypes(List<Operation> operations) throws RequestConfigurationException {
for (Operation operation : operations) {
try {
@@ -80,41 +127,39 @@ public class DynaCorbaServant extends ObjectImpl implements InvokeHandler {
}
operationTypes.setInputType(inputInstances);
- operationsCache.put(operation.getName(), operationTypes);
+ operationsCache.put(operation, operationTypes);
} catch (RequestConfigurationException e) {
throw e;
}
}
}
+ /**
+ * Sets CORBA object ID
+ * @param ids
+ */
public void setIds(String[] ids) {
for (int i = 0; i < ids.length; i++) {
if (ids[i] == null || ids[i].length() == 0) {
- this.ids = DEFAULT_IDS;
+ // if invalid id was passed then set to default
+ setDefaultIds();
return;
}
}
this.ids = ids;
}
- public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) {
-
+ public OutputStream _invoke(String operationName, InputStream in, ResponseHandler rh) {
Operation operation = null;
-
- List<Operation> operations = service.getInterfaceContract().getInterface().getOperations();
+ Method method = operationsMap.get(operationName);
// searching for proper operation
- for (Operation oper : operations) {
- if (oper.getName().equals(method)) {
- operation = oper;
- break;
- }
- }
+ operation = methodOperationMapping.get(method);
if (operation == null) {
// operation wasn't found
throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
} else {
List<Object> inputInstances = new ArrayList<Object>();
- OperationTypes types = operationsCache.get(operation.getName());
+ OperationTypes types = operationsCache.get(operation);
try {
// retrieving in arguments
for (TypeTree tree : types.getInputType()) {
@@ -129,19 +174,19 @@ public class DynaCorbaServant extends ObjectImpl implements InvokeHandler {
try {
// invocation and sending result
Object result = service.getRuntimeWire(binding).invoke(operation, inputInstances.toArray());
+ OutputStream out = rh.createReply();
if (types.getOutputType() != null) {
- OutputStream out = rh.createReply();
TypeTree tree = types.getOutputType();
TypeHelpersProxy.write(tree.getRootNode(), out, result);
- return out;
}
+ return out;
} catch (InvocationTargetException ie) {
// handling user exception
try {
OutputStream out = rh.createExceptionReply();
Class<?> exceptionClass = ie.getTargetException().getClass();
TypeTree tree = TypeTreeCreator.createTypeTree(exceptionClass);
- String exceptionId = Utils.getExceptionId(exceptionClass);
+ String exceptionId = Utils.getTypeId(exceptionClass);
out.write_string(exceptionId);
TypeHelpersProxy.write(tree.getRootNode(), out, ie.getTargetException());
return out;
@@ -163,4 +208,12 @@ public class DynaCorbaServant extends ObjectImpl implements InvokeHandler {
return ids;
}
+ /**
+ * Sets servant ID to default, based on Java class name
+ */
+ private void setDefaultIds() {
+ String id = Utils.getTypeId(javaClass);
+ this.ids = new String[] {id};
+ }
+
}
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java
index 4c1467d3c3..de381f995b 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java
@@ -26,7 +26,7 @@ public class Utils {
* @param forClass
* @return
*/
- public static String getExceptionId(Class<?> forClass) {
+ public static String getTypeId(Class<?> forClass) {
String result = forClass.getName().replace('.', '/');
result = result.replaceAll("Package", "");
result = "IDL:" + result + ":1.0";
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java
new file mode 100644
index 0000000000..ea18a33ce0
--- /dev/null
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java
@@ -0,0 +1,96 @@
+/*
+ * 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.binding.corba.impl.util;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Utility for finding method in given class.
+ */
+public class MethodFinder {
+
+ private static Map<Class<?>, Class<?>> boxingMapping;
+
+ static {
+ boxingMapping = new HashMap<Class<?>, Class<?>>();
+ boxingMapping.put(boolean.class, Boolean.class);
+ boxingMapping.put(byte.class, Byte.class);
+ boxingMapping.put(short.class, Short.class);
+ boxingMapping.put(char.class, Character.class);
+ boxingMapping.put(int.class, Integer.class);
+ boxingMapping.put(long.class, Long.class);
+ boxingMapping.put(float.class, Float.class);
+ boxingMapping.put(double.class, Double.class);
+ }
+
+ /**
+ * Converts primitive class to its object equivalent.
+ *
+ * @param parameter class to convert
+ * @return object equivalent for primitive type. If parameter wasn't
+ * primitive then returns parameter.
+ */
+ private static Class<?> normalizePrimitive(Class<?> parameter) {
+ Class<?> result = boxingMapping.get(parameter);
+ if (result != null) {
+ return result;
+ } else {
+ // not a primitive - no need to normalize
+ return parameter;
+ }
+ }
+
+ /**
+ * Finds appropriate method. This method ignores difference between
+ * primitive types and theirs object equivalents. Ie. if we want to find
+ * method "get" in java.util.List with only one parameter, which type is
+ * Integer then we'll obtain method get(int).
+ *
+ * @param forClass class which possibly contains desired method
+ * @param methodName desired methods name
+ * @param parameterTypes desired methods parameter types
+ * @return desired method, if no method was found then null will be returned
+ */
+ public static Method findMethod(Class<?> forClass, String methodName, Class<?>[] parameterTypes) {
+ Method[] methods = forClass.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals(methodName)) {
+ Class<?>[] methodPTypes = methods[i].getParameterTypes();
+ if (methodPTypes.length == parameterTypes.length) {
+ boolean parameterMatch = true;
+ for (int j = 0; j < methodPTypes.length; j++) {
+ Class<?> nMethodPType = normalizePrimitive(methodPTypes[j]);
+ Class<?> nParameterType = normalizePrimitive(parameterTypes[j]);
+ if (!nMethodPType.equals(nParameterType)) {
+ parameterMatch = false;
+ break;
+ }
+ }
+ if (parameterMatch) {
+ return methods[i];
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java
new file mode 100644
index 0000000000..d5f31dd723
--- /dev/null
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java
@@ -0,0 +1,516 @@
+/*
+ * 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.binding.corba.impl.util;
+
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * @version $Rev$ $Date$
+ * @see UtilInitializer
+ */
+public final class OperationMapper {
+
+ private static Set<Class<?>> getAllInterfaces(Class<?> intfClass) {
+ Set<Class<?>> allInterfaces = new LinkedHashSet<Class<?>>();
+
+ LinkedList<Class<?>> stack = new LinkedList<Class<?>>();
+ stack.addFirst(intfClass);
+
+ while (!stack.isEmpty()) {
+ Class<?> intf = stack.removeFirst();
+ allInterfaces.add(intf);
+ stack.addAll(0, Arrays.asList(intf.getInterfaces()));
+ }
+
+ return allInterfaces;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<Method, String> mapMethodToOperation(Class<?> intfClass) {
+ return iiopMap(intfClass, false);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String, Method> mapOperationToMethod(Class<?> intfClass) {
+ return iiopMap(intfClass, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Map iiopMap(Class<?> intfClass, boolean operationToMethod) {
+ Method[] methods = getAllMethods(intfClass);
+
+ // find every valid getter
+ Map<Method, String> getterByMethod = new HashMap<Method, String>(methods.length);
+ Map<String, Method> getterByName = new HashMap<String, Method>(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ String methodName = method.getName();
+
+ // no arguments allowed
+ if (method.getParameterTypes().length != 0) {
+ continue;
+ }
+
+ // must start with get or is
+ String verb;
+ if (methodName.startsWith("get") && methodName.length() > 3 && method.getReturnType() != void.class) {
+ verb = "get";
+ } else if (methodName.startsWith("is") && methodName.length() > 2 && method.getReturnType() == boolean.class) {
+ verb = "is";
+ } else {
+ continue;
+ }
+
+ // must only throw Remote or Runtime Exceptions
+ boolean exceptionsValid = true;
+ Class[] exceptionTypes = method.getExceptionTypes();
+ for (int j = 0; j < exceptionTypes.length; j++) {
+ Class<?> exceptionType = exceptionTypes[j];
+ if (!RemoteException.class.isAssignableFrom(exceptionType) &&
+ !RuntimeException.class.isAssignableFrom(exceptionType) &&
+ !Error.class.isAssignableFrom(exceptionType)) {
+ exceptionsValid = false;
+ break;
+ }
+ }
+ if (!exceptionsValid) {
+ continue;
+ }
+
+ String propertyName;
+ if (methodName.length() > verb.length() + 1 && Character.isUpperCase(methodName.charAt(verb.length() + 1))) {
+ propertyName = methodName.substring(verb.length());
+ } else {
+ propertyName = Character.toLowerCase(methodName.charAt(verb.length())) + methodName.substring(verb.length() + 1);
+ }
+ getterByMethod.put(method, propertyName);
+ getterByName.put(propertyName, method);
+ }
+
+ Map<Method, String> setterByMethod = new HashMap<Method, String>(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ String methodName = method.getName();
+
+ // must have exactally one arg
+ if (method.getParameterTypes().length != 1) {
+ continue;
+ }
+
+ // must return non void
+ if (method.getReturnType() != void.class) {
+ continue;
+ }
+
+ // must start with set
+ if (!methodName.startsWith("set") || methodName.length() <= 3) {
+ continue;
+ }
+
+ // must only throw Remote or Runtime Exceptions
+ boolean exceptionsValid = true;
+ Class<?>[] exceptionTypes = method.getExceptionTypes();
+ for (int j = 0; j < exceptionTypes.length; j++) {
+ Class<?> exceptionType = exceptionTypes[j];
+ if (!RemoteException.class.isAssignableFrom(exceptionType) &&
+ !RuntimeException.class.isAssignableFrom(exceptionType) &&
+ !Error.class.isAssignableFrom(exceptionType)) {
+ exceptionsValid = false;
+ break;
+ }
+ }
+ if (!exceptionsValid) {
+ continue;
+ }
+
+ String propertyName;
+ if (methodName.length() > 4 && Character.isUpperCase(methodName.charAt(4))) {
+ propertyName = methodName.substring(3);
+ } else {
+ propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
+ }
+
+ // must have a matching getter
+ Method getter = (Method) getterByName.get(propertyName);
+ if (getter == null) {
+ continue;
+ }
+
+ // setter property must match getter return value
+ if (!method.getParameterTypes()[0].equals(getter.getReturnType())) {
+ continue;
+ }
+ setterByMethod.put(method, propertyName);
+ }
+
+ // index the methods by name... used to determine which methods are overloaded
+ HashMap<String, List<Method>> overloadedMethods = new HashMap<String, List<Method>>(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
+ continue;
+ }
+ String methodName = method.getName();
+ List<Method> methodList = overloadedMethods.get(methodName);
+ if (methodList == null) {
+ methodList = new LinkedList<Method>();
+ overloadedMethods.put(methodName, methodList);
+ }
+ methodList.add(method);
+ }
+
+ // index the methods by lower case name... used to determine which methods differ only by case
+ Map<String, Set<String>> caseCollisionMethods = new HashMap<String, Set<String>>(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
+ continue;
+ }
+ String lowerCaseMethodName = method.getName().toLowerCase();
+ Set<String> methodSet = caseCollisionMethods.get(lowerCaseMethodName);
+ if (methodSet == null) {
+ methodSet = new HashSet<String>();
+ caseCollisionMethods.put(lowerCaseMethodName, methodSet);
+ }
+ methodSet.add(method.getName());
+ }
+
+ String className = getClassName(intfClass);
+ Map iiopMap = new HashMap(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+
+ String iiopName = (String) getterByMethod.get(method);
+ if (iiopName != null) {
+ // if we have a leading underscore prepend with J
+ if (iiopName.charAt(0) == '_') {
+ iiopName = "J_get_" + iiopName.substring(1);
+ } else {
+ iiopName = "_get_" + iiopName;
+ }
+ } else {
+ iiopName = (String) setterByMethod.get(method);
+ if (iiopName != null) {
+ // if we have a leading underscore prepend with J
+ if (iiopName.charAt(0) == '_') {
+ iiopName = "J_set_" + iiopName.substring(1);
+ } else {
+ iiopName = "_set_" + iiopName;
+ }
+ } else {
+ iiopName = method.getName();
+
+ // if we have a leading underscore prepend with J
+ if (iiopName.charAt(0) == '_') {
+ iiopName = "J" + iiopName;
+ }
+ }
+ }
+
+ // if this name only differs by case add the case index to the end
+ Set<String> caseCollisions = caseCollisionMethods.get(method.getName().toLowerCase());
+ if (caseCollisions != null && caseCollisions.size() > 1) {
+ iiopName += upperCaseIndexString(iiopName);
+ }
+
+ // if this is an overloaded method append the parameter string
+ List<Method> overloads = overloadedMethods.get(method.getName());
+ if (overloads != null && overloads.size() > 1) {
+ iiopName += buildOverloadParameterString(method.getParameterTypes());
+ }
+
+ // if we have a leading underscore prepend with J
+ iiopName = replace(iiopName, '$', "U0024");
+
+ // if we have matched a keyword prepend with an underscore
+ if (keywords.contains(iiopName.toLowerCase())) {
+ iiopName = "_" + iiopName;
+ }
+
+ // if the name is the same as the class name, append an underscore
+ if (iiopName.equalsIgnoreCase(className)) {
+ iiopName += "_";
+ }
+
+ if (operationToMethod) {
+ iiopMap.put(iiopName, method);
+ } else {
+ iiopMap.put(method, iiopName);
+ }
+ }
+
+ return iiopMap;
+ }
+
+ private static Method[] getAllMethods(Class<?> intfClass) {
+ List<Method> methods = new LinkedList<Method>();
+ for (Iterator<Class<?>> iterator = getAllInterfaces(intfClass).iterator(); iterator.hasNext();) {
+ Class<?> intf = iterator.next();
+ methods.addAll(Arrays.asList(intf.getDeclaredMethods()));
+ }
+
+ return (Method[]) methods.toArray(new Method[methods.size()]);
+ }
+
+ /**
+ * Return the a string containing an underscore '_' index of each uppercase
+ * character in the IIOP name. This is used for distinction of names that
+ * only differ by case, since CORBA does not support case sensitive names.
+ */
+ private static String upperCaseIndexString(String iiopName) {
+ StringBuffer stringBuffer = new StringBuffer();
+ for (int i = 0; i < iiopName.length(); i++) {
+ char c = iiopName.charAt(i);
+ if (Character.isUpperCase(c)) {
+ stringBuffer.append('_').append(i);
+ }
+ }
+ return stringBuffer.toString();
+ }
+
+ /**
+ * Replaces any occurances of the specified "oldChar" with the new string.
+ * This is used to replace occurances if '$' in CORBA names since '$' is a
+ * special character
+ */
+ private static String replace(String source, char oldChar, String newString) {
+ StringBuffer stringBuffer = new StringBuffer(source.length());
+ for (int i = 0; i < source.length(); i++) {
+ char c = source.charAt(i);
+ if (c == oldChar) {
+ stringBuffer.append(newString);
+ } else {
+ stringBuffer.append(c);
+ }
+ }
+ return stringBuffer.toString();
+ }
+
+ /**
+ * Return the a string containing a double underscore '__' list of parameter
+ * types encoded using the Java to IDL rules. This is used for distinction
+ * of methods that only differ by parameter lists.
+ */
+ private static String buildOverloadParameterString(Class<?>[] parameterTypes) {
+ String name = "";
+ if (parameterTypes.length == 0) {
+ name += "__";
+ } else {
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class<?> parameterType = parameterTypes[i];
+ name += buildOverloadParameterString(parameterType);
+ }
+ }
+ return name.replace('.', '_');
+ }
+
+ /**
+ * Returns a single parameter type encoded using the Java to IDL rules.
+ */
+ private static String buildOverloadParameterString(Class<?> parameterType) {
+ String name = "_";
+
+ int arrayDimensions = 0;
+ while (parameterType.isArray()) {
+ arrayDimensions++;
+ parameterType = parameterType.getComponentType();
+ }
+
+ // arrays start with org_omg_boxedRMI_
+ if (arrayDimensions > 0) {
+ name += "_org_omg_boxedRMI";
+ }
+
+ // IDLEntity types must be prefixed with org_omg_boxedIDL_
+ if (IDLEntity.class.isAssignableFrom(parameterType)) {
+ name += "_org_omg_boxedIDL";
+ }
+
+ // add package... some types have special mappings in corba
+ String packageName = (String)specialTypePackages.get(parameterType.getName());
+ if (packageName == null) {
+ packageName = getPackageName(parameterType.getName());
+ }
+ if (packageName.length() > 0) {
+ name += "_" + packageName;
+ }
+
+ // arrays now contain a dimension indicator
+ if (arrayDimensions > 0) {
+ name += "_" + "seq" + arrayDimensions;
+ }
+
+ // add the class name
+ String className = (String)specialTypeNames.get(parameterType.getName());
+ if (className == null) {
+ className = buildClassName(parameterType);
+ }
+ name += "_" + className;
+
+ return name;
+ }
+
+ /**
+ * Returns a string containing an encoded class name.
+ */
+ private static String buildClassName(Class<?> type) {
+ if (type.isArray()) {
+ throw new IllegalArgumentException("type is an array: " + type);
+ }
+
+ // get the classname
+ String typeName = type.getName();
+ int endIndex = typeName.lastIndexOf('.');
+ if (endIndex < 0) {
+ return typeName;
+ }
+ StringBuffer className = new StringBuffer(typeName.substring(endIndex + 1));
+
+ // for innerclasses replace the $ separator with two underscores
+ // we can't just blindly replace all $ characters since class names can
+ // contain the $ character
+ if (type.getDeclaringClass() != null) {
+ String declaringClassName = getClassName(type.getDeclaringClass());
+ assert className.toString().startsWith(declaringClassName + "$");
+ className.replace(declaringClassName.length(), declaringClassName.length() + 1, "__");
+ }
+
+ // if we have a leading underscore prepend with J
+ if (className.charAt(0) == '_') {
+ className.insert(0, "J");
+ }
+ return className.toString();
+ }
+
+ private static String getClassName(Class<?> type) {
+ if (type.isArray()) {
+ throw new IllegalArgumentException("type is an array: " + type);
+ }
+
+ // get the classname
+ String typeName = type.getName();
+ int endIndex = typeName.lastIndexOf('.');
+ if (endIndex < 0) {
+ return typeName;
+ }
+ return typeName.substring(endIndex + 1);
+ }
+
+ private static String getPackageName(String interfaceName) {
+ int endIndex = interfaceName.lastIndexOf('.');
+ if (endIndex < 0) {
+ return "";
+ }
+ return interfaceName.substring(0, endIndex);
+ }
+
+ private static final Map<String, String> specialTypeNames;
+ private static final Map<String, String> specialTypePackages;
+ private static final Set<String> keywords;
+
+ static {
+ specialTypeNames = new HashMap<String, String>();
+ specialTypeNames.put("boolean", "boolean");
+ specialTypeNames.put("char", "wchar");
+ specialTypeNames.put("byte", "octet");
+ specialTypeNames.put("short", "short");
+ specialTypeNames.put("int", "long");
+ specialTypeNames.put("long", "long_long");
+ specialTypeNames.put("float", "float");
+ specialTypeNames.put("double", "double");
+ specialTypeNames.put("java.lang.Class", "ClassDesc");
+ specialTypeNames.put("java.lang.String", "WStringValue");
+ specialTypeNames.put("org.omg.CORBA.Object", "Object");
+
+ specialTypePackages = new HashMap<String, String>();
+ specialTypePackages.put("boolean", "");
+ specialTypePackages.put("char", "");
+ specialTypePackages.put("byte", "");
+ specialTypePackages.put("short", "");
+ specialTypePackages.put("int", "");
+ specialTypePackages.put("long", "");
+ specialTypePackages.put("float", "");
+ specialTypePackages.put("double", "");
+ specialTypePackages.put("java.lang.Class", "javax.rmi.CORBA");
+ specialTypePackages.put("java.lang.String", "CORBA");
+ specialTypePackages.put("org.omg.CORBA.Object", "");
+
+ keywords = new HashSet<String>();
+ keywords.add("abstract");
+ keywords.add("any");
+ keywords.add("attribute");
+ keywords.add("boolean");
+ keywords.add("case");
+ keywords.add("char");
+ keywords.add("const");
+ keywords.add("context");
+ keywords.add("custom");
+ keywords.add("default");
+ keywords.add("double");
+ keywords.add("enum");
+ keywords.add("exception");
+ keywords.add("factory");
+ keywords.add("false");
+ keywords.add("fixed");
+ keywords.add("float");
+ keywords.add("in");
+ keywords.add("inout");
+ keywords.add("interface");
+ keywords.add("long");
+ keywords.add("module");
+ keywords.add("native");
+ keywords.add("object");
+ keywords.add("octet");
+ keywords.add("oneway");
+ keywords.add("out");
+ keywords.add("private");
+ keywords.add("public");
+ keywords.add("raises");
+ keywords.add("readonly");
+ keywords.add("sequence");
+ keywords.add("short");
+ keywords.add("string");
+ keywords.add("struct");
+ keywords.add("supports");
+ keywords.add("switch");
+ keywords.add("true");
+ keywords.add("truncatable");
+ keywords.add("typedef");
+ keywords.add("union");
+ keywords.add("unsigned");
+ keywords.add("valuebase");
+ keywords.add("valuetype");
+ keywords.add("void");
+ keywords.add("wchar");
+ keywords.add("wstring");
+ }
+
+}
diff --git a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java
index 4419dce132..e41a60d86a 100644
--- a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java
+++ b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java
@@ -558,8 +558,6 @@ public class CorbaTypesTestCase {
fail();
} catch (Exception e) {
assertTrue(e instanceof RequestConfigurationException);
- } finally {
- request.release();
}
try {
@@ -568,8 +566,6 @@ public class CorbaTypesTestCase {
fail();
} catch (Exception e) {
assertTrue(e instanceof RequestConfigurationException);
- } finally {
- request.release();
}
try {
@@ -578,17 +574,13 @@ public class CorbaTypesTestCase {
fail();
} catch (Exception e) {
assertTrue(e instanceof RequestConfigurationException);
- } finally {
- request.release();
}
-
+
try {
request = new DynaCorbaRequest(refArraysSetter, "whatever");
request.setOutputType(SomeStruct.class);
} catch (Exception e) {
fail();
- } finally {
- request.release();
}
}
@@ -604,8 +596,6 @@ public class CorbaTypesTestCase {
fail();
} catch (Exception e) {
assertTrue(e instanceof RequestConfigurationException);
- } finally {
- request.release();
}
try {
@@ -614,8 +604,6 @@ public class CorbaTypesTestCase {
fail();
} catch (Exception e) {
assertTrue(e instanceof RequestConfigurationException);
- } finally {
- request.release();
}
try {
@@ -624,8 +612,6 @@ public class CorbaTypesTestCase {
fail();
} catch (Exception e) {
assertTrue(e instanceof RequestConfigurationException);
- } finally {
- request.release();
}
try {
@@ -633,8 +619,6 @@ public class CorbaTypesTestCase {
request.setOutputType(Color.class);
} catch (Exception e) {
fail();
- } finally {
- request.release();
}
}
diff --git a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.java b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.java
new file mode 100644
index 0000000000..11bcdc195e
--- /dev/null
+++ b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.java
@@ -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.
+ */
+
+package org.apache.tuscany.sca.binding.corba.testing;
+
+/**
+ * Interface that can be tested for operations mapping
+ */
+public interface MappingTestInterface {
+
+ int getIntField();
+
+ void setIntField(int intField);
+
+ boolean isBoolField();
+
+ void setBoolField(boolean boolField);
+
+ void overloadedName();
+
+ void overloadedName(String arg1);
+
+ void overloadedName(String arg1, int arg2);
+
+ void caseCollision();
+
+ void CaseCollision();
+
+}
diff --git a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java
new file mode 100644
index 0000000000..fa64afca8b
--- /dev/null
+++ b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java
@@ -0,0 +1,69 @@
+/*
+ * 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.binding.corba.testing;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.binding.corba.impl.util.MethodFinder;
+import org.junit.Test;
+
+/**
+ * Various tests for MethodFinder
+ */
+public class MethodFinderTestCase {
+
+ /**
+ * Tests finding existing methods
+ */
+ @Test
+ public void test_findExistingMethod() {
+ try {
+ String methodName = "rotateLeft";
+ Method sample = Integer.class.getMethod(methodName, new Class<?>[] {int.class, int.class});
+ Method m1 = MethodFinder.findMethod(Integer.class, methodName, new Class<?>[] {int.class, int.class});
+ Method m2 =
+ MethodFinder.findMethod(Integer.class, methodName, new Class<?>[] {Integer.class, Integer.class});
+ assertEquals(sample, m1);
+ assertEquals(sample, m2);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests null result value for not existing method
+ */
+ @Test
+ public void test_findNotExistingMethod() {
+ try {
+ String methodName = "rotateLeft";
+ Method method = MethodFinder.findMethod(Integer.class, methodName, new Class<?>[] {});
+ assertEquals(null, method);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
diff --git a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.java b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.java
new file mode 100644
index 0000000000..8d3f34f48c
--- /dev/null
+++ b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.java
@@ -0,0 +1,66 @@
+/*
+ * 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.binding.corba.testing;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
+import org.junit.Test;
+
+/**
+ * Various tests for OperationsMapping
+ */
+public class OperationMappingTestCase {
+
+ /**
+ * Tests if Java2IDLUtil maps methods to operations correctly
+ */
+ @Test
+ public void test_mappingRules() {
+ Map<Method, String> met2op = OperationMapper.mapMethodToOperation(MappingTestInterface.class);
+ for (Method method : met2op.keySet()) {
+ String name = method.getName();
+ String translatedName = met2op.get(method);
+ if (name.equals("getIntField")) {
+ assertEquals("_get_intField", translatedName);
+ } else if (name.equals("setIntField")) {
+ assertEquals("_set_intField", translatedName);
+ } else if (name.equals("isBoolField")) {
+ assertEquals("_get_boolField", translatedName);
+ } else if (name.equals("setBoolField")) {
+ assertEquals("_set_boolField", translatedName);
+ } else if (name.equals("overloadedName") && method.getParameterTypes().length == 0) {
+ assertEquals("overloadedName__", translatedName);
+ } else if (name.equals("overloadedName") && method.getParameterTypes().length == 1) {
+ assertEquals("overloadedName__CORBA_WStringValue", translatedName);
+ } else if (name.equals("overloadedName") && method.getParameterTypes().length == 2) {
+ assertEquals("overloadedName__CORBA_WStringValue__long", translatedName);
+ } else if (name.equals("caseCollision")) {
+ assertEquals("caseCollision_4", translatedName);
+ } else if (name.equals("CaseCollision")) {
+ assertEquals("CaseCollision_0_4", translatedName);
+ }
+ }
+ }
+
+}
diff --git a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java
index 8c74fd3a8c..1fcacca732 100644
--- a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java
+++ b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java
@@ -21,8 +21,10 @@ package org.apache.tuscany.sca.binding.corba.testing.service.mocks;
import java.util.List;
-import org.apache.tuscany.sca.interfacedef.Interface;
+import javax.xml.namespace.QName;
+
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.IntentAttachPointType;
import org.apache.tuscany.sca.policy.PolicySet;
@@ -30,12 +32,14 @@ import org.apache.tuscany.sca.policy.PolicySet;
/**
* Mock TestInterface implementation. Only few methods needs to be implemented.
*/
-public class TestInterface implements Interface {
+public class TestInterface implements JavaInterface {
private List<Operation> operations;
+ private Class<?> javaClass;
- public TestInterface(List<Operation> opearations) {
+ public TestInterface(List<Operation> opearations, Class<?> javaClass) {
this.operations = opearations;
+ this.javaClass = javaClass;
}
public List<Operation> getOperations() {
@@ -94,4 +98,41 @@ public class TestInterface implements Interface {
return null;
}
+ public Class<?> getCallbackClass() {
+ return null;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public QName getQName() {
+ return null;
+ }
+
+ public void setCallbackClass(Class<?> arg0) {
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ public void setName(String arg0) {
+ }
+
+ public void setQName(QName arg0) {
+
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean arg0) {
+ }
+
}
diff --git a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
index 58793c044e..e105c5f3de 100644
--- a/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
+++ b/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
@@ -73,7 +73,7 @@ public class TestRuntimeComponentService implements RuntimeComponentService {
operation.setName(methods[i].getName());
}
}
- TestInterface iface = new TestInterface(operations);
+ TestInterface iface = new TestInterface(operations, invocationTarget.getClass());
interfaceContract = new TestInterfaceContract();
interfaceContract.setInterface(iface);
}