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

📄 defaultpropertiestestlibrary.java

📁 第三方的SQL Server and Sybase的jdbc dirver,速度更快
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * Test the <code>prepareSql</code> property.     */    public void test_prepareSql() {        String fieldName = "prepareSql";        String messageKey = Driver.PREPARESQL;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName,                DefaultProperties.PREPARE_SQLSERVER);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName,                    DefaultProperties.PREPARE_SYBASE);        }    }    /**     * Test the <code>progName</code> property.     */    public void test_progName() {        String fieldName = "progName";        String messageKey = Driver.PROGNAME;        String expectedValue = DefaultProperties.PROG_NAME;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>sendStringParametersAsUnicode</code> property.     */    public void test_sendStringParametersAsUnicode() {        String fieldName = "sendStringParametersAsUnicode";        String messageKey = Driver.SENDSTRINGPARAMETERSASUNICODE;        String expectedValue = DefaultProperties.USE_UNICODE;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>batchSize</code> property.     */    public void test_batchSize() {        String fieldName = "batchSize";        String messageKey = Driver.BATCHSIZE;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName,                DefaultProperties.BATCH_SIZE_SQLSERVER);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName,                    DefaultProperties.BATCH_SIZE_SYBASE);        }    }    /**     * Test the <code>bufferMaxMemory</code> property.     */    public void test_bufferMaxMemory() {        String fieldName = "bufferMaxMemory";        String messageKey = Driver.BUFFERMAXMEMORY;        String expectedValue = DefaultProperties.BUFFER_MAX_MEMORY;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>bufferMinPackets</code> property.     */    public void test_bufferMinPackets() {        String fieldName = "bufferMinPackets";        String messageKey = Driver.BUFFERMINPACKETS;        String expectedValue = DefaultProperties.BUFFER_MIN_PACKETS;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>cacheMetaData</code> property.     */    public void test_cacheMetaData() {        String fieldName = "useMetadataCache";        String messageKey = Driver.CACHEMETA;        String expectedValue = DefaultProperties.CACHEMETA;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>tcpNoDelay</code> property.     */    public void test_tcpNoDelay() {        String fieldName = "tcpNoDelay";        String messageKey = Driver.TCPNODELAY;        String expectedValue = DefaultProperties.TCP_NODELAY;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>useCursors</code> property.     */    public void test_usecursors() {        String fieldName = "useCursors";        String messageKey = Driver.USECURSORS;        String expectedValue = DefaultProperties.USECURSORS;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>useLOBs</code> property.     */    public void test_useLOBs() {        String fieldName = "useLOBs";        String messageKey = Driver.USELOBS;        String expectedValue = DefaultProperties.USELOBS;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Test the <code>wsid</code> property.     */    public void test_wsid() {        String fieldName = "wsid";        String messageKey = Driver.WSID;        String expectedValue = DefaultProperties.WSID;        assertDefaultPropertyByServerType(URL_SQLSERVER, messageKey, fieldName, expectedValue);        if (!isOnlySqlServerTests()) {            assertDefaultPropertyByServerType(URL_SYBASE, messageKey, fieldName, expectedValue);        }    }    /**     * Assert that the <code>expected</code> property value is set using     * a given <code>url</code> and <code>tdsVersion</code> property.     *     * @param url The JDBC URL.     * @param tdsVersion The TDS version.     * @param key The message key.     * @param fieldName The field name used in the class.     * @param expected The expected value of the property.     */    private void assertDefaultPropertyByTdsVersion(            String url, String tdsVersion, String key, String fieldName, String expected) {        Properties properties = new Properties();        properties.setProperty(Messages.get(Driver.TDS), tdsVersion);        getTester().assertDefaultProperty("Default property incorrect", url, properties, fieldName, key, expected);    }    /**     * Assert that the <code>expected</code> property value is set using     * a given <code>url</code>.     *     * @param url The JDBC URL.     * @param key The message key.     * @param fieldName The field name used in the class.     * @param expected The expected value of the property.     */    private void assertDefaultPropertyByServerType(String url, String key, String fieldName, String expected) {        getTester().assertDefaultProperty("Default property incorrect", url, new Properties(), fieldName, key, expected);    }    /**     * Getter for {@link #tester}.     *     * @return Value of {@link #tester}.     */    protected DefaultPropertiesTester getTester() {        return tester;    }    /**     * Setter for {@link #tester}.     *     * @param tester The value to set {@link #tester} to.     */    public void setTester(DefaultPropertiesTester tester) {        this.tester = tester;    }    /**     * Getter for {@link #onlySqlServerTests}.     *     * @return Value of {@link #onlySqlServerTests}.     */    public boolean isOnlySqlServerTests() {        return onlySqlServerTests;    }    /**     * Setter for {@link #onlySqlServerTests}.     *     * @param onlySqlServerTests The value to set {@link #onlySqlServerTests} to.     */    protected void setOnlySqlServerTests(boolean onlySqlServerTests) {        this.onlySqlServerTests = onlySqlServerTests;    }    /**     * Getter for {@link #onlyTds70Tests}.     *     * @return Value of {@link #onlyTds70Tests}.     */    public boolean isOnlyTds70Tests() {        return onlyTds70Tests;    }    /**     * Setter for {@link #onlyTds70Tests}.     *     * @param onlyTds70Tests The value to set {@link #onlyTds70Tests} to.     */    protected void setOnlyTds70Tests(boolean onlyTds70Tests) {        this.onlyTds70Tests = onlyTds70Tests;    }    /**     * Changes the first character of a string to uppercase.     *     * @param s The string to be processed.     * @return The value of <code>s</code> if it is <code>null</code> or zero length,     *         else the string with the first character changed to uppercase.     */    protected String ucFirst(String s) {        if (s == null || s.length() == 0) return s;        if (s.length() == 1) {            return s.toUpperCase();        }        return s.substring(0, 1).toUpperCase() + s.substring(1);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -