Ported code to new APIs
This commit is contained in:
parent
017f8648b4
commit
c2835d00d5
|
@ -6,6 +6,7 @@ import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||||
|
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
import org.gcube.common.storagehub.client.dsl.ContainerType;
|
import org.gcube.common.storagehub.client.dsl.ContainerType;
|
||||||
|
@ -106,7 +107,7 @@ public class StorageHubManagement {
|
||||||
|
|
||||||
protected FolderContainer getContextFolder() throws Exception {
|
protected FolderContainer getContextFolder() throws Exception {
|
||||||
FolderContainer destinationFolder = getWorkspaceRoot();
|
FolderContainer destinationFolder = getWorkspaceRoot();
|
||||||
String currentContext = SecretManager.instance.get().getContext();
|
String currentContext = SecretManagerProvider.instance.get().getContext();
|
||||||
ScopeBean scopeBean = new ScopeBean(currentContext);
|
ScopeBean scopeBean = new ScopeBean(currentContext);
|
||||||
switch(scopeBean.type()) {
|
switch(scopeBean.type()) {
|
||||||
case INFRASTRUCTURE:
|
case INFRASTRUCTURE:
|
||||||
|
@ -128,10 +129,11 @@ public class StorageHubManagement {
|
||||||
|
|
||||||
public FolderContainer getApplicationFolder() throws Exception {
|
public FolderContainer getApplicationFolder() throws Exception {
|
||||||
FolderContainer destinationFolder = getContextFolder();
|
FolderContainer destinationFolder = getContextFolder();
|
||||||
String currentContext = SecretManager.instance.get().getContext();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
|
String currentContext = secretManager.getContext();
|
||||||
ScopeBean scopeBean = new ScopeBean(currentContext);
|
ScopeBean scopeBean = new ScopeBean(currentContext);
|
||||||
if(scopeBean.is(Type.VRE)) {
|
if(scopeBean.is(Type.VRE)) {
|
||||||
String username = SecretManager.instance.get().getUser().getUsername();
|
String username = secretManager.getUser().getUsername();
|
||||||
destinationFolder = getOrCreateFolder(destinationFolder, username, "Folder Created for user/application", true);
|
destinationFolder = getOrCreateFolder(destinationFolder, username, "Folder Created for user/application", true);
|
||||||
}
|
}
|
||||||
return destinationFolder;
|
return destinationFolder;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||||
|
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||||
import org.gcube.common.authorization.utils.secret.GCubeSecret;
|
import org.gcube.common.authorization.utils.secret.GCubeSecret;
|
||||||
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;
|
||||||
|
@ -25,7 +26,7 @@ public class StorageHubManagementTest extends ContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void myTest() throws Exception {
|
public void myTest() throws Exception {
|
||||||
SecretManager secretManager = SecretManager.instance.get();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
||||||
secretManager.startSession(gCubeSecret);
|
secretManager.startSession(gCubeSecret);
|
||||||
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
||||||
|
@ -36,7 +37,7 @@ public class StorageHubManagementTest extends ContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
SecretManager secretManager = SecretManager.instance.get();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
||||||
secretManager.startSession(gCubeSecret);
|
secretManager.startSession(gCubeSecret);
|
||||||
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
||||||
|
@ -54,7 +55,7 @@ public class StorageHubManagementTest extends ContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void listFolders() throws Exception {
|
public void listFolders() throws Exception {
|
||||||
SecretManager secretManager = SecretManager.instance.get();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
||||||
secretManager.startSession(gCubeSecret);
|
secretManager.startSession(gCubeSecret);
|
||||||
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
||||||
|
@ -80,7 +81,7 @@ public class StorageHubManagementTest extends ContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getFileInfo() throws Exception {
|
public void getFileInfo() throws Exception {
|
||||||
SecretManager secretManager = SecretManager.instance.get();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
||||||
secretManager.startSession(gCubeSecret);
|
secretManager.startSession(gCubeSecret);
|
||||||
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
||||||
|
@ -110,7 +111,7 @@ public class StorageHubManagementTest extends ContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getFileInfoViaDirectoryListing() throws Exception {
|
public void getFileInfoViaDirectoryListing() throws Exception {
|
||||||
SecretManager secretManager = SecretManager.instance.get();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
GCubeSecret gCubeSecret = new GCubeSecret(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
|
||||||
secretManager.startSession(gCubeSecret);
|
secretManager.startSession(gCubeSecret);
|
||||||
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
||||||
|
|
Loading…
Reference in New Issue