KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > proxool > admin > jmx > AbstractJMXTest


1 package org.logicalcobwebs.proxool.admin.jmx;
2
3 import java.util.Properties JavaDoc;
4 import java.sql.SQLException JavaDoc;
5 import java.sql.DriverManager JavaDoc;
6
7 import org.logicalcobwebs.proxool.AbstractProxoolTest;
8 import org.logicalcobwebs.proxool.TestHelper;
9 import org.logicalcobwebs.proxool.TestConstants;
10 import org.logicalcobwebs.proxool.ProxoolConstants;
11
12 /**
13  * Parent class for the JMX tests.
14  *
15  * @version $Revision: 1.1 $, $Date: 2003/10/20 07:40:44 $
16  * @author Christian Nedregaard (christian_nedregaard@email.com)
17  * @author $Author: chr32 $ (current maintainer)
18  * @since Proxool 0.8
19  */

20 public class AbstractJMXTest extends AbstractProxoolTest {
21     /**
22      * @see junit.framework.TestCase#TestCase(java.lang.String)
23      */

24     public AbstractJMXTest(String JavaDoc alias) {
25         super(alias);
26     }
27
28     /**
29      * Create a very basic Proxool pool.
30      * @param alias the alias of the pool
31      * @return the properties used to create the pool.
32      * @throws SQLException if the pool creation fails.
33      */

34     protected Properties JavaDoc createBasicPool(String JavaDoc alias) throws SQLException JavaDoc {
35         final String JavaDoc url = TestHelper.buildProxoolUrl(alias,
36             TestConstants.HYPERSONIC_DRIVER,
37             TestConstants.HYPERSONIC_TEST_URL);
38         final Properties JavaDoc info = createBasicProperties(alias);
39         DriverManager.getConnection(url, info).close();
40         return info;
41     }
42
43     /**
44      * Create some very basic Proxool configuration.
45      * @param alias the alias of the pool to be configured.
46      * @return the created properties.
47      */

48     protected Properties JavaDoc createBasicProperties(String JavaDoc alias) {
49         final Properties JavaDoc info = new Properties JavaDoc();
50         info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER);
51         info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD);
52         info.setProperty(ProxoolConstants.JMX_PROPERTY, Boolean.TRUE.toString());
53         info.setProperty(ProxoolConstants.FATAL_SQL_EXCEPTION_PROPERTY, alias);
54         return info;
55     }
56 }
57
Popular Tags