Switching to new smart-executor-api

pull/2/head
Luca Frosini 4 years ago
parent c47d0bbd25
commit 1fd086e63d

@ -0,0 +1,4 @@
groupId=${groupId}
artifactId=${artifactId}
version=${version}
description=${description}

@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
* @author Eric Perrone (ISTI - CNR)
* @author Luca Frosini (ISTI - CNR)
*/
public class AccountingDashboardHarvesterPlugin extends Plugin<AccountingDashboardHarvesterPluginDeclaration> {
public class AccountingDashboardHarvesterPlugin extends Plugin {
private static Logger logger = LoggerFactory.getLogger(AccountingDashboardHarvesterPlugin.class);
@ -72,8 +72,8 @@ public class AccountingDashboardHarvesterPlugin extends Plugin<AccountingDashboa
protected Date start;
protected Date end;
public AccountingDashboardHarvesterPlugin(AccountingDashboardHarvesterPluginDeclaration pluginDeclaration) {
super(pluginDeclaration);
public AccountingDashboardHarvesterPlugin() {
super();
}
private static final InheritableThreadLocal<Properties> properties = new InheritableThreadLocal<Properties>() {
@ -134,8 +134,6 @@ public class AccountingDashboardHarvesterPlugin extends Plugin<AccountingDashboa
};
public Properties getConfigParameters() throws IOException {
Properties properties = new Properties();
try {

@ -1,74 +0,0 @@
package org.gcube.dataharvest;
import java.util.HashMap;
import java.util.Map;
import org.gcube.vremanagement.executor.plugin.Plugin;
import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Eric Perrone (ISTI - CNR)
* @author Luca Frosini (ISTI - CNR)
*/
public class AccountingDashboardHarvesterPluginDeclaration implements PluginDeclaration {
private static Logger logger = LoggerFactory.getLogger(AccountingDashboardHarvesterPluginDeclaration.class);
public static final String NAME = "AccountingDashboardHarvester";
public static final String DESCRIPTION = "Data Harvester for Accounting Dashboard";
public static final String VERSION = "1.4.0";
/**{@inheritDoc}*/
@Override
public void init() {
logger.debug(String.format("%s initialized", AccountingDashboardHarvesterPlugin.class.getSimpleName()));
}
/**{@inheritDoc}*/
@Override
public String getName() {
return NAME;
}
/**{@inheritDoc}*/
@Override
public String getDescription() {
return DESCRIPTION;
}
/**{@inheritDoc}*/
@Override
public String getVersion() {
return VERSION;
}
/**{@inheritDoc}*/
@Override
public Map<String, String> getSupportedCapabilities() {
Map<String, String> discoveredCapabilities = new HashMap<String, String>();
return discoveredCapabilities;
}
/**{@inheritDoc}*/
@Override
public Class<? extends Plugin<? extends PluginDeclaration>> 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());
}
}

@ -0,0 +1 @@
org.gcube.dataharvest.AccountingDashboardHarvesterPlugin

@ -1 +0,0 @@
org.gcube.dataharvest.AccountingDashboardHarvesterPluginDeclaration

@ -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<String,Object> 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<String,Object> 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<String,Object> 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<String> 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<String> 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);

Loading…
Cancel
Save