KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > classloader > LoaderManagerImplTest


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: LoaderManagerImplTest.java 12:34:14 PM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.classloader;
23
24 import java.net.URL JavaDoc;
25 import java.util.ArrayList JavaDoc;
26 import junit.framework.TestCase;
27 import org.objectweb.petals.PetalsException;
28 import org.objectweb.petals.util.LoggingUtil;
29
30 /**
31  * Tests of the LoaderManagerImpl
32  *
33  * @author ddesjardins - eBMWebsourcing
34  */

35 public class LoaderManagerImplTest extends TestCase {
36     
37     LoaderManagerImpl loaderManagerImpl =null;
38     
39     public void setUp(){
40         loaderManagerImpl = new LoaderManagerImpl();
41         loaderManagerImpl.log = new LoggingUtil(null);
42     }
43     
44     public void testContainsClassLoader() {
45         assertFalse(loaderManagerImpl.containsClassLoader("foo"));
46     }
47
48     public void testCreateClassLoader() throws PetalsException {
49         assertNotNull(loaderManagerImpl.createClassLoader(new URL JavaDoc[0],
50             new ArrayList JavaDoc<String JavaDoc>(), true));
51     }
52
53     public void testCreateComponentClassLoader() throws PetalsException {
54         assertNotNull(loaderManagerImpl.createComponentClassLoader("foo",
55             new URL JavaDoc[0], new ArrayList JavaDoc<String JavaDoc>(), true, new ArrayList JavaDoc<String JavaDoc>()));
56     }
57
58     public void testCreateSharedLibraryClassLoader() throws PetalsException {
59         assertNotNull(loaderManagerImpl.createSharedLibraryClassLoader("foo",
60             new URL JavaDoc[0], new ArrayList JavaDoc<String JavaDoc>(), true));
61     }
62     
63     public void testDeleteClassLoader() throws PetalsException {
64         assertFalse(loaderManagerImpl.containsClassLoader("bar"));
65         loaderManagerImpl.createComponentClassLoader("bar",
66             new URL JavaDoc[0], new ArrayList JavaDoc<String JavaDoc>(), true, new ArrayList JavaDoc<String JavaDoc>());
67         assertTrue(loaderManagerImpl.containsClassLoader("bar"));
68         loaderManagerImpl.deleteClassLoader("bar");
69         assertFalse(loaderManagerImpl.containsClassLoader("bar"));
70     }
71
72 }
73
Popular Tags