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

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

?? multipartboundaryinputstreamtest.java

?? struts的源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * \$Header\$
 * \$Rev: 54929 $
 * \$Date\$
 *
 * Copyright 2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.struts.upload;

import junit.framework.TestCase;

import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;

/**
 * This is a unit test for the MultipartBoundaryInputStream class.
 */
public class MultipartBoundaryInputStreamTest extends TestCase
{
    public static final String DISPOSITION_FORM_DATA = "form-data";

    public static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain";

    /**
     * The resource with a single multipart element with a single final boundary.
     */
    public static final String RESOURCE_SINGLE_TEXT_ELEMENT = "/org/apache/struts/upload/resources/multipart-single-text-element.txt";

    /**
     * The resource with two multipart elements with two boundaries.
     */
    public static final String RESOURCE_TWO_TEXT_ELEMENT = "/org/apache/struts/upload/resources/multipart-two-text-element.txt";

    /**
     * The resource with three multipart elements, two text one file.
     */
    public static final String RESOURCE_THREE_MIXED_ELEMENT = "/org/apache/struts/upload/resources/multipart-three-mixed-element.txt";

    /**
     * The resource with three multipart elements, the first with alot of newlines.
     */
    public static final String RESOURCE_THREE_MIXED_NEWLINES = "/org/apache/struts/upload/resources/multipart-three-mixed-newline.txt";

    /**
     * The resource with a problem.
     */
    public static final String RESOURCE_PROBLEM1 = "/org/apache/struts/upload/resources/multipart-problem1.txt";

    public static final String RESOURCE_PROBLEM2 = "/org/apache/struts/upload/resources/multipart-problem2.txt";

    public static final String RESOURCE_PROBLEM3 = "/org/apache/struts/upload/resources/multipart-problem3.txt";



    /**
     * The resource with file data of 5400 bytes.
     */
    public static final String RESOURCE_5400B = "/org/apache/struts/upload/resources/multipart-file-element-5400b.txt";

    /**
     * The resource to compare the newline data with.
     */
    public static final String RESOURCE_NEWLINES = "/org/apache/struts/upload/resources/multipart-file-element-newlines.txt";

    /**
     * The resource that is the value of problem1.
     */
    public static final String RESOURCE_DESIRED_PROBLEM1 = "/org/apache/struts/upload/resources/multipart-file-element-problem1.txt";

    public static final String RESOURCE_DESIRED_PROBLEM2 = "/org/apache/struts/upload/resources/multipart-file-element-problem2.txt";

    public static final String RESOURCE_DESIRED_PROBLEM3 = "/org/apache/struts/upload/resources/multipart-file-element-problem3.txt";

    /**
     * The boundary for the single multipart element resource.
     */
    public static final String BOUNDARY_SINGLE_TEXT_ELEMENT = "x9F38FJJ";

    /**
     * The boundary for the two multipart element resource.
     */
    public static final String BOUNDARY_TWO_TEXT_ELEMENT = "----------x9F38FJJ339502";

    /**
     * The boundary for problem1.
     */
    public static final String BOUNDARY_PROBLEM1 = "---------------------------63341846741";

    public static final String BOUNDARY_PROBLEM2 = "---------------------------7d21fed3c0352";

    public static final String BOUNDARY_PROBLEM3 = "---------------------------7d21cb2b102cc";

    /**
     * The boundary for the three multipart element resource.
     */
    public static final String BOUNDARY_THREE_TEXT_ELEMENT = "----------g320nnjJJF32AA666FF";

    public static final String NAME_SINGLE_TEXT_ELEMENT = "testData";

    public static final String NAME_TWO_TEXT_ELEMENT_1 = "testData1";

    public static final String NAME_TWO_TEXT_ELEMENT_2 = "testData2";

    public static final String NAME_THREE_MIXED_ELEMENT_1 = "testFile1";

    public static final String NAME_THREE_MIXED_ELEMENT_2 = "testData1";

    public static final String NAME_THREE_MIXED_ELEMENT_3 = "testData2";

    public static final String NAME_PROBLEM1_1 = "theText";

    public static final String NAME_PROBLEM1_2 = "theFile";

    public static final String NAME_PROBLEM1_3 = "writeFile";

    public static final String NAME_PROBLEM1_4 = "filePath";

    public static final String NAME_PROBLEM1_5 = "submit";

    /**
     * The expected value of the element.
     */
    public static final String DESIRED_SINGLE_TEXT_ELEMENT = "this is test data";

    /**
     * The expected value of the element.
     */
    public static final String DESIRED_TEST_DATA_1 = "this is test data 1";

    /**
     * The expected value of the element.
     */
    public static final String DESIRED_TEST_DATA_2 = "this is test data 2";

    /**
     * The InputStream to single test data.
     */
    protected InputStream singleTextElementDataStream;

    /**
     * The InputStream to test two element data.
     */
    protected InputStream twoTextElementDataStream;

    /**
     * The InputStream to test three element mixed data.
     */
    protected InputStream threeMixedElementDataStream;

    /**
     * The InputStream to the multipart request with all the newlines.
     */
    protected InputStream newlinesDataStream;

    /**
     * The InputStream to the 5400 byte test file.
     */
    protected InputStream testFile5400bDataStream;

    /**
     * The InputStream to the problem1 test file.
     */
    protected InputStream testFileProblem1;

    protected InputStream testFileProblem2;

    protected InputStream testFileProblem3;

    /**
     * The InputStream to the file with alot of newlines.
     */
    protected InputStream testFileNewlines;

    /**
     * The InputStream to the file with a problem.
     */
    protected InputStream testProblem1;

    protected InputStream testProblem2;

    protected InputStream testProblem3;

    /**
     *
     *                   //  \\
     *                  ((   ''
     *                   \\__,
     *                  /6 (%)\,
     *                 (__/:";,;\--____----_
     *                  ;; :';,:';`;,';,;';`,`_
     *                    ;:,;;';';,;':,';';,-Y\
     *                     ;,;,;';';,;':;';'; Z/
     *                     / ;,';';,;';,;';;'
     *                    / / |';/~~~~~\';;'
     *                   ( K  | |      || |
     *                    \_\ | |      || |
     *                     \Z | |      || |
     *                        L_|      LL_|
     *                        LW/      LLW/
     */
    public MultipartBoundaryInputStreamTest(String name)
    {
        super(name);
    }

    protected void setUp() throws Exception
    {
        super.setUp();

        this.singleTextElementDataStream = this.getClass().getResourceAsStream(RESOURCE_SINGLE_TEXT_ELEMENT);
        if (this.singleTextElementDataStream == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_SINGLE_TEXT_ELEMENT);
        }
        this.twoTextElementDataStream    = this.getClass().getResourceAsStream(RESOURCE_TWO_TEXT_ELEMENT);
        if (this.twoTextElementDataStream == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_TWO_TEXT_ELEMENT);
        }
        this.threeMixedElementDataStream = this.getClass().getResourceAsStream(RESOURCE_THREE_MIXED_ELEMENT);
        if (this.threeMixedElementDataStream == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_THREE_MIXED_ELEMENT);
        }
        this.newlinesDataStream = this.getClass().getResourceAsStream(RESOURCE_THREE_MIXED_NEWLINES);
        if (this.newlinesDataStream == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_THREE_MIXED_NEWLINES);
        }
        this.testFile5400bDataStream = this.getClass().getResourceAsStream(RESOURCE_5400B);
        if (this.testFile5400bDataStream == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_5400B);
        }
        this.testFileNewlines = this.getClass().getResourceAsStream(RESOURCE_NEWLINES);
        if (this.testFileNewlines == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_NEWLINES);
        }
        this.testFileProblem1 = this.getClass().getResourceAsStream(RESOURCE_DESIRED_PROBLEM1);
        if (this.testFileProblem1 == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_DESIRED_PROBLEM1);
        }
        this.testFileProblem2 = this.getClass().getResourceAsStream(RESOURCE_DESIRED_PROBLEM2);
        if (this.testFileProblem2 == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_DESIRED_PROBLEM2);
        }
        this.testFileProblem3 = this.getClass().getResourceAsStream(RESOURCE_DESIRED_PROBLEM3);
        if (this.testFileProblem3 == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_DESIRED_PROBLEM3);
        }
        this.testProblem1 = this.getClass().getResourceAsStream(RESOURCE_PROBLEM1);
        if (this.testProblem1 == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_PROBLEM1);
        }
        this.testProblem2 = this.getClass().getResourceAsStream(RESOURCE_PROBLEM2);
        if (this.testProblem2 == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_PROBLEM2);
        }
        this.testProblem3 = this.getClass().getResourceAsStream(RESOURCE_PROBLEM3);
        if (this.testProblem3 == null)
        {
            fail("Couldn't obtain resource " + RESOURCE_PROBLEM3);
        }
    }

    protected void tearDown() throws Exception
    {
        super.tearDown();

        this.singleTextElementDataStream = null;
        this.twoTextElementDataStream    = null;
        this.threeMixedElementDataStream = null;
        this.testFile5400bDataStream     = null;
        this.testFileNewlines            = null;
        this.testFileProblem1            = null;
        this.testProblem1                = null;
        this.testFileProblem2            = null;
        this.testProblem2                = null;
    }

    public void testSingleTextElementData() throws Exception
    {
        MultipartBoundaryInputStream inputStream = new MultipartBoundaryInputStream();
        inputStream.setBoundary(BOUNDARY_SINGLE_TEXT_ELEMENT);
        inputStream.setInputStream(this.singleTextElementDataStream);
        //get only element
        String resultData = streamToString(inputStream);
        assertEquals(DISPOSITION_FORM_DATA, inputStream.getElementContentDisposition());
        assertEquals(NAME_SINGLE_TEXT_ELEMENT, inputStream.getElementName());
        assertTrue(!inputStream.isElementFile());
        assertEquals(CONTENT_TYPE_TEXT_PLAIN, inputStream.getElementContentType());
        assertEquals(DESIRED_SINGLE_TEXT_ELEMENT, resultData);
        assertTrue(inputStream.isBoundaryEncountered());
        assertTrue(inputStream.isFinalBoundaryEncountered());
        assertTrue(inputStream.isEndOfStream());
    }

    public void testTwoTextElementData() throws Exception
    {
        MultipartBoundaryInputStream inputStream = new MultipartBoundaryInputStream();
        inputStream.setBoundary(BOUNDARY_TWO_TEXT_ELEMENT);
        inputStream.setInputStream(this.twoTextElementDataStream);

        //get first element
        String resultData = streamToString(inputStream);
        assertEquals(DISPOSITION_FORM_DATA, inputStream.getElementContentDisposition());
        assertEquals(NAME_TWO_TEXT_ELEMENT_1, inputStream.getElementName());
        assertTrue(!inputStream.isElementFile());
        assertEquals(CONTENT_TYPE_TEXT_PLAIN, inputStream.getElementContentType());
        assertTrue(inputStream.isBoundaryEncountered());
        assertEquals(DESIRED_TEST_DATA_1, resultData);

        //get second element
        inputStream.resetForNextBoundary();
        resultData = streamToString(inputStream);
        assertEquals(DESIRED_TEST_DATA_2, resultData);
        assertEquals(DISPOSITION_FORM_DATA, inputStream.getElementContentDisposition());
        assertEquals(NAME_TWO_TEXT_ELEMENT_2, inputStream.getElementName());
        assertEquals("utf-8", inputStream.getElementCharset());
        assertTrue(!inputStream.isElementFile());
        assertEquals("text/html", inputStream.getElementContentType());
        assertTrue(inputStream.isBoundaryEncountered());
        assertTrue(inputStream.isFinalBoundaryEncountered());
        assertTrue(inputStream.isEndOfStream());
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久91精品久久久久久秒播| 欧美在线高清视频| 国产精品蜜臀在线观看| 一本大道av伊人久久综合| 亚洲韩国精品一区| 日韩欧美电影一二三| 久久成人免费网| 久久精品久久99精品久久| 麻豆91在线播放| 欧美日韩国产成人在线免费| 婷婷六月综合网| 国产精品污www在线观看| 欧美日韩一区二区欧美激情| 精品一区二区三区免费观看| 精品一区二区三区久久| 欧美三级在线看| 自拍av一区二区三区| 国产一区二区不卡| 日韩一区二区三区电影| 亚洲一级二级在线| 亚洲日本免费电影| 国产福利一区在线观看| 国产日韩亚洲欧美综合| 成人一区二区三区| 日韩欧美中文字幕制服| 久久99久久99小草精品免视看| 欧美日韩中文另类| 香港成人在线视频| 69成人精品免费视频| 亚洲一区二区三区激情| 国产成人精品一区二区三区四区 | 欧美性猛片aaaaaaa做受| 欧美高清在线视频| 99久久免费视频.com| 亚洲一区欧美一区| 欧美另类videos死尸| 美国一区二区三区在线播放| 久久久久国产成人精品亚洲午夜| 美洲天堂一区二卡三卡四卡视频| 久久精品视频网| 欧美午夜电影一区| 国产精品18久久久久久久久久久久| 蜜臀久久99精品久久久画质超高清 | 国产在线播放一区三区四| 日韩三级伦理片妻子的秘密按摩| 懂色av中文字幕一区二区三区 | 日韩成人dvd| 国产91综合一区在线观看| 日韩欧美专区在线| 极品瑜伽女神91| 精品国产伦理网| 国内偷窥港台综合视频在线播放| 欧美tickling网站挠脚心| 久久爱www久久做| av成人老司机| 蜜桃av一区二区三区电影| 国产日本一区二区| 制服丝袜日韩国产| 国产成人精品亚洲777人妖 | 国产精品麻豆视频| 欧美日韩一区二区三区在线| 国产在线视视频有精品| 亚洲精品国产一区二区精华液 | 丁香亚洲综合激情啪啪综合| 亚洲免费在线看| 日韩久久免费av| 欧美精选一区二区| 99久久免费视频.com| 国产suv精品一区二区883| 琪琪一区二区三区| 亚洲免费在线播放| 中文字幕av在线一区二区三区| 91久久线看在观草草青青| 国产精品系列在线播放| 国产乱淫av一区二区三区 | 青青草国产成人av片免费| 蜜臀av一区二区在线免费观看| 韩国三级中文字幕hd久久精品| 91麻豆精东视频| 成人教育av在线| 亚洲一区二区免费视频| 亚洲欧美日韩成人高清在线一区| 欧美bbbbb| 51精品视频一区二区三区| 欧美一级久久久久久久大片| 韩国三级在线一区| 中文字幕在线观看一区| 欧美日韩一区二区三区视频| 国内精品久久久久影院薰衣草 | 成人免费毛片嘿嘿连载视频| 伊人婷婷欧美激情| 中文字幕亚洲在| 欧美日韩国产一级二级| 91麻豆精东视频| 一本高清dvd不卡在线观看| 欧美一区在线视频| 一本大道久久a久久综合| 欧美日韩黄色影视| 91.com视频| 欧美一区二区三区免费观看视频 | 欧美乱妇15p| 欧美一区二区三区在线看| 日韩免费电影网站| 国产精品免费免费| 亚洲精品五月天| 另类小说一区二区三区| 国产一区二区三区最好精华液| 粉嫩高潮美女一区二区三区| 99久久精品国产精品久久| 99精品桃花视频在线观看| 欧美色图激情小说| 久久综合视频网| 中文字幕欧美日本乱码一线二线| 国产精品国产三级国产aⅴ中文| 亚洲无人区一区| 国产成人av资源| 欧美午夜精品电影| 亚洲一区在线观看免费观看电影高清| 久久精品国产亚洲aⅴ| 欧美色国产精品| 亚洲激情自拍偷拍| 91丨九色丨黑人外教| 国产清纯在线一区二区www| 韩国视频一区二区| 国产日本欧洲亚洲| 樱花草国产18久久久久| 亚洲另类春色国产| 国产成人亚洲精品青草天美| 精品国产一区久久| 色综合久久综合| 一区二区三区**美女毛片| 色综合久久天天| 从欧美一区二区三区| 九九精品视频在线看| 亚洲成av人综合在线观看| 亚洲欧洲日韩综合一区二区| 久久这里只精品最新地址| 777xxx欧美| 91在线观看一区二区| 国产aⅴ精品一区二区三区色成熟| 亚洲视频在线一区观看| 成人a免费在线看| 久久理论电影网| 国产在线精品一区二区夜色 | 亚瑟在线精品视频| 91丨porny丨最新| 中文字幕va一区二区三区| 九色porny丨国产精品| 欧美一激情一区二区三区| 亚洲mv大片欧洲mv大片精品| 色婷婷综合久久久久中文 | 91污片在线观看| 日本一区二区三级电影在线观看| 免费成人性网站| 精品理论电影在线观看| 美女网站一区二区| 日韩精品一区二区三区视频在线观看 | 亚洲福利视频一区| 欧美日高清视频| 日韩av一区二| 2021国产精品久久精品| 久久99精品一区二区三区三区| 91精品在线免费观看| 亚洲最大色网站| 91麻豆精品91久久久久久清纯| 老司机精品视频导航| 亚洲亚洲精品在线观看| 国产精品久久夜| 91精品国产一区二区三区香蕉| 91亚洲国产成人精品一区二区三 | 中文字幕一区二区三区乱码在线| 国产精品18久久久久久久网站| 亚洲精品一区二区三区四区高清| 欧美午夜一区二区三区| 91精品国产高清一区二区三区蜜臀| 欧美日韩高清在线播放| 亚洲一区二区偷拍精品| 亚洲午夜激情网页| 天天综合色天天综合色h| 日本不卡视频在线| 国产精一品亚洲二区在线视频| 国产精品一二一区| 成人av在线电影| 在线视频欧美区| 欧美一区二区女人| 久久人人爽人人爽| 18涩涩午夜精品.www| 亚洲图片欧美综合| 中文字幕av一区 二区| 欧美影院一区二区三区| 精品影视av免费| 亚洲一区二区精品久久av| 日韩一区二区三区高清免费看看| 捆绑紧缚一区二区三区视频| 中文字幕不卡的av| 欧美精品一区男女天堂| 欧美日韩在线免费视频| 国产在线一区二区综合免费视频| 综合婷婷亚洲小说| 久久伊人中文字幕|