diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java')
4 files changed, 29 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java index 322008de1f..91efccc4e5 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java @@ -18,6 +18,7 @@ */ package echo; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -61,4 +62,5 @@ public interface Echo { void get\u03a9\u03bb\u03c0(); + BigDecimal echoBigDecimal(BigDecimal param); } diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java index f76ec74b16..4163f86313 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java @@ -19,6 +19,7 @@ package echo; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -81,5 +82,9 @@ public class EchoClientImpl implements Echo { public void get\u03a9\u03bb\u03c0() { throw new UnsupportedOperationException("UNsupported !"); } + + public BigDecimal echoBigDecimal(BigDecimal param) { + throw new UnsupportedOperationException("UNsupported !"); + } } diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java index 08ccb6e6d5..0a34404281 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java @@ -18,6 +18,7 @@ */ package echo; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -96,8 +97,11 @@ public class EchoComponentImpl implements Echo { } - public void get\u03a9\u03bb\u03c0() { } + + public BigDecimal echoBigDecimal(BigDecimal param) { + return param; + } } diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java index 0fd622d29b..d09bce6365 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java @@ -199,4 +199,21 @@ public class JSONRPCDataTypeTestCase { Assert.assertEquals("red", jsonResp.getJSONArray("result").get(0)); } + + @Test + public void testBigDecimal() throws Exception { + JSONObject jsonRequest = new JSONObject( + "{ \"method\": \"echoBigDecimal\", \"params\": [\"12345.67\"], \"id\": 4}"); + + WebConversation wc = new WebConversation(); + WebRequest request = new PostMethodWebRequest(SERVICE_URL, + new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json"); + WebResponse response = wc.getResource(request); + + Assert.assertEquals(200, response.getResponseCode()); + + JSONObject jsonResp = new JSONObject(response.getText()); + + Assert.assertEquals("12345.67", jsonResp.get("result")); + } }
\ No newline at end of file |