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

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

?? testpublishissues.java

?? cms是開源的框架
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/test/org/opencms/file/TestPublishIssues.java,v $
 * Date   : $Date: 2006/03/27 14:52:46 $
 * Version: $Revision: 1.21 $
 *
 * 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.file;

import org.opencms.db.CmsPublishList;
import org.opencms.file.types.CmsResourceTypeFolder;
import org.opencms.file.types.CmsResourceTypePlain;
import org.opencms.lock.CmsLock;
import org.opencms.main.CmsException;
import org.opencms.main.OpenCms;
import org.opencms.report.CmsShellReport;
import org.opencms.test.OpenCmsTestCase;
import org.opencms.test.OpenCmsTestProperties;
import org.opencms.util.CmsUUID;

import java.util.Collections;
import java.util.List;

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

/**
 * Unit tests for special publish issues.<p>
 * 
 * @author Alexander Kandzior 
 * 
 * @version $Revision: 1.21 $
 */
/**
 * Comment for <code>TestPermissions</code>.<p>
 */
public class TestPublishIssues extends OpenCmsTestCase {
  
    /**
     * Default JUnit constructor.<p>
     * 
     * @param arg0 JUnit parameters
     */    
    public TestPublishIssues(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(TestPublishIssues.class.getName());
                
        suite.addTest(new TestPublishIssues("testPublishScenarioA"));
        suite.addTest(new TestPublishIssues("testPublishScenarioB"));
        suite.addTest(new TestPublishIssues("testPublishScenarioC"));        
        suite.addTest(new TestPublishIssues("testMultipleProjectCreation"));
        suite.addTest(new TestPublishIssues("testDirectPublishWithSiblings"));
        suite.addTest(new TestPublishIssues("testPublishScenarioD"));        
        suite.addTest(new TestPublishIssues("testPublishScenarioE"));        
        
        TestSetup wrapper = new TestSetup(suite) {
            
            protected void setUp() {
                setupOpenCms("simpletest", "/sites/default/");
            }
            
            protected void tearDown() {
                removeOpenCms();
            }
        };
        
        return wrapper;
    }
 
    /**
     * Tests publish scenario "A".<p>
     * 
     * This scenario is described as follows:
     * We have users "test1" and "test2".
     * We have two projects, "project1" and "project2".
     * Project "project1" consists of the folder "/".
     * Project "project2" consists of the folder "/folder1/subfolder11/".
     * User "test2" edits the file "/folder1/subfolder11/index.html".
     * After this, user "test1" locks the folder "/folder1" in "project1", and unlocks it again.
     * User "test2" logs in and now publishes "project2".<p>
     * 
     * Wanted result: the changed resource "/folder1/subfolder11/index.html" is published 
     * with "project2".<p> 
     * 
     * The test illustrates a change in the logic from OpenCms 5 to OpenCms 6:
     * In OpenCms 5, locking a file caused it to switch to the current users project.
     * In OpenCms 6, this is no longer true, at last not if you just lock a parent folder.
     * So in OpenCms 5, this test would fail, since the resource would be in "project1", not "project2".<p> 
     * 
     * @throws Throwable if something goes wrong
     */
    public void testPublishScenarioA() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing publish scenario A");
        String projectRes1 = "/folder1/subfolder11/";
        String resource1 = projectRes1 + "index.html";
        String resource2 = "/folder1/";
        long timestamp = System.currentTimeMillis();
                
        // we use the default "Offline" project as "project1"
        CmsProject project1 = cms.readProject("Offline");
        
        // create "project2" as Admin user       
        cms.createProject(
            "project2", 
            "Test project 2 for scenario A", 
            OpenCms.getDefaultUsers().getGroupUsers(), 
            OpenCms.getDefaultUsers().getGroupUsers());

        CmsProject project2 = cms.readProject("project2");
        cms.getRequestContext().setCurrentProject(project2);
        cms.copyResourceToProject(projectRes1);
        
        // check if the project was created as planned
        List resources = cms.readProjectResources(project2);
        assertEquals(1, resources.size());
        assertEquals("/sites/default" + projectRes1, (String)resources.get(0));
        
        // login as user "test2"
        cms.loginUser("test2", "test2");
        cms.getRequestContext().setCurrentProject(project2);        
                
        // perform some edit on the file
        cms.lockResource(resource1);
        cms.setDateLastModified(resource1, System.currentTimeMillis(), false);
        
        // assert some basic status info
        assertDateLastModifiedAfter(cms, resource1, timestamp);
        assertProject(cms, resource1, project2);
        assertLock(cms, resource1, CmsLock.TYPE_EXCLUSIVE);
        assertState(cms, resource1, CmsResource.STATE_CHANGED);
        
        // now login as user "test1" (default will be in the "Offline" project)
        cms.loginUser("test1", "test1");
        cms.getRequestContext().setCurrentProject(project1);     
        
        // lock the folder
        cms.lockResource(resource2);
        
