tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r810816 - in /tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src: main/java/composite/SourceImpl.java test/java/composite/CompositeTestCase.java
Date Thu, 03 Sep 2009 08:43:07 GMT
Author: nash
Date: Thu Sep  3 08:43:06 2009
New Revision: 810816

URL: http://svn.apache.org/viewvc?rev=810816&view=rev
Log:
Update samples/implementation-composite to verify successful completion (TUSCANY-3253)

Modified:
    tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java
    tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java

Modified: tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java?rev=810816&r1=810815&r2=810816&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java
Thu Sep  3 08:43:06 2009
@@ -27,6 +27,7 @@
 @Scope("COMPOSITE")
 public class SourceImpl implements Source, SourceCallback {
 
+    public static int callbackCount = 0;
     private Target targetReference;
     private Target targetReference2;
 
@@ -49,6 +50,9 @@
     }
 
     public void receiveResult(String result) {
+        synchronized(this) {
+            callbackCount += 1;
+        }
         System.out.println("Work thread " + Thread.currentThread());
         System.out.println("Result: " + result);
     }

Modified: tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java?rev=810816&r1=810815&r2=810816&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java
(original)
+++ tuscany/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java
Thu Sep  3 08:43:06 2009
@@ -39,13 +39,12 @@
     }
 
     public void test() throws Exception {
-        try {
-            System.out.println("Main thread " + Thread.currentThread());
-            source.clientMethod("Client.main");
-            System.out.println("Sleeping ...");
-            Thread.sleep(1000);
-        } catch (Throwable t) {
-            t.printStackTrace();
+        System.out.println("Main thread " + Thread.currentThread());
+        source.clientMethod("Client.main");
+        System.out.println("Sleeping ...");
+        Thread.sleep(1000);
+        if (SourceImpl.callbackCount != 2) {
+            throw new IllegalStateException("Expected callbacks not received");
         }
     }
 }



Mime
View raw message