1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.jms.integration;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.client.MuleClient;
15
16 import org.junit.Test;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertNotNull;
20 import static org.junit.Assert.assertNull;
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 public class JmsConnectorJndiTestCase extends AbstractJmsFunctionalTestCase
40 {
41
42 @Override
43 protected String getConfigResources()
44 {
45 return "integration/jms-jndi-config.xml";
46 }
47
48 @Test
49 public void testConnectionFactoryFromJndi() throws Exception
50 {
51
52
53 }
54
55 @Test
56 public void testQueueFromJndi() throws Exception
57 {
58 MuleClient client = new MuleClient(muleContext);
59
60 client.dispatch("ep_jndi-queue", DEFAULT_INPUT_MESSAGE, null);
61
62 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
63 assertNotNull(result);
64 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
65 }
66
67 @Test
68 public void testTopicFromJndi() throws Exception
69 {
70 MuleClient client = new MuleClient(muleContext);
71
72 client.dispatch("ep_jndi-topic", DEFAULT_INPUT_MESSAGE, null);
73
74 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
75 assertNotNull(result);
76 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
77 }
78
79
80
81
82 @Test
83 public void testNonJndiDestination() throws Exception
84 {
85 MuleClient client = new MuleClient(muleContext);
86
87 client.dispatch("ep_non-jndi-queue", DEFAULT_INPUT_MESSAGE, null);
88
89 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
90 assertNotNull(result);
91 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
92 }
93
94
95
96
97 @Test
98 public void testNonJndiDestinationOptional() throws Exception
99 {
100 MuleClient client = new MuleClient(muleContext);
101
102 client.dispatch("ep_non-jndi-queue-optional-jndi", DEFAULT_INPUT_MESSAGE, null);
103
104 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
105 assertNotNull(result);
106 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
107 }
108
109
110
111
112 @Test
113 public void testNonJndiDestinationForce() throws Exception
114 {
115 MuleClient client = new MuleClient(muleContext);
116
117 client.dispatch("ep_non-jndi-queue-force-jndi", DEFAULT_INPUT_MESSAGE, null);
118
119 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
120 assertNull("Attempt to look up a non-existant JNDI Destination should have failed", result);
121 }
122
123 @Test
124 public void testQueueFromJndiWithJndiNameResolver() throws Exception
125 {
126 MuleClient client = new MuleClient(muleContext);
127
128 client.dispatch("ep_jndi-queue-with-jndi-name-resolver", DEFAULT_INPUT_MESSAGE, null);
129
130 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
131 assertNotNull(result);
132 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
133 }
134
135 @Test
136 public void testTopicFromJndiWithJndiNameResolver() throws Exception
137 {
138 MuleClient client = new MuleClient(muleContext);
139
140 client.dispatch("ep_jndi-topic-with-jndi-name-resolver", DEFAULT_INPUT_MESSAGE, null);
141
142 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
143 assertNotNull(result);
144 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
145 }
146
147
148
149
150 @Test
151 public void testNonJndiDestinationWithJndiNameResolver() throws Exception
152 {
153 MuleClient client = new MuleClient(muleContext);
154
155 client.dispatch("ep_non-jndi-queue-with-jndi-name-resolver", DEFAULT_INPUT_MESSAGE, null);
156
157 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
158 assertNotNull(result);
159 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
160 }
161
162
163
164
165 @Test
166 public void testNonJndiDestinationOptionalWithJndiNameResolver() throws Exception
167 {
168 MuleClient client = new MuleClient(muleContext);
169
170 client.dispatch("ep_non-jndi-queue-optional-jndi-with-jndi-name-resolver", DEFAULT_INPUT_MESSAGE, null);
171
172 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
173 assertNotNull(result);
174 assertEquals(DEFAULT_INPUT_MESSAGE, result.getPayloadAsString());
175 }
176
177
178
179
180 @Test
181 public void testNonJndiDestinationForceWithJndiNameResolver() throws Exception
182 {
183 MuleClient client = new MuleClient(muleContext);
184
185 client.dispatch("ep_non-jndi-queue-force-jndi-with-jndi-name-resolver", DEFAULT_INPUT_MESSAGE, null);
186
187 MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
188 assertNull("Attempt to look up a non-existant JNDI Destination should have failed", result);
189 }
190 }