Fixed tests

This commit is contained in:
Luca Frosini 2020-10-01 12:51:35 +02:00
parent 8bf985b124
commit d379a997aa
2 changed files with 13 additions and 14 deletions

View File

@ -86,7 +86,7 @@
<dependency>
<groupId>org.gcube.vremanagement</groupId>
<artifactId>hello-world-se-plugin</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>test</scope>
</dependency>

View File

@ -10,11 +10,11 @@ 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.gcube.vremanagement.helloworld.HelloWorldPluginDeclaration;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
@ -51,7 +51,7 @@ public class SmartExecutorClientTest extends ContextTest {
inputs.put(HelloWorldPlugin.SLEEP_TIME, TimeUnit.SECONDS.toMillis(10));
inputs.put("TestUUID", UUID.randomUUID());
LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs);
LaunchParameter launchParameter = new LaunchParameter(new HelloWorldPlugin().getName(), inputs);
launchParameter.setScheduling(scheduling);
return launchParameter;
@ -61,23 +61,22 @@ public class SmartExecutorClientTest extends ContextTest {
public void testServiceInteraction() throws Exception {
SmartExecutorClientFactory.forceURL("http://pc-frosini.isti.cnr.it:8080/smart-executor");
HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration();
logger.debug("Going to test smart executor using {} plugin", helloWorldPluginDeclaration.getName());
SmartExecutorClient smartExecutorClient = SmartExecutorClientFactory
.getClient(helloWorldPluginDeclaration.getName());
Plugin plugin = new HelloWorldPlugin();
String pluginName = plugin.getName();
logger.debug("Going to test smart executor using {} plugin", pluginName);
SmartExecutorClient smartExecutorClient = SmartExecutorClientFactory.getClient(pluginName);
String host = smartExecutorClient.getHost();
Assert.assertTrue(host.contains("pc-frosini.isti.cnr.it"));
List<PluginDefinition> plugins = smartExecutorClient.getPlugins();
Assert.assertTrue(plugins.size() == 1);
PluginDefinition pluginDeclaration = plugins.get(0);
PluginDefinition pluginDefinition = plugins.get(0);
Assert.assertTrue(pluginDeclaration.getName().compareTo(helloWorldPluginDeclaration.getName()) == 0);
Assert.assertTrue(
pluginDeclaration.getDescription().compareTo(helloWorldPluginDeclaration.getDescription()) == 0);
Assert.assertTrue(pluginDeclaration.getVersion().compareTo(helloWorldPluginDeclaration.getVersion()) == 0);
Assert.assertTrue(pluginDeclaration.getSupportedCapabilities()
.equals(helloWorldPluginDeclaration.getSupportedCapabilities()));
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()));
List<ScheduledTask> orphans = smartExecutorClient.getOrphanScheduledLaunches();
for(ScheduledTask orphan : orphans) {