01: package test;
02:
03: import dalma.Conversation;
04: import dalma.test.Launcher;
05: import dalma.test.Launcher;
06:
07: import java.io.Serializable;
08:
09: /**
10: * Tests waiting for other conversations.
11: *
12: * @author Kohsuke Kawaguchi
13: */
14: public class ConversationPortTest extends Launcher {
15: public ConversationPortTest(String[] args) throws Exception {
16: super (args);
17: }
18:
19: public static void main(String[] args) throws Exception {
20: new ConversationPortTest(args).run();
21: }
22:
23: private Conversation conv;
24:
25: protected void init() throws Exception {
26: Conversation conv1 = createConversation(ClickConversation.class);
27: conv = createConversation(WaitConversation.class, conv1);
28: }
29:
30: private void run() throws Exception {
31: conv.join();
32: System.out.println("completed");
33: System.exit(0);
34: }
35:
36: public static final class WaitConversation implements Runnable,
37: Serializable {
38: private final Conversation conv;
39:
40: public WaitConversation(Conversation conv) {
41: this .conv = conv;
42: }
43:
44: public void run() {
45: try {
46: conv.join();
47: } catch (InterruptedException e) {
48: }
49: System.out.println("joined");
50: }
51:
52: private static final long serialVersionUID = 1L;
53: }
54: }
|