diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-24 09:27:44 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-24 09:27:44 +0000 |
commit | 1c21d758af81d880ad6e045d18f8bc62ad8be89e (patch) | |
tree | 5d7de84e2edcb5b5e12183506f98b68b0e312046 /sca-cpp/trunk/modules/java/test | |
parent | aff8757990e8f3d633541cb9649c43483377c0fa (diff) |
Minor improvements to java component support, use one classloader per component, use Iterables instead of arrays to represent lists, added more tests and a working java version of the store integration test.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@902539 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/java/test')
-rw-r--r-- | sca-cpp/trunk/modules/java/test/CalcImpl.java | 14 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/java/test/Client.java | 8 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/java/test/ClientImpl.java | 8 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/java/test/Server.java | 8 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/java/test/ServerImpl.java | 18 |
5 files changed, 34 insertions, 22 deletions
diff --git a/sca-cpp/trunk/modules/java/test/CalcImpl.java b/sca-cpp/trunk/modules/java/test/CalcImpl.java index 51753785e4..37dc642e75 100644 --- a/sca-cpp/trunk/modules/java/test/CalcImpl.java +++ b/sca-cpp/trunk/modules/java/test/CalcImpl.java @@ -19,6 +19,9 @@ package test; +import java.util.List; +import java.util.ArrayList; + public class CalcImpl { public Double add(Double x, Double y, Adder adder) { @@ -29,4 +32,15 @@ public class CalcImpl { return x * y; } + public Boolean even(Double x) { + return (double)(((int)(double)x / 2) * 2) == (double)x; + } + + public Iterable<Double> square(Iterable<Double> l) { + List r = new ArrayList(); + for (Double x: l) + r.add(x * x); + return r; + } + } diff --git a/sca-cpp/trunk/modules/java/test/Client.java b/sca-cpp/trunk/modules/java/test/Client.java index 447b408cd4..ff2d3fee13 100644 --- a/sca-cpp/trunk/modules/java/test/Client.java +++ b/sca-cpp/trunk/modules/java/test/Client.java @@ -23,13 +23,13 @@ public interface Client { String echo(String x); - Object[] getall(); + Iterable<?> getall(); - Object[] get(String id); + Iterable<?> get(String id); - String post(Object[] item); + String post(Iterable<?> item); - Boolean put(String id, Object[] entry); + Boolean put(String id, Iterable<?> entry); Boolean deleteall(); diff --git a/sca-cpp/trunk/modules/java/test/ClientImpl.java b/sca-cpp/trunk/modules/java/test/ClientImpl.java index 3d3063b608..4bd3498dd5 100644 --- a/sca-cpp/trunk/modules/java/test/ClientImpl.java +++ b/sca-cpp/trunk/modules/java/test/ClientImpl.java @@ -25,19 +25,19 @@ public class ClientImpl { return server.echo(x); } - public Object[] getall(Server server) { + public Iterable<?> getall(Server server) { return server.getall(); } - public Object[] get(String id, Server server) { + public Iterable<?> get(String id, Server server) { return server.get(id); } - public String post(Object[] item, Server server) { + public String post(Iterable<?> item, Server server) { return server.post(item); } - public Boolean put(String id, Object[] item, Server server) { + public Boolean put(String id, Iterable<?> item, Server server) { return server.put(id, item); } diff --git a/sca-cpp/trunk/modules/java/test/Server.java b/sca-cpp/trunk/modules/java/test/Server.java index a165988550..917ccfd6b9 100644 --- a/sca-cpp/trunk/modules/java/test/Server.java +++ b/sca-cpp/trunk/modules/java/test/Server.java @@ -23,13 +23,13 @@ public interface Server { String echo(String x); - Object[] getall(); + Iterable<?> getall(); - Object[] get(String id); + Iterable<?> get(String id); - String post(Object[] item); + String post(Iterable<?> item); - Boolean put(String id, Object[] entry); + Boolean put(String id, Iterable<?> entry); Boolean deleteall(); diff --git a/sca-cpp/trunk/modules/java/test/ServerImpl.java b/sca-cpp/trunk/modules/java/test/ServerImpl.java index f82a8a24b5..dd4e227123 100644 --- a/sca-cpp/trunk/modules/java/test/ServerImpl.java +++ b/sca-cpp/trunk/modules/java/test/ServerImpl.java @@ -19,33 +19,31 @@ package test; +import static org.apache.tuscany.IterableUtil.*; + public class ServerImpl { - Object[] list(Object... o) { - return o; - } - public String echo(String x) { return x; } - public Object[] getall() { + public Iterable<?> getall() { return list("Sample Feed", "123456789", list("Item", "111", list(list("'javaClass", "services.Item"), list("'name", "Apple"), list("'currencyCode", "USD"), list("'currencySymbol", "$"), list("'price", 2.99))), list("Item", "222", list(list("'javaClass", "services.Item"), list("'name", "Orange"), list("'currencyCode", "USD"), list("'currencySymbol", "$"), list("'price", 3.55))), - list("Item", "333", list(list("'javaClass", "services.Item"), list("name", "Pear"), list("'currencyCode", "USD"), list("'currencySymbol", "$"), list("'price", 1.55)))); + list("Item", "333", list(list("'javaClass", "services.Item"), list("'name", "Pear"), list("'currencyCode", "USD"), list("'currencySymbol", "$"), list("'price", 1.55)))); } - public Object[] get(String id) { - Object[] entry = list(list("'javaClass", "services.Item"), list("'name", "Apple"), list("'currencyCode", "USD"), list("'currencySymbol", "$"), list("'price", 2.99)); + public Iterable<?> get(String id) { + Iterable<?> entry = list(list("'javaClass", "services.Item"), list("'name", "Apple"), list("'currencyCode", "USD"), list("'currencySymbol", "$"), list("'price", 2.99)); return list("Item", id, entry); } - public String post(Object[] item) { + public String post(Iterable<?> item) { return "123456789"; } - public Boolean put(String id, Object[] entry) { + public Boolean put(String id, Iterable<?> entry) { return true; } |