only added Junit Test

This commit is contained in:
Francesco Mangiacrapa 2021-03-03 11:19:26 +01:00
parent 658c89dfee
commit 3bf02b8d41
4 changed files with 28 additions and 14 deletions

View File

@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1-0-1-SNAPSHOT] - 2021-03-03
Improved JUnit Test
## [v1-0-0] [r4-25-0] - 2020-07-15
#### Enhancements

View File

@ -10,7 +10,7 @@
</parent>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-wrapper</artifactId>
<version>1.0.0</version>
<version>1.0.1-SNAPSHOT</version>
<name>storagehub-client-wrapper</name>
<description>This is a wrapper of storagehub-client library. It allows to interact with storagehub in a simplified way by exposing several utilities. Moreover, It exposes by another inteface java beans as defined in (the old) HL interfaces</description>
<scm>

View File

@ -35,7 +35,7 @@ public class WorkspaceInstance {
//public static String USERNAME = "massimiliano.assante";
public static String USERNAME = "francesco.mangiacrapa";
public static String TOKEN; //YOU MUST SET THIS AS VM PARAMETER
public static String TOKEN = System.getenv("TOKEN_gcube"); //YOU MUST SET THIS AS Environment variable
public static String FIND_FILE_NAME = "francesco";
@ -44,12 +44,15 @@ public class WorkspaceInstance {
private WorkspaceStorageHubClientService workspace;
@Before
//@Before
public void init(){
TOKEN = System.getProperty("token");
if(TOKEN==null) {
System.err.println("You must set the token as Environment variable");
return;
}
System.out.println("Read TOKEN: "+TOKEN);
System.out.println("Read TOKEN_gcube: "+TOKEN);
//METHOD 1
storageHubWrapper = new StorageHubWrapper(SCOPE, TOKEN, false, false, true);
@ -79,7 +82,7 @@ public class WorkspaceInstance {
}
@Test
//@Test
public void getChildren() throws Exception{
System.out.println("Get children test");
@ -92,16 +95,22 @@ public class WorkspaceInstance {
int i = 0;
for (WorkspaceItem workspaceItem : children) {
System.out.println(++i+")"+workspaceItem.getId() + " name: "+workspaceItem.getName() + " type: "+workspaceItem.getType() +" class: "+workspaceItem.getClass());
//System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass());
}
}
// System.out.println(++i+")");
// if(workspaceItem.isFolder()){
// WorkspaceFolder folder = (WorkspaceFolder) workspaceItem;
// System.out.println("is public? "+folder.isPublicFolder());
// }
//@Test
public void getPathOnShared() throws Exception{
System.out.println("Get Path on Shared");
//printMap(workspaceItem);
WorkspaceFolder root = storageHubWrapper.getWorkspace().getRoot();
List<? extends WorkspaceItem> children = storageHubWrapper.getWorkspace().getChildren(root.getId());
int i = 0;
for (WorkspaceItem workspaceItem : children) {
if(workspaceItem.isShared()) {
System.out.println(++i+")"+workspaceItem.getId() + " name: "+workspaceItem.getName() + " type: "+workspaceItem.getPath());
}
}
}