亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? testqueryproperties.java

?? cms是開源的框架
?? JAVA
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/test/org/opencms/db/TestQueryProperties.java,v $
 * Date   : $Date: 2006/03/27 14:53:05 $
 * Version: $Revision: 1.2 $
 *
 * This library is part of OpenCms -
 * the Open Source Content Mananagement System
 *
 * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * For further information about Alkacon Software GmbH, please see the
 * company website: http://www.alkacon.com
 *
 * For further information about OpenCms, please see the
 * project website: http://www.opencms.org
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.opencms.db;

import org.opencms.test.OpenCmsTestCase;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.StringTokenizer;

import junit.framework.Test;
import junit.framework.TestSuite;

/**
 * Unit tests that checks the "query.properties" files used by the various drivers for correct
 * format.
 * <p>
 * 
 * This is no code functionality test but a configuration validation that was inspired by a 1 hour
 * debug session caused by a query.properties file with a trailing tab after the "escape linebreak"
 * backslash.
 * <p>
 * 
 * Currently the following checks are made:
 * <ul>
 * <li> <b>Invalid linebreak escape</b><br>
 * If a linebreak is escaped by a backslash there must not follow any character in that line. </li>
 * <li> <b>Invalid comment line</b><br>
 * If a comment character is found it has to be the first character of the line or
 * <ul>
 * <li> The characters before it have to be fully "trimmable" (Unicode General Category Separator,
 * Space [Zs]). </li>
 * <li> The characters before it are a valid key - value pair in properties notation. </li>
 * </ul>
 * </li>
 * </ul>
 * <p>
 * 
 * @author Achim Westermann
 * 
 * @version $Revision: 1.2 $
 */
public class TestQueryProperties extends OpenCmsTestCase {

    /**
     * Default JUnit constructor.
     * <p>
     * 
     * @param arg0 JUnit parameters
     */
    public TestQueryProperties(String arg0) {

        super(arg0);
    }

    /**
     * Test suite for this test class.
     * <p>
     * 
     * @return the test suite
     */
    public static Test suite() {

        TestSuite suite = new TestSuite();
        suite.setName(TestQueryProperties.class.getName());

        suite.addTest(new TestQueryProperties("testQueryPropertiesGeneric"));
        suite.addTest(new TestQueryProperties("testQueryPropertiesMaxdb"));
        suite.addTest(new TestQueryProperties("testQueryPropertiesMssql"));
        suite.addTest(new TestQueryProperties("testQueryPropertiesMysql"));
        suite.addTest(new TestQueryProperties("testQueryPropertiesMysql3"));
        suite.addTest(new TestQueryProperties("testQueryPropertiesOracle8"));
        suite.addTest(new TestQueryProperties("testQueryPropertiesPostgresql"));

        return suite;
    }

    /**
     * Test the generic query.properties file within the workspace for format errors.
     * <p>
     * 
     * @throws ParseException if the format of a tested query.properties file is invalid.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * 
     */
    public void testQueryPropertiesGeneric() throws IOException, ParseException {

        // generic
        File queries = new File("src/org/opencms/db/generic/query.properties");
        parseQueryProperties(queries);

    }

    /**
     * Test the maxdb query.properties file within the workspace for format errors.
     * <p>
     * 
     * @throws ParseException if the format of a tested query.properties file is invalid.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * 
     */
    public void testQueryPropertiesMaxdb() throws IOException, ParseException {

        // maxdb
        File queries = new File("src/org/opencms/db/maxdb/query.properties");
        parseQueryProperties(queries);
    }

    /**
     * Test the mssql query.properties file within the workspace for format errors.
     * <p>
     * 
     * @throws ParseException if the format of a tested query.properties file is invalid.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * 
     */
    public void testQueryPropertiesMssql() throws IOException, ParseException {

        // mssql
        File queries = new File("src/org/opencms/db/mssql/query.properties");
        parseQueryProperties(queries);

    }

    /**
     * Test the mysql query.properties file within the workspace for format errors.
     * <p>
     * 
     * @throws ParseException if the format of a tested query.properties file is invalid.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * 
     */
    public void testQueryPropertiesMysql() throws IOException, ParseException {

        // mysql
        File queries = new File("src/org/opencms/db/mysql/query.properties");
        parseQueryProperties(queries);
    }

    /**
     * Test the mysql3 query.properties file within the workspace for format errors.
     * <p>
     * 
     * @throws ParseException if the format of a tested query.properties file is invalid.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * 
     */
    public void testQueryPropertiesMysql3() throws IOException, ParseException {

        // mysql3
        File queries = new File("src/org/opencms/db/mysql3/query.properties");
        parseQueryProperties(queries);
    }

