git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@179283 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1871710e38
commit
355fb1f4c4
|
@ -6,8 +6,10 @@ import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
|
@ -19,6 +21,7 @@ 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.acls.AccessType;
|
import org.gcube.common.storagehub.model.acls.AccessType;
|
||||||
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
||||||
|
import org.gcube.common.storagehub.model.exceptions.UserNotAuthorizedException;
|
||||||
import org.gcube.common.storagehub.model.items.Item;
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
|
@ -32,8 +35,8 @@ 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("7c26a682-f47b-4e6e-90e0-6d101a4314cd-980114272");
|
||||||
ScopeProvider.instance.set("/gcube");
|
ScopeProvider.instance.set("/pred4s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +46,19 @@ public class Items {
|
||||||
System.out.println(shc.openTrash().get().getId());
|
System.out.println(shc.openTrash().get().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected=UserNotAuthorizedException.class)
|
||||||
|
public void gxRestExceptionTest() throws Exception{
|
||||||
|
|
||||||
|
StorageHubClient shc = new StorageHubClient();
|
||||||
|
|
||||||
|
shc.open("3bc977be-37f0-4518-888f-a7cb96c9be8e").asFolder().newFolder("testFails", "");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void renameFile() throws Exception{
|
public void renameFile() throws Exception{
|
||||||
|
|
||||||
|
@ -86,14 +102,15 @@ public class Items {
|
||||||
public void uploadAndcopyFile() throws Exception {
|
public void uploadAndcopyFile() throws Exception {
|
||||||
StorageHubClient shc = new StorageHubClient();
|
StorageHubClient shc = new StorageHubClient();
|
||||||
|
|
||||||
|
shc.open("15191718-d848-4b85-a748-0cf3adade042").asFolder().newFolder("shouldFail", "fail");
|
||||||
|
/*
|
||||||
FileContainer file = null;
|
FileContainer file = null;
|
||||||
try(InputStream is = new FileInputStream(new File("/home/lucio/Downloads/Table.java"))){
|
try(InputStream is = new FileInputStream(new File("/home/lucio/Downloads/Table.java"))){
|
||||||
file = shc.getWSRoot().uploadFile(is, "TableNew.java", "descr");
|
file = shc.open("15191718-d848-4b85-a748-0cf3adade042").asFolder().uploadFile(is, "TableNew.java", "descr");
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//file.copy(shc.getWSRoot(), "firstCopy.jpg");
|
//file.copy(shc.getWSRoot(), "firstCopy.jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue