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 NO_ID = null;
19 public static final String SERVICE_1_ID = "service-1";
20 public static final String SERVICE_2_ID = "service-2";
21 public static final String CLIENT_ID = "MuleClient";
22
23 @Override
24 protected String getConfigResources()
25 {
26 return "org/mule/test/integration/notifications/endpoint-message-notification-test.xml";
27 }
28
29 @Override
30 public void doTest() throws Exception
31 {
32 final MuleClient client = new MuleClient(muleContext);
33 assertNotNull(client.send("vm://in-1?connector=direct", "hello sweet world", null));
34 client.dispatch("vm://in-2?connector=direct", "goodbye cruel world", null);
35 assertNotNull(client.request("vm://out-2?connector=queue", 5000));
36 }
37
38 @Override
39 public RestrictedNode getSpecification()
40 {
41 return new Node().parallel(
42 new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_SENT, CLIENT_ID))
43 .parallel(
44 new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_RECEIVED,
45 SERVICE_1_ID))
46 .parallel(
47 new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_RESPONSE,
48 SERVICE_1_ID))
49 .parallel(
50 new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_DISPATCHED,
51 CLIENT_ID))
52 .parallel(
53 new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_RECEIVED,
54 SERVICE_2_ID))
55 .parallel(
56 new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_DISPATCHED,
57 SERVICE_2_ID))
58 .parallel(
59 new Node(EndpointMessageNotification.class, EndpointMessageNotification.MESSAGE_REQUESTED,
60 NO_ID));
61 }
62
63 @Override
64 public void validateSpecification(RestrictedNode spec) throws Exception
65 {
66 verifyAllNotifications(spec, EndpointMessageNotification.class,
67 EndpointMessageNotification.MESSAGE_RECEIVED, EndpointMessageNotification.MESSAGE_REQUESTED);
68 }
69
70 }