        // assert some basic status info
        assertProject(cms, resource1, project2);
        assertLock(cms, resource1, CmsLock.TYPE_INHERITED);        
        
        // now unlock the folder again
        cms.unlockResource(resource2);
        
        // back to the user "test2"
        cms.loginUser("test2", "test2");
        cms.getRequestContext().setCurrentProject(project2);            

        // get the publish list
        CmsPublishList publishList = cms.getPublishList();
        assertEquals(1, publishList.getFileList().size());
        
        // project should have no locked resources 
        int resourceProjectCount = cms.countLockedResources(project2.getId());    
        assertEquals(0, resourceProjectCount);
        
        // unlock the project
        cms.publishProject();
        
        // ensure the file was published - state must be "unchanged" 
        assertState(cms, resource1, CmsResource.STATE_UNCHANGED);
    }
    
    /**
     * Tests publish scenario "B".<p>
     * 
     * This scenario is described as follows:
     * We have users "test1" and "test2" and projects "projectA" and "projectB".
     * Both projects contain all resources.
     * We have two folders "/foldera/" and "/folderb/".
     * There is a resource "test.txt" that has a sibling in both folders. 
     * User "test1" locks folder "/foldera/" and user "test2" locks folder "/folderb".
     * Now both users try to edit the sibling of "test.txt" in their folder.
     * 
     * TODO: How are concurrent file modifications avoided on the sibling?.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testPublishScenarioB() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing publish scenario B");
        
        // set up the test case first
        String folderA = "/foldera/";
        String folderB = "/folderb/";
        String resourceA = folderA + "test.txt";
        String resourceB = folderB + "test.txt";
        
        // create the resource and the sibling
        cms.createResource(folderA, CmsResourceTypeFolder.getStaticTypeId());
        cms.createResource(folderB, CmsResourceTypeFolder.getStaticTypeId());
        cms.createResource(resourceA, CmsResourceTypePlain.getStaticTypeId());
        cms.createSibling(resourceA, resourceB, Collections.EMPTY_LIST);
        CmsFile cmsFile = cms.readFile(resourceA);
        cmsFile.setContents("Hello, this is a test!".getBytes());
        cms.writeFile(cmsFile);
        
        // now publish the project
        cms.unlockProject(cms.getRequestContext().currentProject().getId());
        cms.publishProject();
        
        // check if the setup was created as planned
        cmsFile = cms.readFile(resourceA);
        assertEquals(2, cmsFile.getSiblingCount());
        assertState(cms, resourceA, CmsResource.STATE_UNCHANGED);
        cmsFile = cms.readFile(resourceB);
        assertEquals(2, cmsFile.getSiblingCount());        
        assertState(cms, resourceB, CmsResource.STATE_UNCHANGED);
        
        // we use the default "Offline" project as "projectA"
//        CmsProject projectA = cms.readProject("Offline");        
        
        // create "projectB" as Admin user       
        cms.createProject(
            "projectB", 
            "Test project 2 for scenario B", 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影在线播放| 成人动漫一区二区| 亚洲欧美色综合| 国产蜜臀av在线一区二区三区| 日韩精品一区二区三区在线| 宅男在线国产精品| 精品动漫一区二区三区在线观看| 亚洲主播在线观看| 一区视频在线播放| 亚洲特黄一级片| 亚洲另类在线一区| 亚洲少妇最新在线视频| 亚洲午夜精品网| 日韩国产精品91| 国产麻豆精品95视频| 成人福利电影精品一区二区在线观看| 粉嫩aⅴ一区二区三区四区| 免费成人av在线播放| 免费观看30秒视频久久| 国产一区二区三区电影在线观看| 国产精品一区二区三区乱码| 99在线热播精品免费| 欧美日韩午夜影院| 337p日本欧洲亚洲大胆色噜噜| 国产亚洲欧美一区在线观看| 日韩一区在线看| 丝袜亚洲另类欧美| 国产suv精品一区二区6| 91麻豆国产在线观看| 日韩视频一区二区三区在线播放| 国产色91在线| 首页综合国产亚洲丝袜| 成人网在线播放| 欧美性大战久久久久久久| 久久伊人蜜桃av一区二区| 亚洲欧美日韩国产成人精品影院| 视频一区在线视频| 成人国产精品免费观看| 欧美一区二视频| 亚洲同性gay激情无套| 男人操女人的视频在线观看欧美| 成人一二三区视频| 日韩欧美国产午夜精品| 亚洲激情男女视频| 国产美女在线精品| 日韩午夜在线影院| 精彩视频一区二区三区| 色呦呦网站一区| 久久精品视频免费| 蜜桃久久久久久| 欧美午夜一区二区三区免费大片| 欧美激情一区二区三区不卡 | 91蜜桃免费观看视频| 日韩三级免费观看| 亚洲一区成人在线| www.色精品| 欧美成人精品二区三区99精品| 亚洲主播在线播放| 在线中文字幕不卡| 亚洲免费观看在线视频| 丁香一区二区三区| 欧美激情艳妇裸体舞| 国产一区免费电影| 久久亚洲精品小早川怜子| 美日韩一区二区| 91精品国产麻豆国产自产在线| 亚洲夂夂婷婷色拍ww47| 91福利小视频| 亚洲一区二区三区国产| 色视频欧美一区二区三区| 亚洲欧美韩国综合色| 波多野结衣亚洲一区| 国产亚洲精品精华液| 国产一级精品在线| 国产色综合一区| 成人黄色a**站在线观看| 中文无字幕一区二区三区| 欧洲一区二区av| 亚洲成av人片在www色猫咪| 欧美日韩黄色一区二区| 亚洲第一综合色| 欧美一区二区视频在线观看2020| 午夜欧美视频在线观看 | 成人黄色777网| 中文字幕在线播放不卡一区| 波多野结衣亚洲一区| 亚洲精品综合在线| 欧美日韩大陆一区二区| 久久精品国产第一区二区三区| 欧美不卡在线视频| 成人午夜精品在线| 亚洲女与黑人做爰| 91精品国产色综合久久不卡电影| 精品一区二区三区日韩| 综合欧美亚洲日本| 337p亚洲精品色噜噜| 久久99国产精品久久| 久久精品一区二区| 在线观看欧美精品| 久久狠狠亚洲综合| 中文字幕一区二区三区在线观看| 在线观看亚洲精品视频| 九色综合狠狠综合久久| 亚洲欧美在线观看| 欧美一级片在线观看| 成人国产精品免费| 日韩电影在线观看一区| 国产精品三级视频| 欧美亚洲高清一区二区三区不卡| 精品亚洲免费视频| 亚洲精品欧美专区| 久久综合视频网| 欧美中文字幕亚洲一区二区va在线 | 91论坛在线播放| 麻豆精品一区二区综合av| 亚洲视频中文字幕| 精品日韩一区二区三区免费视频| 色哟哟一区二区| 高清不卡一区二区| 美国毛片一区二区三区| 洋洋成人永久网站入口| 久久久精品影视| 日韩欧美亚洲另类制服综合在线| 99精品久久免费看蜜臀剧情介绍| 久久精品国产亚洲高清剧情介绍| 亚洲一区二区三区免费视频| 国产精品妹子av| 亚洲精品在线免费观看视频| 欧美日韩成人综合在线一区二区| 成人激情黄色小说| 国产精品1区2区3区在线观看| 日韩专区一卡二卡| 夜夜爽夜夜爽精品视频| 亚洲欧洲中文日韩久久av乱码| 26uuu欧美| 精品久久五月天| 欧美一区二区视频在线观看2020| 欧美日韩中字一区| 欧美伊人精品成人久久综合97| 99久久99久久久精品齐齐| 国产成人av电影在线播放| 国内外成人在线| 久久99国内精品| 久久精品国产亚洲aⅴ | 岛国一区二区三区| 激情综合一区二区三区| 久久99久久久欧美国产| 久久精品国产精品亚洲综合| 免费成人深夜小野草| 久久99精品久久久久婷婷| 久久精品国产精品亚洲红杏| 免费av成人在线| 久久99精品国产麻豆不卡| 国内精品国产成人| 国产高清无密码一区二区三区| 国产一区二区在线免费观看| 韩国v欧美v日本v亚洲v| 国产精一区二区三区| 国产精品一卡二| 99久久99久久精品免费观看 | 国产精品亚洲成人| 国产成人在线视频网站| 国产激情一区二区三区四区| 北岛玲一区二区三区四区| 99国产精品一区| 欧美在线小视频| 91精品国产综合久久香蕉麻豆| 精品三级在线看| 国产精品久久久久影视| 一区二区在线免费观看| 天天影视涩香欲综合网| 国产一区二区成人久久免费影院 | 在线亚洲高清视频| 7777精品伊人久久久大香线蕉的 | 国产精品色在线观看| 一区二区三区中文在线观看| 日日摸夜夜添夜夜添精品视频| 激情都市一区二区| 色欧美日韩亚洲| 欧美xxxxxxxxx| 亚洲欧美偷拍另类a∨色屁股| 日韩va亚洲va欧美va久久| 国产拍欧美日韩视频二区| 欧美一级在线观看| 精品区一区二区| 奇米精品一区二区三区在线观看一 | 亚洲 欧美综合在线网络| 99国产精品久久久久久久久久| 精品国产免费久久 | 亚洲高清免费一级二级三级| 99精品久久只有精品| 国产精品久久久久aaaa樱花 | 国产在线精品国自产拍免费| 日韩一区二区精品在线观看| 婷婷丁香久久五月婷婷| 欧美日韩国产另类不卡| 午夜精品久久久久久久99水蜜桃| 精品污污网站免费看| 亚洲午夜私人影院| 精品视频在线视频|