1
2
3
4
5
6
7
8
9
10
11 package org.mule.context.notification;
12
13 import org.mule.module.client.MuleClient;
14
15 public class EndpointMessageNotificationTestCase extends AbstractNotificationTestCase
16 {
17
18 public static final String SERVICE_1 = "service-1";
19 public static final String SERVICE_2 = "service-2";
20 public static final String CLIENT = null;
21
22 protected String getConfigResources()
23 {
24 return "org/mule/test/integration/notifications/endpoint-message-notification-test.xml";
25 }
26
27 public void doTest() throws Exception
28 {
29 MuleClient client = new MuleClient();
30 assertNotNull(client.send("vm://in-1?connector=direct", "hello sweet world", null));
31 client.dispatch("vm://in-2?connector=direct", "goodbye cruel world", null);
32 assertNotNull(client.request("vm://out-2?connector=queue", 5000));
33 }
34
35 public RestrictedNode getSpecification()
36 {
37 return new Node()
38 .parallel(new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_SENT, CLIENT))
39 .parallel(new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_RECEIVED, SERVICE_1))
40 .parallel(new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_DISPATCHED, CLIENT))
41 .parallel(new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_RECEIVED, SERVICE_2))
42 .parallel(new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_DISPATCHED, SERVICE_2))
43 .parallel(new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_REQUESTED, CLIENT));
44 }
45
46 public void validateSpecification(RestrictedNode spec) throws Exception
47 {
48 verifyAllNotifications(spec, EndpointMessageNotification.class,
49 EndpointMessageNotification.MESSAGE_RECEIVED, EndpointMessageNotification.MESSAGE_REQUESTED);
50 }
51
52 }