⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 poolmantests.java

📁 Java Database connection pool
💻 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 + -