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

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

?? testreadresource.java

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

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

/**
 * Unit test for the "readFileHeader" method of the CmsObject to test the release and expiration date.<p>
 * 
 * @author Michael Emmerich 
 * @version $Revision: 1.8 $
 */
public class TestReadResource extends OpenCmsTestCase {
  
    /**
     * Default JUnit constructor.<p>
     * 
     * @param arg0 JUnit parameters
     */    
    public TestReadResource(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(TestReadResource.class.getName());
        
        suite.addTest(new TestReadResource("testReadBeforeReleaseDate"));
        suite.addTest(new TestReadResource("testReadInValidTimeRange"));
        suite.addTest(new TestReadResource("testReadAfterExpirationDate"));
        suite.addTest(new TestReadResource("testReadBeforeReleaseDateIgnore"));
        suite.addTest(new TestReadResource("testReadInValidTimeRangeIgnore"));
        suite.addTest(new TestReadResource("testReadAfterExpirationDateIgnore"));
        
        TestSetup wrapper = new TestSetup(suite) {

            protected void setUp() {
                setupOpenCms("simpletest", "/sites/default/");                
            }
            
            protected void tearDown() {
                removeOpenCms();
            }
        };
        
        return wrapper;
    }       
    
    /**
     * Test readResource of a file before its release date.<p>
     * 
     * @param tc the OpenCmsTestCase
     * @param cms the CmsObject
     * @param resource1 the resource to touch
     * @param filter the filter to use
     * @throws Throwable if something goes wrong
     */
    public static void readBeforeReleaseDate(OpenCmsTestCase tc, CmsObject cms, String resource1, CmsResourceFilter filter) throws Throwable {            
              
        tc.storeResources(cms, resource1);
      
        // preperation, modify the release date
        CmsFile preperationRes = cms.readFile(resource1, CmsResourceFilter.ALL);
        // set the release date to one hour in the future
        preperationRes .setDateReleased(System.currentTimeMillis() + (60 * 60 *1000));
        
        cms.lockResource(resource1);        
        cms.writeFile(preperationRes);
        cms.unlockResource(resource1);
        
        // now try to access the resource
        try {
            cms.readResource(resource1, filter);
            if (!filter.includeDeleted()) {
                // the file could be read, despite the release date set in the future
                fail("Resource "+ resource1+ " could be read before release date");
            }               
        } catch (CmsException e) {
            if (filter.includeDeleted()) {
                fail("Resource "+ resource1+ " could not be read");
            }  
        }      
    }

    /**
     * Test readResource of a file after its expirationrelease date.<p>
     * 
     * @param tc the OpenCmsTestCase
     * @param cms the CmsObject
     * @param resource1 the resource to touch
     * @param filter the filter to use
     * @throws Throwable if something goes wrong
     */
    public static void readAfterExpirationDate(OpenCmsTestCase tc, CmsObject cms, String resource1, CmsResourceFilter filter) throws Throwable {            
              
        tc.storeResources(cms, resource1);
      
        // preperation, modify the expiration date
        CmsFile preperationRes = cms.readFile(resource1, CmsResourceFilter.ALL);
        // set the expiration date to one hour in the past
        preperationRes.setDateExpired(System.currentTimeMillis() - (60 * 60 *1000));

        cms.lockResource(resource1);          
        cms.writeFile(preperationRes);
        cms.unlockResource(resource1);          
        
        // now try to access the resource
        try {
            cms.readResource(resource1, filter);
            if (!filter.includeDeleted()) {
                // the file could be read, despite the expiration date was set to the past
                fail("Resource "+ resource1+ " could be read after the expiration date");
            }               
        } catch (CmsException e) {
            if (filter.includeDeleted()) {
                fail("Resource "+ resource1+ " could not be read");
            }  
        }      
    }
  
    /**
     * Test readResource of a file in its valid time range.<p>
     * 
     * @param tc the OpenCmsTestCase
     * @param cms the CmsObject
     * @param resource1 the resource to touch
     * @param filter the filter to use
     * @throws Throwable if something goes wrong
     */
    public static void readInValidTimeRange(OpenCmsTestCase tc, CmsObject cms, String resource1, CmsResourceFilter filter) throws Throwable {            
              
        tc.storeResources(cms, resource1);
      
        // preperation, modify the expiration date
        CmsFile preperationRes = cms.readFile(resource1, CmsResourceFilter.ALL);
        // set the release date to one hour in the future
        preperationRes.setDateReleased(System.currentTimeMillis()- (60 * 60 *1000));
        // set the expiration date to one hour in the past
        preperationRes.setDateExpired(System.currentTimeMillis() + (60 * 60 *1000));
        
        cms.lockResource(resource1);                  
        cms.writeFile(preperationRes);
        cms.unlockResource(resource1);          
        
        // now try to access the resource
        try {
            cms.readResource(resource1, filter);            
        } catch (CmsException e) {
                fail("Resource "+ resource1+ " could not be read");
        }      
    }
    
