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

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

?? testpriorityresourcecollectors.java

?? cms是開源的框架
?? JAVA
字號:
/*
 * File   : $Source: /usr/local/cvs/opencms/test/org/opencms/file/TestPriorityResourceCollectors.java,v $
 * Date   : $Date: 2005/06/27 23:22:09 $
 * Version: $Revision: 1.5 $
 *
 * 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.collectors.CmsPriorityDateResourceComparator;
import org.opencms.file.collectors.CmsPriorityResourceCollector;
import org.opencms.file.collectors.I_CmsResourceCollector;
import org.opencms.file.types.CmsResourceTypeFolder;
import org.opencms.file.types.CmsResourceTypeJsp;
import org.opencms.file.types.CmsResourceTypePlain;
import org.opencms.main.CmsException;
import org.opencms.test.OpenCmsTestCase;
import org.opencms.test.OpenCmsTestProperties;

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

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

/**
 * Tests the priority resource collectors.<p>
 */
public class TestPriorityResourceCollectors extends OpenCmsTestCase {

    /**
     * Default JUnit constructor.<p>
     * 
     * @param arg0 JUnit parameters
     */    
    public TestPriorityResourceCollectors(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(TestPriorityResourceCollectors.class.getName());

        suite.addTest(new TestPriorityResourceCollectors("testCollectAllInFolderPriority"));
        suite.addTest(new TestPriorityResourceCollectors("testCollectAllInSubTreePriority"));
        
        TestSetup wrapper = new TestSetup(suite) {
            
            protected void setUp() {
                CmsObject cms = setupOpenCms(null, null, false);
                try {
                    initResources(cms);
                } catch (CmsException exc) {
                    fail(exc.getMessage());
                }  
            }
            
            protected void tearDown() {
                removeOpenCms();
            }
        };
        
        return wrapper;
    }     

    /**
     * Initializes the resources needed for the tests.<p>
     * 
     * @param cms the cms object
     * @throws CmsException if something goes wrong
     */
    public static void initResources(CmsObject cms) throws CmsException {
        
        List properties = new ArrayList(2);
        CmsProperty propPrio = new CmsProperty();
        propPrio.setName(CmsPriorityResourceCollector.PROPERTY_PRIORITY);
        CmsProperty propDate = new CmsProperty();
        propDate.setName(CmsPriorityDateResourceComparator.PROPERTY_DATE);
        
        long time = System.currentTimeMillis();
        
        // absolute priority order of the created files:
        // /folder1/sub1/file5, /file1, /folder1/file3, /folder1/file2, /folder1/file1, /folder1/file4 
    
        // create a file in the root directory              
        propPrio.setStructureValue("15");
        properties.add(propPrio);        
        propDate.setStructureValue("" + time);
        properties.add(propDate);
        CmsProperty.setAutoCreatePropertyDefinitions(properties, true);
        cms.createResource("/file1", CmsResourceTypePlain.getStaticTypeId(), null, properties);
        
        // create a folder in the root directory
        cms.createResource("/folder1", CmsResourceTypeFolder.getStaticTypeId());
        
        // create a file in the folder directory
        properties.clear();
        propPrio.setStructureValue("5");
        properties.add(propPrio);
        propDate.setStructureValue("" + (time + 20));
        properties.add(propDate);
        cms.createResource("/folder1/file1", CmsResourceTypePlain.getStaticTypeId(), null, properties);

        // create a file in the folder directory
        properties.clear();
        propPrio.setStructureValue("10");
        properties.add(propPrio);
        propDate.setStructureValue("" + time);
        properties.add(propDate);
        cms.createResource("/folder1/file2", CmsResourceTypePlain.getStaticTypeId(), null, properties);
        
        // create a file in the folder directory
        properties.clear();
        propPrio.setStructureValue("10");
        properties.add(propPrio);
        propDate.setStructureValue("" + (time + 10));
        properties.add(propDate);
        cms.createResource("/folder1/file3", CmsResourceTypePlain.getStaticTypeId(), null, properties);
        
        // create a file in the folder directory
        properties.clear();
        propPrio.setStructureValue("1");
        properties.add(propPrio);
        propDate.setStructureValue("" + (time + 30));
        properties.add(propDate);
        cms.createResource("/folder1/file4", CmsResourceTypePlain.getStaticTypeId(), null, properties);
        
        // create a file of other type in the folder directory
        properties.clear();
        propPrio.setStructureValue("10");
        properties.add(propPrio);
        propDate.setStructureValue("" + (time + 50));
        properties.add(propDate);
        cms.createResource("/folder1/fileJsp", CmsResourceTypeJsp.getStaticTypeId(), null, properties);
        
        // create a subfolder in the folder1 directory
        cms.createResource("/folder1/sub1", CmsResourceTypeFolder.getStaticTypeId());
        
        //create a file in the subfolder directory
        properties.clear();
        propPrio.setStructureValue("15");
        properties.add(propPrio);
        propDate.setStructureValue("" + time + 40);
        properties.add(propDate);
        cms.createResource("/folder1/sub1/file5", CmsResourceTypePlain.getStaticTypeId(), null, properties);
    }
    
