From d972d8e2f3221f63a387490e9ff0825a0cfa1a12 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 11 May 2021 12:51:09 +0200 Subject: [PATCH] cleaned test cases --- .../wsthreddssync/server/SyncronizeWithThredds.java | 2 +- .../widgets/wsthreddssync/TestWsThreddsEngine.java | 9 --------- .../widgets/wsthreddssync/TestWsThreddsQuery.java | 2 -- .../widgets/wsthreddssync/UnSyncThreddsFolders.java | 13 ++++++------- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SyncronizeWithThredds.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SyncronizeWithThredds.java index 536a997..f3240c5 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SyncronizeWithThredds.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SyncronizeWithThredds.java @@ -121,7 +121,7 @@ public class SyncronizeWithThredds { * @throws ItemNotSynched the item not synched * @throws Exception the exception */ - public ThSyncFolderDescriptor isItemSynched(String folderId) throws ItemNotSynched, Exception { + public ThSyncFolderDescriptor isItemSynched(String folderId) throws ItemNotSynched { ThSyncFolderDescriptor config = null; try { config = workspaceThreddsSynchronize.getConfiguration(folderId); diff --git a/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsEngine.java b/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsEngine.java index e05ba39..ab508d9 100644 --- a/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsEngine.java +++ b/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsEngine.java @@ -1,17 +1,8 @@ package org.gcube.portlets.widgets.wsthreddssync; -import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize; import org.gcube.portlets.widgets.wsthreddssync.server.SyncronizeWithThredds; -import org.gcube.usecases.ws.thredds.SyncEngine; -import org.gcube.usecases.ws.thredds.engine.impl.ProcessDescriptor; -import org.gcube.usecases.ws.thredds.engine.impl.ProcessStatus; -import org.gcube.usecases.ws.thredds.faults.WorkspaceLockedException; -import org.gcube.usecases.ws.thredds.faults.WorkspaceNotSynchedException; -import org.gcube.usecases.ws.thredds.model.SyncOperationCallBack; -import org.gcube.usecases.ws.thredds.model.SynchFolderConfiguration; -// TODO: Auto-generated Javadoc /** * The Class TestWsThreddsEngine. * diff --git a/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsQuery.java b/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsQuery.java index a23e663..255cb7e 100644 --- a/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsQuery.java +++ b/src/test/java/org/gcube/portlets/widgets/wsthreddssync/TestWsThreddsQuery.java @@ -5,8 +5,6 @@ import java.util.Map; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.storagehubwrapper.server.StorageHubWrapper; import org.gcube.common.storagehubwrapper.server.tohl.Workspace; -import org.gcube.common.storagehubwrapper.shared.tohl.Properties; -import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder; import org.gcube.portal.wssynclibrary.shared.ItemNotSynched; public class TestWsThreddsQuery { diff --git a/src/test/java/org/gcube/portlets/widgets/wsthreddssync/UnSyncThreddsFolders.java b/src/test/java/org/gcube/portlets/widgets/wsthreddssync/UnSyncThreddsFolders.java index c1a69eb..a30b794 100644 --- a/src/test/java/org/gcube/portlets/widgets/wsthreddssync/UnSyncThreddsFolders.java +++ b/src/test/java/org/gcube/portlets/widgets/wsthreddssync/UnSyncThreddsFolders.java @@ -5,7 +5,6 @@ package org.gcube.portlets.widgets.wsthreddssync; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; @@ -15,8 +14,8 @@ import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem; import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException; import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.ItemNotFoundException; import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.WorkspaceFolderNotFoundException; +import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor; import org.gcube.portlets.widgets.wsthreddssync.server.SyncronizeWithThredds; -import org.gcube.usecases.ws.thredds.Constants; @@ -30,7 +29,7 @@ public class UnSyncThreddsFolders { public static String DEFAULT_SCOPE = "/gcube"; //DEV public static String TEST_USER = "francesco.mangiacrapa"; - public static String TEST_USER_TOKEN = "0e2c7963-8d3e-4ea6-a56d-ffda530dd0fa-98187548"; //token user: Francesco Mangiacrapa - /gcube (root) + public static String TEST_USER_TOKEN = "TOKEN"; private static List lstUnSynchedItem = new ArrayList(); private static List lstUnSynchedFailedItem = new ArrayList(); @@ -146,13 +145,13 @@ public class UnSyncThreddsFolders { return; try{ - boolean synched = syncService.isItemSynched(workspaceItem.getId(), DEFAULT_SCOPE, TEST_USER); + ScopeProvider.instance.set(DEFAULT_SCOPE); + SecurityTokenProvider.instance.set(TEST_USER_TOKEN); + ThSyncFolderDescriptor synched = syncService.isItemSynched(workspaceItem.getId()); System.out.println("Is the workspace item: "+workspaceItem.getId() + " synched? "+synched +", Is folder? "+workspaceItem.isFolder()); - if(synched && workspaceItem.isFolder()){ + if(synched != null){ //Boolean unsynched = syncService.doUnSync(workspaceItem.getId(), false, DEFAULT_SCOPE, TEST_USER_TOKEN); - ScopeProvider.instance.set(DEFAULT_SCOPE); - SecurityTokenProvider.instance.set(TEST_USER_TOKEN); Workspace ws = getWorkspace(); cleanItem(workspaceItem, ws); totalAttempts++;