KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > connector > BootstrapContextTest


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.connector;
19
20 import java.util.Timer JavaDoc;
21 import javax.resource.spi.XATerminator JavaDoc;
22 import javax.resource.spi.work.WorkManager JavaDoc;
23
24 import junit.framework.TestCase;
25 import org.apache.geronimo.connector.work.GeronimoWorkManager;
26 import org.apache.geronimo.pool.ThreadPool;
27 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
28
29 /**
30  * Unit tests for {@link GeronimoBootstrapContext}
31  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
32  */

33 public class BootstrapContextTest extends TestCase {
34     ThreadPool pool;
35     protected void setUp() throws Exception JavaDoc {
36         super.setUp();
37         pool = new ThreadPool(1, "Connector Test", 30000, ThreadPool.class.getClassLoader(), "foo:test=bar");
38     }
39
40     /**
41      * Tests get and set work manager
42      */

43     public void testGetSetWorkManager() throws Exception JavaDoc {
44         GeronimoTransactionManager transactionManager = new GeronimoTransactionManager();
45         GeronimoWorkManager manager = new GeronimoWorkManager(pool, pool, pool, transactionManager);
46         GeronimoBootstrapContext context = new GeronimoBootstrapContext(manager, transactionManager);
47         WorkManager JavaDoc wm = context.getWorkManager();
48
49         assertSame("Make sure it is the same object", manager, wm);
50     }
51
52     /**
53      * Tests get and set XATerminator
54      */

55     public void testGetSetXATerminator() throws Exception JavaDoc {
56         GeronimoTransactionManager transactionManager = new GeronimoTransactionManager();
57         GeronimoWorkManager manager = new GeronimoWorkManager(pool, pool, pool, transactionManager);
58         GeronimoBootstrapContext context = new GeronimoBootstrapContext(manager, transactionManager);
59         XATerminator JavaDoc xat = context.getXATerminator();
60
61         assertSame("Make sure it is the same object", transactionManager, xat);
62     }
63
64     /**
65      * Tests getTimer
66      */

67     public void testGetTimer() throws Exception JavaDoc {
68         GeronimoBootstrapContext context = new GeronimoBootstrapContext(null, null);
69         Timer JavaDoc t = context.createTimer();
70         assertNotNull("Object is not null", t);
71     }
72
73 }
74
Popular Tags