diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-24 01:10:37 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-24 01:10:37 +0000 |
commit | 40741392744e1401050c2f75d6ae7b055e1d8c6d (patch) | |
tree | e7ab757f52615497ce70a8fc4bc820afc29ab083 /sca-java-2.x/trunk/modules/implementation-python-runtime | |
parent | babcd818b2799218ba4a9ed2226362b16ea41de8 (diff) |
Test passing multiple parameters, and use JSON-RPC binding in all test cases.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@988367 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-python-runtime')
7 files changed, 39 insertions, 28 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java b/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java index 301dfee78a..251364933e 100644 --- a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ClientTest.java +++ b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java b/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java index 88719a0ddc..366a94a346 100644 --- a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/EchoTest.java +++ b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java b/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java index 2d8388b6d4..b32c931453 100644 --- a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/InvokeTestCase.java +++ b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java b/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java index 36e4f18f64..422be15dd6 100644 --- a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/java/org/apache/tuscany/sca/implementation/python/provider/ServerTest.java +++ b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/client_test.py b/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/client_test.py index 47e6cf4bda..e3cbaf077f 100644 --- a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/client_test.py +++ b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/domain-test.composite b/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/domain-test.composite index 7f7a82dcd4..dfcf4f83ea 100644 --- a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/domain-test.composite +++ b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/server_test.py b/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/server_test.py index dcda763043..75f9712f95 100644 --- a/sca-java-2.x/trunk/modules/implementation-python-runtime/src/test/resources/server_test.py +++ b/sca-java-2.x/trunk/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 |