diff --git a/gcube/extra-resources/META-INF/plugin.properties b/gcube/extra-resources/META-INF/plugin.properties new file mode 100644 index 0000000..27b1aba --- /dev/null +++ b/gcube/extra-resources/META-INF/plugin.properties @@ -0,0 +1,4 @@ +groupId=${groupId} +artifactId=${artifactId} +version=${version} +description=${description} \ No newline at end of file diff --git a/src/main/java/org/gcube/dataharvest/AccountingDashboardHarvesterPlugin.java b/src/main/java/org/gcube/dataharvest/AccountingDashboardHarvesterPlugin.java index 3a64dc3..32e9661 100644 --- a/src/main/java/org/gcube/dataharvest/AccountingDashboardHarvesterPlugin.java +++ b/src/main/java/org/gcube/dataharvest/AccountingDashboardHarvesterPlugin.java @@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory; * @author Eric Perrone (ISTI - CNR) * @author Luca Frosini (ISTI - CNR) */ -public class AccountingDashboardHarvesterPlugin extends Plugin { +public class AccountingDashboardHarvesterPlugin extends Plugin { private static Logger logger = LoggerFactory.getLogger(AccountingDashboardHarvesterPlugin.class); @@ -72,8 +72,8 @@ public class AccountingDashboardHarvesterPlugin extends Plugin properties = new InheritableThreadLocal() { @@ -134,8 +134,6 @@ public class AccountingDashboardHarvesterPlugin extends Plugin getSupportedCapabilities() { - Map discoveredCapabilities = new HashMap(); - return discoveredCapabilities; - } - - /**{@inheritDoc}*/ - @Override - public Class> getPluginImplementation() { - return AccountingDashboardHarvesterPlugin.class; - } - - @Override - public String toString(){ - return String.format("{" - + "name:%s," - + "version:%s," - + "description:%s," - + "pluginImplementation:%s," - + "}", - getName(), - getVersion(), - getDescription(), - getPluginImplementation().getClass().getSimpleName()); - } - -} diff --git a/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.Plugin b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.Plugin new file mode 100644 index 0000000..72efccb --- /dev/null +++ b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.Plugin @@ -0,0 +1 @@ +org.gcube.dataharvest.AccountingDashboardHarvesterPlugin \ No newline at end of file diff --git a/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration deleted file mode 100644 index c61670a..0000000 --- a/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration +++ /dev/null @@ -1 +0,0 @@ -org.gcube.dataharvest.AccountingDashboardHarvesterPluginDeclaration \ No newline at end of file diff --git a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java index fd4d419..bfa4ca7 100644 --- a/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java +++ b/src/test/java/org/gcube/dataharvest/AccountingDataHarvesterPluginTest.java @@ -96,10 +96,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( - dataHarvestPluginDeclaration); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); Map inputs = new HashMap<>(); @@ -133,7 +130,9 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - SmartExecutorClient smartExecutor = SmartExecutorClientFactory.getClient(AccountingDashboardHarvesterPluginDeclaration.NAME); + String pluginName = new AccountingDashboardHarvesterPlugin().getName(); + + SmartExecutorClient smartExecutor = SmartExecutorClientFactory.getClient(pluginName); Assert.assertNotNull(smartExecutor); Map inputs = new HashMap<>(); @@ -161,9 +160,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Scheduling scheduling = new Scheduling(cronExpression); scheduling.setGlobal(false); - LaunchParameter launchParameter = new LaunchParameter(AccountingDashboardHarvesterPluginDeclaration.NAME, inputs, - scheduling); - //LaunchParameter launchParameter = new LaunchParameter(AccountingDashboardHarvesterPluginDeclaration.NAME, inputs); + LaunchParameter launchParameter = new LaunchParameter(pluginName, inputs, scheduling); + //LaunchParameter launchParameter = new LaunchParameter(pluginName, inputs); smartExecutor.launch(launchParameter); @@ -180,10 +178,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( - dataHarvestPluginDeclaration); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); Map inputs = new HashMap<>(); @@ -220,10 +215,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); // AccountingDao dao = AccountingDao.get(); - AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( - dataHarvestPluginDeclaration); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); Properties properties = accountingDataHarvesterPlugin.getConfigParameters(); AccountingDashboardHarvesterPlugin.getProperties().set(properties); @@ -423,7 +415,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date start = DateUtils.getPreviousPeriod(measureType, false).getTime(); Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false); - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); accountingDataHarvesterPlugin.getConfigParameters(); ContextAuthorization contextAuthorization = new ContextAuthorization(); @@ -491,10 +483,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); // AccountingDao dao = AccountingDao.get(); - AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( - dataHarvestPluginDeclaration); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); Properties properties = accountingDataHarvesterPlugin.getConfigParameters(); AccountingDashboardHarvesterPlugin.getProperties().set(properties); @@ -649,9 +638,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { try { ContextTest.setContextByName(ROOT); - AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin( - dataHarvestPluginDeclaration); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); Properties properties = accountingDataHarvesterPlugin.getConfigParameters(); AccountingDashboardHarvesterPlugin.getProperties().set(properties); @@ -693,7 +680,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { SortedSet contexts = getContexts(); - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); accountingDataHarvesterPlugin.getConfigParameters(); ResourceCatalogueHarvester resourceCatalogueHarvester = new ResourceCatalogueHarvester(start, end, @@ -722,7 +709,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date start = DateUtils.getPreviousPeriod(measureType, false).getTime(); Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false); - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); accountingDataHarvesterPlugin.getConfigParameters(); SortedSet contexts = getContexts(); @@ -825,7 +812,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { Date start = DateUtils.getPreviousPeriod(measureType, false).getTime(); Date end = DateUtils.getEndDateFromStartDate(measureType, start, 1, false); - AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(null); + AccountingDashboardHarvesterPlugin accountingDataHarvesterPlugin = new AccountingDashboardHarvesterPlugin(); accountingDataHarvesterPlugin.getConfigParameters(); ContextAuthorization contextAuthorization = new ContextAuthorization(); @@ -863,8 +850,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest { ContextTest.setContextByName(ROOT); - AccountingDashboardHarvesterPluginDeclaration dataHarvestPluginDeclaration = new AccountingDashboardHarvesterPluginDeclaration(); - AccountingDashboardHarvesterPlugin adhp = new AccountingDashboardHarvesterPlugin(dataHarvestPluginDeclaration); + AccountingDashboardHarvesterPlugin adhp = new AccountingDashboardHarvesterPlugin(); Properties properties = adhp.getConfigParameters(); AccountingDashboardHarvesterPlugin.getProperties().set(properties);