KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > ResourceLoaderTest


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util;
11
12 import java.net.URL JavaDoc;
13
14 import junit.framework.TestCase;
15
16 /**
17  * Test the working of the ResourceLoader.
18  *
19  * <ul>
20  * <li>tests if the resource loader can run when mmbase is not started</li>
21  * </ul>
22  *
23  * @author Kees Jongenburger
24  * @verion $Id: ResourceLoaderTest.java,v 1.4 2005/06/03 07:15:33 michiel Exp $
25  */

26 public class ResourceLoaderTest extends TestCase {
27
28     /**
29      * perform lookup of non existing resource
30      */

31     public void testNonExistingResource() throws java.io.IOException JavaDoc {
32         URL JavaDoc url = ResourceLoader.getConfigurationRoot().getResource("nonExisting/test.xml");
33         assertTrue("non existing resource should not be openable for input", !url.openConnection().getDoInput());
34     }
35
36     /**
37      * perform lookup of mmbaseroot.xml using getConfigurationroot
38      */

39     public void testGetMMBaseRootModule() throws java.io.IOException JavaDoc {
40         URL JavaDoc url = ResourceLoader.getConfigurationRoot().getResource("modules/mmbaseroot.xml");
41         assertNotNull("did not find mmbaseroot.xml", url);
42         assertTrue("non existing resource should openable for input", url.openConnection().getDoInput());
43     }
44 }
Popular Tags