summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
Diffstat (limited to 'branches')
-rw-r--r--branches/sca-java-1.5.1/samples/implementation-composite/src/main/java/composite/SourceImpl.java4
-rw-r--r--branches/sca-java-1.5.1/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java13
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");
}
}
}