    /**
     * Test the oracle8 query.properties file within the workspace for format errors.
     * <p>
     * 
     * @throws ParseException if the format of a tested query.properties file is invalid.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * 
     */
    public void testQueryPropertiesOracle8() throws IOException, ParseException {

        // oracle8
        File queries = new File("src/org/opencms/db/oracle8/query.properties");
        parseQueryProperties(queries);

    }

    /**
     * Test the postgresql query.properties file within the workspace for format errors.
     * <p>
     * 
     * @throws ParseException if the format of a tested query.properties file is invalid.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * 
     */
    public void testQueryPropertiesPostgresql() throws IOException, ParseException {

        // postgresql
        File queries = new File("src/org/opencms/db/postgresql/query.properties");
        parseQueryProperties(queries);
    }

    /**
     * Implementation of the checks to perform.
     * 
     * @param f the query.properties file to parse.
     * 
     * @throws IOException if sth. goes wrong.
     * 
     * @throws ParseException if the format of the file was invalid.
     */
    private void parseQueryProperties(File f) throws IOException, ParseException {

        LineNumberReader reader = new LineNumberReader(new InputStreamReader(
            new FileInputStream(f),
            Charset.forName("ISO-8859-1")));
        String read;
        int len;
        int count = 0;
        int lastEscape = 0;
        while ((read = reader.readLine()) != null) {
            len = read.length();
            count++;
            lastEscape = read.lastIndexOf('\\');

            if (read.trim().length() > 0) {

                // filter comments
                int firstSharp = read.indexOf('#');
                if (firstSharp > -1) {
                    String prefix = read.substring(0, firstSharp).trim();
                    if (prefix.length() > 0) {

                        // check 1: invalid key value pair before comment char
                        try {
                            parseKeyValue(prefix);
                        } catch (ParseException pe) {

                            throw new ParseException("Bad format in file "
                                + f.getAbsolutePath()
                                + ", line "
                                + count
                                + ": "
                                + pe.getMessage(), count);
                        }
                    } else {
                        // valid comment - only line
                        continue;
                    }
                } else {
                    // no omment line
                }
            }

            // check 2: invalid attempt to escape a line break, something follows
            if (lastEscape != -1) {

                if (lastEscape != len - 1) {
                    throw new ParseException("Bad format in file "
                        + f.getAbsolutePath()
                        + ", line "
                        + count
                        + ": Line termination escape '\\' is followed by further characters.", count);
                }
            }

            // further checks if desired
        }
    }

