summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java5
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/Upper.java4
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java49
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java11
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperTest.java9
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java22
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl7
7 files changed, 101 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java
index 6758c1fc1f..41e53d90b7 100644
--- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java
+++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java
@@ -71,8 +71,9 @@ class SampleWSDLInvoker extends InterceptorAsyncImpl {
// At this point we could serialize the AsyncResponseInvoker and pick it up again
// later to send the async response
- //((RuntimeEndpoint)msg.getTo()).invokeAsyncResponse(responseMsg);
- respInvoker.invokeAsyncResponse(responseMsg);
+ if (responseMsg.getBody() != null){
+ respInvoker.invokeAsyncResponse(responseMsg);
+ }
} // end method invokeAsyncRequest
public Message processRequest(Message msg) {
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/Upper.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/Upper.java
index 9c772b3487..3a831a0ecf 100644
--- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/Upper.java
+++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/Upper.java
@@ -30,4 +30,8 @@ import org.oasisopen.sca.annotation.Remotable;
public interface Upper {
String upper(String s);
+
+ String upper2(String s);
+
+ String upperVoid(String s);
}
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java
index 7a86d68043..4bfc8356c4 100644
--- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java
+++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java
@@ -46,6 +46,8 @@ public class UpperSampleAsyncReferenceImpl {
WSDLReference upper;
Element response;
+ Element response2;
+ public static String responseVoid;
CountDownLatch latch = new CountDownLatch( 1 );
public String upper(String s) {
@@ -80,4 +82,51 @@ public class UpperSampleAsyncReferenceImpl {
this.response = response;
latch.countDown();
}
+
+ public String upper2(String s) {
+ out.println("UpperSampleAsyncReferenceImpl.upper2(" + s + ")");
+
+ // TODO - I'm passing in the non-wrapped version of the parameter
+ // here which doesn't seem right. Need to test that databinding
+ // wraps it correctly
+ //final Element ureq = xdom("http://sample/upper-async", "s", text(s));
+ NodeBuilder node1 = elem("s", text(s));
+ final Element ureq = xdom("http://sample/upper-async", "upper", node1);
+ upper.callAsync("upper2", ureq);
+
+ try {
+ Thread.sleep(500);
+ latch.await(500, TimeUnit.SECONDS);
+ } catch (Exception ex) {
+ // do nothing
+ }
+
+ if( response2 != null ) return response2.getTextContent();
+ else return "upper did not get called back";
+ }
+
+ /**
+ * In this implementation the convention is that the
+ * async callback arrives at an operation named
+ * operationName + Callback
+ */
+ public void upper2Callback(Element response) {
+ out.println("UpperSampleAsyncReferenceImpl.upper2Callback(" + response.getTextContent() + ")");
+ this.response2 = response;
+ latch.countDown();
+ }
+
+ public String upperVoid(String s) {
+ out.println("UpperSampleAsyncReferenceImpl.upperVoid(" + s + ")");
+
+ // TODO - I'm passing in the non-wrapped version of the parameter
+ // here which doesn't seem right. Need to test that databinding
+ // wraps it correctly
+ //final Element ureq = xdom("http://sample/upper-async", "s", text(s));
+ NodeBuilder node1 = elem("s", text(s));
+ final Element ureq = xdom("http://sample/upper-async", "upper", node1);
+ upper.callAsync("upperVoid", ureq);
+ return responseVoid;
+ }
+
}
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java
index 69d6cb9ecf..75fe271d7a 100644
--- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java
+++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java
@@ -38,8 +38,15 @@ public class UpperSampleAsyncServiceImpl {
public Element call(String op, Element e) {
String input = e.getTextContent();
- out.println("UpperSampleAsyncServiceImpl.upper(" + input + ")");
+ out.println("UpperSampleAsyncServiceImpl." + op + "(" + input + ")");
String output = input.toUpperCase();
- return xdom("http://sample/upper-async", "upperResponse", elem("result", text(output)));
+
+ if (!op.equals("upperVoid")){
+ return xdom("http://sample/upper-async", "upperResponse", elem("result", text(output)));
+ } else {
+ out.println("No response as void return type");
+ UpperSampleAsyncReferenceImpl.responseVoid = output;
+ return null;
+ }
}
}
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperTest.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperTest.java
index 5399e4410d..f1daf8155e 100644
--- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperTest.java
+++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperTest.java
@@ -34,4 +34,13 @@ public class UpperTest {
out.println("UpperTest.upper(" + s + ")");
return s.toUpperCase();
}
+
+ public String upper2(String s) {
+ out.println("UpperTest.upper2(" + s + ")");
+ return s.toUpperCase();
+ }
+
+ public void upperVoid(String s) {
+ out.println("UpperTest.upperVoid(" + s + ")");
+ }
}
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java
index f5198e7df0..28d54647c5 100644
--- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java
+++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java
@@ -54,11 +54,29 @@ public class SampleNativeAsyncTestCase {
}
@Test
- public void testReference() {
- System.out.println("SampleNaiveAsyncTestCase.testReference");
+ public void testUpper() {
+ System.out.println("SampleNaiveAsyncTestCase.testUpper");
Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference");
final String r = upper.upper("async");
System.out.println(r);
assertEquals("ASYNC", r);
}
+
+ @Test
+ public void testUpper2() {
+ System.out.println("SampleNaiveAsyncTestCase.testUpper2");
+ Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference");
+ final String r = upper.upper2("async2");
+ System.out.println(r);
+ assertEquals("ASYNC2", r);
+ }
+
+ @Test
+ public void testVoid() {
+ System.out.println("SampleNaiveAsyncTestCase.testUpperVoid");
+ Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference");
+ final String r = upper.upperVoid("asyncVoid");
+ System.out.println(r);
+ assertEquals("ASYNCVOID", r);
+ }
}
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl
index a16fb5db3d..9a6ab268fb 100644
--- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl
+++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl
@@ -60,6 +60,13 @@
<wsdl:input message="tns:upperRequest" name="upperRequest" />
<wsdl:output message="tns:upperResponse" name="upperResponse" />
</wsdl:operation>
+ <wsdl:operation name="upper2">
+ <wsdl:input message="tns:upperRequest" name="upperRequest" />
+ <wsdl:output message="tns:upperResponse" name="upperResponse" />
+ </wsdl:operation>
+ <wsdl:operation name="upperVoid">
+ <wsdl:input message="tns:upperRequest" name="upperRequest" />
+ </wsdl:operation>
</wsdl:portType>
</wsdl:definitions>