?? poolmantests.java
字號:
package poolman.tests;import junit.framework.Test;import junit.framework.TestCase;import junit.framework.TestSuite;import javax.naming.Context;import javax.naming.InitialContext;/** * The top level suite of JUnit test cases for PoolMan. */public class PoolManTests extends TestCase { /** Name of the test database as specified in poolman.xml. */ public static final String TEST_DB_NAME = "testdb"; /** Name the test DataSource is bound to. */ public static final String TEST_JNDI_NAME = "jndi-testdb"; /** PoolMan URL for the test database. */ public static final String TEST_DB_URL = "jdbc:poolman://" + TEST_DB_NAME; /** Description of the test database. */ public static final String TEST_DB_DESCRIPTION = "PoolMan Test Case Database"; public static void main(String args[]) throws Exception { System.getProperties().load (Thread.currentThread().getContextClassLoader() .getResourceAsStream("jndi.properties")); if (args.length > 0) { if (args[0].equals("-text")) { junit.textui.TestRunner.run(suite()); } else { System.out.println("SYNTAX: java poolman.tests.PoolManTests [-text (optional)]"); System.exit(1); } } else { junit.swingui.TestRunner.run(PoolManTests.class); } } public PoolManTests() { super("PoolMan Tests"); } public PoolManTests(String str) { super(str); } public static Test suite() { TestSuite suite = new TestSuite("PoolMan Test Suite"); suite.addTest(new PoolManTests("testNaming")); suite.addTest(poolman.tests.basic.ConnectionTests.suite()); suite.addTest(poolman.tests.util.UtilityTests.suite()); suite.addTest(poolman.tests.basic.ResultSetTests.suite()); suite.addTest(poolman.tests.basic.ResultSetTypesTests.suite()); suite.addTest(poolman.tests.basic.GenericPoolTests.suite()); suite.addTest(poolman.tests.util.SQLUtilTests.suite()); suite.addTest(poolman.tests.util.ProgPoolTests.suite()); suite.addTest(poolman.tests.basic.StringTests.suite()); suite.addTest(poolman.tests.basic.PreparedStatementPoolTests.suite()); suite.addTest(poolman.tests.basic.MultiplePoolTests.suite()); return suite; } /** Set up the test database and its tables. */ protected void setUp() { // Bind the test datasource via JNDI try { // START THE REGISTRY IF NECESSARY try { java.rmi.registry.Registry reg = java.rmi.registry.LocateRegistry.createRegistry(1099); } catch (Exception e) { } } catch (Exception e) { e.printStackTrace(); } } public static Context getNamingContext() throws Exception { return new InitialContext(); } public void testNaming() { Context ctx = null; try { ctx = getNamingContext(); } catch (Exception e) { } assert(ctx != null); try { ctx.close(); } catch (Exception e) { } } /** Remove the test tables. */ protected void tearDown() { }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -