1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.jms;
12
13 import org.mule.tck.junit4.FunctionalTestCase;
14 import org.mule.transport.jms.test.TestConnectionFactory;
15
16 import javax.jms.ConnectionFactory;
17
18 import org.junit.Test;
19
20 import static org.junit.Assert.assertEquals;
21 import static org.junit.Assert.assertNotNull;
22 import static org.junit.Assert.assertTrue;
23
24 public class JmsConnectionFactoryTestCase extends FunctionalTestCase
25 {
26
27 @Override
28 protected String getConfigResources()
29 {
30 return "jms-connection-factory.xml";
31 }
32
33
34
35
36
37 @Test
38 public void testProviderPropertiesNotPassed() throws Exception
39 {
40 JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector1");
41 assertNotNull(c);
42
43 ConnectionFactory cf = c.getConnectionFactory();
44 assertTrue(cf instanceof TestConnectionFactory);
45 assertEquals("Provider properties should not be passed to the ConnectionFactory.", "NOT_SET",
46 ((TestConnectionFactory)cf).getProviderProperty());
47 }
48
49
50
51
52
53 @Test
54 public void testConnectionFactoryPropertiesPassed() throws Exception
55 {
56 JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector2");
57 assertNotNull(c);
58
59 ConnectionFactory cf = c.getConnectionFactory();
60 assertTrue(cf instanceof TestConnectionFactory);
61 assertEquals("ConnectionFactory properties should be passed to the ConnectionFactory.", "TEST_VALUE",
62 ((TestConnectionFactory)cf).getConnectionFactoryProperty());
63 }
64 }