summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java')
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java49
1 files changed, 49 insertions, 0 deletions
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;
+ }
+
}