|
|
|
@ -10,11 +10,9 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
|
|
|
|
import org.gcube.vremanagement.executor.api.types.Scheduling;
|
|
|
|
|
import org.gcube.vremanagement.executor.client.query.Discover;
|
|
|
|
|
import org.gcube.vremanagement.executor.plugin.Plugin;
|
|
|
|
|
import org.gcube.vremanagement.executor.plugin.PluginDefinition;
|
|
|
|
|
import org.gcube.vremanagement.executor.plugin.PluginStateEvolution;
|
|
|
|
|
import org.gcube.vremanagement.executor.plugin.ScheduledTask;
|
|
|
|
|
import org.gcube.vremanagement.helloworld.HelloWorldPlugin;
|
|
|
|
|
import org.junit.Assert;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
@ -31,6 +29,11 @@ public class SmartExecutorClientTest extends ContextTest {
|
|
|
|
|
public static final String HTTPS_ADDRESS = "https://smartexecutor.d4science.org:8090/smart-executor/rest";
|
|
|
|
|
public static final String HOST = "smartexecutor.d4science.org";
|
|
|
|
|
|
|
|
|
|
public static final String SLEEP_TIME = "sleepTime";
|
|
|
|
|
public static final String HELLO_WORLD_PLUGIN_NAME = "hello-world-se-plugin";
|
|
|
|
|
public static final String HELLO_WORLD_PLUGIN_VERSION = "2.0.0";
|
|
|
|
|
public static final String HELLO_WORLD_PLUGIN_DESCRIPTION = "Hello World Smart Executor Plugin";
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testSetAddress() {
|
|
|
|
|
SmartExecutorClientImpl smartExecutorClient = new SmartExecutorClientImpl();
|
|
|
|
@ -48,10 +51,10 @@ public class SmartExecutorClientTest extends ContextTest {
|
|
|
|
|
private LaunchParameter getLaunchParameter() {
|
|
|
|
|
Scheduling scheduling = new Scheduling(20);
|
|
|
|
|
Map<String,Object> inputs = new HashMap<String,Object>();
|
|
|
|
|
inputs.put(HelloWorldPlugin.SLEEP_TIME, TimeUnit.SECONDS.toMillis(10));
|
|
|
|
|
inputs.put(SLEEP_TIME, TimeUnit.SECONDS.toMillis(10));
|
|
|
|
|
inputs.put("TestUUID", UUID.randomUUID());
|
|
|
|
|
|
|
|
|
|
LaunchParameter launchParameter = new LaunchParameter(new HelloWorldPlugin().getName(), inputs);
|
|
|
|
|
LaunchParameter launchParameter = new LaunchParameter(HELLO_WORLD_PLUGIN_NAME, inputs);
|
|
|
|
|
launchParameter.setScheduling(scheduling);
|
|
|
|
|
|
|
|
|
|
return launchParameter;
|
|
|
|
@ -61,8 +64,7 @@ public class SmartExecutorClientTest extends ContextTest {
|
|
|
|
|
public void testServiceInteraction() throws Exception {
|
|
|
|
|
SmartExecutorClientFactory.forceURL("http://pc-frosini.isti.cnr.it:8080/smart-executor");
|
|
|
|
|
|
|
|
|
|
Plugin plugin = new HelloWorldPlugin();
|
|
|
|
|
String pluginName = plugin.getName();
|
|
|
|
|
String pluginName = HELLO_WORLD_PLUGIN_NAME;
|
|
|
|
|
|
|
|
|
|
logger.debug("Going to test smart executor using {} plugin", pluginName);
|
|
|
|
|
SmartExecutorClient smartExecutorClient = SmartExecutorClientFactory.getClient(pluginName);
|
|
|
|
@ -74,9 +76,9 @@ public class SmartExecutorClientTest extends ContextTest {
|
|
|
|
|
PluginDefinition pluginDefinition = plugins.get(0);
|
|
|
|
|
|
|
|
|
|
Assert.assertTrue(pluginDefinition.getName().compareTo(pluginName) == 0);
|
|
|
|
|
Assert.assertTrue(pluginDefinition.getDescription().compareTo(plugin.getDescription()) == 0);
|
|
|
|
|
Assert.assertTrue(pluginDefinition.getVersion().compareTo(plugin.getVersion()) == 0);
|
|
|
|
|
Assert.assertTrue(pluginDefinition.getSupportedCapabilities().equals(plugin.getSupportedCapabilities()));
|
|
|
|
|
Assert.assertTrue(pluginDefinition.getDescription().compareTo(HELLO_WORLD_PLUGIN_DESCRIPTION) == 0);
|
|
|
|
|
Assert.assertTrue(pluginDefinition.getVersion().compareTo(HELLO_WORLD_PLUGIN_VERSION) == 0);
|
|
|
|
|
//Assert.assertTrue(pluginDefinition.getSupportedCapabilities().equals(plugin.getSupportedCapabilities()));
|
|
|
|
|
|
|
|
|
|
List<ScheduledTask> orphans = smartExecutorClient.getOrphanScheduledLaunches();
|
|
|
|
|
for(ScheduledTask orphan : orphans) {
|
|
|
|
|