01: package org.objectweb.celtix.bus.transports.jms;
02:
03: import java.util.Properties;
04:
05: import javax.naming.Context;
06:
07: import junit.framework.TestCase;
08:
09: import org.objectweb.celtix.transports.jms.JMSAddressPolicyType;
10: import org.objectweb.celtix.transports.jms.JMSNamingPropertyType;
11:
12: public class JMSUtilsTest extends TestCase {
13:
14: public JMSUtilsTest(String name) {
15: super (name);
16: }
17:
18: /**
19: * @param args
20: */
21: public static void main(String[] args) {
22: junit.textui.TestRunner.run(JMSUtilsTest.class);
23: }
24:
25: public void setUp() throws Exception {
26: }
27:
28: public void tearDown() throws Exception {
29: //
30: }
31:
32: // This is just a place holder for now it will be chaning in next task
33: // when the new JMS address policies and configurations are introdced.
34: public void testpopulateIncomingContextNonNull() throws Exception {
35: JMSAddressPolicyType addrType = new JMSAddressPolicyType();
36:
37: JMSNamingPropertyType prop = new JMSNamingPropertyType();
38: prop.setName(Context.APPLET);
39: prop.setValue("testValue");
40: addrType.getJMSNamingProperty().add(prop);
41:
42: prop.setName(Context.BATCHSIZE);
43: prop.setValue("12");
44: addrType.getJMSNamingProperty().add(prop);
45:
46: Properties env = new Properties();
47: assertTrue(env.size() <= 0);
48: JMSUtils.populateContextEnvironment(addrType, env);
49: assertTrue("Environment should not be empty", env.size() > 0);
50: assertTrue(
51: "Environemnt should contain NamingBatchSize property",
52: env.get(Context.BATCHSIZE) != null);
53: }
54:
55: }
|