亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美色爱综合网| 97精品超碰一区二区三区| 在线成人av网站| 午夜精品久久久| 欧美一区二区精美| 韩国一区二区在线观看| 久久精品欧美日韩| 99精品欧美一区| 亚洲成人免费av| 欧美电影免费观看高清完整版在线观看| 免费成人你懂的| 国产亚洲1区2区3区| 99精品视频在线观看| 亚洲最新视频在线播放| 337p亚洲精品色噜噜噜| 国产一区二区三区电影在线观看| 国产精品毛片无遮挡高清| 色噜噜久久综合| 日韩精品五月天| 中文字幕欧美区| 欧美日韩一区二区不卡| 国产麻豆91精品| 亚洲精品视频一区二区| 欧美成人性战久久| 91在线视频网址| 捆绑变态av一区二区三区| 国产精品网曝门| 欧美精品第1页| 99麻豆久久久国产精品免费| 婷婷开心激情综合| 亚洲国产成人在线| 91精品一区二区三区久久久久久 | 成人精品在线视频观看| 亚洲精品免费在线播放| 精品久久久久av影院| 色综合天天狠狠| 精品一区免费av| 亚洲电影在线播放| 欧美国产日韩亚洲一区| 欧美一级理论性理论a| 99精品热视频| 国产精品一区二区视频| 日本女优在线视频一区二区| 亚洲欧美日韩小说| 久久蜜桃av一区精品变态类天堂| 欧美色综合天天久久综合精品| 韩国视频一区二区| 日韩福利视频网| 一区二区三区.www| 国产精品传媒视频| 久久精品一级爱片| 在线综合视频播放| 欧美性感一区二区三区| 99久久99久久精品免费观看| 国产风韵犹存在线视精品| 青青草原综合久久大伊人精品| 亚洲欧美国产高清| 夜夜夜精品看看| 亚洲婷婷综合色高清在线| 国产欧美一区二区三区在线老狼 | 色婷婷久久99综合精品jk白丝| 国产精品资源在线| 狠狠狠色丁香婷婷综合激情| 免费观看成人av| 日本免费新一区视频| 日日噜噜夜夜狠狠视频欧美人| 亚洲综合在线五月| 一区二区三区欧美日韩| 亚洲欧美另类久久久精品| 中文字幕在线观看不卡视频| 国产欧美精品区一区二区三区| 精品久久久久99| 久久伊人蜜桃av一区二区| 日韩欧美国产综合在线一区二区三区| 精品视频资源站| 欧美网站大全在线观看| 欧美日韩精品一区二区三区 | 国产精品女主播av| 中文字幕第一区综合| 国产拍欧美日韩视频二区| 久久久亚洲午夜电影| 国产亚洲综合av| 国产精品三级电影| 亚洲天堂精品在线观看| 亚洲精选视频免费看| 亚洲线精品一区二区三区八戒| 亚洲成av人影院| 青青草精品视频| 国内欧美视频一区二区 | 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美a级理论片| 国产一区二区网址| 成人国产在线观看| 91国产免费观看| 91精品国产入口| 国产性色一区二区| 亚洲另类春色校园小说| 午夜精品久久久久久久99水蜜桃 | 日韩av成人高清| 国产麻豆精品95视频| av成人老司机| 欧美日韩国产区一| 久久精品在线免费观看| 1024国产精品| 日本成人中文字幕| 成人开心网精品视频| 欧美日韩高清在线| 国产亚洲综合色| 亚洲成人一区二区在线观看| 极品少妇xxxx精品少妇偷拍| av高清不卡在线| 6080yy午夜一二三区久久| 久久综合九色综合欧美就去吻 | 欧美精品在欧美一区二区少妇| 日韩欧美亚洲一区二区| 国产精品伦理在线| 粉嫩蜜臀av国产精品网站| 色综合久久综合网97色综合| 日韩一区二区三区免费看| 国产精品久久久久一区| 日本免费在线视频不卡一不卡二| 国产·精品毛片| 7777精品伊人久久久大香线蕉| 欧美国产精品久久| 日本午夜一区二区| 色中色一区二区| 久久久久九九视频| 日韩高清不卡一区二区| av欧美精品.com| 久久蜜臀精品av| 日韩av电影免费观看高清完整版 | 国产午夜久久久久| 婷婷激情综合网| 91首页免费视频| 久久久青草青青国产亚洲免观| 性做久久久久久| 91亚洲资源网| 国产精品女主播在线观看| 麻豆精品一区二区av白丝在线| 91麻豆国产福利精品| 精品国产乱子伦一区| 午夜精品视频在线观看| 91视频在线观看| 日本一区二区视频在线| 国内精品在线播放| 9191久久久久久久久久久| 亚洲最新视频在线观看| 成人av集中营| 日本一区二区三区免费乱视频 | 国产精品人妖ts系列视频| 麻豆91精品91久久久的内涵| 欧美日韩激情一区| 亚洲精品午夜久久久| 99久久综合色| 亚洲欧洲性图库| 处破女av一区二区| 国产亚洲精品中文字幕| 黄色资源网久久资源365| 日韩欧美一级片| 免费在线看成人av| 日韩亚洲欧美在线观看| 丝袜美腿亚洲综合| 8x8x8国产精品| 亚洲成国产人片在线观看| 欧美色大人视频| 亚洲va欧美va人人爽| 欧美疯狂做受xxxx富婆| 亚洲高清三级视频| 欧美日韩一卡二卡| 日韩不卡手机在线v区| 日韩欧美区一区二| 九色综合狠狠综合久久| 欧美va亚洲va香蕉在线| 久热成人在线视频| xnxx国产精品| 豆国产96在线|亚洲| 国产精品私人影院| 色就色 综合激情| 午夜免费久久看| 日韩三级视频在线看| 久久超碰97中文字幕| 国产欧美日韩三级| 91免费视频大全| 亚洲一线二线三线久久久| 欧美日韩国产美| 国内偷窥港台综合视频在线播放| 国产校园另类小说区| 91首页免费视频| 日韩精品免费专区| 久久亚区不卡日本| 欧美亚洲综合久久| 美女视频一区二区三区| 久久免费电影网| 色综合天天综合网天天看片| 亚洲一二三四在线| 日韩欧美国产综合一区| av不卡免费电影| 五月综合激情婷婷六月色窝| 亚洲精品一区二区在线观看| 成人动漫av在线|