summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-23 10:27:15 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-23 10:27:15 +0000
commit85da664220832533f65cdfe5ac611fe7ee9afad8 (patch)
treec8d21580b4e34fda50ca5e0edcb2e309e12c0cfd
parenta1f1485ebf771c5bd9cc4bddb6adfbd5fc2eb550 (diff)
Finish implementing the jaxws client invoke tests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@828991 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java44
-rw-r--r--java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java2
-rw-r--r--java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java10
3 files changed, 28 insertions, 28 deletions
diff --git a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java
index 7619e4928f..0bf3328c31 100644
--- a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java
+++ b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java
@@ -43,27 +43,27 @@ public class StockQuoteClient {
Object mutex = new Object();
Exception exception;
-// public float getPriceAsyncCallback(String ticker) throws Exception {
-// AsyncHandler<Float> callback = new AsyncHandler<Float>() {
-// public void handleResponse(Response<Float> arg) {
-// synchronized (mutex) {
-// try {
-// price = arg.get();
-// } catch (Exception e) {
-// exception = e;
-// }
-// mutex.notify();
-// }
-// }
-// };
-// stockQuote.getPriceAsync("foo", callback);
-// synchronized (mutex) {
-// if (price == 0f)
-// wait(5000); // wait for up to 5 seconds
-// }
-//
-// if (exception != null) throw exception;
-// return price;
-// }
+ public float getPriceAsyncCallback(String ticker) throws Exception {
+ AsyncHandler<Float> callback = new AsyncHandler<Float>() {
+ public void handleResponse(Response<Float> arg) {
+ synchronized (mutex) {
+ try {
+ price = arg.get();
+ } catch (Exception e) {
+ exception = e;
+ }
+ mutex.notify();
+ }
+ }
+ };
+ stockQuote.getPriceAsync("foo", callback);
+ synchronized (mutex) {
+ if (price == 0f)
+ mutex.wait(5000); // wait for up to 5 seconds
+ }
+
+ if (exception != null) throw exception;
+ return price;
+ }
}
diff --git a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java
index 6199996448..b15ab6be08 100644
--- a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java
+++ b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java
@@ -35,5 +35,5 @@ public interface StockQuoteRef extends StockQuote {
Response<Float> getPriceAsync(String ticker);
-// Future<?> getPriceAsync(String ticker, AsyncHandler<Float> callback);
+ Future<?> getPriceAsync(String ticker, AsyncHandler<Float> callback);
}
diff --git a/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java b/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java
index 4f7bbcc268..eb72924093 100644
--- a/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java
+++ b/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java
@@ -58,10 +58,10 @@ public class AsyncServiceTestCase {
Assert.assertEquals(10.0f, sc.getPriceAsyncPoll("foo"));
}
-// @Test
-// public void invokeAsyncCallback() throws Exception {
-// StockQuoteClient sc = node.getService(StockQuoteClient.class, "StockQuoteClient");
-// Assert.assertEquals(10.0f, sc.getPriceAsyncCallback("foo"));
-// }
+ @Test
+ public void invokeAsyncCallback() throws Exception {
+ StockQuoteClient sc = node.getService(StockQuoteClient.class, "StockQuoteClient");
+ Assert.assertEquals(10.0f, sc.getPriceAsyncCallback("foo"));
+ }
}