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