removed old HL test

This commit is contained in:
Luca Frosini 2021-11-26 16:38:20 +01:00
parent eaa0de49ea
commit f79703fe44
1 changed files with 18 additions and 27 deletions

View File

@ -3,10 +3,12 @@ package org.gcube.storagehub;
import java.util.List;
import java.util.Map;
import org.gcube.common.storagehub.client.dsl.ContainerType;
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.ListResolver;
import org.gcube.common.storagehub.client.dsl.ListResolverTyped;
import org.gcube.common.storagehub.client.dsl.OpenResolver;
import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.items.Item;
@ -19,26 +21,6 @@ public class StorageHubManagementTest extends ContextTest {
private static final Logger logger = LoggerFactory.getLogger(StorageHubManagementTest.class);
//@Test
// public void testHL() throws Exception {
// ApplicationMode applicationMode = new ApplicationMode(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
// applicationMode.start();
// String username = ContextUtility.getUsername();
// HomeManagerFactory factory = HomeLibrary.getHomeManagerFactory();
// HomeManager manager = factory.getHomeManager();
// User user = manager.createUser(username);
// @SuppressWarnings("deprecation")
// Home home = manager.getHome(user);
// Workspace ws = home.getWorkspace();
// WorkspaceFolder workspaceFolder = ws.getRoot();
// workspaceFolder = ws.getVREFolderByScope(ContextUtility.getCurrentContext());
// // logger.debug("VRE Folder ID : {} - Owner: {}", workspaceFolder.getId(), workspaceFolder.getOwner().getPortalLogin());
// List<WorkspaceItem> workspaceItems = workspaceFolder.getChildren(true);
// for(WorkspaceItem workspaceItem : workspaceItems) {
// logger.debug("{} {}{} ID:{}", workspaceFolder.getType(), workspaceItem.getName(), workspaceItem.isHidden()? " (hidden)":"", workspaceItem.getId());
// }
// }
@Test
public void myTest() throws Exception {
ApplicationMode applicationMode = new ApplicationMode(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
@ -53,8 +35,8 @@ public class StorageHubManagementTest extends ContextTest {
ApplicationMode applicationMode = new ApplicationMode(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
applicationMode.start();
StorageHubManagement storageHubManagement = new StorageHubManagement();
OpenResolver openResolver = storageHubManagement.storageHubClient.open("71394bdc-296f-46d4-ab7b-ecc9abc36bdd");
openResolver.asItem().delete();
OpenResolver openResolver = storageHubManagement.storageHubClient.open("");
// openResolver.asItem().delete();
/*
openResolver = storageHubManagement.storageHubClient.open("656cd713-bd79-4659-abd6-9f1baaedb5bc");
openResolver.asItem().delete();
@ -64,17 +46,26 @@ public class StorageHubManagementTest extends ContextTest {
applicationMode.end();
}
//@Test
@Test
public void listFolders() throws Exception {
ApplicationMode applicationMode = new ApplicationMode(ContextTest.properties.getProperty(DEFAULT_TEST_SCOPE_NAME));
applicationMode.start();
StorageHubManagement storageHubManagement = new StorageHubManagement();
FolderContainer root = storageHubManagement.getWorkspaceRoot();
FolderContainer contextFolder = storageHubManagement.getContextFolder();
// FolderContainer dstFolder =
storageHubManagement.getDestinationFolder("application/pdf");
storageHubManagement.tree(root);
storageHubManagement.tree(contextFolder);
ListResolverTyped listResolverTyped = contextFolder.list();
List<ItemContainer<? extends Item>> containers = listResolverTyped.includeHidden().getContainers();
for(ItemContainer<? extends Item> itemContainer : containers) {
Item item = itemContainer.get();
String name = item.getName();
ContainerType containerType = itemContainer.getType();
if(containerType==ContainerType.FOLDER && name.compareTo(".catalogue")==0) {
itemContainer.delete();
}
}
// FolderContainer dstFolder = storageHubManagement.getDestinationFolder("application/pdf");
// storageHubManagement.tree(root);
// storageHubManagement.tree(contextFolder);
// storageHubManagement.tree(dstFolder);
applicationMode.end();
}