KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > naming > memory > test > MemoryContextTestCase


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.naming.memory.test;
9
10 import java.util.Hashtable JavaDoc;
11 import javax.naming.Context JavaDoc;
12 import org.apache.avalon.excalibur.naming.memory.MemoryInitialContextFactory;
13 import org.apache.avalon.excalibur.naming.test.AbstractContextTestCase;
14
15 /**
16  * Unit testing for Memory system
17  *
18  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
19  * @version $Revision: 1.3 $
20  */

21 public class MemoryContextTestCase extends AbstractContextTestCase
22 {
23     private int m_id = 0;
24     private Context JavaDoc m_rootContext;
25
26     public MemoryContextTestCase( String JavaDoc name )
27     {
28         super( name );
29     }
30
31     protected void setUp()
32     {
33         try
34         {
35             final MemoryInitialContextFactory factory = new MemoryInitialContextFactory();
36             m_rootContext = factory.getInitialContext( new Hashtable JavaDoc() );
37             m_context = m_rootContext.createSubcontext( "test" + m_id++ );
38         }
39         catch (Exception JavaDoc e)
40         {}
41     }
42
43     protected void tearDown()
44     {
45         try
46         {
47             m_context.close();
48             m_context = null;
49             m_rootContext.close();
50         }
51         catch (Exception JavaDoc e)
52         {}
53     }
54 }
55
Popular Tags