From b39441bcc5a975bc723a0cefc4afcb311ad8fff3 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Tue, 20 Jul 2010 04:36:21 +0000 Subject: Test passing multiple parameters, and use JSON-RPC binding in all test cases. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@965723 13f79535-47bb-0310-9956-ffa450edef68 --- .../implementation/python/provider/ClientTest.java | 4 ++-- .../implementation/python/provider/EchoTest.java | 2 +- .../python/provider/InvokeTestCase.java | 26 +++++++++++++--------- .../implementation/python/provider/ServerTest.java | 4 ++-- .../src/test/resources/client_test.py | 4 ++-- .../src/test/resources/domain-test.composite | 23 ++++++++++++------- .../src/test/resources/server_test.py | 4 ++-- 7 files changed, 39 insertions(+), 28 deletions(-) (limited to 'sandbox/sebastien') 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 @@ - + - + - + + + + - + - - + + + + - - + + + + 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 -- cgit v1.2.3