Fixing tests

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@158735 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-11-21 15:32:32 +00:00
parent c9c13bc309
commit 8484ba1913
2 changed files with 47 additions and 7 deletions

View File

@ -8,10 +8,14 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.gcube.common.clients.ProxyBuilderImpl;
import org.gcube.testutility.ScopedTest;
import org.gcube.vremanagement.executor.api.SmartExecutor;
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
import org.gcube.vremanagement.executor.api.types.Scheduling;
import org.gcube.vremanagement.executor.client.plugins.ExecutorPlugin;
import org.gcube.vremanagement.executor.client.plugins.query.SmartExecutorPluginQuery;
import org.gcube.vremanagement.executor.client.plugins.query.filter.SpecificEndpointDiscoveryFilter;
import org.gcube.vremanagement.executor.client.proxies.SmartExecutorProxy;
import org.gcube.vremanagement.executor.plugin.PluginStateEvolution;
import org.junit.Assert;
@ -136,10 +140,47 @@ public class ISExporterPluginSmartExecutorSchedulerTest extends ScopedTest {
}
@Test
public void unSchedule() throws Exception {
SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(ISExporterPluginDeclaration.NAME).build();
Assert.assertNotNull(proxy);
//proxy.unSchedule(null, true);
}
public void stop() throws Exception {
ExecutorPlugin runExecutorPlugin = new ExecutorPlugin();
SmartExecutorPluginQuery runQuery = new SmartExecutorPluginQuery(runExecutorPlugin);
runQuery.addConditions(ISExporterPluginDeclaration.NAME);
SpecificEndpointDiscoveryFilter sedf = new SpecificEndpointDiscoveryFilter("http://pc-frosini.isti.cnr.it:8080/smart-executor/gcube/vremanagement/smart-executor");
runQuery.setEndpointDiscoveryFilter(sedf);
SmartExecutorProxy proxy = new ProxyBuilderImpl<SmartExecutor, SmartExecutorProxy>(runExecutorPlugin, runQuery).build();
Assert.assertNotNull(proxy);
proxy.stop("321d8640-1b9f-4529-ba23-588ff2f17625");
}
@Test
public void launchTest() throws Exception {
Map<String, Object> inputs = new HashMap<String, Object>();
inputs.put(ISExporterPlugin.FILTERED_REPORT, true);
logger.debug("Inputs : {}", inputs);
LaunchParameter parameter = new LaunchParameter(ISExporterPluginDeclaration.NAME, inputs);
try {
ExecutorPlugin runExecutorPlugin = new ExecutorPlugin();
SmartExecutorPluginQuery runQuery = new SmartExecutorPluginQuery(runExecutorPlugin);
runQuery.addConditions(ISExporterPluginDeclaration.NAME);
SpecificEndpointDiscoveryFilter sedf = new SpecificEndpointDiscoveryFilter("http://pc-frosini.isti.cnr.it:8080/smart-executor/gcube/vremanagement/smart-executor");
runQuery.setEndpointDiscoveryFilter(sedf);
SmartExecutorProxy proxy = new ProxyBuilderImpl<SmartExecutor, SmartExecutorProxy>(runExecutorPlugin, runQuery).build();
String uuidString = proxy.launch(parameter);
UUID uuid = UUID.fromString(uuidString);
logger.debug("Launched with UUID : {}", uuid);
} catch(Exception e){
logger.error("Error launching sheduled task", e);
throw e;
}
}
}

View File

@ -8,7 +8,6 @@ import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.context.ContextElaborator;
import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.resourceregistry.context.ContextManagement;
import org.gcube.informationsystem.resourceregistry.context.ContextManagementImpl;
/**
@ -18,7 +17,7 @@ public class ContextCreator extends ContextElaborator {
protected Map<String, UUID> contexts;
protected ContextManagement contextManagement;
protected ContextManagementImpl contextManagement;
public ContextCreator() {
super();