From 3bf02b8d415654beb9a821005c9cab7d5d9ff53c Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Wed, 3 Mar 2021 11:19:26 +0100 Subject: [PATCH] only added Junit Test --- CHANGELOG.md | 5 +++ pom.xml | 2 +- .../server/converter/HLMapper.java | 2 +- src/test/java/WorkspaceInstance.java | 33 ++++++++++++------- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fde20d..55af606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pom.xml b/pom.xml index 5720802..8cca62d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.common storagehub-client-wrapper - 1.0.0 + 1.0.1-SNAPSHOT storagehub-client-wrapper 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 diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java b/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java index 8fcd81a..35bc464 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/converter/HLMapper.java @@ -221,7 +221,7 @@ public class HLMapper { } ((WorkspaceFolder) theItem).setPublicFolder(isPublicItem); - + } //THE ITEM IS A KIND OF FILE diff --git a/src/test/java/WorkspaceInstance.java b/src/test/java/WorkspaceInstance.java index 4aee6d5..59ee79e 100644 --- a/src/test/java/WorkspaceInstance.java +++ b/src/test/java/WorkspaceInstance.java @@ -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()); + } + } + + //@Test + public void getPathOnShared() throws Exception{ + System.out.println("Get Path on Shared"); -// System.out.println(++i+")"); -// if(workspaceItem.isFolder()){ -// WorkspaceFolder folder = (WorkspaceFolder) workspaceItem; -// System.out.println("is public? "+folder.isPublicFolder()); -// } + WorkspaceFolder root = storageHubWrapper.getWorkspace().getRoot(); + List children = storageHubWrapper.getWorkspace().getChildren(root.getId()); - //printMap(workspaceItem); + int i = 0; + for (WorkspaceItem workspaceItem : children) { + if(workspaceItem.isShared()) { + System.out.println(++i+")"+workspaceItem.getId() + " name: "+workspaceItem.getName() + " type: "+workspaceItem.getPath()); + } } }