    /**
     * Tests the "allInFolderPriorityDesc" resource collector.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testCollectAllInFolderPriority() throws Throwable {
        
        CmsObject cms = getCmsObject();
        int resTypeIdPlain = CmsResourceTypePlain.getStaticTypeId(); 
        echo("Testing allInFolderPriorityDateDesc resource collector");
        
        I_CmsResourceCollector collector = new CmsPriorityResourceCollector();
        List resources = collector.getResults(cms, "allInFolderPriorityDateDesc", "/folder1/|" + resTypeIdPlain + "|3");
        
        // assert that 3 files are returned
        assertEquals(3, resources.size());
        
        CmsResource res;
        
        // order descending determined by root path
        
        res = (CmsResource)resources.get(0);
        assertEquals("/sites/default/folder1/file3", res.getRootPath());
        
        res = (CmsResource)resources.get(1);
        assertEquals("/sites/default/folder1/file2", res.getRootPath()); 
        
        res = (CmsResource)resources.get(2);
        assertEquals("/sites/default/folder1/file1", res.getRootPath()); 
    }
    
    /**
     * Tests the "allInSubTreePriorityDesc" resource collector.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testCollectAllInSubTreePriority() throws Throwable {
        
        CmsObject cms = getCmsObject();
        int resTypeIdPlain = CmsResourceTypePlain.getStaticTypeId(); 
        echo("Testing allInSubTreePriorityDesc resource collector");
        
        I_CmsResourceCollector collector = new CmsPriorityResourceCollector();
        List resources = collector.getResults(cms, "allInSubTreePriorityDateDesc", "/|" + resTypeIdPlain + "|4");
        
        // assert that 4 files are returned
        assertEquals(4, resources.size());
        
        CmsResource res;
        
        // order descending determined by root path
        
        res = (CmsResource)resources.get(0);
        assertEquals("/sites/default/folder1/sub1/file5", res.getRootPath());
        
        res = (CmsResource)resources.get(1);
        assertEquals("/sites/default/file1", res.getRootPath()); 
        
        res = (CmsResource)resources.get(2);
        assertEquals("/sites/default/folder1/file3", res.getRootPath()); 
        
        res = (CmsResource)resources.get(3);
        assertEquals("/sites/default/folder1/file2", res.getRootPath());
        
        resources = collector.getResults(cms, "allInSubTreePriorityDateDesc", "/|1");
        
        // assert that all 6 plain files are returned
        assertEquals(6, resources.size());
        
        res = (CmsResource)resources.get(0);
        assertEquals("/sites/default/folder1/sub1/file5", res.getRootPath());
        
        res = (CmsResource)resources.get(5);
        assertEquals("/sites/default/folder1/file4", res.getRootPath());
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人高清伦理免费影院在线观看| 日本中文在线一区| 97超碰欧美中文字幕| 国产精品理论片在线观看| 成人av在线网站| 亚洲欧美日韩系列| 精品视频一区二区三区免费| 午夜精品福利一区二区三区av| 日韩一区二区三区免费观看| 狠狠色狠狠色合久久伊人| 久久综合视频网| www.av亚洲| 午夜久久久影院| 久久综合一区二区| caoporen国产精品视频| 亚洲第一会所有码转帖| 日韩免费在线观看| 成人久久视频在线观看| 一区二区三区国产| 日韩视频一区在线观看| 成人黄页在线观看| 亚洲bt欧美bt精品| 国产片一区二区三区| 91久久国产最好的精华液| 蜜桃精品视频在线观看| 国产精品久久久爽爽爽麻豆色哟哟 | 天天操天天色综合| 欧美不卡一区二区三区| 成人午夜视频网站| 日韩精品成人一区二区在线| 久久精品夜色噜噜亚洲aⅴ| 成人午夜伦理影院| 日韩精品乱码免费| 国产精品午夜电影| 日韩视频免费直播| 色综合天天综合网国产成人综合天 | 欧美国产欧美亚州国产日韩mv天天看完整| 成人在线视频首页| 性欧美疯狂xxxxbbbb| 国产精品免费视频一区| 日韩午夜av一区| 欧美日韩三级一区| 97精品久久久午夜一区二区三区 | 久久精品一区二区三区四区 | 欧美成人a在线| 在线亚洲一区观看| 成人性生交大合| 美国av一区二区| 亚洲午夜精品在线| 中文字幕一区二区三中文字幕| 日韩视频在线观看一区二区| 欧美中文字幕久久| 91亚洲精品久久久蜜桃网站| 激情深爱一区二区| 免费美女久久99| 亚洲成av人片在www色猫咪| 国产精品电影一区二区三区| 久久欧美一区二区| 欧美成人一区二区三区片免费 | 91免费国产在线观看| 国产成都精品91一区二区三| 美女视频黄a大片欧美| 亚洲成人自拍一区| 一级女性全黄久久生活片免费| 中文字幕欧美日韩一区| 久久久久久久久97黄色工厂| 日韩三级在线免费观看| 日韩欧美另类在线| 91精品国产91久久久久久最新毛片| 欧美色综合天天久久综合精品| 一本色道久久综合精品竹菊 | 欧美艳星brazzers| 欧美色窝79yyyycom| 91久久精品国产91性色tv| 日本久久一区二区三区| 91久久一区二区| 欧美色图一区二区三区| 欧美天天综合网| 欧美高清视频在线高清观看mv色露露十八 | 国产亚洲美州欧州综合国| 欧美一卡2卡3卡4卡| 91精品国产麻豆| 制服丝袜日韩国产| 日韩一区二区不卡| 久久久久久亚洲综合| 日本一区二区三区在线观看| 国产精品三级电影| 一区二区三区自拍| 日韩和的一区二区| 黄网站免费久久| 不卡av电影在线播放| 一本大道综合伊人精品热热| 欧美影院一区二区三区| 欧美色偷偷大香| 精品国产一区二区在线观看| 久久综合久久综合九色| 国产精品国产自产拍高清av| 亚洲免费在线看| 日韩不卡手机在线v区| 国产在线视视频有精品| 成人高清免费观看| 欧美日韩成人高清| 精品国产乱码久久久久久浪潮| 国产日本欧洲亚洲| 亚洲高清免费观看高清完整版在线观看 | 精品国产不卡一区二区三区| 亚洲精品一区二区三区影院| 欧美激情综合网| 亚洲影院久久精品| 国产一区二区伦理| 日本韩国精品一区二区在线观看| 欧美色精品天天在线观看视频| 91精品国产综合久久福利软件| 中文字幕免费一区| 图片区小说区区亚洲影院| 国产乱妇无码大片在线观看| 在线观看三级视频欧美| 精品电影一区二区三区| 一区二区三区四区不卡在线 | 国产精品亚洲第一| 欧美丝袜自拍制服另类| 久久久久久**毛片大全| 亚洲成a人v欧美综合天堂下载 | 91精品福利视频| 精品国产91亚洲一区二区三区婷婷 | 一本高清dvd不卡在线观看 | 99riav久久精品riav| 欧美精品aⅴ在线视频| 国产精品乱码一区二区三区软件| 日韩精彩视频在线观看| 91在线视频免费91| 久久免费国产精品 | 精品一区二区三区久久| 欧日韩精品视频| 国产欧美日韩三级| 日本大胆欧美人术艺术动态| 97久久超碰国产精品| 久久精品亚洲乱码伦伦中文| 日本欧美肥老太交大片| 欧美性videosxxxxx| 中文字幕一区二区不卡| 国产在线日韩欧美| 欧美疯狂性受xxxxx喷水图片| 国产精品美女久久久久久| 九九久久精品视频| 日韩欧美一区电影| 亚洲成av人片在线| 欧美色网站导航| 亚洲自拍偷拍图区| 91色视频在线| 国产精品入口麻豆原神| 国产精品18久久久| 26uuu精品一区二区| 日韩av电影天堂| 欧美人动与zoxxxx乱| 亚洲综合精品自拍| 在线视频亚洲一区| 一区二区三区美女| 一本大道久久a久久综合| 国产精品国产自产拍高清av| 成人免费毛片app| 中文字幕欧美国产| 波多野洁衣一区| 国产精品区一区二区三| 高清在线不卡av| 中文字幕第一区综合| 成人中文字幕电影| 国产精品每日更新在线播放网址 | 精品国产露脸精彩对白| 欧美a一区二区| 精品国产一区二区三区四区四| 毛片不卡一区二区| 欧美电视剧在线看免费| 久久99精品国产.久久久久久| 欧美成人一区二区三区| 国产精品美女久久久久av爽李琼| 久久超碰97中文字幕| 日韩区在线观看| 国内精品国产成人国产三级粉色| 亚洲精品一区二区三区精华液 | 成人a区在线观看| 亚洲色图在线播放| 在线观看网站黄不卡| 日本麻豆一区二区三区视频| 精品日韩在线一区| 国产不卡在线视频| 亚洲精品免费一二三区| 欧美日韩久久一区| 看电视剧不卡顿的网站| 久久综合色之久久综合| 99精品欧美一区二区三区综合在线| 亚洲视频图片小说| 欧美日韩高清在线| 韩国一区二区三区| 中文字幕一区二区三区四区不卡| 在线一区二区三区| 韩国成人福利片在线播放| 国产精品区一区二区三| 欧美日本国产视频| 国产精品一区二区无线|