diff options
author | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-03 08:43:06 +0000 |
---|---|---|
committer | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-03 08:43:06 +0000 |
commit | 6ff8d9365787776369e13aba9382e6606c28ea28 (patch) | |
tree | 593cea49c5aa86fdb02c9e8ace6ddca95882179b /branches | |
parent | 7e12e1a561d89e94a280127752c32b95a180ec62 (diff) |
Update samples/implementation-composite to verify successful completion (TUSCANY-3253)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810816 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
2 files changed, 10 insertions, 7 deletions
diff --git a/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java b/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java index b9a0c7ff74..72bf552a1e 100644 --- a/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java +++ b/branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java @@ -27,6 +27,7 @@ import org.osoa.sca.annotations.Service; @Scope("COMPOSITE") public class SourceImpl implements Source, SourceCallback { + public static int callbackCount = 0; private Target targetReference; private Target targetReference2; @@ -49,6 +50,9 @@ public class SourceImpl implements Source, SourceCallback { } public void receiveResult(String result) { + synchronized(this) { + callbackCount += 1; + } System.out.println("Work thread " + Thread.currentThread()); System.out.println("Result: " + result); } diff --git a/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java b/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java index 9e9a4b44a4..980552ac06 100644 --- a/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java +++ b/branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java @@ -39,13 +39,12 @@ public class CompositeTestCase extends TestCase { } 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"); } } } |