git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@171673 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
17ae467950
commit
2fd18396ce
|
@ -25,8 +25,8 @@ public class FolderContainer extends ItemContainer<FolderItem>{
|
||||||
return ContainerType.FOLDER;
|
return ContainerType.FOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListResolver list() {
|
public ListResolverTyped list() {
|
||||||
return new ListResolver(excludes -> itemclient.getChildren(itemId, excludes), itemclient);
|
return new ListResolverTyped((onlyType, excludes) -> itemclient.getChildren(itemId, onlyType, excludes), itemclient) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileContainer uploadFile(InputStream stream, String filename, String description) {
|
public FileContainer uploadFile(InputStream stream, String filename, String description) {
|
||||||
|
@ -47,7 +47,7 @@ public class FolderContainer extends ItemContainer<FolderItem>{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListResolver findByName(String namePattern) {
|
public ListResolver findByName(String namePattern) {
|
||||||
return new ListResolver(excludes -> itemclient.findChildrenByNamePattern(itemId, namePattern , excludes), itemclient);
|
return new ListResolver((onlyType, excludes) -> itemclient.findChildrenByNamePattern(itemId, namePattern , excludes), itemclient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FolderContainer share(Set<String> users, AccessType accessType) throws Exception {
|
public FolderContainer share(Set<String> users, AccessType accessType) throws Exception {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public abstract class ItemContainer<I extends Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListResolver getAnchestors() {
|
public ListResolver getAnchestors() {
|
||||||
return new ListResolver(excludes -> itemclient.getAnchestors(this.itemId,excludes) , itemclient);
|
return new ListResolver((onlyType, excludes) -> itemclient.getAnchestors(this.itemId,excludes) , itemclient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
|
|
|
@ -17,6 +17,8 @@ public class ListResolver {
|
||||||
|
|
||||||
|
|
||||||
Set<String> excludes = new HashSet<>(Arrays.asList(NodeConstants.ACCOUNTING_NAME, NodeConstants.CONTENT_NAME, NodeConstants.METADATA_NAME));
|
Set<String> excludes = new HashSet<>(Arrays.asList(NodeConstants.ACCOUNTING_NAME, NodeConstants.CONTENT_NAME, NodeConstants.METADATA_NAME));
|
||||||
|
Class<? extends Item> onlyType = null;
|
||||||
|
|
||||||
|
|
||||||
protected ListResolver(ListRetriever retriever, ItemManagerClient itemClient) {
|
protected ListResolver(ListRetriever retriever, ItemManagerClient itemClient) {
|
||||||
this.retriever = retriever;
|
this.retriever = retriever;
|
||||||
|
@ -38,8 +40,9 @@ public class ListResolver {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<? extends Item> getItems(){
|
public List<? extends Item> getItems(){
|
||||||
return retriever.getList(excludes.toArray(new String[excludes.size()]));
|
return retriever.getList(onlyType, excludes.toArray(new String[excludes.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemContainer<? extends Item>> getContainers(){
|
public List<ItemContainer<? extends Item>> getContainers(){
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.gcube.common.storagehub.client.dsl;
|
||||||
|
|
||||||
|
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||||
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
|
|
||||||
|
public class ListResolverTyped extends ListResolver {
|
||||||
|
|
||||||
|
protected ListResolverTyped(ListRetriever retriever, ItemManagerClient itemClient) {
|
||||||
|
super(retriever, itemClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListResolver ofType(Class<? extends Item> type){
|
||||||
|
onlyType = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,5 +6,5 @@ import org.gcube.common.storagehub.model.items.Item;
|
||||||
|
|
||||||
public interface ListRetriever {
|
public interface ListRetriever {
|
||||||
|
|
||||||
List<? extends Item> getList(String ... excludes);
|
List<? extends Item> getList(Class<? extends Item> onlyType, String ... excludes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.gcube.common.gxrest.response.inbound.GXInboundResponse;
|
||||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||||
import org.gcube.common.storagehub.model.acls.ACL;
|
import org.gcube.common.storagehub.model.acls.ACL;
|
||||||
import org.gcube.common.storagehub.model.acls.AccessType;
|
import org.gcube.common.storagehub.model.acls.AccessType;
|
||||||
|
import org.gcube.common.storagehub.model.annotations.RootNode;
|
||||||
import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
|
import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
|
||||||
import org.gcube.common.storagehub.model.items.Item;
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
import org.gcube.common.storagehub.model.service.ItemList;
|
import org.gcube.common.storagehub.model.service.ItemList;
|
||||||
|
@ -41,7 +42,7 @@ public class DefaultItemManager implements ItemManagerClient {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Item> getChildren(String id, String ... excludeNodes) {
|
public List<? extends Item> getChildren(String id, Class<? extends Item> onlyOfType, String ... excludeNodes) {
|
||||||
Call<GXWebTargetAdapterRequest, ItemList> call = new Call<GXWebTargetAdapterRequest, ItemList>() {
|
Call<GXWebTargetAdapterRequest, ItemList> call = new Call<GXWebTargetAdapterRequest, ItemList>() {
|
||||||
@Override
|
@Override
|
||||||
public ItemList call(GXWebTargetAdapterRequest manager) throws Exception {
|
public ItemList call(GXWebTargetAdapterRequest manager) throws Exception {
|
||||||
|
@ -50,6 +51,9 @@ public class DefaultItemManager implements ItemManagerClient {
|
||||||
if (excludeNodes !=null && excludeNodes.length>0)
|
if (excludeNodes !=null && excludeNodes.length>0)
|
||||||
params.put("exclude",excludeNodes);
|
params.put("exclude",excludeNodes);
|
||||||
|
|
||||||
|
if (onlyOfType!=null)
|
||||||
|
params.put("onlyType", new Object[] {resolveNodeType(onlyOfType)});
|
||||||
|
|
||||||
GXInboundResponse response = myManager.setAcceptedResponseType(MediaType.APPLICATION_JSON_TYPE).queryParams(params).get();
|
GXInboundResponse response = myManager.setAcceptedResponseType(MediaType.APPLICATION_JSON_TYPE).queryParams(params).get();
|
||||||
|
|
||||||
if (response.hasGXError())
|
if (response.hasGXError())
|
||||||
|
@ -67,8 +71,96 @@ public class DefaultItemManager implements ItemManagerClient {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Item> getChildren(String id, int start, int limit, Class<? extends Item> onlyOfType, String... excludeNodes) {
|
||||||
|
Call<GXWebTargetAdapterRequest, ItemList> call = new Call<GXWebTargetAdapterRequest, ItemList>() {
|
||||||
|
@Override
|
||||||
|
public ItemList call(GXWebTargetAdapterRequest manager) throws Exception {
|
||||||
|
GXWebTargetAdapterRequest myManager = manager.path(id).path("children").path("paged");
|
||||||
|
Map<String, Object[]> params = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
if (excludeNodes !=null && excludeNodes.length>0)
|
||||||
|
params.put("exclude",excludeNodes);
|
||||||
|
|
||||||
|
if (onlyOfType!=null)
|
||||||
|
params.put("onlyType", new Object[] {resolveNodeType(onlyOfType)});
|
||||||
|
|
||||||
|
params.put("start", new Object[] {start});
|
||||||
|
params.put("limit", new Object[] {limit});
|
||||||
|
|
||||||
|
|
||||||
|
GXInboundResponse response = myManager.setAcceptedResponseType(MediaType.APPLICATION_JSON_TYPE).queryParams(params).get();
|
||||||
|
|
||||||
|
if (response.hasGXError())
|
||||||
|
throw response.getException();
|
||||||
|
|
||||||
|
ItemList items = response.getSource().readEntity(ItemList.class);
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
ItemList result = delegate.make(call);
|
||||||
|
return result.getItemlist();
|
||||||
|
}catch(Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Item> getChildren(String id, int start, int limit,
|
||||||
|
String... excludeNodes) {
|
||||||
|
return getChildren(id, start, limit, null, excludeNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Item> getChildren(String id, String ... excludeNodes) {
|
||||||
|
return getChildren(id, null, excludeNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer childrenCount(String id , Class<? extends Item> onlyOfType) {
|
||||||
|
Call<GXWebTargetAdapterRequest, Integer> call = new Call<GXWebTargetAdapterRequest, Integer>() {
|
||||||
|
@Override
|
||||||
|
public Integer call(GXWebTargetAdapterRequest manager) throws Exception {
|
||||||
|
GXWebTargetAdapterRequest myManager = manager.path(id).path("children").path("count");
|
||||||
|
Map<String, Object[]> params = new HashMap<>();
|
||||||
|
if (onlyOfType!=null)
|
||||||
|
params.put("onlyType", new Object[] {resolveNodeType(onlyOfType)});
|
||||||
|
|
||||||
|
GXInboundResponse response = myManager.queryParams(params).setAcceptedResponseType(MediaType.TEXT_PLAIN_TYPE).get();
|
||||||
|
|
||||||
|
if (response.hasGXError())
|
||||||
|
throw response.getException();
|
||||||
|
|
||||||
|
return response.getSource().readEntity(Integer.class);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
Integer result = delegate.make(call);
|
||||||
|
return result;
|
||||||
|
}catch(Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer childrenCount(String id) {
|
||||||
|
return childrenCount(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String resolveNodeType(Class<? extends Item> itemClass){
|
||||||
|
if (!itemClass.isAnnotationPresent(RootNode.class)) return null;
|
||||||
|
String nodeType= itemClass.getAnnotation(RootNode.class).value();
|
||||||
|
return nodeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamDescriptor download(String id, String... excludeNodes) {
|
public StreamDescriptor download(String id, String... excludeNodes) {
|
||||||
Call<GXWebTargetAdapterRequest, StreamDescriptor> call = new Call<GXWebTargetAdapterRequest, StreamDescriptor>() {
|
Call<GXWebTargetAdapterRequest, StreamDescriptor> call = new Call<GXWebTargetAdapterRequest, StreamDescriptor>() {
|
||||||
|
@ -182,40 +274,6 @@ public class DefaultItemManager implements ItemManagerClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<? extends Item> getChildren(String id, int start, int limit, String... excludeNodes) {
|
|
||||||
Call<GXWebTargetAdapterRequest, ItemList> call = new Call<GXWebTargetAdapterRequest, ItemList>() {
|
|
||||||
@Override
|
|
||||||
public ItemList call(GXWebTargetAdapterRequest manager) throws Exception {
|
|
||||||
GXWebTargetAdapterRequest myManager = manager.path(id).path("children").path("paged");
|
|
||||||
Map<String, Object[]> params = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
if (excludeNodes !=null && excludeNodes.length>0)
|
|
||||||
params.put("exclude",excludeNodes);
|
|
||||||
|
|
||||||
params.put("start", new Object[] {start});
|
|
||||||
params.put("limit", new Object[] {limit});
|
|
||||||
|
|
||||||
|
|
||||||
GXInboundResponse response = myManager.setAcceptedResponseType(MediaType.APPLICATION_JSON_TYPE).queryParams(params).get();
|
|
||||||
|
|
||||||
if (response.hasGXError())
|
|
||||||
throw response.getException();
|
|
||||||
|
|
||||||
ItemList items = response.getSource().readEntity(ItemList.class);
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
ItemList result = delegate.make(call);
|
|
||||||
return result.getItemlist();
|
|
||||||
}catch(Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Item> findChildrenByNamePattern(String id, String name, String... excludeNodes) {
|
public List<? extends Item> findChildrenByNamePattern(String id, String name, String... excludeNodes) {
|
||||||
Call<GXWebTargetAdapterRequest, ItemList> call = new Call<GXWebTargetAdapterRequest, ItemList>() {
|
Call<GXWebTargetAdapterRequest, ItemList> call = new Call<GXWebTargetAdapterRequest, ItemList>() {
|
||||||
|
@ -246,30 +304,6 @@ public class DefaultItemManager implements ItemManagerClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer childrenCount(String id) {
|
|
||||||
Call<GXWebTargetAdapterRequest, Integer> call = new Call<GXWebTargetAdapterRequest, Integer>() {
|
|
||||||
@Override
|
|
||||||
public Integer call(GXWebTargetAdapterRequest manager) throws Exception {
|
|
||||||
GXWebTargetAdapterRequest myManager = manager.path(id).path("children").path("count");
|
|
||||||
|
|
||||||
GXInboundResponse response = myManager.setAcceptedResponseType(MediaType.TEXT_PLAIN_TYPE).get();
|
|
||||||
|
|
||||||
if (response.hasGXError())
|
|
||||||
throw response.getException();
|
|
||||||
|
|
||||||
return response.getSource().readEntity(Integer.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
Integer result = delegate.make(call);
|
|
||||||
return result;
|
|
||||||
}catch(Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String uploadFile(InputStream stream, String parentId, String fileName, String description) {
|
public String uploadFile(InputStream stream, String parentId, String fileName, String description) {
|
||||||
Call<GXWebTargetAdapterRequest, String> call = new Call<GXWebTargetAdapterRequest, String>() {
|
Call<GXWebTargetAdapterRequest, String> call = new Call<GXWebTargetAdapterRequest, String>() {
|
||||||
|
@ -513,5 +547,4 @@ public class DefaultItemManager implements ItemManagerClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,18 @@ public interface ItemManagerClient {
|
||||||
|
|
||||||
List<? extends Item> getChildren(String id, String ... excludeNodes);
|
List<? extends Item> getChildren(String id, String ... excludeNodes);
|
||||||
|
|
||||||
|
List<? extends Item> getChildren(String id, Class<? extends Item> onlyOfType, String ... excludeNodes);
|
||||||
|
|
||||||
|
List<? extends Item> getChildren(String id, int start, int limit, Class<? extends Item> onlyOfType, String ... excludeNodes);
|
||||||
|
|
||||||
List<? extends Item> getChildren(String id, int start, int limit, String ... excludeNodes);
|
List<? extends Item> getChildren(String id, int start, int limit, String ... excludeNodes);
|
||||||
|
|
||||||
List<? extends Item> getAnchestors(String id, String ... excludeNodes);
|
List<? extends Item> getAnchestors(String id, String ... excludeNodes);
|
||||||
|
|
||||||
Integer childrenCount(String id);
|
Integer childrenCount(String id);
|
||||||
|
|
||||||
|
Integer childrenCount(String id, Class<? extends Item> onlyOfType);
|
||||||
|
|
||||||
Item get(String id, String ... excludeNodes);
|
Item get(String id, String ... excludeNodes);
|
||||||
|
|
||||||
StreamDescriptor download(String id, String... excludeNodes);
|
StreamDescriptor download(String id, String... excludeNodes);
|
||||||
|
@ -47,5 +53,7 @@ public interface ItemManagerClient {
|
||||||
String uploadArchive(InputStream stream, String parentId, String extractionFolderName);
|
String uploadArchive(InputStream stream, String parentId, String extractionFolderName);
|
||||||
|
|
||||||
String unshareFolder(String id, Set<String> users);
|
String unshareFolder(String id, Set<String> users);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.data.access.fs;
|
package org.gcube.data.access.fs;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -26,8 +27,10 @@ import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||||
import org.gcube.common.storagehub.client.dsl.ContainerType;
|
import org.gcube.common.storagehub.client.dsl.ContainerType;
|
||||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
||||||
import org.gcube.common.storagehub.client.dsl.ItemContainer;
|
import org.gcube.common.storagehub.client.dsl.ItemContainer;
|
||||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||||
|
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||||
import org.gcube.common.storagehub.model.items.Item;
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
import org.glassfish.jersey.client.ClientProperties;
|
import org.glassfish.jersey.client.ClientProperties;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||||
|
@ -42,7 +45,9 @@ public class Items {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp(){
|
public static void setUp(){
|
||||||
|
//SecurityTokenProvider.instance.set("b7c80297-e4ed-42ab-ab42-fdc0b8b0eabf-98187548");
|
||||||
SecurityTokenProvider.instance.set("b7c80297-e4ed-42ab-ab42-fdc0b8b0eabf-98187548");
|
SecurityTokenProvider.instance.set("b7c80297-e4ed-42ab-ab42-fdc0b8b0eabf-98187548");
|
||||||
|
|
||||||
ScopeProvider.instance.set("/gcube");
|
ScopeProvider.instance.set("/gcube");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +70,28 @@ public class Items {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void download() throws Exception {
|
||||||
|
StorageHubClient shc = new StorageHubClient();
|
||||||
|
|
||||||
|
FolderContainer openResolver = shc.open("5cf82ba3-53b9-4352-b37a-c4a94800eaec").asFolder();
|
||||||
|
|
||||||
|
StreamDescriptor streamDescr = openResolver.findByName("stat_algo.project").getContainers().get(0).download();
|
||||||
|
|
||||||
|
|
||||||
|
File output = Files.createTempFile("down", streamDescr.getFileName()).toFile();
|
||||||
|
try (BufferedInputStream bi = new BufferedInputStream(streamDescr.getStream()); FileOutputStream fo = new FileOutputStream(output)){
|
||||||
|
byte[] buf = new byte[2048];
|
||||||
|
int read = -1;
|
||||||
|
while ((read=bi.read(buf))!=-1) {
|
||||||
|
fo.write(buf, 0, read);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("file written "+output.getAbsolutePath());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void emptyTrash() throws Exception {
|
public void emptyTrash() throws Exception {
|
||||||
|
@ -103,9 +130,9 @@ public class Items {
|
||||||
@Test
|
@Test
|
||||||
public void findByName() throws Exception{
|
public void findByName() throws Exception{
|
||||||
StorageHubClient shc = new StorageHubClient();
|
StorageHubClient shc = new StorageHubClient();
|
||||||
List<? extends Item> containers = shc.getWSRoot().findByName("DataMiner").getItems();
|
List<? extends Item> containers = shc.getWSRoot().list().ofType(FolderItem.class).getItems();
|
||||||
for (Item container : containers) {
|
for (Item container : containers) {
|
||||||
System.out.println("name is :"+container.getName());
|
System.out.println("name is :"+container.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class TestCall {
|
||||||
|
|
||||||
//SecurityTokenProvider.instance.set("0e2c7963-8d3e-4ea6-a56d-ffda530dd0fa-98187548");
|
//SecurityTokenProvider.instance.set("0e2c7963-8d3e-4ea6-a56d-ffda530dd0fa-98187548");
|
||||||
//token costantino 9ca79556-54b0-4bbf-ab0f-151ae326f4cf-98187548
|
//token costantino 9ca79556-54b0-4bbf-ab0f-151ae326f4cf-98187548
|
||||||
SecurityTokenProvider.instance.set("d9431600-9fef-41a7-946d-a5b402de30d6-98187548");
|
SecurityTokenProvider.instance.set("ae1208f0-210d-47c9-9b24-d3f2dfcce05f-98187548");
|
||||||
ScopeProvider.instance.set("/gcube");
|
ScopeProvider.instance.set("/gcube");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ public class TestCall {
|
||||||
@Test
|
@Test
|
||||||
public void download() throws Exception{
|
public void download() throws Exception{
|
||||||
ItemManagerClient client = AbstractPlugin.item().build();
|
ItemManagerClient client = AbstractPlugin.item().build();
|
||||||
StreamDescriptor streamDescr = client.download("07cd8d55-a35b-4445-9680-c98f158c55de");
|
StreamDescriptor streamDescr = client.download("6875651d-6510-4b82-a0f3-cc3356c1a143");
|
||||||
File output = Files.createTempFile("down", streamDescr.getFileName()).toFile();
|
File output = Files.createTempFile("down", streamDescr.getFileName()).toFile();
|
||||||
try (BufferedInputStream bi = new BufferedInputStream(streamDescr.getStream()); FileOutputStream fo = new FileOutputStream(output)){
|
try (BufferedInputStream bi = new BufferedInputStream(streamDescr.getStream()); FileOutputStream fo = new FileOutputStream(output)){
|
||||||
byte[] buf = new byte[2048];
|
byte[] buf = new byte[2048];
|
||||||
|
@ -193,8 +193,6 @@ public class TestCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("file written "+output.getAbsolutePath());
|
System.out.println("file written "+output.getAbsolutePath());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue