1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.naming;
11
12 import java.util.Properties;
13
14 import javax.naming.Context;
15
16 import junit.framework.Test;
17 import junit.framework.TestSuite;
18 import nl.tudelft.simulation.naming.InitialEventContext;
19
20 /***
21 * Tests the NamingSuite.
22 * <p>
23 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
24 * University of Technology </a>, the Netherlands. <br>
25 * See for project information <a href="http://www.simulation.tudelft.nl">
26 * www.simulation.tudelft.nl </a> <br>
27 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
28 * License (GPL) </a>, no warranty <br>
29 *
30 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
31 * Jacobs </a>
32 * @version 1.4 2004-04-08
33 * @since 1.2
34 */
35 public final class NamingTestSuite
36 {
37 /***
38 * constructs a new NamingTestSuite
39 */
40 private NamingTestSuite()
41 {
42 super();
43 }
44
45 /***
46 * constructs the test suite
47 *
48 * @return Test the main DSOL Test Suite
49 */
50 public static Test suite()
51 {
52
53 TestSuite suite = new TestSuite("Naming Test Suite");
54
55 try
56 {
57 Properties properties = new Properties();
58 properties.put("java.naming.factory.initial",
59 "nl.tudelft.simulation.naming.JVMContextFactory");
60 Context context = new InitialEventContext(properties);
61 suite.addTest(new ContextTest(context));
62
63 properties.put("java.naming.factory.initial",
64 "nl.tudelft.simulation.naming.FileContextFactory");
65 properties.put("java.naming.provider.url", "file:/tmp/context.jpo");
66 context = new InitialEventContext(properties);
67 suite.addTest(new ContextTest(context));
68
69 properties.put("java.naming.factory.initial",
70 "nl.tudelft.simulation.naming.RemoteContextFactory");
71 properties.put("java.naming.provider.url",
72 "http://localhost:1099/remoteContext");
73 properties.put("wrapped.naming.factory.initial",
74 "nl.tudelft.simulation.naming.JVMContextFactory");
75 context = new InitialEventContext(properties);
76 suite.addTest(new ContextTest(context));
77 } catch (Exception exception)
78 {
79 exception = null;
80 }
81 return suite;
82 }
83 }