%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.components.util.DatasourceTestCase |
|
|
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 | package org.apache.jetspeed.components.util; |
|
18 | ||
19 | import junit.framework.TestCase; |
|
20 | ||
21 | import org.apache.commons.pool.impl.GenericObjectPool; |
|
22 | import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent; |
|
23 | import org.apache.jetspeed.components.jndi.JNDIComponent; |
|
24 | import org.apache.jetspeed.components.jndi.TyrexJNDIComponent; |
|
25 | ||
26 | /** |
|
27 | * @author <a href="mailto:sweaver@einnovation.com">Scott T. Weaver </a> |
|
28 | * |
|
29 | */ |
|
30 | public class DatasourceTestCase extends TestCase |
|
31 | { |
|
32 | ||
33 | protected BoundDBCPDatasourceComponent datasourceComponent; |
|
34 | ||
35 | protected JNDIComponent jndi; |
|
36 | ||
37 | /** |
|
38 | * |
|
39 | */ |
|
40 | public DatasourceTestCase() |
|
41 | { |
|
42 | 0 | super(); |
43 | // TODO Auto-generated constructor stub |
|
44 | 0 | } |
45 | ||
46 | /** |
|
47 | * @param arg0 |
|
48 | */ |
|
49 | public DatasourceTestCase(String arg0) |
|
50 | { |
|
51 | 0 | super(arg0); |
52 | // TODO Auto-generated constructor stub |
|
53 | 0 | } |
54 | ||
55 | /** |
|
56 | * @see junit.framework.TestCase#setUp() |
|
57 | */ |
|
58 | protected void setUp() throws Exception |
|
59 | { |
|
60 | 0 | super.setUp(); |
61 | 0 | jndi = new TyrexJNDIComponent(); |
62 | 0 | String url = System.getProperty("org.apache.jetspeed.database.url"); |
63 | 0 | String driver = System.getProperty("org.apache.jetspeed.database.driver"); |
64 | 0 | String user = System.getProperty("org.apache.jetspeed.database.user"); |
65 | 0 | String password = System.getProperty("org.apache.jetspeed.database.password"); |
66 | 0 | datasourceComponent = new BoundDBCPDatasourceComponent(user, password, driver, url, 20, 5000, |
67 | GenericObjectPool.WHEN_EXHAUSTED_GROW, true, "jetspeed", jndi); |
|
68 | 0 | datasourceComponent.start(); |
69 | ||
70 | 0 | } |
71 | ||
72 | /** |
|
73 | * @see junit.framework.TestCase#tearDown() |
|
74 | */ |
|
75 | protected void tearDown() throws Exception |
|
76 | { |
|
77 | 0 | datasourceComponent.stop(); |
78 | 0 | jndi.unbindFromCurrentThread(); |
79 | 0 | super.tearDown(); |
80 | 0 | } |
81 | ||
82 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |