removed double call for upload file
This commit is contained in:
parent
28e4e9eb56
commit
18d2fb9287
|
@ -663,22 +663,6 @@ public class DefaultItemManager extends DefaultManagerClient implements ItemMana
|
|||
|
||||
response = myManager.queryParams(initQueryParameters()).post(Entity.entity(multipart, multipart.getMediaType()));
|
||||
|
||||
|
||||
ContentDisposition contentDisposition;
|
||||
if (contentLength>0)
|
||||
contentDisposition = ContentDisposition.type("attachment").fileName(fileName).size(contentLength).build();
|
||||
else
|
||||
contentDisposition = ContentDisposition.type("attachment").fileName(fileName).build();
|
||||
|
||||
|
||||
BodyPart fdp = new StreamDataBodyPart("file", stream);
|
||||
|
||||
multipart.bodyPart(fdp);
|
||||
|
||||
Entity<FormDataMultiPart> entity = Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA);
|
||||
|
||||
response = myManager.queryParams(initQueryParameters()).header("Content-Disposition",Arrays.asList(contentDisposition.toString())).post(entity);
|
||||
|
||||
if (response.isErrorResponse()) {
|
||||
if (response.hasException()) {
|
||||
throw response.getException();
|
||||
|
|
|
@ -104,7 +104,7 @@ public class Items {
|
|||
File file = new File(vresFile);
|
||||
|
||||
try ( InputStream fileIS = new FileInputStream(file)){
|
||||
shc.getWSRoot().uploadFile(fileIS, "stampa_crossover_retro.pdf", "description");
|
||||
shc.getWSRoot().uploadFile(fileIS, "stampa_crossover_retro.pdf", "description");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -134,23 +134,30 @@ public class Items {
|
|||
try {
|
||||
|
||||
|
||||
IntStream.range(1, 100).forEach( i-> {
|
||||
IntStream.range(1, 300).forEach( i-> {
|
||||
try {
|
||||
StorageHubClient shc = new StorageHubClient();
|
||||
FolderContainer vre = shc.openVREFolder().openByRelativePath("testLucio").asFolder();
|
||||
FolderContainer fc = vre.newFolder("folder"+i, "");
|
||||
IntStream.range(1, 3).forEach(k -> {
|
||||
String vresFile = "/home/lucio/Scaricati/NLP-Hub-Algorithms.pptx";
|
||||
for (int t =1 ; t<10; t++) {
|
||||
StorageHubClient shc1 = new StorageHubClient();
|
||||
FolderContainer sub = shc1.open(fc.getId()).asFolder();
|
||||
FolderContainer fcsub2 = sub.newFolder("folder"+i+"-"+t, "");
|
||||
for (int k=0;k<3;k++) {
|
||||
String vresFile = "/home/lucio/Downloads/GNA_foto_Cuma Necropoli mediana_4B.jpg";
|
||||
|
||||
File file = new File(vresFile);
|
||||
StorageHubClient shc2 = new StorageHubClient();
|
||||
FolderContainer sub2 = shc2.open(fcsub2.getId()).asFolder();
|
||||
|
||||
try ( InputStream fileIS = new FileInputStream(file)){
|
||||
fc.uploadFile(fileIS, "file"+k, "description");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
File file = new File(vresFile);
|
||||
|
||||
try ( InputStream fileIS = new FileInputStream(file)){
|
||||
sub2.uploadFile(fileIS, "file"+k, "description");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
} catch (StorageHubException e) {
|
||||
System.out.println("error creating stressTest"+i);
|
||||
}
|
||||
|
@ -243,7 +250,7 @@ public class Items {
|
|||
|
||||
File inFile = new File("/home/lucio/Downloads/scimmia braccia aperte.mp4");
|
||||
try(InputStream is = new FileInputStream(inFile)){
|
||||
myRoot.uploadFile(is, "scimmia braccia aperte.mp4", "file");
|
||||
myRoot.uploadFile(is, "scimmia braccia aperte.mp4", "file");
|
||||
|
||||
}
|
||||
System.out.println("Response in "+(System.currentTimeMillis()-start));
|
||||
|
|
Loading…
Reference in New Issue