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

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

?? testlock.java

?? cms是開源的框架
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/test/org/opencms/file/TestLock.java,v $
 * Date   : $Date: 2006/03/27 14:52:46 $
 * Version: $Revision: 1.20 $
 *
 * 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.file.types.CmsResourceTypePlain;
import org.opencms.lock.CmsLock;
import org.opencms.lock.CmsLockException;
import org.opencms.main.OpenCms;
import org.opencms.security.CmsAccessControlEntry;
import org.opencms.security.CmsPermissionSet;
import org.opencms.security.CmsPermissionViolationException;
import org.opencms.security.I_CmsPrincipal;
import org.opencms.test.OpenCmsTestCase;
import org.opencms.test.OpenCmsTestProperties;
import org.opencms.test.OpenCmsTestResourceFilter;

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

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

/**
 * Unit tests for lock operation.<p>
 * 
 * @author Alexander Kandzior 
 * 
 * @version $Revision: 1.20 $
 */
public class TestLock extends OpenCmsTestCase {
  
    /**
     * Default JUnit constructor.<p>
     * 
     * @param arg0 JUnit parameters
     */    
    public TestLock(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(TestLock.class.getName());
             
        suite.addTest(new TestLock("testLockWithDeletedNewFiles"));
        suite.addTest(new TestLock("testLockForFile"));
        suite.addTest(new TestLock("testLockForFolder"));
        suite.addTest(new TestLock("testLockForFolderPrelockedShared"));
        suite.addTest(new TestLock("testLockForFolderPrelockedExclusive"));
        suite.addTest(new TestLock("testLockSteal")); 
        suite.addTest(new TestLock("testLockRequired"));
        suite.addTest(new TestLock("testLockInherit"));
        suite.addTest(new TestLock("testLockForSiblings"));
        suite.addTest(new TestLock("testLockForBaseOperations"));
      
        
        TestSetup wrapper = new TestSetup(suite) {
            
            protected void setUp() {
                setupOpenCms("simpletest", "/sites/default/");
            }
            
            protected void tearDown() {
                removeOpenCms();
            }
        };
        
        return wrapper;
    }     
        
    /**
     * Tests lock status after a new file has been deleted in offline project.<p>
     * 
     * Issue description:
     * User A creates a new file, but deletes it without ever publishing it.
     * Now user B create a new file with the same name / path.
     * The file was still in the lock manager but for user A, this generated 
     * an error for user B.<p>
     * 
     * Solution:
     * Remove new files that are deleted from the lock manager.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockWithDeletedNewFiles() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing lock status of a deleted new file");
        
        String source = "/folder1/newfile.html";

        // create a new resource as default test user
        cms.createResource(source, CmsResourceTypePlain.getStaticTypeId());
        // the source file must now have an exclusive lock
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);        
        // now delete the created resource
        cms.deleteResource(source, CmsResource.DELETE_REMOVE_SIBLINGS);
        
        // now login as user "test2"
        cms.loginUser("test2", "test2");
        cms.getRequestContext().setCurrentProject(cms.readProject("Offline"));    
                
        // now create the resource again
        cms.createResource(source, CmsResourceTypePlain.getStaticTypeId()); 
        
        // the newly created resource must now be locked to user "test2"
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
    }    
    
    /**
     * Tests lock status of a resource for basic operations.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockForBaseOperations() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing lock state for basic operations");
        
        String source = "/types/text.txt";
        String destination1 = "/types/text_new1.txt";
        String destination2 = "/types/text_new2.txt";
        storeResources(cms, source);
        
        // copy source
        cms.copyResource(source, destination1, CmsResource.COPY_AS_NEW);

        // since source was not locked, destination must be locked exclusive
        // and source must still be unlocked
        assertLock(cms, source, CmsLock.TYPE_UNLOCKED);
        assertLock(cms, destination1, CmsLock.TYPE_EXCLUSIVE);
        
        // copy source again
        cms.lockResource(source);        
        cms.copyResource(source, destination2, CmsResource.COPY_AS_NEW);  
        
        // both source and destination must be exlusive locked
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, destination2, CmsLock.TYPE_EXCLUSIVE);
                
        // now some move tests
        source = "/types/jsp.jsp";
        destination1 = "/types/jsp_new1.html";

        // lock resource
        cms.lockResource(source);
        cms.moveResource(source, destination1);
        
        // since source was locked, destination must be shared exclusive
        assertLock(cms, source, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, destination1, CmsLock.TYPE_EXCLUSIVE);
    }    
    
    /**
     * Tests lock status of a file and its siblings.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockForFile() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing locking of files");
        
        String source = "/folder1/subfolder11/page1.html";
        String sibling1 = "/folder1/subfolder12/page1.html";
        String sibling2 = "/folder2/subfolder22/page1.html";
        storeResources(cms, source);
        
        // lock source
        cms.lockResource(source);

        // the source file must have an exclusive lock
        // all siblings must have shared locks
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, sibling1, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, sibling2, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        // now unlock the source
        cms.unlockResource(source);
        
        // the source file and all sibling are unlocked now
        assertLock(cms, source, CmsLock.TYPE_UNLOCKED);
        assertLock(cms, sibling1, CmsLock.TYPE_UNLOCKED);
        assertLock(cms, sibling2, CmsLock.TYPE_UNLOCKED);
    }    
    
    /**
     * Tests lock status of a folder and its siblings.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockForFolder() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing locking of folders");
        
        String folder = "/folder1/subfolder12/";
        String sibling1 = "/folder1/subfolder12/page1.html";
        String sibling2 = "/folder2/subfolder22/page1.html";
        storeResources(cms, folder);
        
        // lock folder
        cms.lockResource(folder);

        // the source folder must have an exclusive lock
        assertLock(cms, folder, CmsLock.TYPE_EXCLUSIVE);
        
        // all resources in the folder must have an inherited lock        
        List resources = cms.getResourcesInFolder(folder, CmsResourceFilter.DEFAULT);
        Iterator i = resources.iterator();
        while (i.hasNext()) {
            CmsResource res = (CmsResource)i.next();
            assertLock(cms, cms.getSitePath(res), CmsLock.TYPE_INHERITED);
        }
        
        // all siblings inside the folder must have an inherited lock
        assertLock(cms, sibling1, CmsLock.TYPE_INHERITED);
        // all siblings outside the folder must not locked
        assertLock(cms, sibling2, CmsLock.TYPE_UNLOCKED);
        
        // now unlock the folder 
        cms.unlockResource(folder);
        
        // the source folder must be unlocked
        assertLock(cms, folder, CmsLock.TYPE_UNLOCKED);
        
        // all resources in the folder must be ulocked      
        resources = cms.getResourcesInFolder(folder, CmsResourceFilter.DEFAULT);
        i = resources.iterator();
        while (i.hasNext()) {
            CmsResource res = (CmsResource)i.next();
            assertLock(cms, cms.getSitePath(res), CmsLock.TYPE_UNLOCKED);
        }
        
        // all siblings outside of the folder must not locked
        assertLock(cms, sibling1, CmsLock.TYPE_UNLOCKED);
        assertLock(cms, sibling2, CmsLock.TYPE_UNLOCKED);
        
    }    
    
    /**
     * Tests lock status of a folder and its siblings.<p>
     * 
     * In this test, the folder has some prelocked siblings with shared locks in it
     *  
     * @throws Throwable if something goes wrong
     */
    public void testLockForFolderPrelockedShared() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing locking of folders with shared prelocks");
        
        String folder = "/folder1/subfolder12/";
        String source = "/folder1/subfolder11/page1.html";
        String sibling1 = "/folder1/subfolder12/page1.html";
        String sibling2 = "/folder2/subfolder22/page1.html";
        storeResources(cms, folder);
        
   
        // lock source
        cms.lockResource(source);

        // the source file must have an exclusive lock
        // all siblings must have shared exclusive locks
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, sibling1, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, sibling2, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        // lock folder
        cms.lockResource(folder);
        
        // all resources in the folder must have an inherited or shared inherited lock        
        List resources = cms.getResourcesInFolder(folder, CmsResourceFilter.DEFAULT);
        Iterator i = resources.iterator();
        while (i.hasNext()) {
            CmsResource res = (CmsResource)i.next();
            // the sibling to the resource "source" must have an shared inherited lock
            // all other resources must have a inherited lock
            if (cms.getSitePath(res).equals(sibling1)) {
                assertLock(cms, cms.getSitePath(res), CmsLock.TYPE_SHARED_INHERITED);
            } else {
                assertLock(cms, cms.getSitePath(res), CmsLock.TYPE_INHERITED);
            }
        }

        // The siblings outside the folder keppt their previous lockstate
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, sibling2, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        // now unlock the folder
        cms.unlockResource(folder);
        
