From 225b0aacb78d7425b876774d1548af4f55b6346c Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 1 Mar 2024 09:51:23 +0100 Subject: [PATCH] cleaned tests --- .../gcube/accounting/aggregator/ContextTest.java | 6 ++++-- .../persistence/PostgreSQLConnectorTest.java | 1 - .../plugin/AccountingAggregatorPluginTest.java | 13 ++++--------- .../gcube/accounting/aggregator/plugin/MyTest.java | 6 +----- .../workspace/WorkSpaceManagementTest.java | 3 --- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/test/java/org/gcube/accounting/aggregator/ContextTest.java b/src/test/java/org/gcube/accounting/aggregator/ContextTest.java index 5d4da09..f613e8e 100644 --- a/src/test/java/org/gcube/accounting/aggregator/ContextTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/ContextTest.java @@ -37,7 +37,8 @@ public class ContextTest { public static final String DEVSEC; public static final String DEVVRE; - public static final String ROOT_PROD; + private static final String ROOT_PROD; + private static final String ROOT_PRE; protected static final Properties properties; @@ -54,6 +55,7 @@ public class ContextTest { DEVVRE = DEVSEC + "/devVRE"; ROOT_PROD = "/d4science.research-infrastructures.eu"; + ROOT_PRE = "/pred4s"; DEFAULT_TEST_SCOPE = GCUBE; @@ -162,7 +164,7 @@ public class ContextTest { @BeforeClass public static void beforeClass() throws Exception { - setContextByName(ROOT_PROD); + setContextByName(DEFAULT_TEST_SCOPE); } @AfterClass diff --git a/src/test/java/org/gcube/accounting/aggregator/persistence/PostgreSQLConnectorTest.java b/src/test/java/org/gcube/accounting/aggregator/persistence/PostgreSQLConnectorTest.java index ee7df84..20cdfca 100644 --- a/src/test/java/org/gcube/accounting/aggregator/persistence/PostgreSQLConnectorTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/persistence/PostgreSQLConnectorTest.java @@ -186,7 +186,6 @@ public class PostgreSQLConnectorTest extends ContextTest { @Ignore @Test public void moveStatusFromSrcToDst() throws Exception { - ContextTest.setContextByName(ROOT_PROD); AggregatorPersistenceStatusSrc apsSrc = AggregatorPersistenceFactory.getAggregatorPersistenceStatusSrc(); List aggregationStatuses = apsSrc.getAll(); for(AggregationStatus aggregationStatus : aggregationStatuses) { diff --git a/src/test/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPluginTest.java b/src/test/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPluginTest.java index 56827f6..238c707 100644 --- a/src/test/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPluginTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/plugin/AccountingAggregatorPluginTest.java @@ -23,9 +23,7 @@ import org.slf4j.LoggerFactory; public class AccountingAggregatorPluginTest extends ContextTest { private static Logger logger = LoggerFactory.getLogger(AccountingAggregatorPluginTest.class); - - public static final String ROOT_PROD = "/d4science.research-infrastructures.eu"; - + private void aggregate(String recordType, AggregationType aggregationType, Calendar aggregationStartCalendar, Calendar aggregationEndCalendar, boolean forceRerun, boolean forceEarlyAggregation, boolean skipAggregation) throws Exception { Map inputs = new HashMap(); @@ -79,7 +77,7 @@ public class AccountingAggregatorPluginTest extends ContextTest { } - @Ignore +// @Ignore @Test public void aggregateRecordDaily() throws Exception { Set types = new HashSet<>(); @@ -92,8 +90,8 @@ public class AccountingAggregatorPluginTest extends ContextTest { for(String recordType : types) { AggregationType aggregationType = AggregationType.DAILY; - Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2024, Calendar.FEBRUARY, 29); - Calendar end = Utility.getAggregationStartCalendar(2024, Calendar.MARCH, 1); + Calendar aggregationStartCalendar = Utility.getAggregationStartCalendar(2024, Calendar.MARCH, 1); + Calendar end = Utility.getAggregationStartCalendar(2024, Calendar.MARCH, 2); while (aggregationStartCalendar.before(end)) { Calendar aggregationEndCalendar = Utility.getEndCalendarFromStartCalendar(aggregationType, aggregationStartCalendar, 1); aggregate(recordType, aggregationType, aggregationStartCalendar, aggregationEndCalendar, forceRestart, forceEarlyAggregation, false); @@ -185,9 +183,6 @@ public class AccountingAggregatorPluginTest extends ContextTest { @Test public void testRecovery() throws Exception { - ContextTest.setContextByName(GCUBE); - // ContextTest.setContextByName(ROOT_PROD); - Map inputs = new HashMap(); AggregationType aggregationType = AggregationType.DAILY; diff --git a/src/test/java/org/gcube/accounting/aggregator/plugin/MyTest.java b/src/test/java/org/gcube/accounting/aggregator/plugin/MyTest.java index 049fa0c..804def2 100644 --- a/src/test/java/org/gcube/accounting/aggregator/plugin/MyTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/plugin/MyTest.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.gcube.accounting.aggregator.ContextTest; import org.gcube.accounting.aggregator.aggregation.AggregationInfo; import org.gcube.accounting.aggregator.aggregation.AggregationType; import org.gcube.accounting.aggregator.elaboration.Elaborator; @@ -267,13 +266,10 @@ public class MyTest { Constant.DEFAULT_DATE_FORMAT.format(aggregationEndDate)); } - - public static final String ROOT_PROD = "/d4science.research-infrastructures.eu"; - + @Ignore @Test public void testStorageHub() throws Exception { - ContextTest.setContextByName(ROOT_PROD); FolderContainer destinationFolder = null; StorageHubClient storageHubClient = new StorageHubClient(); FolderContainer parent = storageHubClient.getWSRoot(); diff --git a/src/test/java/org/gcube/accounting/aggregator/workspace/WorkSpaceManagementTest.java b/src/test/java/org/gcube/accounting/aggregator/workspace/WorkSpaceManagementTest.java index 9538291..749fd37 100644 --- a/src/test/java/org/gcube/accounting/aggregator/workspace/WorkSpaceManagementTest.java +++ b/src/test/java/org/gcube/accounting/aggregator/workspace/WorkSpaceManagementTest.java @@ -9,9 +9,6 @@ public class WorkSpaceManagementTest extends ContextTest { @Test public void testCreatedirectory() throws Exception { - ContextTest.setContextByName(GCUBE); - //ContextTest.setContextByName(AccountingAggregatorPluginTest.ROOT_PROD); - WorkSpaceManagement workSpaceManagement = WorkSpaceManagement.getInstance(); FolderContainer root = workSpaceManagement.getWorkspaceRoot();