Package org.iplass.mtp.test
Class TestUploadFileHandle
java.lang.Object
org.iplass.mtp.test.TestUploadFileHandle
- All Implemented Interfaces:
UploadFileHandle
テスト時に利用可能なUploadFileHandleの実装です。
アップロードファイルを伴うテストの場合に、
TestRequestContext.setParam(String, Object)にてセットします。-
Constructor Summary
ConstructorsConstructorDescriptionTestUploadFileHandle(File tempFile, String fileName, String type) 指定のtempFileで指定されるファイルにてTestUploadFileHandleを生成します。TestUploadFileHandle(String fileName, String type, long size, boolean isSizeOver) アップロードされたファイルがサイズオーバーであった場合を想定したテストの場合、当コンストラクタを利用し、 isSizeOverがtrueの状態のUploadFileHandleを生成することが可能です。 -
Method Summary
Modifier and TypeMethodDescriptioncopyTo(Path target, CopyOption... options) アップロードされたファイルを指定のtargetへコピーする。アップロードされたファイルのバイナリを読み込むためのInputStreamを取得。longgetSize()getType()booleanアップロードされたファイルのファイルサイズが上限値を超えていた場合true。moveTo(Path target, CopyOption... options) アップロードされたファイルを指定のtargetへ移動する。アップロードされたファイルをBinaryReferenceのインスタンスに変換。 変換されたBinaryReferenceはEntityの属性として保存されるまでは、 テンポラリLOBとしてアップロードしたユーザーのみが参照可能な状態。
-
Constructor Details
-
TestUploadFileHandle
指定のtempFileで指定されるファイルにてTestUploadFileHandleを生成します。- Parameters:
tempFile-fileName-type-
-
TestUploadFileHandle
アップロードされたファイルがサイズオーバーであった場合を想定したテストの場合、当コンストラクタを利用し、 isSizeOverがtrueの状態のUploadFileHandleを生成することが可能です。- Parameters:
fileName-type-size-isSizeOver-
-
-
Method Details
-
getFileName
- Specified by:
getFileNamein interfaceUploadFileHandle
-
getType
- Specified by:
getTypein interfaceUploadFileHandle
-
toBinaryReference
Description copied from interface:UploadFileHandleアップロードされたファイルをBinaryReferenceのインスタンスに変換。 変換されたBinaryReferenceはEntityの属性として保存されるまでは、 テンポラリLOBとしてアップロードしたユーザーのみが参照可能な状態。- Specified by:
toBinaryReferencein interfaceUploadFileHandle- Returns:
-
getSize
public long getSize()- Specified by:
getSizein interfaceUploadFileHandle
-
getInputStream
Description copied from interface:UploadFileHandleアップロードされたファイルのバイナリを読み込むためのInputStreamを取得。- Specified by:
getInputStreamin interfaceUploadFileHandle- Returns:
-
isSizeOver
public boolean isSizeOver()Description copied from interface:UploadFileHandleアップロードされたファイルのファイルサイズが上限値を超えていた場合true。- Specified by:
isSizeOverin interfaceUploadFileHandle- Returns:
-
copyTo
Description copied from interface:UploadFileHandleアップロードされたファイルを指定のtargetへコピーする。- Specified by:
copyToin interfaceUploadFileHandle- Parameters:
target-options-- Returns:
- コピー先のpath
-
moveTo
Description copied from interface:UploadFileHandleアップロードされたファイルを指定のtargetへ移動する。- Specified by:
moveToin interfaceUploadFileHandle- Parameters:
target-options-- Returns:
- 移動先のpath
-