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

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

?? multipartboundaryinputstreamtest.java

?? struts的源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號(hào):
/*
 * \$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
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91福利社在线观看| 波多野结衣一区二区三区| 在线欧美日韩国产| 日韩精品一二三四| 日韩亚洲欧美高清| 韩日精品视频一区| 国产精品福利电影一区二区三区四区| 欧美区视频在线观看| 免费高清不卡av| 亚洲区小说区图片区qvod| 欧美日韩中字一区| 成人一区二区三区中文字幕| 亚洲欧美二区三区| 日韩欧美一区二区三区在线| 裸体健美xxxx欧美裸体表演| 日韩一区有码在线| 欧美成人猛片aaaaaaa| 色综合久久中文字幕综合网| 国产九色精品成人porny | 日本成人在线网站| 国产精品久久久久国产精品日日| 91精品国产91久久久久久最新毛片| 高清成人在线观看| 久久精品久久久精品美女| 国产精品情趣视频| 欧美二区三区91| 91在线精品一区二区三区| 国产伦精品一区二区三区在线观看| 亚洲综合色区另类av| 亚洲综合一区二区精品导航| 综合分类小说区另类春色亚洲小说欧美| 精品国免费一区二区三区| 日韩午夜在线播放| 精品国产乱码久久久久久夜甘婷婷 | 国产精品自拍一区| 亚洲女与黑人做爰| 亚洲影视资源网| 亚洲一级片在线观看| 视频一区在线视频| 久久国产欧美日韩精品| 狠狠色伊人亚洲综合成人| 国产精品一区二区三区乱码| 丁香桃色午夜亚洲一区二区三区| 国产**成人网毛片九色 | 欧美精品一二三区| 日韩欧美国产一区二区三区| 国产欧美日韩不卡免费| 亚洲综合色自拍一区| 国产一区二区三区不卡在线观看 | 亚洲女人小视频在线观看| 日本美女一区二区| 久草在线在线精品观看| 色综合咪咪久久| 久久免费电影网| 日韩av不卡在线观看| 91在线观看高清| 国产欧美日韩亚州综合| 日韩av一区二区三区四区| 91国内精品野花午夜精品| 欧美高清在线视频| 成人美女视频在线观看18| 欧美韩国日本一区| 丁香婷婷综合网| 国产精品久久久久久久久动漫 | 亚洲成人自拍一区| 色94色欧美sute亚洲线路二| 中文字幕一区二区三中文字幕| 精品无人区卡一卡二卡三乱码免费卡 | 色综合久久久久久久久久久| 亚洲黄色av一区| 久久综合av免费| 中文字幕一区二区三区蜜月| 一区二区日韩av| 国产99精品视频| 欧美成人欧美edvon| 久久精品噜噜噜成人av农村| av在线不卡电影| 中文字幕第一区综合| 免费在线成人网| 91一区二区三区在线观看| 成人高清av在线| 欧美日韩一区不卡| 日韩欧美精品三级| 丝瓜av网站精品一区二区| 91免费小视频| 一区二区三区在线播放| 成人av电影在线播放| 中文字幕亚洲在| 久久电影网站中文字幕| 欧美久久一二区| 国产夜色精品一区二区av| 激情综合网av| 久久亚洲影视婷婷| 波多野结衣中文一区| 亚洲美腿欧美偷拍| 欧美无乱码久久久免费午夜一区| 亚洲免费伊人电影| 欧美福利电影网| 免费观看在线综合| 中文字幕高清一区| 欧美影院一区二区| 美国av一区二区| 国产人成亚洲第一网站在线播放| 色国产综合视频| 国精产品一区一区三区mba桃花 | 综合久久久久综合| 欧美日韩综合不卡| 免费观看久久久4p| 中文字幕欧美一区| 日韩欧美一区在线观看| 欧美人与z0zoxxxx视频| 国产大陆精品国产| 亚洲第一成年网| 中文字幕一区二区三区精华液| 91精品办公室少妇高潮对白| 国产99久久久国产精品潘金网站| 国产精品久久久久影院老司 | 欧美在线影院一区二区| 国产另类ts人妖一区二区| 日本中文在线一区| 亚洲风情在线资源站| 正在播放一区二区| 成人午夜私人影院| 精品在线免费观看| 激情综合五月天| 国产福利91精品一区二区三区| 日韩经典中文字幕一区| 亚洲aⅴ怡春院| 亚洲va欧美va国产va天堂影院| 亚洲欧美一区二区三区国产精品 | 精品国偷自产国产一区| www.综合网.com| 国产在线精品一区二区不卡了| 天堂在线一区二区| 国产精品视频yy9299一区| 日本一区二区电影| 国产欧美日韩激情| 一区二区三区中文字幕电影| 国产精品国产精品国产专区不片| 国产精品久久久久久久蜜臀| 国产亚洲成年网址在线观看| 日本一区二区在线不卡| 国产精品免费免费| 国产日韩精品一区二区三区| 亚洲女厕所小便bbb| 免费在线欧美视频| 日本不卡视频一二三区| 久久久久久久综合色一本| 日韩一区二区电影网| 在线观看网站黄不卡| 国产精品一区二区果冻传媒| 久久成人免费网| 欧美日韩国产乱码电影| 日韩精品一二三| 欧美日韩国产区一| 久久精品国产亚洲a| 成人一区二区视频| 亚洲欧美色图小说| 亚洲线精品一区二区三区八戒| 精品一区二区三区免费毛片爱| 国产精品自拍网站| 91精品国产麻豆国产自产在线| 亚洲视频电影在线| 国产精品自拍av| 久久九九国产精品| 一区二区欧美国产| 婷婷成人激情在线网| 琪琪久久久久日韩精品| 色狠狠av一区二区三区| 亚洲欧洲成人精品av97| 日韩影院免费视频| 欧美日韩成人综合天天影院 | 国产一区二区三区av电影| 日本欧美一区二区三区| 麻豆成人在线观看| 精品av久久707| 国产·精品毛片| 欧美日韩一区二区电影| 一区二区三区在线视频免费| 欧美一区二区三区四区视频| 精品一区二区三区免费播放| 欧美草草影院在线视频| 成人性生交大片免费看中文| 亚洲一区二区在线播放相泽| 精品99久久久久久| 成人性视频免费网站| 亚洲第一综合色| 国产精品视频第一区| 欧美日韩国产高清一区二区| 成人小视频在线| 久久99精品一区二区三区 | 国产亚洲一区二区在线观看| 91网站黄www| 精品写真视频在线观看| 五月婷婷综合网| 国产精品欧美综合在线| 91麻豆精品91久久久久久清纯| 91在线无精精品入口| 久久不见久久见免费视频1| 日本aⅴ免费视频一区二区三区 |