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
This commit is contained in:
parent
4e68ab6192
commit
11607cb7e4
5 changed files with 23 additions and 1 deletions
sca-java-1.x/trunk/modules
binding-jsonp-runtime/src/test/java
databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,5 +39,7 @@ public interface HelloWorldService {
|
|||
void sayHello7();
|
||||
|
||||
void sayHello8(String name);
|
||||
|
||||
int sayHello9(int name);
|
||||
|
||||
}
|
||||
|
|
|
@ -162,6 +162,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(){
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue