diff --git a/.idea/modules/app/app.iml b/.idea/modules/app/app.iml
index 3a0f669..f5481e4 100755
--- a/.idea/modules/app/app.iml
+++ b/.idea/modules/app/app.iml
@@ -78,6 +78,7 @@
+
diff --git a/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourFtpUpload.java b/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourFtpUpload.java
index b5e9f0b..a3fb401 100755
--- a/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourFtpUpload.java
+++ b/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourFtpUpload.java
@@ -16,7 +16,7 @@ import java.util.regex.Pattern;
*/
public class UeBehaviourFtpUpload extends UeBehaviourFtp {
private static final Logger log = Logger.getLogger(UeBehaviourFtpUpload.class);
- private static final int BUFFER_SIZE = 512;
+ private static final int BUFFER_SIZE = 8192;
@Configurable(order=1, value="Host")
@@ -38,8 +38,8 @@ public class UeBehaviourFtpUpload extends UeBehaviourFtp {
if (outStream != null) {
OutputStream out = new BufferedOutputStream(outStream);
- if(sizeOrFile != null && Pattern.matches("\\d*", sizeOrFile)){
- int size = Integer.parseInt(sizeOrFile);
+ if(isLong(sizeOrFile)){
+ long size = Long.parseLong(sizeOrFile);
uploadRandomData(out, size);
}
else{
@@ -55,13 +55,13 @@ public class UeBehaviourFtpUpload extends UeBehaviourFtp {
}
}
- private void uploadRandomData(OutputStream out, int size) throws IOException {
+ private void uploadRandomData(OutputStream out, long size) throws IOException {
// Upload data
log.debug("Uploading random data with size "+size);
- int total = 0;
+ long total = 0;
byte[] data = new byte[BUFFER_SIZE];
while (total < size && !stopExecution()) {
- int writeLength = (total + data.length < size ? data.length : size - total);
+ int writeLength = (int)(total + data.length < size ? data.length : size - total);
out.write(data, 0, writeLength);
total += writeLength;
@@ -109,11 +109,19 @@ public class UeBehaviourFtpUpload extends UeBehaviourFtp {
@Override
public String toString() {
- if(sizeOrFile != null && Pattern.matches("\\d*", sizeOrFile)){
- int size = Integer.parseInt(sizeOrFile);
- return "Will upload "+ StringUtil.getByteString(size) +" of random data.";
+ if (sizeOrFile != null) {
+ if (isLong(sizeOrFile)) {
+ long size = Long.parseLong(sizeOrFile);
+ return "Will upload " + StringUtil.getByteString(size) + " of random data.";
+ }
+ else
+ return "Will upload local file " + sizeOrFile;
}
- return "Will upload local file "+ sizeOrFile;
+ else
+ return "No file specified";
}
+ private boolean isLong(String str){
+ return sizeOrFile != null && Pattern.matches("\\d{1,19}", str);
+ }
}