You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2010/09/17 09:38:10 UTC

svn commit: r998005 - in /tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src: main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/ test/java/echo/

Author: lresende
Date: Fri Sep 17 07:38:09 2010
New Revision: 998005

URL: http://svn.apache.org/viewvc?rev=998005&view=rev
Log:
Adding test for double values

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java
    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java?rev=998005&r1=998004&r2=998005&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java Fri Sep 17 07:38:09 2010
@@ -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.Ru
 
 /**
  * Implementation of the JSONRPC Binding Provider for References
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider {
@@ -57,7 +57,7 @@ public class JSONRPCReferenceBindingProv
 
         this.endpointReference = endpointReference;
         this.reference = (RuntimeComponentReference) endpointReference.getReference();
-        
+
         //clone the service contract to avoid databinding issues
         /*
         try {
@@ -65,20 +65,20 @@ public class JSONRPCReferenceBindingProv
         } 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 JSONRPCReferenceBindingProv
     }
 
     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);
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java?rev=998005&r1=998004&r2=998005&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java Fri Sep 17 07:38:09 2010
@@ -45,6 +45,8 @@ public interface Echo {
     void echoBusinessException() throws EchoBusinessException;
 
     int echoInt(int param);
+    
+    double echoDouble(double param);
 
     boolean echoBoolean(boolean param);
 

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java?rev=998005&r1=998004&r2=998005&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java Fri Sep 17 07:38:09 2010
@@ -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 E
         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 E
     public void get\u03a9\u03bb\u03c0() {
         throw new UnsupportedOperationException("UNsupported !");
     }
-    
+
     public BigDecimal echoBigDecimal(BigDecimal param) {
         throw new UnsupportedOperationException("UNsupported !");
-    }    
+    }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java?rev=998005&r1=998004&r2=998005&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java Fri Sep 17 07:38:09 2010
@@ -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 implement
         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 implement
     public void get\u03a9\u03bb\u03c0() {
 
     }
-    
+
     public BigDecimal echoBigDecimal(BigDecimal param) {
         return param;
-    }    
+    }
 }