summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2010-12-21 07:22:12 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2010-12-21 07:22:12 +0000
commite721aa978d542d7f7668d9027affaafccfa8bab5 (patch)
treef00672b79c2ec5b74b17c3ddefd56e4af909b3c0 /sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java
parent1f91615143cc34ad7eeffc7d91b6ffec9d7d0271 (diff)
Tweaks and extensions to better match the async service implementation in core + JMS binding
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1051397 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java14
1 files changed, 12 insertions, 2 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 b6f59515cc..7a86d68043 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
@@ -24,8 +24,12 @@ import static sample.Xutil.elem;
import static sample.Xutil.text;
import static sample.Xutil.xdom;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
import org.w3c.dom.Element;
+import sample.Xutil.NodeBuilder;
import sample.api.Java;
import sample.api.WSDL;
import sample.api.WSDLReference;
@@ -42,6 +46,7 @@ public class UpperSampleAsyncReferenceImpl {
WSDLReference upper;
Element response;
+ CountDownLatch latch = new CountDownLatch( 1 );
public String upper(String s) {
out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")");
@@ -49,16 +54,20 @@ public class UpperSampleAsyncReferenceImpl {
// 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));
+ //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("upper", ureq);
try {
Thread.sleep(500);
+ latch.await(500, TimeUnit.SECONDS);
} catch (Exception ex) {
// do nothing
}
- return response.getTextContent();
+ if( response != null ) return response.getTextContent();
+ else return "upper did not get called back";
}
/**
@@ -69,5 +78,6 @@ public class UpperSampleAsyncReferenceImpl {
public void upperCallback(Element response) {
out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response.getTextContent() + ")");
this.response = response;
+ latch.countDown();
}
}