| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
package org.kuali.rice.kew.test.web; |
| 19 |
|
|
| 20 |
|
import java.io.File; |
| 21 |
|
import java.io.FileInputStream; |
| 22 |
|
import java.io.FileNotFoundException; |
| 23 |
|
import java.io.IOException; |
| 24 |
|
import java.io.InputStream; |
| 25 |
|
|
| 26 |
|
import org.apache.struts.upload.FormFile; |
| 27 |
|
import org.springframework.util.FileCopyUtils; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
@author |
| 32 |
|
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 11 |
Complexity Density: 0.92 |
|
| 33 |
|
public class MockFormFile implements FormFile { |
| 34 |
|
private File file; |
| 35 |
|
private String fileName; |
| 36 |
|
private int fileSize; |
| 37 |
|
private String contentType = "application/octet-stream"; |
| 38 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 39 |
0
|
public MockFormFile(File file) {... |
| 40 |
0
|
this.file = file; |
| 41 |
0
|
this.fileName = file.getName(); |
| 42 |
0
|
this.fileSize = (int) file.length(); |
| 43 |
|
} |
| 44 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 45 |
0
|
public String getContentType() {... |
| 46 |
0
|
return contentType; |
| 47 |
|
} |
| 48 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 49 |
0
|
public void setContentType(String contentType) {... |
| 50 |
0
|
this.contentType = contentType; |
| 51 |
|
} |
| 52 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 53 |
0
|
public byte[] getFileData() throws FileNotFoundException, IOException {... |
| 54 |
0
|
return FileCopyUtils.copyToByteArray(file); |
| 55 |
|
} |
| 56 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 57 |
0
|
public String getFileName() {... |
| 58 |
0
|
return fileName; |
| 59 |
|
} |
| 60 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 61 |
0
|
public void setFileName(String fileName) {... |
| 62 |
0
|
this.fileName = fileName; |
| 63 |
|
} |
| 64 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 65 |
0
|
public int getFileSize() {... |
| 66 |
0
|
return fileSize; |
| 67 |
|
} |
| 68 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 69 |
0
|
public void setFileSize(int fileSize) {... |
| 70 |
0
|
this.fileSize = fileSize; |
| 71 |
|
} |
| 72 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
0
|
public InputStream getInputStream() throws FileNotFoundException, IOException {... |
| 74 |
0
|
return new FileInputStream(file); |
| 75 |
|
} |
| 76 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 77 |
0
|
public void destroy() {... |
| 78 |
|
} |
| 79 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 80 |
0
|
public String toString() {... |
| 81 |
0
|
return "[MockFormFile: " + file + "]"; |
| 82 |
|
} |
| 83 |
|
} |