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

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

?? testmoduledeletethread.java

?? cms是開源的框架
?? JAVA
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/test/org/opencms/module/TestModuleDeleteThread.java,v $
 * Date   : $Date: 2005/07/28 15:53:10 $
 * Version: $Revision: 1.5 $
 *
 * 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.module;

import org.opencms.file.CmsObject;
import org.opencms.main.OpenCms;
import org.opencms.report.CmsShellReport;
import org.opencms.test.OpenCmsTestCase;
import org.opencms.test.OpenCmsTestLogAppender;
import org.opencms.test.OpenCmsTestProperties;
import org.opencms.workplace.threads.CmsModuleDeleteThread;

import java.util.ArrayList;
import java.util.List;

import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;

/**
 * Tests the deleting of modules using the module delete thread, 
 * comparing this to the deletion using the module manager alone.<p>
 * 
 * @author Olaf Watteroth
 * @author Alexander Kandzior 
 * 
 * @version $Revision: 1.5 $
 */
public class TestModuleDeleteThread extends OpenCmsTestCase {

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

        super(arg0);
    }

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

        OpenCmsTestProperties.initialize(org.opencms.test.AllTests.TEST_PROPERTIES_PATH);

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

        // test to delete a module without resources with a single and with two threads
        suite.addTest(new TestModuleDeleteThread("testModuleDeleteThread"));
        // test to delete a module with non-existing resources using the module delete thread
        suite.addTest(new TestModuleDeleteThread("testModuleResourcesDeleteThread"));
        // test to delete a module with non-existing resources using the CmsModuleManager - to compare with above
        suite.addTest(new TestModuleDeleteThread("testModuleResourcesDelete"));

        TestSetup wrapper = new TestSetup(suite) {

            protected void setUp() {

                setupOpenCms("simpletest", "/sites/default/");
                // this test causes issues that are written to the error log channel
                OpenCmsTestLogAppender.setBreakOnError(false);
            }

            protected void tearDown() {

                removeOpenCms();
            }
        };

        return wrapper;
    }

    /**
     * Test to delete a module without resources with a single and with two threads.<p>
     *
     * @throws Exception in case the test fails
     */
    public void testModuleDeleteThread() throws Exception {

        echo("Testing to delete a module without resources using the module delete thread.");
        // get a reference to the CmsObject
        CmsObject cms = getCmsObject();

        // list for the module - used later
        List moduleDeleteList;

        // create a new blank module
        String moduleName = "org.opencms.test.testModuleDeleteThread";
        CmsModule module1 = new CmsModule(
            moduleName,
            "Testing to delete a single module using the module delete thread/1",
            "ModuleGroup",
            null,
            null,
            new CmsModuleVersion("1.0"),
            "Olaf Watteroth",
            "watterot@inf.fu-berlin.de",
            System.currentTimeMillis(),
            null,
            0L,
            null,
            null,
            null,
            null);

        OpenCms.getModuleManager().addModule(cms, module1);
        //      basic check if the module was created correctly
        if (!OpenCms.getModuleManager().hasModule(moduleName)) {
            fail("Module '" + moduleName + "' was not created!");
        }

        // create two CmsModuleDeleteThread's for testing
        moduleDeleteList = new ArrayList();
        moduleDeleteList.add(moduleName);
        // create a single Thread to delete the module
        CmsModuleDeleteThread thread1 = new CmsModuleDeleteThread(cms, moduleDeleteList, false, false);

        // start the threads
        thread1.start();
        // wait till the thread finish
        thread1.join();

        while (thread1.isAlive()) {
            // check if thread1 is still running and wait to finish
        }
        // try to get the deleted module
        CmsModule temp = OpenCms.getModuleManager().getModule(moduleName);
        // test if the module is null - it should be 'cause it was deleted
        echo("Test if the module still exists");
        assertNull(temp);

        CmsModule module2 = new CmsModule(
            moduleName,
            "Testing to delete a single module using the module delete thread/2",
            "ModuleGroup",
            null,
            null,
            new CmsModuleVersion("1.0"),
            "Olaf Watteroth",
            "watterot@inf.fu-berlin.de",
            System.currentTimeMillis(),
            null,
            0L,
            null,
            null,
            null,
            null);

        OpenCms.getModuleManager().addModule(cms, module2);

        // Create two CmsModuleDeleteThread's for testing
        moduleDeleteList = new ArrayList();
        moduleDeleteList.add(moduleName);
        echo("Created a new module again and try to delete it - this time with two threads at once");
        CmsModuleDeleteThread thread_parallel_1 = new CmsModuleDeleteThread(cms, moduleDeleteList, false, false);
        CmsModuleDeleteThread thread_parallel_2 = new CmsModuleDeleteThread(cms, moduleDeleteList, false, false);

        // start the threads
        thread_parallel_1.start();
        thread_parallel_2.start();

        // wait 'till all threads finish
        thread_parallel_1.join();
        thread_parallel_2.join();

        while (thread_parallel_1.isAlive() & thread_parallel_2.isAlive()) {
            // check if all threads finished
            Thread.sleep(1000);
        }

        // try to get the deleted module
        module1 = OpenCms.getModuleManager().getModule(moduleName);
        // test if the module is null - it should be 'cause it was deleted
        echo("Exceptions will be logged - but the module should be deleted correctly");
        assertNull(module1);
    }

    /**
     * Test to delete a module with non-existing resources using the module delete thread.<p>
     * 
     * @throws Exception in case the test fails
     */
    public void testModuleResourcesDeleteThread() throws Exception {

        echo("Test to delete a module with non-existing resources using the module delete thread");

        CmsObject cms = getCmsObject();
        String moduleName = "org.opencms.test.testModuleResourcesDeleteThread";

        String res1 = "/system/modules/tests/test1/";
        String res2 = "/system/modules/tests/test2/";
        String res3 = "/system/modules/tests/test3/";
        String res4 = "/system/modules/tests/test4/";

        List resources = new ArrayList();
        resources.add(res1);
        resources.add(res2);
        resources.add(res3);
        resources.add(res4);

        CmsModule module1 = new CmsModule(
            moduleName,
            "Test to delete a module with non-existing resources using the module delete thread",
            "ModuleGroup",
            null,
            null,
            new CmsModuleVersion("1.0"),
            "Olaf Watteroth",
            "watterot@inf.fu-berlin.de",
            System.currentTimeMillis(),
            null,
            0L,
            null,
            null,
            resources,
            null);

        OpenCms.getModuleManager().addModule(cms, module1);
        module1 = OpenCms.getModuleManager().getModule(moduleName);

        assertEquals(0, module1.getParameters().size());
        assertEquals(4, module1.getResources().size());

        // Now its new code
        echo("Module created. Now try to delete it");
        // Now try to delete this module after it was added
        // Create a CmsModuleDeleteThread's for testing
        List module = new ArrayList();
        module.add(moduleName);

        // Create a single Thread to delete the module
        CmsModuleDeleteThread thread1 = new CmsModuleDeleteThread(cms, module, false, false);

        // Start the threads
        thread1.start();

        // Wait till the thread finish
        thread1.join();

        while (thread1.isAlive()) {
            // Check if thread1 is still running and wait to finish
            Thread.sleep(1000);
        }

        // try to get the deleted module
        module1 = OpenCms.getModuleManager().getModule(moduleName);
        // test if the module is null - it should be 'cause it was deleted
        echo("Test if the module still exists");
        assertNull(module1);
    }

    /**
     * Test to delete a module with non-existing resources using the CmsModuleManager.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testModuleResourcesDelete() throws Throwable {

        echo("Test to delete a module with non-existing resources using the CmsModuleManager");

        CmsObject cms = getCmsObject();
        String moduleName = "org.opencms.test.testModuleResourcesDelete";

        String res1 = "/system/modules/tests/test1/";
        String res2 = "/system/modules/tests/test2/";
        String res3 = "/system/modules/tests/test3/";
        String res4 = "/system/modules/tests/test4/";

        List resources = new ArrayList();
        resources.add(res1);
        resources.add(res2);
        resources.add(res3);
        resources.add(res4);

        CmsModule module1 = new CmsModule(
            moduleName,
            "Test to delete a module with non-existing resources using the CmsModuleManager",
            "ModuleGroup",
            null,
            null,
            new CmsModuleVersion("1.0"),
            "Olaf Watteroth",
            "watterot@inf.fu-berlin.de",
            System.currentTimeMillis(),
            null,
            0L,
            null,
            null,
            resources,
            null);

        OpenCms.getModuleManager().addModule(cms, module1);
        module1 = OpenCms.getModuleManager().getModule(moduleName);

        assertEquals(4, module1.getResources().size());

        echo("Now try to delete it *the normal way*");
        OpenCms.getModuleManager().deleteModule(cms, moduleName, false, new CmsShellReport(cms.getRequestContext().getLocale()));

        module1 = OpenCms.getModuleManager().getModule(moduleName);
        // now it should be null
        echo("Now check if module was deleted");
        assertNull(module1);
        echo("Test finished");
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品国产麻豆婷婷洗澡| 91精品欧美一区二区三区综合在 | 美国毛片一区二区| 欧美一级夜夜爽| 国产麻豆精品95视频| 欧美国产成人精品| av爱爱亚洲一区| 亚洲中国最大av网站| 欧美日韩一区二区在线视频| 日本中文字幕一区二区有限公司| 精品国产a毛片| 色综合久久综合| 日韩av二区在线播放| 久久精品国产成人一区二区三区 | 亚洲欧洲制服丝袜| 日韩欧美卡一卡二| 91丝袜国产在线播放| 免费观看在线色综合| 亚洲女人****多毛耸耸8| 有码一区二区三区| 国产精品麻豆久久久| 91精品国产综合久久久久久漫画| 欧美一区国产二区| 国产色爱av资源综合区| 欧美精品久久一区二区三区| www.成人网.com| 欧美网站一区二区| 91在线国产福利| 懂色av一区二区三区蜜臀| 日韩成人精品在线观看| 国内精品久久久久影院薰衣草 | 亚洲欧美日韩一区二区| 亚洲资源在线观看| 狠狠色丁香久久婷婷综| 91麻豆精品在线观看| 欧美一区二区美女| 亚洲丝袜另类动漫二区| 国产精品美女一区二区三区| 一区二区不卡在线播放 | 国产一区二区影院| 欧日韩精品视频| 欧美性猛交xxxx黑人交| 久久精品夜夜夜夜久久| 午夜激情综合网| 亚洲综合无码一区二区| 国产精品一区二区在线观看网站| 国模娜娜一区二区三区| 色94色欧美sute亚洲线路一久 | 久久久久国产精品麻豆| 日本一区二区三区视频视频| 欧美国产日产图区| 精品在线一区二区| 欧美日韩成人高清| 精品国产91洋老外米糕| 亚洲日本中文字幕区| 国产成人高清在线| 成人激情午夜影院| 91成人免费电影| 国产精品久久影院| 亚洲成年人网站在线观看| 日本在线播放一区二区三区| 色噜噜狠狠一区二区三区果冻| 中文字幕av一区 二区| 黄一区二区三区| 日韩一卡二卡三卡四卡| 久久久蜜臀国产一区二区| 蜜桃av一区二区三区| 欧美丰满一区二区免费视频 | 国产麻豆成人传媒免费观看| 日韩小视频在线观看专区| 亚洲va天堂va国产va久| 在线观看免费一区| 亚洲国产成人精品视频| 国产在线精品一区在线观看麻豆| 日韩一区二区在线播放| 日本欧美韩国一区三区| 精品欧美一区二区久久| 亚洲啪啪综合av一区二区三区| 成人在线综合网| 91麻豆精品国产自产在线| 午夜精品福利久久久| 日韩欧美不卡在线观看视频| 精品中文字幕一区二区小辣椒| 精品三级在线看| 国产成人精品亚洲777人妖| 国产欧美一区二区三区网站| 国产成人免费9x9x人网站视频| 欧美国产日产图区| 在线精品视频小说1| 五月激情综合网| 久久综合九色综合97婷婷女人 | **欧美大码日韩| 日本不卡免费在线视频| 日韩一区二区三区在线观看| 蜜臀av亚洲一区中文字幕| 久久人人爽爽爽人久久久| 色综合色狠狠天天综合色| 丝袜美腿亚洲一区| 欧美三级电影在线观看| 蜜芽一区二区三区| 最新久久zyz资源站| 欧美性猛交xxxxxxxx| 国产真实乱子伦精品视频| 亚洲日本免费电影| 欧美一区欧美二区| 91在线视频播放地址| 亚洲va欧美va国产va天堂影院| 日韩精品一区二区在线| 色综合久久久久久久| 日本视频一区二区三区| 国产精品亲子乱子伦xxxx裸| 欧美三级电影精品| 粗大黑人巨茎大战欧美成人| 亚洲v日本v欧美v久久精品| 国产偷v国产偷v亚洲高清| 欧美年轻男男videosbes| 国产一区二区精品久久91| 樱桃国产成人精品视频| 欧美精品一区二区久久久| 日本乱人伦aⅴ精品| 高清免费成人av| 精品一区二区影视| 亚洲午夜久久久| 最新日韩av在线| 亚洲国产高清在线观看视频| 欧美一区二区日韩| 日本高清不卡视频| 成人av网址在线| 狠狠色丁香久久婷婷综| 首页国产欧美久久| 亚洲成人一区二区在线观看| 日韩理论在线观看| 国产精品视频一二三| 精品国产在天天线2019| 91精品国模一区二区三区| 日本道色综合久久| 91九色最新地址| eeuss鲁片一区二区三区| 国产精品一区二区久久精品爱涩| 秋霞影院一区二区| 亚洲成人动漫一区| 亚洲高清中文字幕| 一区二区三区四区不卡视频| 亚洲色图一区二区| 亚洲欧美日韩久久| 自拍偷拍欧美精品| 亚洲人吸女人奶水| 亚洲天堂av一区| 亚洲最新在线观看| 亚洲资源中文字幕| 偷拍一区二区三区| 久久精品国产在热久久| 美女视频黄 久久| 韩国一区二区三区| 国产盗摄视频一区二区三区| 国产a区久久久| www.在线欧美| 欧美探花视频资源| 日韩欧美你懂的| 2014亚洲片线观看视频免费| 国产欧美视频在线观看| 久久久久亚洲综合| 国产精品久久久久9999吃药| 中文字幕日韩精品一区 | 欧美日韩在线播放三区四区| 欧美性极品少妇| 日韩午夜精品视频| 中文字幕乱码日本亚洲一区二区| 国产欧美一区二区三区鸳鸯浴| 国产精品久久久久久久久免费桃花 | 亚洲精选免费视频| 婷婷夜色潮精品综合在线| 麻豆一区二区三区| 成人免费毛片app| 欧美综合在线视频| 欧美xxxxx裸体时装秀| 国产精品欧美一区二区三区| 亚洲成人av资源| 国产高清不卡一区| 欧美怡红院视频| 久久久久久久久久久久电影| 亚洲图片另类小说| 精品亚洲国内自在自线福利| 成人午夜激情视频| 欧美日本韩国一区| 国产日韩欧美综合一区| 亚洲精品精品亚洲| 国产综合久久久久久久久久久久| av资源站一区| 欧美www视频| 一区二区三区鲁丝不卡| 国产一区二区福利| 欧美性色欧美a在线播放| 久久久99精品久久| 三级成人在线视频| 91看片淫黄大片一级在线观看| 精品少妇一区二区三区视频免付费 | 奇米影视在线99精品| 97国产一区二区| 国产日本一区二区|