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

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

?? testlock.java

?? cms是開源的框架
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
        
        // lock folder
        cms.lockResource(folder);
        
        // 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);
        }

        // The siblings outside the folder are unlocked
        assertLock(cms, sibling1, CmsLock.TYPE_UNLOCKED);
        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 unlocked
        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);
        }
        
        // The siblings outside the folder keppt their previous lockstate
        assertLock(cms, sibling1, CmsLock.TYPE_UNLOCKED);
        assertLock(cms, sibling2, CmsLock.TYPE_UNLOCKED);

    }    
 
    /**
     * Tests to steal a lock.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockSteal() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing stealing a lock");
        
        String source = "/folder1/subfolder11/page1.html";
        String sibling1 = "/folder1/subfolder12/page1.html";
        String sibling2 = "/folder2/subfolder22/page1.html";
        storeResources(cms, source);
        
        // get the offline project
        CmsProject offlineProject = cms.readProject("Offline");
        
        // login as user "test1"
        cms.loginUser("test1" , "test1");
        cms.getRequestContext().setCurrentProject(offlineProject);
       
        // 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);
 
        // login as user "admin"
        cms.loginUser("Admin" , "admin");
        cms.getRequestContext().setCurrentProject(offlineProject);
        
        // steal lock from first sibling
        cms.changeLock(sibling1);
        
        // the sibling1 file must have an exclusive lock
        // all siblings of it must have shared locks
        assertLock(cms, sibling1, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, source, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, sibling2, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        // now revoke write permissions for user "test2"
        cms.chacc(source, I_CmsPrincipal.PRINCIPAL_USER, "test2", 0, CmsPermissionSet.PERMISSION_WRITE, CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE + CmsAccessControlEntry.ACCESS_FLAGS_INHERIT);

        // switch to user "test2"
        cms.loginUser("test2" , "test2");
        cms.getRequestContext().setCurrentProject(offlineProject);
                
        Exception error = null;
        try {
            // try to steal lock from the source
            cms.changeLock(source);
        } catch (CmsPermissionViolationException e) {
            error = e;
        }
        assertNotNull(error);
        try {
            // try to steal lock from the first sibling
            cms.changeLock(sibling1);
        } catch (CmsPermissionViolationException e) {
            error = e;
        }
        assertNotNull(error);
        try {
            // try to steal lock from the second sibling
            cms.changeLock(sibling2);
        } catch (CmsPermissionViolationException e) {
            error = e;
        }
        assertNotNull(error);        
        
        // login as user "Admin" again
        cms.loginUser("Admin" , "admin");
        cms.getRequestContext().setCurrentProject(offlineProject);
        
        // assert the locks are still there
        assertLock(cms, sibling1, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, source, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, sibling2, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        // login as user "test1" again
        cms.loginUser("test1" , "test1");
        cms.getRequestContext().setCurrentProject(offlineProject);
        
        // steal lock from second sibling
        cms.changeLock(sibling2);
        
        // assert the locks for siblings are there
        assertLock(cms, sibling2, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, source, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, sibling1, CmsLock.TYPE_SHARED_EXCLUSIVE);
    } 
    
    /**
     * Tests lock status of a resource during sibling creation.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockForSiblings() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing lock state after sibling creation");
        
        String source = "/folder2/index.html";
        String destination1 = "/folder2/index_sib1.html";
        String destination2 = "/folder2/index_sib2.html";
        storeResources(cms, source);
        
        // copy source
        cms.copyResource(source, destination1, CmsResource.COPY_AS_SIBLING);

        // since source was not locked, destination must be locked exclusive
        // and source must be locked shared
        assertLock(cms, source, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, destination1, CmsLock.TYPE_EXCLUSIVE);
        
        // copy source again
        cms.copyResource(source, destination2, CmsResource.COPY_AS_SIBLING);  
        
        // since one sibling was already exclusive locked, 
        // new sibling must be shared locked
        assertLock(cms, source, CmsLock.TYPE_SHARED_EXCLUSIVE);
        assertLock(cms, destination1, CmsLock.TYPE_EXCLUSIVE);        
        assertLock(cms, destination2, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        // same stuff but in a different order 
        source = "/folder2/page1.html";
        destination1 = "/folder2/page1_sib1.html";
        destination2 = "/folder2/page1_sib2.html";
        
        // this time source is already locked
        cms.lockResource(source);
        cms.createSibling(source, destination1, null);
        
        // since source was locked, destination must be shared exclusive
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, destination1, CmsLock.TYPE_SHARED_EXCLUSIVE);    
        
        // create another sibling
        cms.createSibling(destination1, destination2, null);    
        // since one sibling was already exclusive locked, 
        // new sibling must be shared locked
        assertLock(cms, source, CmsLock.TYPE_EXCLUSIVE);
        assertLock(cms, destination1, CmsLock.TYPE_SHARED_EXCLUSIVE);        
        assertLock(cms, destination2, CmsLock.TYPE_SHARED_EXCLUSIVE);    
    }    
    
    /**
     * Tests an inherited lock in a resource delete scenario.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockInherit() throws Throwable {
        
        CmsObject cms = getCmsObject();     
        echo("Testing inherited lock delete scenario");
        
        String source = "/folder1/index.html";
        String folder = "/folder1/";
        storeResources(cms, source);        

        // first delete the resource
        cms.lockResource(source);
        cms.deleteResource(source, CmsResource.DELETE_PRESERVE_SIBLINGS);
       
        // now lock the folder
        cms.lockResource(folder);
        
        // make sure the deleted file has an inherited lock
        assertLock(cms, source, CmsLock.TYPE_INHERITED);
    }
        
    /**
     * Ensures that a lock is required for all write/control operations.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testLockRequired() throws Throwable {

        CmsObject cms = getCmsObject();     
        echo("Testing if a lock is required for write/control operations");
        
        String source = "/index.html";
        storeResources(cms, source);        
        long timestamp = System.currentTimeMillis();
        
        // make sure source is not locked
        assertLock(cms, source, CmsLock.TYPE_UNLOCKED);                
        
        CmsFile file = cms.readFile(source);
                
        boolean needLock;
        
        needLock = false;
        try {
            cms.setDateLastModified(source, timestamp, false);            
        } catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        }        
        if (! needLock) {
            fail("Touch operation on resource permitted without a lock on the current user!");
        }         
        
        needLock = false;
        try {
            cms.deleteResource(source, CmsResource.DELETE_PRESERVE_SIBLINGS);
        } catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        }        
        if (! needLock) {
            fail("Delete operation on resource permitted without a lock on the current user!");
        } 

        needLock = false;
        try {
            cms.writeFile(file);
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Write operation on resource permitted without a lock on the current user!");
        }   

        needLock = false;
        try {
            cms.moveResource(source, "index_dest.html");
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Move operation on resource permitted without a lock on the current user!");
        } 

        needLock = false;
        try {
            cms.writePropertyObject(source, new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, "New title", null));
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Write property operation on resource permitted without a lock on the current user!");
        }       
        
        needLock = false;
        try {
            List properties = new ArrayList();
            properties.add(new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, "New title 2", null));
            cms.writePropertyObjects(source, properties);
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Write property list operation on resource permitted without a lock on the current user!");
        }           

        needLock = false;
        try {
            cms.chflags(source, 1234);
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Change flags operation on resource permitted without a lock on the current user!");
        }        

        needLock = false;
        try {
            cms.chtype(source, CmsResourceTypePlain.getStaticTypeId());
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Change type operation on resource permitted without a lock on the current user!");
        }  

        needLock = false;
        try {
            cms.replaceResource(source, CmsResourceTypePlain.getStaticTypeId(), "Kaputt".getBytes(), null);
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Replace operation on resource permitted without a lock on the current user!");
        }     

        needLock = false;
        try {
            cms.changeLastModifiedProjectId(source);
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Change last modified in project operation on resource permitted without a lock on the current user!");
        }           

        needLock = false;
        try {
            CmsPermissionSet permissions = new CmsPermissionSet(CmsPermissionSet.PERMISSION_WRITE, CmsPermissionSet.PERMISSION_READ);
            cms.chacc(source, I_CmsPrincipal.PRINCIPAL_GROUP, OpenCms.getDefaultUsers().getGroupAdministrators(), permissions.getAllowedPermissions(), permissions.getDeniedPermissions(), CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE);
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Change permissions operation on resource permitted without a lock on the current user!");
        }
        
        needLock = false;
        try {
            cms.undeleteResource(source);
        }  catch (CmsLockException e) {
            // must throw a security exception because resource is not locked
            needLock = true;
        } 
        if (! needLock) {
            fail("Unlock operation on resource permitted without a lock on the current user!");
        }  
        
        // make sure original resource is unchanged
        assertFilter(cms, source, OpenCmsTestResourceFilter.FILTER_EQUAL);
        
        // now perform a delete operation with lock
        cms.lockResource(source);
        cms.deleteResource(source, CmsResource.DELETE_PRESERVE_SIBLINGS);
        
        // now undelete the resource
        cms.lockResource(source);        
        cms.undeleteResource(source);
        cms.unlockResource(source);
        
        // make sure original resource is still unchanged
        assertFilter(cms, source, OpenCmsTestResourceFilter.FILTER_UNDOCHANGES);        
    }      
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一二三精品| 久久精品国产澳门| 国产精品视频在线看| 日韩欧美国产午夜精品| 日韩亚洲欧美综合| 日韩欧美国产麻豆| 日韩一区二区免费电影| 日韩欧美国产一二三区| 久久亚洲二区三区| 国产片一区二区三区| 国产情人综合久久777777| 国产欧美精品一区二区色综合| 亚洲精品一线二线三线无人区| 精品第一国产综合精品aⅴ| 久久久精品影视| 国产精品日日摸夜夜摸av| 亚洲视频 欧洲视频| 亚洲乱码国产乱码精品精98午夜 | 欧美人牲a欧美精品| 欧美日韩五月天| 欧美一区二区三区免费| www国产精品av| 亚洲色图欧洲色图婷婷| 五月天精品一区二区三区| 久久疯狂做爰流白浆xx| av男人天堂一区| 欧美猛男男办公室激情| 久久综合av免费| 亚洲人成人一区二区在线观看| 亚洲二区在线观看| 国产精品一级片在线观看| 91福利精品视频| 26uuu国产一区二区三区| 亚洲视频1区2区| 久久超碰97中文字幕| 色综合中文字幕国产| 日韩欧美成人午夜| 一区二区三区在线视频观看 | 国产伦精品一区二区三区视频青涩 | 日韩精品一区二区三区在线播放 | 极品少妇xxxx偷拍精品少妇| 国产xxx精品视频大全| 色婷婷av一区二区三区之一色屋| 欧美一区二区三区男人的天堂| 国产日韩精品一区二区浪潮av| 一区二区免费在线播放| 国产成人精品影院| 在线电影欧美成精品| 国产精品久久久久四虎| 捆绑紧缚一区二区三区视频| 色视频成人在线观看免| 欧美激情一区二区三区蜜桃视频| 日韩中文字幕av电影| 99久久精品免费观看| 久久精品无码一区二区三区| 日日噜噜夜夜狠狠视频欧美人| 成人激情午夜影院| 久久久亚洲精品石原莉奈| 亚洲成在线观看| 国产**成人网毛片九色| 日韩一区二区在线看片| 偷拍亚洲欧洲综合| 欧美日韩免费一区二区三区视频| 国产精品伦一区| 高清在线不卡av| 日韩欧美一区电影| 免费成人在线网站| 日韩一区二区高清| 美日韩一级片在线观看| 欧美乱妇20p| 日韩精品每日更新| 欧美一区三区四区| 日本伊人精品一区二区三区观看方式 | 免费人成精品欧美精品| 欧美精品久久99久久在免费线 | 欧美精品亚洲一区二区在线播放| 亚洲国产精品传媒在线观看| 国产乱码精品一区二区三区忘忧草 | 亚洲一区二区高清| 欧美日韩在线电影| 日韩精品电影在线观看| 91精品国产免费| 麻豆freexxxx性91精品| 久久综合av免费| 成人午夜私人影院| 亚洲欧美综合色| 在线观看av一区二区| 首页综合国产亚洲丝袜| 日韩一区二区三区免费观看| 麻豆精品新av中文字幕| 久久综合网色—综合色88| 韩国视频一区二区| 国产精品嫩草久久久久| 欧美亚洲动漫另类| 美女视频黄a大片欧美| 26uuu国产在线精品一区二区| 国产成人欧美日韩在线电影| 国产欧美日韩精品一区| 色综合久久中文字幕| 午夜久久久久久电影| 日韩欧美国产综合| 成人午夜在线播放| 午夜婷婷国产麻豆精品| 欧美精品一区二| 99久久婷婷国产| 天天色天天爱天天射综合| 精品入口麻豆88视频| jlzzjlzz欧美大全| 蜜桃久久精品一区二区| 国产精品天干天干在线综合| 欧美在线免费观看亚洲| 狠狠色综合日日| 亚洲免费观看高清完整版在线观看熊| 欧美精品tushy高清| 成人激情开心网| 日韩精品一卡二卡三卡四卡无卡| 久久久99精品免费观看不卡| 91成人免费网站| 国产精品一二三四| 日韩精品一级二级| 亚洲丝袜美腿综合| 亚洲精品一区二区三区香蕉| av午夜一区麻豆| 国产精品一区久久久久| 亚洲不卡一区二区三区| 亚洲国产成人午夜在线一区| 91精品久久久久久蜜臀| 色乱码一区二区三区88| 国产 欧美在线| 九九九精品视频| 日韩高清欧美激情| 亚洲午夜免费电影| 国产精品色哟哟| 国产欧美一区二区三区沐欲| 91麻豆精品国产91久久久久久| 9i在线看片成人免费| 国产一区视频网站| 久久草av在线| 久久精品国产免费| 奇米影视在线99精品| 亚洲高清在线视频| 一卡二卡三卡日韩欧美| 国产精品福利影院| 欧美激情一二三区| 亚洲国产成人午夜在线一区| 久久久国际精品| www国产成人| 国产亚洲污的网站| 久久午夜老司机| 久久影视一区二区| 欧美不卡激情三级在线观看| 91精品国产色综合久久不卡蜜臀| 日本韩国欧美在线| 91欧美激情一区二区三区成人| 成人av动漫网站| 成人动漫视频在线| av日韩在线网站| 99精品黄色片免费大全| 99久久er热在这里只有精品15| 北条麻妃国产九九精品视频| 国产精品18久久久久久久久久久久| 国产乱色国产精品免费视频| 国产91精品一区二区麻豆网站 | 欧美在线免费观看视频| 欧美日韩国产在线观看| 欧美日韩aaa| 精品久久人人做人人爽| 久久久久99精品国产片| 国产精品久久久久一区二区三区 | 欧美国产精品一区二区| 中文字幕一区二区三区精华液| 国产精品国产三级国产a| 中文字幕一区二区三区四区 | 在线综合亚洲欧美在线视频| 日韩一区二区三区观看| 久久久精品国产免大香伊 | 亚洲国产sm捆绑调教视频| 日韩电影在线观看一区| 国产呦萝稀缺另类资源| 成人av在线播放网站| 欧美日韩免费电影| 久久综合精品国产一区二区三区| 国产精品美女久久久久久| 午夜欧美在线一二页| 久草精品在线观看| 日本久久一区二区三区| 亚洲精品在线免费观看视频| 国产精品久久夜| 免费观看在线综合色| jlzzjlzz欧美大全| 日韩精品一区二区三区蜜臀| 一区二区中文视频| 久久精品国产精品亚洲精品 | 午夜伦欧美伦电影理论片| 国产精品自在在线| 在线电影院国产精品| 国产精品无遮挡| 久久精品国产77777蜜臀| 91亚洲精品乱码久久久久久蜜桃| 欧美一区二区三区在线电影|