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()));
|
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.isErrorResponse()) {
|
||||||
if (response.hasException()) {
|
if (response.hasException()) {
|
||||||
throw response.getException();
|
throw response.getException();
|
||||||
|
|
|
@ -134,23 +134,30 @@ public class Items {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
IntStream.range(1, 100).forEach( i-> {
|
IntStream.range(1, 300).forEach( i-> {
|
||||||
try {
|
try {
|
||||||
StorageHubClient shc = new StorageHubClient();
|
StorageHubClient shc = new StorageHubClient();
|
||||||
FolderContainer vre = shc.openVREFolder().openByRelativePath("testLucio").asFolder();
|
FolderContainer vre = shc.openVREFolder().openByRelativePath("testLucio").asFolder();
|
||||||
FolderContainer fc = vre.newFolder("folder"+i, "");
|
FolderContainer fc = vre.newFolder("folder"+i, "");
|
||||||
IntStream.range(1, 3).forEach(k -> {
|
for (int t =1 ; t<10; t++) {
|
||||||
String vresFile = "/home/lucio/Scaricati/NLP-Hub-Algorithms.pptx";
|
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";
|
||||||
|
|
||||||
|
StorageHubClient shc2 = new StorageHubClient();
|
||||||
|
FolderContainer sub2 = shc2.open(fcsub2.getId()).asFolder();
|
||||||
|
|
||||||
File file = new File(vresFile);
|
File file = new File(vresFile);
|
||||||
|
|
||||||
try ( InputStream fileIS = new FileInputStream(file)){
|
try ( InputStream fileIS = new FileInputStream(file)){
|
||||||
fc.uploadFile(fileIS, "file"+k, "description");
|
sub2.uploadFile(fileIS, "file"+k, "description");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
} catch (StorageHubException e) {
|
} catch (StorageHubException e) {
|
||||||
System.out.println("error creating stressTest"+i);
|
System.out.println("error creating stressTest"+i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue