From d379a997aa4beeaf79d05d59faf14d9188dfbfeb Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 1 Oct 2020 12:51:35 +0200 Subject: [PATCH] Fixed tests --- pom.xml | 2 +- .../client/SmartExecutorClientTest.java | 25 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 2d06759..3c92f50 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,7 @@ org.gcube.vremanagement hello-world-se-plugin - [1.0.0, 2.0.0-SNAPSHOT) + [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) test diff --git a/src/test/java/org/gcube/vremanagement/executor/client/SmartExecutorClientTest.java b/src/test/java/org/gcube/vremanagement/executor/client/SmartExecutorClientTest.java index 037351d..abc8984 100644 --- a/src/test/java/org/gcube/vremanagement/executor/client/SmartExecutorClientTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/client/SmartExecutorClientTest.java @@ -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 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 orphans = smartExecutorClient.getOrphanScheduledLaunches(); for(ScheduledTask orphan : orphans) {