Class TestUploadFileHandle

java.lang.Object
org.iplass.mtp.test.TestUploadFileHandle
All Implemented Interfaces:
UploadFileHandle

public class TestUploadFileHandle
extends java.lang.Object
implements UploadFileHandle
テスト時に利用可能なUploadFileHandleの実装です。 アップロードファイルを伴うテストの場合に、 TestRequestContext.setParam(String, Object)にてセットします。
  • Constructor Summary

    Constructors 
    Constructor Description
    TestUploadFileHandle​(java.io.File tempFile, java.lang.String fileName, java.lang.String type)
    指定のtempFileで指定されるファイルにてTestUploadFileHandleを生成します。
    TestUploadFileHandle​(java.lang.String fileName, java.lang.String type, long size, boolean isSizeOver)
    アップロードされたファイルがサイズオーバーであった場合を想定したテストの場合、当コンストラクタを利用し、 isSizeOverがtrueの状態のUploadFileHandleを生成することが可能です。
  • Method Summary

    Modifier and Type Method Description
    java.nio.file.Path copyTo​(java.nio.file.Path target, java.nio.file.CopyOption... options)
    アップロードされたファイルを指定のtargetへコピーする。
    java.lang.String getFileName()  
    java.io.InputStream getInputStream()
    アップロードされたファイルのバイナリを読み込むためのInputStreamを取得。
    long getSize()  
    java.lang.String getType()  
    boolean isSizeOver()
    アップロードされたファイルのファイルサイズが上限値を超えていた場合true。
    java.nio.file.Path moveTo​(java.nio.file.Path target, java.nio.file.CopyOption... options)
    アップロードされたファイルを指定のtargetへ移動する。
    BinaryReference toBinaryReference()
    アップロードされたファイルをBinaryReferenceのインスタンスに変換。 変換されたBinaryReferenceはEntityの属性として保存されるまでは、 テンポラリLOBとしてアップロードしたユーザのみが参照可能な状態。

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TestUploadFileHandle

      public TestUploadFileHandle​(java.io.File tempFile, java.lang.String fileName, java.lang.String type)
      指定のtempFileで指定されるファイルにてTestUploadFileHandleを生成します。
      Parameters:
      tempFile -
      fileName -
      type -
    • TestUploadFileHandle

      public TestUploadFileHandle​(java.lang.String fileName, java.lang.String type, long size, boolean isSizeOver)
      アップロードされたファイルがサイズオーバーであった場合を想定したテストの場合、当コンストラクタを利用し、 isSizeOverがtrueの状態のUploadFileHandleを生成することが可能です。
      Parameters:
      fileName -
      type -
      size -
      isSizeOver -
  • Method Details

    • getFileName

      public java.lang.String getFileName()
      Specified by:
      getFileName in interface UploadFileHandle
    • getType

      public java.lang.String getType()
      Specified by:
      getType in interface UploadFileHandle
    • toBinaryReference

      public BinaryReference toBinaryReference()
      Description copied from interface: UploadFileHandle
      アップロードされたファイルをBinaryReferenceのインスタンスに変換。 変換されたBinaryReferenceはEntityの属性として保存されるまでは、 テンポラリLOBとしてアップロードしたユーザのみが参照可能な状態。
      Specified by:
      toBinaryReference in interface UploadFileHandle
      Returns:
    • getSize

      public long getSize()
      Specified by:
      getSize in interface UploadFileHandle
    • getInputStream

      public java.io.InputStream getInputStream()
      Description copied from interface: UploadFileHandle
      アップロードされたファイルのバイナリを読み込むためのInputStreamを取得。
      Specified by:
      getInputStream in interface UploadFileHandle
      Returns:
    • isSizeOver

      public boolean isSizeOver()
      Description copied from interface: UploadFileHandle
      アップロードされたファイルのファイルサイズが上限値を超えていた場合true。
      Specified by:
      isSizeOver in interface UploadFileHandle
      Returns:
    • copyTo

      public java.nio.file.Path copyTo​(java.nio.file.Path target, java.nio.file.CopyOption... options)
      Description copied from interface: UploadFileHandle
      アップロードされたファイルを指定のtargetへコピーする。
      Specified by:
      copyTo in interface UploadFileHandle
      Returns:
      コピー先のpath
    • moveTo

      public java.nio.file.Path moveTo​(java.nio.file.Path target, java.nio.file.CopyOption... options)
      Description copied from interface: UploadFileHandle
      アップロードされたファイルを指定のtargetへ移動する。
      Specified by:
      moveTo in interface UploadFileHandle
      Returns:
      移動先のpath