KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cowsultants > itracker > ejb > test > TestApplicationProperties


1 /*
2  * This software was designed and created by Jason Carroll.
3  * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4  * The author can be reached at jcarroll@cowsultants.com
5  * ITracker website: http://www.cowsultants.com
6  * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it only under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  */

18
19 package cowsultants.itracker.ejb.test;
20
21 import java.rmi.*;
22 import java.sql.*;
23 import java.util.*;
24 import javax.rmi.*;
25 import javax.sql.*;
26 import javax.naming.*;
27 import javax.ejb.CreateException JavaDoc;
28
29 import junit.framework.*;
30
31 import cowsultants.itracker.ejb.client.interfaces.*;
32
33 public class TestApplicationProperties extends TestCase {
34
35     public TestApplicationProperties(String JavaDoc name) {
36         super(name);
37     }
38
39     public void testGetProperties() {
40         try {
41             InitialContext ic = new InitialContext();
42             Object JavaDoc scRef = ic.lookup(SystemConfiguration.JNDI_NAME);
43             SystemConfigurationHome scHome = (SystemConfigurationHome) PortableRemoteObject.narrow(scRef, SystemConfigurationHome.class);
44             SystemConfiguration sc = scHome.create();
45
46             Properties props = sc.getProperties();
47             assertTrue("default_ds != java:/ITrackerDS", props.getProperty("default_ds").equals("java:/ITrackerDS"));
48
49         } catch(CreateException JavaDoc ce) {
50             fail("CreateException caught during testIDCacheLoad: " + ce.getMessage());
51         } catch(NamingException ne) {
52             fail("NamingException caught during testIDCacheLoad: " + ne.getMessage());
53         }
54     }
55
56     public static Test suite() {
57         return new TestSuite(TestApplicationProperties.class);
58     }
59 }
Popular Tags