    /**
     * Test readResource of a file before its release date.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testReadBeforeReleaseDate() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing readFileHeader of a file before the release date");
        readBeforeReleaseDate(this, cms, "/folder1/page1.html", CmsResourceFilter.DEFAULT);
    }
    
    /**
     * Test readFileHeader of a file after its expiration date.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testReadAfterExpirationDate() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing readFileHeader of a file after the expiration date");
        readAfterExpirationDate(this, cms, "/folder1/page2.html", CmsResourceFilter.DEFAULT);
    }

    /**
     * Test readFileHeader of a file in its valid time range.<p>
     * 
     * @throws Throwable if something goes wrong
     */
    public void testReadInValidTimeRange() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing readFileHeader of a file in its valid time range");
        readInValidTimeRange(this, cms, "/folder1/page3.html", CmsResourceFilter.DEFAULT);
    }
    
    /**
     * Test readFileHeader of a file before its release date.<p>
     * The valid time range will be ignored.
     * 
     * @throws Throwable if something goes wrong
     */
    public void testReadBeforeReleaseDateIgnore() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing readFileHeader of a file before the release date, ignoring valid timerange");
        readBeforeReleaseDate(this, cms, "/folder1/page1.html", CmsResourceFilter.ALL);
    }
    
    /**
     * Test readFileHeader of a file after its expiration date.<p>
     * The valid time range will be ignored.
     * 
     * @throws Throwable if something goes wrong
     */
    public void testReadAfterExpirationDateIgnore() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing readFileHeader of a file after the expiration date, ignoring valid timerange");
        readAfterExpirationDate(this, cms, "/folder1/page2.html", CmsResourceFilter.ALL);
    }

    /**
     * Test readFileHeader of a file in its valid time range.<p>
     * The valid time range will be ignored.
     * 
     * @throws Throwable if something goes wrong
     */
    public void testReadInValidTimeRangeIgnore() throws Throwable {
        
        CmsObject cms = getCmsObject();
        echo("Testing readFileHeader of a file in its valid time range, ignoring valid timerange");
        readInValidTimeRange(this, cms, "/folder1/page3.html", CmsResourceFilter.ALL);
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区av| 久久久精品国产免大香伊| 成人app网站| 成人午夜看片网址| 成人美女视频在线观看| 国产成人综合在线| 国产在线播放一区三区四| 久久99九九99精品| 国产一区二区91| 不卡av在线网| 欧美在线999| 欧美日韩精品一区二区三区| 欧美男同性恋视频网站| 欧美欧美午夜aⅴ在线观看| 日韩欧美国产综合| 久久久亚洲精华液精华液精华液| 欧美v日韩v国产v| 国产欧美日韩在线观看| 欧美国产日韩亚洲一区| 国产精品久久午夜| 夜夜亚洲天天久久| 久久99精品久久久久久久久久久久| 国精产品一区一区三区mba视频| 国产成人在线视频网址| 色综合久久久久久久久久久| 欧美精品第1页| 久久久91精品国产一区二区精品| 综合电影一区二区三区| 亚洲va国产va欧美va观看| 久久精品国产精品亚洲红杏 | 欧美色图在线观看| 日韩丝袜情趣美女图片| 国产精品国产三级国产| 午夜久久久久久久久| 国产高清精品在线| 欧美四级电影在线观看| 久久精品亚洲精品国产欧美| 亚洲午夜免费福利视频| 国产成人综合在线播放| 欧美日韩国产一区二区三区地区| 久久先锋影音av鲁色资源| 亚洲激情图片小说视频| 国产麻豆日韩欧美久久| 在线观看日产精品| 国产三级欧美三级日产三级99| 亚洲免费毛片网站| 国产精品系列在线观看| 欧美日韩国产乱码电影| 中文字幕一区二区三区在线观看| 久久精品久久精品| 91麻豆精品91久久久久久清纯 | 一二三区精品视频| 国产福利一区二区三区在线视频| 欧美日韩中字一区| 中文字幕中文字幕一区| 国产精品69毛片高清亚洲| 337p亚洲精品色噜噜噜| 一区二区三区免费| www.色综合.com| 欧美成va人片在线观看| 三级亚洲高清视频| 欧美亚洲国产bt| 有码一区二区三区| 97久久超碰精品国产| 亚洲国产高清aⅴ视频| 国产一区二区三区四| 日韩欧美激情四射| 精品一区二区三区在线观看国产| 欧美日韩一区在线观看| 亚洲国产欧美另类丝袜| 91久久精品一区二区三| 成人欧美一区二区三区1314| proumb性欧美在线观看| 国产精品久久久一区麻豆最新章节| 国产精品综合一区二区三区| 精品久久人人做人人爰| 激情综合亚洲精品| 久久亚洲综合色| 国产精品资源在线| 国产亚洲成aⅴ人片在线观看| 国产毛片精品一区| 国产亚洲一二三区| 成人av在线网| 亚洲激情第一区| 欧美日韩国产综合一区二区| 亚洲一区二区三区在线| 91精品国产综合久久久久久久| 天堂蜜桃91精品| 久久青草国产手机看片福利盒子| 国产一区二区主播在线| 国产无遮挡一区二区三区毛片日本| 国产在线精品免费av| 国产精品乱码妇女bbbb| 色婷婷综合久久久中文字幕| 亚洲一区二区精品视频| 欧美成人一区二区三区| 国产suv精品一区二区6| 亚洲综合激情另类小说区| 欧美日韩国产首页在线观看| 视频一区在线播放| 欧美韩国一区二区| 欧美日韩在线一区二区| 久久精品国产成人一区二区三区 | 中文字幕不卡一区| 色婷婷激情一区二区三区| 亚洲成人动漫av| 久久亚洲私人国产精品va媚药| 成人开心网精品视频| 亚洲成国产人片在线观看| 久久免费午夜影院| 欧美亚洲高清一区| 粉嫩在线一区二区三区视频| 亚洲一二三四区不卡| 欧美精品一区二区在线播放| 91色在线porny| 国内精品国产成人| 午夜精品爽啪视频| 中文在线免费一区三区高中清不卡| 欧美性生活一区| 丁香婷婷综合激情五月色| 亚洲电影第三页| 国产精品久久久久久久久免费相片| 欧美顶级少妇做爰| 91在线视频观看| 国产成人激情av| 日本成人在线网站| 亚洲午夜电影在线观看| 中文字幕一区二区三中文字幕| 精品国产sm最大网站免费看| 欧美性大战久久| 不卡的av电影| 国产99久久久国产精品潘金| 午夜精品成人在线| 亚洲在线中文字幕| 中文字幕一区二区视频| 久久精品男人天堂av| 日韩一区二区麻豆国产| 欧美性大战久久久| 91视频免费观看| 99精品久久99久久久久| 国产宾馆实践打屁股91| 国产乱子伦视频一区二区三区| 视频一区在线播放| 日产国产欧美视频一区精品| 夜夜嗨av一区二区三区网页 | 欧美日韩国产首页在线观看| 成人免费精品视频| 国产一区三区三区| 韩国一区二区在线观看| 日本不卡一二三| 日韩激情视频在线观看| 亚洲成av人片www| 亚洲成人av福利| 亚洲成a人v欧美综合天堂| 中文av一区二区| 国产精品三级av| 国产精品久久久久久久久久久免费看 | 国产精品伦理在线| 国产精品国产三级国产aⅴ原创 | 国产三级精品在线| 国产视频一区二区在线| 国产精品伦理在线| 亚洲国产一区二区视频| 三级在线观看一区二区| 蜜臀久久99精品久久久久宅男| 免费观看一级欧美片| 久久99精品久久久久久久久久久久| 国产九色精品成人porny| 国产成人精品在线看| 91老司机福利 在线| 欧美日韩在线一区二区| 欧美精品一区视频| 综合av第一页| 免费在线一区观看| 粉嫩av一区二区三区| 99re视频这里只有精品| 欧美精品三级日韩久久| 精品国产一区二区三区久久影院 | 欧美高清你懂得| 精品国产三级a在线观看| 亚洲国产精品精华液2区45| 一区二区理论电影在线观看| 免费成人美女在线观看.| 成人伦理片在线| 欧美一卡二卡在线观看| 中文字幕免费不卡在线| 日韩精品91亚洲二区在线观看| 国产高清无密码一区二区三区| 91亚洲精品乱码久久久久久蜜桃 | 欧美激情一区二区三区全黄| 亚洲免费视频中文字幕| 久久国产剧场电影| 一本色道久久综合亚洲精品按摩| 欧美一级黄色录像| 一区二区三区蜜桃网| 懂色av一区二区在线播放| 91精品国产乱码久久蜜臀| 国产精品久久久久四虎| 激情av综合网| 欧美精品丝袜中出|