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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? testcopy.java

?? cms是開源的框架
?? JAVA
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/test/org/opencms/file/TestCopy.java,v $
 * Date   : $Date: 2005/06/29 14:22:49 $
 * Version: $Revision: 1.16 $
 *
 * 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.lock.CmsLock;
import org.opencms.main.OpenCms;
import org.opencms.test.OpenCmsTestCase;
import org.opencms.test.OpenCmsTestProperties;
import org.opencms.test.OpenCmsTestResourceConfigurableFilter;
import org.opencms.test.OpenCmsTestResourceFilter;

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

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

/**
 * Unit tests for copy operation.<p>
 * 
 * @author Alexander Kandzior 
 * 
 * @version $Revision: 1.16 $
 */
public class TestCopy extends OpenCmsTestCase {
  
    /**
     * Default JUnit constructor.<p>
     * 
     * @param arg0 JUnit parameters
     */    
    public TestCopy(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(TestCopy.class.getName());
                
        // suite.addTest(new TestCopy("testCopyFileUserCreatedIssue"));
        suite.addTest(new TestCopy("testCopySingleResourceAsNew"));
        suite.addTest(new TestCopy("testCopyFolderDateIssue"));
        suite.addTest(new TestCopy("testCopyFolderAsNew"));
        suite.addTest(new TestCopy("testCopyOverwriteDeletedFile"));
        
        TestSetup wrapper = new TestSetup(suite) {
            
            protected void setUp() {
                setupOpenCms("simpletest", "/sites/default/");
            }
            
            protected void tearDown() {
                removeOpenCms();
            }
        };
        
        return wrapper;
    }
    
    /**
     * Tests the "copy single resource as new" operation.<p>
     * 
     * @throws Exception if the test fails
     */
    public void testCopySingleResourceAsNew() throws Exception {

        CmsObject cms = getCmsObject();     
        echo("Testing copy of a file as new");
        
        // create a project for all tests in this suite
        cms.createProject("testproject", "a test project", "Users", "Users", CmsProject.PROJECT_TYPE_NORMAL);
        cms.copyResourceToProject("/");   
        cms.addUserToGroup("test1", OpenCms.getDefaultUsers().getGroupAdministrators());
        
        cms.loginUser("test1", "test1");
        cms.getRequestContext().setCurrentProject(cms.readProject("testproject"));

        
        String source = "/index.html";
        String destination = "/index_copy.html";
        long timestamp = System.currentTimeMillis();
        
        CmsUser admin = cms.readUser("Admin");
        // some assertions about the original state of the resource
        assertUserCreated(cms, source, admin);
        assertUserLastModified(cms, source, admin);
        CmsResource original = cms.readResource(source);        
        
        storeResources(cms, source);        
        cms.copyResource(source, destination);
                        
        assertFilter(cms, source, OpenCmsTestResourceFilter.FILTER_EQUAL);
        
        // project must be current project
        assertProject(cms, destination, cms.getRequestContext().currentProject());
        // state must be "new"
        assertState(cms, destination, CmsResource.STATE_NEW);
        // date created must be new
        assertDateCreatedAfter(cms, destination, timestamp);
        // date last modified must be original date
        assertDateLastModified(cms, destination, original.getDateLastModified());        
        // user created must be current user
        assertUserCreated(cms, destination, cms.getRequestContext().currentUser());
        // user last modified must be original user
        assertUserLastModified(cms, destination, cms.readUser(original.getUserLastModified()));
        // now assert the filter for the rest of the attributes        
        setMapping(destination, source);        
        assertFilter(cms, destination, OpenCmsTestResourceFilter.FILTER_COPY_FILE_AS_NEW);
        // assert lock state
        assertLock(cms, destination, CmsLock.TYPE_EXCLUSIVE);
    }  
    
    /**
     * Tests the copy operation for a folder, checking if the date of the new folder is the current date.<p>
     * 
     * @throws Exception if the test fails
     */
    public void testCopyFolderDateIssue() throws Exception {

        
        CmsObject cms = getCmsObject();     
        echo("Testing copy operation for a folder, checking if the date of the new folder is the current date");            
        
        cms.loginUser("test1", "test1");
        cms.getRequestContext().setCurrentProject(cms.readProject("testproject"));
        
        String source = "/xmlcontent/";
        String destination = "/xmlcontent_copy/";
        long timestamp = System.currentTimeMillis();
        
        storeResources(cms, source);        
        cms.copyResource(source, destination);
                
        assertFilter(cms, source, OpenCmsTestResourceFilter.FILTER_EQUAL);
        
        // project must be current project
        assertProject(cms, destination, cms.getRequestContext().currentProject());
        // state must be "new"
        assertState(cms, destination, CmsResource.STATE_NEW);
        // date created must be new
        assertDateCreatedAfter(cms, destination, timestamp);
        // for a copied folder, also the date last modified must be new
        assertDateLastModifiedAfter(cms, destination, timestamp);
        // user created must be current user
        assertUserCreated(cms, destination, cms.getRequestContext().currentUser());
        // user last modified must be current user
        assertUserLastModified(cms, destination, cms.getRequestContext().currentUser());
        // assert lock state
        assertLock(cms, destination, CmsLock.TYPE_EXCLUSIVE);
        // now assert the filter for the rest of the attributes        
        setMapping(destination, source);        
        assertFilter(cms, destination, OpenCmsTestResourceFilter.FILTER_COPY_FOLDER);    
    }    
    
    /**
     * Tests the to copy a single resource to a destination that already exists but is
     * marked as deleted.<p>
     * 
     * @throws Exception if the test fails
     */
    public void testCopyOverwriteDeletedFile() throws Exception {

        CmsObject cms = getCmsObject();     
        echo("Testing overwriting a deleted file");

        cms.loginUser("test1", "test1");
        cms.getRequestContext().setCurrentProject(cms.readProject("testproject"));
        
        String source1 = "/folder1/page2.html";
        String source2 = "/folder1/image1.gif";
        String source3 = "/folder1/page3.html";
        String destination = "/folder1/page1.html";
           
        storeResources(cms, source1);   
        storeResources(cms, source2);   
        storeResources(cms, source3);   
        storeResources(cms, destination);   
        
        cms.lockResource(destination);
        
        // delete and owerwrite with a sibling of source 1
        cms.deleteResource(destination, CmsResource.DELETE_PRESERVE_SIBLINGS);   
        assertState(cms, destination, CmsResource.STATE_DELETED);
        
        cms.copyResource(source1, destination, CmsResource.COPY_AS_SIBLING); 
        
        assertState(cms, destination, CmsResource.STATE_CHANGED);
        assertSiblingCount(cms, destination, 2);
        assertLock(cms, destination, CmsLock.TYPE_EXCLUSIVE);
        
        assertSiblingCountIncremented(cms, source1, 1);
        assertLock(cms, source1, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        assertFilter(cms, source1, OpenCmsTestResourceFilter.FILTER_EXISTING_SIBLING);        
        assertFilter(cms, source1, destination, OpenCmsTestResourceFilter.FILTER_COPY_SOURCE_DESTINATION_AS_SIBLING);
        
        
        // delete again and owerwrite with a sibling of source 2
        cms.deleteResource(destination, CmsResource.DELETE_PRESERVE_SIBLINGS);
        assertState(cms, destination, CmsResource.STATE_DELETED);

        cms.copyResource(source2, destination, CmsResource.COPY_AS_SIBLING); 

        assertSiblingCountIncremented(cms, source1, 0);
        assertLock(cms, source1, CmsLock.TYPE_UNLOCKED);
        
        assertState(cms, destination, CmsResource.STATE_CHANGED);
        assertSiblingCount(cms, destination, 2);
        assertLock(cms, destination, CmsLock.TYPE_EXCLUSIVE);
        
        assertSiblingCountIncremented(cms, source2, 1);
        assertLock(cms, source2, CmsLock.TYPE_SHARED_EXCLUSIVE);
        
        assertFilter(cms, source1, OpenCmsTestResourceFilter.FILTER_UNDOCHANGES);        
        assertFilter(cms, source2, OpenCmsTestResourceFilter.FILTER_EXISTING_SIBLING);        
        assertFilter(cms, source2, destination, OpenCmsTestResourceFilter.FILTER_COPY_SOURCE_DESTINATION_AS_SIBLING);

        cms.deleteResource(destination, CmsResource.DELETE_PRESERVE_SIBLINGS);
        assertState(cms, destination, CmsResource.STATE_DELETED);

        // delete yet again and overwrite with content of source 3 (not a sibling)
        cms.copyResource(source3, destination, CmsResource.COPY_AS_NEW); 

        assertSiblingCountIncremented(cms, source1, 0);
        assertLock(cms, source1, CmsLock.TYPE_UNLOCKED);
        assertSiblingCountIncremented(cms, source2, 0);
        assertLock(cms, source2, CmsLock.TYPE_UNLOCKED);        
        
        assertState(cms, destination, CmsResource.STATE_CHANGED);
        assertSiblingCount(cms, destination, 1);
        assertSiblingCount(cms, source3, 1);
        assertLock(cms, destination, CmsLock.TYPE_EXCLUSIVE);
        
        assertFilter(cms, source1, OpenCmsTestResourceFilter.FILTER_UNDOCHANGES);        
        assertFilter(cms, source2, OpenCmsTestResourceFilter.FILTER_UNDOCHANGES);        
        assertFilter(cms, source3, OpenCmsTestResourceFilter.FILTER_EQUAL);        
        assertFilter(cms, source3, destination, OpenCmsTestResourceFilter.FILTER_COPY_FILE_AS_NEW);            
    }  
        
    /**
     * Tests the "copy a folder as new" operation.<p>
     * 
     * @throws Exception if the test fails
     */
    public void testCopyFolderAsNew() throws Exception {

        CmsObject cms = getCmsObject();     
        echo("Testing copy of a folder as new (i.e. no siblings)");
        
        cms.loginUser("test1", "test1");
        cms.getRequestContext().setCurrentProject(cms.readProject("testproject"));
        
        String source = "/folder2/";
        String destination = "/folder2_copy/";
        long timestamp = System.currentTimeMillis();
        
        storeResources(cms, source);        
        cms.copyResource(source, destination, CmsResource.COPY_AS_NEW);

        List subresources;
        Iterator i;
        
        subresources = getSubtree(cms, source);
        
        // iterate through the subresources
        i = subresources.iterator();
        while (i.hasNext()) {
            CmsResource res = (CmsResource)i.next();
            String resName = cms.getSitePath(res);
            assertFilter(cms, resName, OpenCmsTestResourceFilter.FILTER_EQUAL);
        }     
        
        subresources = getSubtree(cms, destination);
        setMapping(destination, source);    
        
        // prepare filter without sibling count
        OpenCmsTestResourceConfigurableFilter filter =
            new OpenCmsTestResourceConfigurableFilter(OpenCmsTestResourceFilter.FILTER_COPY_FOLDER);

        filter.disableSiblingCountTest();        
        
        // iterate through the subresources
        i = subresources.iterator();
        while (i.hasNext()) {
            CmsResource res = (CmsResource)i.next();
            String resName = cms.getSitePath(res);
            
            // project must be current project
            assertProject(cms, resName, cms.getRequestContext().currentProject());
            // state must be "new"
            assertState(cms, resName, CmsResource.STATE_NEW);
            // date created must be new
            assertDateCreatedAfter(cms, resName, timestamp);
            // user created must be current user
            assertUserCreated(cms, resName, cms.getRequestContext().currentUser());
            // assert lock state
            assertLock(cms, resName);
            // must have sibling count of 1
            assertSiblingCount(cms, resName, 1);
            // now assert the filter for the rest of the attributes            
            assertFilter(cms, resName, filter);  
        }                        
    }      
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产91久久久久久一区二区| 91麻豆精品国产自产在线 | 欧美日韩高清在线播放| 韩国三级中文字幕hd久久精品| 中文字幕一区二区三区av| 欧美一卡二卡在线| 一本大道av一区二区在线播放| 精品无码三级在线观看视频| 亚洲国产aⅴ天堂久久| 国产精品三级久久久久三级| 精品毛片乱码1区2区3区 | 日韩精品最新网址| 欧日韩精品视频| 成人性视频免费网站| 九九精品一区二区| 日韩av网站在线观看| 亚洲一区二区在线观看视频 | 久久噜噜亚洲综合| 日韩一区二区影院| 欧美日韩高清不卡| 在线观看日产精品| 99九九99九九九视频精品| 国产成人精品免费在线| 国产在线视频精品一区| 毛片av一区二区| 青青青伊人色综合久久| 日韩精品三区四区| 五月天婷婷综合| 亚洲成人一区在线| 亚洲电影一区二区三区| 一区二区三区中文字幕精品精品| 中文字幕永久在线不卡| 国产精品久久久久一区| 中文文精品字幕一区二区| 欧美激情在线观看视频免费| 2021久久国产精品不只是精品| 日韩欧美高清在线| 日韩视频在线永久播放| 欧美成人精品高清在线播放| 精品国产一区二区三区忘忧草| 日韩午夜激情视频| 精品播放一区二区| 国产婷婷精品av在线| 中文一区二区在线观看| 国产精品高潮呻吟| 亚洲欧美日韩成人高清在线一区| 亚洲欧美另类久久久精品 | 国模少妇一区二区三区| 韩国av一区二区三区四区| 国产精品一区二区在线看| 成人一级黄色片| 一本一本大道香蕉久在线精品| 91久久香蕉国产日韩欧美9色| 在线看一区二区| 欧美日韩国产系列| 欧美大黄免费观看| 久久精品亚洲麻豆av一区二区 | 91精品国产综合久久久久久久久久| 欧美日本在线看| 欧美va天堂va视频va在线| 国产欧美日韩中文久久| 亚洲精品视频在线| 视频一区二区中文字幕| 国产老肥熟一区二区三区| 97精品超碰一区二区三区| 欧美色欧美亚洲另类二区| 欧美一级xxx| 国产精品久久久久久久裸模 | 久久99精品久久久久久国产越南| 国产丶欧美丶日本不卡视频| 91亚洲午夜精品久久久久久| 欧美日韩你懂得| 欧美精品一区二区三区高清aⅴ| 2024国产精品| 中文字幕亚洲精品在线观看 | 69堂国产成人免费视频| 日韩午夜电影在线观看| 国产欧美综合色| 一区二区成人在线| 欧美aaa在线| 成人性生交大片免费看中文网站| 成人sese在线| 欧美一区二区三区影视| 国产日韩欧美精品在线| 一区二区成人在线| 日本不卡高清视频| 懂色av中文字幕一区二区三区| 福利一区二区在线观看| 在线国产亚洲欧美| 欧美电影免费观看完整版| 亚洲乱码日产精品bd| 日韩国产欧美在线观看| 成人精品亚洲人成在线| 欧美剧情片在线观看| 国产喂奶挤奶一区二区三区| 亚洲制服丝袜av| 国产麻豆成人传媒免费观看| 在线不卡一区二区| 欧美激情一区二区三区不卡 | 色94色欧美sute亚洲13| 久久蜜臀精品av| 亚洲黄色小视频| 精品一区二区久久久| 色婷婷精品大在线视频| 欧美日韩国产首页| 欧美高清在线视频| 亚洲成人福利片| 成人午夜免费视频| 日韩一区二区在线观看| 亚洲精品国产第一综合99久久 | 一区二区成人在线观看| 国产美女精品在线| 91精品国产免费久久综合| 国产精品欧美久久久久无广告| 日本三级亚洲精品| 欧美日韩一区二区三区高清| 亚洲国产精品国自产拍av| 日韩精品午夜视频| 91高清在线观看| 国产精品蜜臀av| 国内精品久久久久影院薰衣草| 欧美视频日韩视频| 亚洲精品中文在线观看| 成人永久免费视频| 久久综合色鬼综合色| 日一区二区三区| 91久久奴性调教| 亚洲美女在线国产| 色999日韩国产欧美一区二区| 中文字幕欧美日韩一区| 精品亚洲porn| 欧美一区二区三区免费在线看| 一区二区三区在线视频播放| 高清不卡一区二区| 国产天堂亚洲国产碰碰| 国产91精品露脸国语对白| 日韩欧美区一区二| 免费在线成人网| 91精品国产福利| 偷拍一区二区三区| 欧美日韩在线精品一区二区三区激情| 爽好久久久欧美精品| 777xxx欧美| 日本中文字幕不卡| 6080国产精品一区二区| 国产黄色精品网站| 欧美大白屁股肥臀xxxxxx| 日本sm残虐另类| 欧美一区二区三区性视频| 有码一区二区三区| 日本电影欧美片| 同产精品九九九| 欧美一区二区日韩| 加勒比av一区二区| 久久久.com| 国产99精品视频| 国产亚洲人成网站| 91网站黄www| 一区二区三区四区视频精品免费 | 色哟哟在线观看一区二区三区| 国产精品亲子乱子伦xxxx裸| 91同城在线观看| 亚洲精品日韩一| 在线观看免费成人| 中文字幕在线一区| 在线观看亚洲一区| 午夜欧美一区二区三区在线播放| 欧美午夜一区二区| 日韩激情一区二区| 26uuu国产在线精品一区二区| 国产馆精品极品| 亚洲欧美在线视频观看| 欧洲生活片亚洲生活在线观看| 天天综合天天做天天综合| 精品成a人在线观看| 国内一区二区视频| 洋洋成人永久网站入口| 欧美精品粉嫩高潮一区二区| 极品少妇xxxx精品少妇偷拍| 国产精品热久久久久夜色精品三区| 99国产精品视频免费观看| 亚洲国产视频直播| 久久久国产午夜精品| 色域天天综合网| 日本aⅴ免费视频一区二区三区 | 亚洲乱码国产乱码精品精98午夜| 91成人免费网站| 国产精品亚洲视频| 一区二区三区成人| 精品美女在线观看| 91久久精品网| 精品一区二区久久久| **性色生活片久久毛片| 9191国产精品| 99久久精品免费精品国产| 秋霞午夜鲁丝一区二区老狼| 国产精品国产三级国产aⅴ入口| 欧美在线播放高清精品| 成人天堂资源www在线| 日韩精品成人一区二区三区|