summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-10-12 15:16:54 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-10-12 15:16:54 +0000
commit11607cb7e42de53e45ba03eebda472ceb2702df2 (patch)
treeb19a3eed789709b5d32a1677ec3d274ae2096b0b /sca-java-1.x/trunk
parent4e68ab61926e3007d047e5a4e8652b0acb88edd1 (diff)
Add primitive type test and take account of it in the temporary databinding that jsonp uses.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1021794 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk')
-rw-r--r--sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java4
-rw-r--r--sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java5
-rw-r--r--sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java2
-rw-r--r--sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java11
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java2
5 files changed, 23 insertions, 1 deletions
diff --git a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java
index aca47c3d5f..c00815196c 100644
--- a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java
+++ b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java
@@ -58,4 +58,8 @@ public class HelloWorldClient implements HelloWorldService {
public void sayHello8(String name) {
ref.sayHello8(name);
}
+
+ public int sayHello9(int name) {
+ return ref.sayHello9(name);
+ }
}
diff --git a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java
index 01d67757f9..f55f8a8994 100644
--- a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java
+++ b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java
@@ -72,4 +72,9 @@ public class HelloWorldImpl implements HelloWorldService {
public void sayHello8(String name) {
System.out.println("Hello void " + name);
}
+
+ public int sayHello9(int name) {
+ System.out.println("Hello void " + name);
+ return name;
+ }
}
diff --git a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java
index 79cc293b97..b68d3d5874 100644
--- a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java
+++ b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java
@@ -39,5 +39,7 @@ public interface HelloWorldService {
void sayHello7();
void sayHello8(String name);
+
+ int sayHello9(int name);
}
diff --git a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java
index bafd6ecd21..6e684c0ac7 100644
--- a/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java
+++ b/sca-java-1.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java
@@ -163,6 +163,17 @@ public class BindingTestCase {
}
@Test
+ public void testIntOut() throws MalformedURLException, IOException {
+ HelloWorldService client = ((SCAClient)node).getService(HelloWorldService.class, "HelloWorldClient");
+
+ try {
+ Assert.assertEquals(28, client.sayHello9(28));
+ } catch (Exception ex){
+ Assert.fail();
+ }
+ }
+
+ @Test
@Ignore
public void waitForInput(){
System.out.println("Press a key");
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java
index d7d04d7848..fbc4b5009b 100644
--- a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java
@@ -54,7 +54,7 @@ public class Object2JSON implements PullTransformer<Object, Object> {
}
try {
String value = mapper.writeValueAsString(source);
- if (targetType == String.class || targetType == Object.class) {
+ if (targetType == String.class || targetType == Object.class || targetType.isPrimitive()) {
return value;
} else if (JsonNode.class.isAssignableFrom(targetType)) {
return JacksonHelper.createJsonParser(value).readValueAsTree();