KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > EventsTest


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.bridge;
12
13 import java.util.*;
14 import org.mmbase.util.*;
15 import org.mmbase.tests.*;
16 import org.mmbase.core.event.*;
17
18 /**
19  * Testing events and bridge.
20  *
21  * @author Michiel Meeuwissen
22  * @since MMBase-1.8
23  */

24 public class EventsTest extends BridgeTest {
25
26     public EventsTest(String JavaDoc name) {
27         super(name);
28     }
29
30     public void testEvents() throws InterruptedException JavaDoc {
31
32         // register a event listener here.
33
AllEventListener listener = new AllEventListener() {
34                 List events = new ArrayList();
35                 public void notify(Event e) {
36                     events.add(e);
37                 }
38             };
39
40         Thread JavaDoc thread1 = new Thread JavaDoc() {
41                 public void run() {
42                     // cause events
43
Event event = new Event("thismachine") { };
44                     // how to send it?
45

46                     Cloud cloud = getCloud();
47                     Node node = cloud.getNodeManager("aa").createNode();
48                     node.commit();
49                     // should have caused a create event.
50

51
52                     // cause more events.
53
}
54             };
55
56         thread1.start();
57         thread1.join();
58
59         // assert if expected events are in listener
60

61     }
62
63 }
64
Popular Tags