summaryrefslogtreecommitdiffstats
path: root/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test')
-rw-r--r--sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java4
-rw-r--r--sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java2
-rw-r--r--sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java26
-rw-r--r--sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java4
-rw-r--r--sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/client_test.py4
-rw-r--r--sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/domain-test.composite23
-rw-r--r--sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/server_test.py4
7 files changed, 39 insertions, 28 deletions
diff --git a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java
index 301dfee78a..251364933e 100644
--- a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java
+++ b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java
@@ -31,7 +31,7 @@ public class ClientTest implements EchoTest {
@Reference
public EchoTest ref;
- public String echo(final String s) {
- return ref.echo(s);
+ public String echo(final String s1, final String s2) {
+ return ref.echo(s1, s2);
}
}
diff --git a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java
index 88719a0ddc..366a94a346 100644
--- a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java
+++ b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java
@@ -29,5 +29,5 @@ import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface EchoTest {
- public String echo(String s);
+ public String echo(String s1, String s2);
}
diff --git a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java
index 2d8388b6d4..b32c931453 100644
--- a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java
+++ b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java
@@ -48,6 +48,7 @@ public class InvokeTestCase {
node.start();
} catch (Exception e) {
e.printStackTrace();
+ throw e;
}
}
@@ -58,32 +59,35 @@ public class InvokeTestCase {
@Test
public void testService() throws Exception {
- final Session s = TransportRegistry.i().createSession("http://localhost:8085/python");
+ final Session s = TransportRegistry.i().createSession("http://localhost:8080/python");
final Client c = new Client(s);
final Object px = c.openProxy("", EchoTest.class);
- final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class), new Object[]{"Hey"});
+ final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class, String.class), new Object[]{"Hey", "There"});
c.closeProxy(px);
s.close();
- assertEquals("Hey", r);
+ assertEquals("Hey There", r);
}
@Test
public void testReference() throws Exception {
- final Session s = TransportRegistry.i().createSession("http://localhost:8085/client");
+ final Session s = TransportRegistry.i().createSession("http://localhost:8080/client");
final Client c = new Client(s);
final Object px = c.openProxy("", EchoTest.class);
- final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class), new Object[]{"Hey"});
+ final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class, String.class), new Object[]{"Hey", "There"});
c.closeProxy(px);
s.close();
- assertEquals("Hey", r);
+ assertEquals("Hey There", r);
}
- //@Test Disabled for now as Java / JSON databinding transform doesn't seem
- // to produce the right JSON
+ @Test
public void testLocal() throws Exception {
- final EchoTest s = node.getService(EchoTest.class, "java-client-test");
- final String r = s.echo("Hey");
- assertEquals("Hey", r);
+ final Session s = TransportRegistry.i().createSession("http://localhost:8080/java-client");
+ final Client c = new Client(s);
+ final Object px = c.openProxy("", EchoTest.class);
+ final Object r = c.invoke(px, EchoTest.class.getMethod("echo", String.class, String.class), new Object[]{"Hey", "There"});
+ c.closeProxy(px);
+ s.close();
+ assertEquals("Hey There", r);
}
}
diff --git a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java
index 36e4f18f64..422be15dd6 100644
--- a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java
+++ b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java
@@ -26,7 +26,7 @@ package org.apache.tuscany.sca.implementation.python.provider;
*/
public class ServerTest implements EchoTest {
- public String echo(final String s) {
- return s;
+ public String echo(final String s1, final String s2) {
+ return s1 + " " + s2;
}
}
diff --git a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/client_test.py b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/client_test.py
index 47e6cf4bda..e3cbaf077f 100644
--- a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/client_test.py
+++ b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/client_test.py
@@ -17,8 +17,8 @@
# JSON-RPC test case
-def echo(x, ref):
- return ref("echo", x)
+def echo(x, y, ref):
+ return ref("echo", x, y)
# ATOMPub test case
diff --git a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/domain-test.composite b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/domain-test.composite
index 7f7a82dcd4..dfcf4f83ea 100644
--- a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/domain-test.composite
+++ b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/domain-test.composite
@@ -25,33 +25,40 @@
<component name="python-test">
<t:implementation.python script="server_test.py"/>
<service name="test">
- <t:binding.jsonrpc uri="http://localhost:8085/python"/>
+ <t:binding.jsonrpc uri="http://localhost:8080/python"/>
</service>
</component>
<component name="client-test">
<t:implementation.python script="client_test.py"/>
<service name="client">
- <t:binding.jsonrpc uri="http://localhost:8085/client"/>
+ <t:binding.jsonrpc uri="http://localhost:8080/client"/>
</service>
<reference name="ref" target="python-test">
</reference>
</component>
- <component name="local-java-test">
+ <component name="java-test">
<implementation.java class="org.apache.tuscany.sca.implementation.python.provider.ServerTest"/>
+ <service name="EchoTest">
+ <t:binding.jsonrpc uri="http://localhost:8080/java"/>
+ </service>
</component>
- <component name="local-client-test">
+ <component name="python-to-java-test">
<t:implementation.python script="client_test.py"/>
- <reference name="ref" target="local-java-test">
- </reference>
+ <service name="client">
+ <t:binding.jsonrpc uri="http://localhost:8080/python-to-java"/>
+ </service>
+ <reference name="ref" target="java-test"/>
</component>
<component name="java-client-test">
<implementation.java class="org.apache.tuscany.sca.implementation.python.provider.ClientTest"/>
- <reference name="ref" target="local-client-test">
- </reference>
+ <service name="EchoTest">
+ <t:binding.jsonrpc uri="http://localhost:8080/java-client"/>
+ </service>
+ <reference name="ref" target="python-to-java-test"/>
</component>
</composite>
diff --git a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/server_test.py b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/server_test.py
index dcda763043..75f9712f95 100644
--- a/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/server_test.py
+++ b/sandbox/sebastien/java/dynamic/modules/implementation-python-runtime/src/test/resources/server_test.py
@@ -17,8 +17,8 @@
# JSON-RPC test case
-def echo(x):
- return x
+def echo(x, y):
+ return x + " " + y
# ATOMPub test case