    private void parseKeyValue(String keyValue) throws ParseException {

        StringTokenizer tokenizer = new StringTokenizer(keyValue, "=:     ", false);
        if (tokenizer.countTokens() != 2) {

            throw new ParseException("Illegal key value pair " + keyValue, 0);

        }

    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲3atv精品一区二区三区| 亚洲国产高清在线观看视频| av在线综合网| 国产盗摄视频一区二区三区| 韩国精品在线观看| 男女视频一区二区| 久久99精品久久久久婷婷| 成人免费视频播放| 国产精品香蕉一区二区三区| 国产99久久久国产精品| 国产不卡视频一区| 91丝袜高跟美女视频| 一本大道久久a久久综合| 99久久国产免费看| 欧美系列亚洲系列| 精品久久五月天| 久久久av毛片精品| 亚洲欧美偷拍另类a∨色屁股| 一区二区不卡在线视频 午夜欧美不卡在| 亚洲人成伊人成综合网小说| 亚洲成人777| 国产一区二区免费看| 不卡的电影网站| 日本韩国精品一区二区在线观看| 7878成人国产在线观看| 精品福利一区二区三区免费视频| 日本一区二区视频在线观看| 亚洲精品国产精华液| 日本在线播放一区二区三区| 国产丶欧美丶日本不卡视频| 欧美日韩激情一区| 久久久亚洲高清| 亚洲小少妇裸体bbw| 国产一区二区三区久久久| 91麻豆免费视频| 91精品久久久久久久久99蜜臂| 国产精品天干天干在观线| 亚洲国产成人va在线观看天堂| 久久99热99| 色婷婷久久久综合中文字幕| 久久一区二区三区四区| 亚洲国产精品人人做人人爽| 国精产品一区一区三区mba桃花| 成人app在线观看| 精品美女在线观看| 一区二区三区不卡在线观看| 国产美女一区二区三区| 欧美私模裸体表演在线观看| 国产免费久久精品| 奇米影视7777精品一区二区| 日本精品裸体写真集在线观看| 久久久久久久久蜜桃| 天堂一区二区在线| 91成人在线观看喷潮| 国产精品色哟哟| 国产一区二区调教| 日韩免费视频一区| 性做久久久久久免费观看| 91小视频在线免费看| 国产日韩精品一区二区三区| 久久精品噜噜噜成人88aⅴ| 欧美性生交片4| 亚洲视频电影在线| 成人精品免费网站| 国产精品私人影院| 国产盗摄女厕一区二区三区| 久久久国产综合精品女国产盗摄| 欧美96一区二区免费视频| 欧美网站大全在线观看| 亚洲精品自拍动漫在线| 91日韩在线专区| 综合分类小说区另类春色亚洲小说欧美| 国模无码大尺度一区二区三区| 欧美不卡一区二区三区四区| 捆绑紧缚一区二区三区视频| 欧美电影一区二区| 日韩av一区二| 日韩女优电影在线观看| 国内精品第一页| 国产日韩欧美精品在线| 99视频精品全部免费在线| 一区二区中文字幕在线| 色综合久久综合网| 午夜视频在线观看一区| 欧美一卡在线观看| 国产一区二区三区综合| 国产日韩欧美电影| 在线观看av不卡| 天堂蜜桃一区二区三区| 久久久久久久久一| 色综合天天天天做夜夜夜夜做| 伊人色综合久久天天人手人婷| 91久久久免费一区二区| 亚洲成人免费在线观看| 欧美成人伊人久久综合网| 国产成人丝袜美腿| 亚洲啪啪综合av一区二区三区| 欧美色综合久久| 久久精品国产精品亚洲综合| 国产精品久线在线观看| 欧美午夜精品久久久| 国产主播一区二区三区| 亚洲视频电影在线| 日韩视频在线你懂得| 成人精品视频网站| 日韩成人dvd| 中文字幕在线观看一区| 欧美美女喷水视频| 成人免费视频国产在线观看| 午夜亚洲福利老司机| 国产精品丝袜久久久久久app| 欧美色偷偷大香| 国产成人精品免费一区二区| 亚洲国产精品久久不卡毛片| 久久午夜电影网| 欧美群妇大交群的观看方式| 成人激情午夜影院| 麻豆精品在线播放| 亚洲一区在线观看网站| 久久精品亚洲一区二区三区浴池| 色国产综合视频| 免费日韩伦理电影| 一区二区三区日韩在线观看| 久久亚洲私人国产精品va媚药| 欧美色图天堂网| 99国产精品久| 国产成人综合亚洲网站| 丝袜国产日韩另类美女| 一区二区在线观看免费视频播放| 久久这里都是精品| 欧美一级午夜免费电影| 在线观看日韩国产| 99vv1com这只有精品| 国产福利不卡视频| 日本亚洲视频在线| 亚洲国产一区二区三区| 亚洲人精品一区| 国产精品福利av| 国产精品久久久久久妇女6080 | 亚洲色大成网站www久久九九| 日韩免费性生活视频播放| 欧美性大战久久久| 99精品欧美一区二区三区综合在线| 韩国女主播成人在线| 国模少妇一区二区三区| 国产一区三区三区| 国产精品资源站在线| 国产麻豆9l精品三级站| 国产精品99久久久久久有的能看| 国产一区二区免费在线| 精品一区二区三区免费播放| 青青草国产精品亚洲专区无| 日本亚洲三级在线| 久久精品av麻豆的观看方式| 久久精品国产亚洲高清剧情介绍| 免费成人美女在线观看| 久久精品国产成人一区二区三区 | 国产精品国模大尺度视频| 久久久一区二区| 中文字幕在线不卡一区二区三区| 欧美韩国一区二区| 国产精品久久久久久户外露出 | 亚洲免费av观看| 亚洲靠逼com| 亚洲一区二区四区蜜桃| 日韩精品一级二级 | 自拍偷拍亚洲欧美日韩| 亚洲欧美日韩一区二区三区在线观看| 亚洲欧美一区二区三区极速播放 | 在线播放中文一区| 日韩欧美国产综合| 国产欧美一区二区三区在线看蜜臀 | 色香蕉久久蜜桃| 在线免费观看日本欧美| 3d动漫精品啪啪| 国产亚洲精品精华液| 亚洲六月丁香色婷婷综合久久| 亚洲一区二区三区在线播放| 久久精品国产77777蜜臀| 国产91丝袜在线播放0| 色综合久久久久综合体桃花网| 欧美日韩国产a| 国产亚洲欧洲997久久综合| 中文字幕日韩av资源站| 日本大胆欧美人术艺术动态 | 91视频在线观看免费| 欧美日韩一区二区三区在线看| 日韩欧美亚洲一区二区| 国产精品网站在线| 免费精品视频最新在线| 97久久精品人人爽人人爽蜜臀| 欧美疯狂做受xxxx富婆| 欧美国产精品一区二区三区| 天天综合天天做天天综合| 国产成人综合自拍| 欧美日韩aaaaa| 国产精品久久久久久妇女6080| 免费成人在线播放| 91福利国产精品| 国产精品第一页第二页第三页|