        // the source folder must be unlocked
        assertLock(cms, folder, CmsLock.TYPE_UNLOCKED);
        
        // all resources in the folder must be unlocked, except those siblings that had a 
        // shared inherited lock, they must get a shared exclusive lock
        resources = cms.getResourcesInFolder(folder, CmsResourceFilter.DEFAULT);
        i = resources.iterator();
        while (i.hasNext()) {
            CmsResource res = (CmsResource)i.next();
            if (cms.getSitePath(res).equals(sibling1)) {
                assertLock(cms, cms.getSitePath(res), CmsLock.TYPE_SHARED_EXCLUSIVE);
            } else {
                assertLock(cms, cms.getSitePath(res),  CmsLock.TYPE_UNLOCKED);
            }
        }
        
        // The siblings outside the folder keppt their previous lockstate
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, sibling2, CmsLock.TYPE_SHARED_EXCLUSIVE);
       
        // now unlock the source
        cms.unlockResource(source);
        
        // the source file and all sibling are unlocked now
        assertLock(cms, source, CmsLock.TYPE_UNLOCKED);
        assertLock(cms, sibling1, CmsLock.TYPE_UNLOCKED);
        assertLock(cms, sibling2, CmsLock.TYPE_UNLOCKED);        
        
    }    
    
    /**
     * Tests lock status of a folder and its siblings.<p>
     * 
     * In this test, the folder has some prelocked siblings with exclusive locks in it
     *  
     * @throws Throwable if something goes wrong
     */
    public void testLockForFolderPrelockedExclusive() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing locking of folders with exclusive prelocks");
        
        String folder = "/folder1/subfolder12/";
        String source = "/folder1/subfolder12/page1.html";
        String sibling1 = "/folder1/subfolder11/page1.html";
        String sibling2 = "/folder2/subfolder22/page1.html";
        storeResources(cms, folder);
        
   
        // lock source
        cms.lockResource(source);

        // the source file must have an exclusive lock
        // all siblings must have shared exclusive locks
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, sibling1, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, sibling2, CmsLock.TYPE_SHARED_EXCLUSIVE);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区免费在线看| 精品伦理精品一区| 亚洲你懂的在线视频| 99久久婷婷国产| 亚洲综合激情网| 欧美男人的天堂一二区| 日韩av一区二区在线影视| 日韩欧美中文字幕一区| 国内一区二区视频| 日韩理论片在线| 欧美日韩在线播放三区四区| 久久国产尿小便嘘嘘| 国产亚洲一区字幕| 91啦中文在线观看| 偷拍日韩校园综合在线| 久久久精品国产免费观看同学| 成人激情av网| 日韩国产欧美在线观看| 国产精品情趣视频| 在线观看国产日韩| 蜜桃视频在线观看一区二区| 日本一区二区三区国色天香| 色综合视频在线观看| 天天综合日日夜夜精品| 亚洲综合999| 成人禁用看黄a在线| 色视频欧美一区二区三区| 精品噜噜噜噜久久久久久久久试看 | 国产精品系列在线观看| 国产精品你懂的在线| 欧美日韩一区国产| 国产精品综合视频| 亚洲v日本v欧美v久久精品| 国产亚洲一区二区三区在线观看| 色一情一伦一子一伦一区| 国产主播一区二区三区| 亚洲第一福利视频在线| 久久精品视频免费| 欧美日韩国产免费一区二区 | 国产成人在线免费观看| 午夜精品久久久久久久蜜桃app| 久久久精品综合| 欧美一区欧美二区| 婷婷夜色潮精品综合在线| 欧美视频完全免费看| jlzzjlzz亚洲日本少妇| 欧美高清在线视频| 日韩美女一区二区三区四区| 色婷婷精品久久二区二区蜜臂av | 亚洲午夜电影网| 亚洲精品一区二区三区蜜桃下载| 91在线云播放| 国产在线一区二区| 日本一区二区免费在线| 一区二区三区四区国产精品| 91丨九色丨国产丨porny| 国产精品盗摄一区二区三区| 99国产精品久久久久| 综合激情成人伊人| 国产精品久久99| 日本不卡高清视频| 成人免费视频国产在线观看| 欧美精品日韩精品| 视频一区国产视频| 26uuu另类欧美| zzijzzij亚洲日本少妇熟睡| 国产精品久久综合| 在线观看视频一区二区欧美日韩| 一区在线中文字幕| 欧美日韩欧美一区二区| 免费观看91视频大全| 亚洲欧美一区二区不卡| 6080亚洲精品一区二区| 成人精品视频一区二区三区尤物| 欧美色窝79yyyycom| 韩国精品免费视频| 有坂深雪av一区二区精品| 色综合久久99| 国产欧美一区二区精品仙草咪| 成人免费观看视频| 亚洲精品大片www| 一级中文字幕一区二区| 精品一区二区成人精品| 国产真实乱子伦精品视频| 久久久无码精品亚洲日韩按摩| 日韩三级视频在线看| 日韩一区二区三区电影 | 亚洲综合清纯丝袜自拍| 亚洲黄色性网站| 亚洲电影视频在线| 欧美日韩一区中文字幕| 日本欧美在线看| 国产凹凸在线观看一区二区| 岛国精品一区二区| 色婷婷久久综合| 欧美一区二区在线播放| 精品99久久久久久| 国产精品福利一区二区三区| 伊人夜夜躁av伊人久久| 亚洲成av人片一区二区三区| 免费看欧美女人艹b| 国产毛片精品一区| 色香蕉久久蜜桃| 欧美一区欧美二区| 欧美激情一区二区三区全黄| 亚洲乱码中文字幕| 看电视剧不卡顿的网站| 成人激情免费网站| 欧美日韩精品一区二区天天拍小说| 91精品国产乱| 中文无字幕一区二区三区 | 一区二区三区四区国产精品| 日韩av一区二区三区四区| 高清视频一区二区| 欧美日韩午夜精品| 日本一区二区综合亚洲| 色综合久久99| 国产91露脸合集magnet| jlzzjlzz欧美大全| 欧美一区二区精品在线| 国产精品久久久久影院| 天堂成人免费av电影一区| 国产成人高清在线| 5858s免费视频成人| 中文字幕免费观看一区| 婷婷成人激情在线网| 成人精品免费看| 欧美一级理论性理论a| 亚洲视频免费观看| 国产剧情av麻豆香蕉精品| 精品视频在线免费看| 国产精品乱人伦| 毛片av一区二区三区| 91久久免费观看| 国产女人水真多18毛片18精品视频| 日韩高清在线不卡| 欧美午夜理伦三级在线观看| 国产三区在线成人av| 久久精品理论片| 欧美日韩国产在线观看| 亚洲色欲色欲www在线观看| 国产精品正在播放| 欧美大胆一级视频| 亚洲国产精品人人做人人爽| 国产成人av资源| 亚洲国产精品一区二区久久| 国产毛片精品视频| 欧美丝袜丝交足nylons图片| 国产精品素人一区二区| 极品少妇xxxx偷拍精品少妇| 欧美视频日韩视频在线观看| 亚洲欧洲综合另类| 国产高清精品网站| 久久一夜天堂av一区二区三区| 亚洲va韩国va欧美va精品 | 精品国产亚洲一区二区三区在线观看 | 国产精品性做久久久久久| 91麻豆精品91久久久久同性| 亚洲高清视频在线| 99久久精品免费观看| 国产精品沙发午睡系列990531| 成人激情校园春色| 美腿丝袜亚洲一区| 欧美一区二区黄| 国产在线观看一区二区| 亚洲欧洲制服丝袜| 国产精品高潮呻吟| 亚洲国产精品嫩草影院| 日韩电影在线免费| 欧美精品色综合| 无吗不卡中文字幕| 制服丝袜亚洲播放| 日产精品久久久久久久性色| 日韩片之四级片| 精品在线播放免费| 久久这里只精品最新地址| 精品亚洲porn| 国产日韩欧美精品在线| 成人在线视频一区二区| 亚洲欧洲www| 91国产成人在线| 午夜精品福利一区二区蜜股av | 国产精品一区专区| 久久久久久久综合色一本| 国产乱人伦偷精品视频不卡| 欧美经典一区二区| 在线观看视频欧美| 日本亚洲视频在线| 国产亚洲综合性久久久影院| 成人激情免费视频| 欧美性大战久久久久久久 | 中文字幕欧美日韩一区| 一区二区日韩av| 狠狠色丁香久久婷婷综合_中| 色欧美日韩亚洲| 久久―日本道色综合久久| 一区二区三区在线免费播放| 国内精品在线播放| 欧美日韩五月天| 成人免费在线视频|