From 8484ba19134684a9d273669ba0dc68139c8d5110 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 21 Nov 2017 15:32:32 +0000 Subject: [PATCH] Fixing tests git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@158735 82a268e6-3cf1-43bd-a215-b396298e98cf --- ...orterPluginSmartExecutorSchedulerTest.java | 51 +++++++++++++++++-- .../resourceregistry/ContextCreator.java | 3 +- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/gcube/informationsystem/exporter/ISExporterPluginSmartExecutorSchedulerTest.java b/src/test/java/org/gcube/informationsystem/exporter/ISExporterPluginSmartExecutorSchedulerTest.java index 373fde7..b4f5500 100644 --- a/src/test/java/org/gcube/informationsystem/exporter/ISExporterPluginSmartExecutorSchedulerTest.java +++ b/src/test/java/org/gcube/informationsystem/exporter/ISExporterPluginSmartExecutorSchedulerTest.java @@ -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(runExecutorPlugin, runQuery).build(); + + Assert.assertNotNull(proxy); + proxy.stop("321d8640-1b9f-4529-ba23-588ff2f17625"); + } + + @Test + public void launchTest() throws Exception { + + Map inputs = new HashMap(); + 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(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; + } + + } + + } diff --git a/src/test/java/org/gcube/resourceregistry/ContextCreator.java b/src/test/java/org/gcube/resourceregistry/ContextCreator.java index d15edae..5ce75d7 100644 --- a/src/test/java/org/gcube/resourceregistry/ContextCreator.java +++ b/src/test/java/org/gcube/resourceregistry/ContextCreator.java @@ -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 contexts; - protected ContextManagement contextManagement; + protected ContextManagementImpl contextManagement; public ContextCreator() { super();