From 25ef0f8ea58c8a7b7d8d1c5e974b68167e0a0397 Mon Sep 17 00:00:00 2001 From: lresende Date: Fri, 17 Sep 2010 07:38:09 +0000 Subject: Adding test for double values git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@998005 13f79535-47bb-0310-9956-ffa450edef68 --- .../provider/JSONRPCReferenceBindingProvider.java | 23 +++++++++++----------- .../src/test/java/echo/Echo.java | 2 ++ .../src/test/java/echo/EchoClientImpl.java | 14 ++++++++----- .../src/test/java/echo/EchoComponentImpl.java | 21 ++++++++++++-------- 4 files changed, 36 insertions(+), 24 deletions(-) (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java index d1e35730b7..adc19202b3 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.apache.tuscany.sca.binding.jsonrpc.provider; @@ -42,7 +42,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentReference; /** * Implementation of the JSONRPC Binding Provider for References - * + * * @version $Rev$ $Date$ */ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider { @@ -57,7 +57,7 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider this.endpointReference = endpointReference; this.reference = (RuntimeComponentReference) endpointReference.getReference(); - + //clone the service contract to avoid databinding issues /* try { @@ -65,20 +65,20 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider } catch(CloneNotSupportedException e) { this.referenceContract = reference.getInterfaceContract(); } - + JSONRPCDatabindingHelper.setDataBinding(referenceContract.getInterface()); */ - + // Create an HTTP client HttpParams defaultParameters = new BasicHttpParams(); //defaultParameters.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 10); HttpProtocolParams.setContentCharset(defaultParameters, HTTP.UTF_8); HttpConnectionParams.setConnectionTimeout(defaultParameters, 60000); HttpConnectionParams.setSoTimeout(defaultParameters, 60000); - + SchemeRegistry supportedSchemes = new SchemeRegistry(); supportedSchemes.register(new Scheme(HttpHost.DEFAULT_SCHEME_NAME, PlainSocketFactory.getSocketFactory(), 80)); - + ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(defaultParameters, supportedSchemes); httpClient = new DefaultHttpClient(connectionManager, defaultParameters); @@ -90,9 +90,10 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider } public Invoker createInvoker(Operation operation) { - final Interface intf = reference.getInterfaceContract().getInterface(); - if (intf.isDynamic()) + final Interface intf = reference.getInterfaceContract().getInterface(); + if (intf.isDynamic()) { return new JSONRPCBindingInvoker(endpointReference, operation, httpClient); + } return new JSONRPCClientInvoker(endpointReference, operation, httpClient); } 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 91efccc4e5..65c2cd3bf6 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 @@ -45,6 +45,8 @@ public interface Echo { void echoBusinessException() throws EchoBusinessException; int echoInt(int param); + + double echoDouble(double param); boolean echoBoolean(boolean 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 4163f86313..66c82aaba3 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 @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package echo; @@ -63,6 +63,10 @@ public class EchoClientImpl implements Echo { throw new UnsupportedOperationException("UNsupported !"); } + public double echoDouble(double param) { + throw new UnsupportedOperationException("UNsupported !"); + } + public List echoList(ArrayList list) { throw new UnsupportedOperationException("UNsupported !"); } @@ -82,9 +86,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 0a34404281..8214d7ad70 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 @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package echo; @@ -31,12 +31,12 @@ import bean.TestBean; /** * A simple client component that uses a reference with an JSONRPC binding. - * + * * @version $Rev$ $Date$ */ -public class EchoComponentImpl implements Echo { +public class EchoComponentImpl implements Echo { - public String echo(String msg) { + public String echo(String msg) { System.out.println("Echo: "+ msg); return "echo: " + msg; } @@ -55,6 +55,11 @@ public class EchoComponentImpl implements Echo { return value; } + public double echoDouble(double param) { + double value = param; + return param; + } + public boolean echoBoolean(boolean param) { boolean value = param; return value; @@ -100,8 +105,8 @@ public class EchoComponentImpl implements Echo { public void get\u03a9\u03bb\u03c0() { } - + public BigDecimal echoBigDecimal(BigDecimal param) { return param; - } + } } -- cgit v1.2.3