tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r828991 - in /tuscany/java/sca/itest/jaxws-asyncclient: ./ src/main/java/stock/StockQuoteClient.java src/main/java/stock/StockQuoteRef.java src/test/java/itest/AsyncServiceTestCase.java
Date Fri, 23 Oct 2009 10:27:16 GMT
Author: antelder
Date: Fri Oct 23 10:27:15 2009
New Revision: 828991

URL: http://svn.apache.org/viewvc?rev=828991&view=rev
Log:
Finish implementing the jaxws client invoke tests

Modified:
    tuscany/java/sca/itest/jaxws-asyncclient/   (props changed)
    tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java
    tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java
    tuscany/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java

Propchange: tuscany/java/sca/itest/jaxws-asyncclient/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 23 10:27:15 2009
@@ -0,0 +1,20 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+derby.log
+maven.log
+maven-eclipse.xml
+build.xml
+build-dependency.xml
+velocity.log*
+junit*.properties
+surefire*.properties
+.project
+.classpath
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders

Modified: tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java?rev=828991&r1=828990&r2=828991&view=diff
==============================================================================
--- tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java (original)
+++ tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java Fri
Oct 23 10:27:15 2009
@@ -43,27 +43,27 @@
     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;
+    }
 
 }

Modified: tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java?rev=828991&r1=828990&r2=828991&view=diff
==============================================================================
--- tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java (original)
+++ tuscany/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java Fri Oct
23 10:27:15 2009
@@ -35,5 +35,5 @@
     
     Response<Float> getPriceAsync(String ticker);
     
-//    Future<?> getPriceAsync(String ticker, AsyncHandler<Float> callback);
+    Future<?> getPriceAsync(String ticker, AsyncHandler<Float> callback);
 }

Modified: tuscany/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java?rev=828991&r1=828990&r2=828991&view=diff
==============================================================================
--- tuscany/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java
(original)
+++ tuscany/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java
Fri Oct 23 10:27:15 2009
@@ -58,10 +58,10 @@
         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"));
+    }
 
 }



Mime
View raw message