Removed circular dependecy

This commit is contained in:
Luca Frosini 2021-06-16 10:07:39 +02:00
parent 9b7bf6445b
commit 47c4fca044
2 changed files with 17 additions and 15 deletions

12
pom.xml
View File

@ -83,12 +83,12 @@
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <!-- <dependency> -->
<groupId>org.gcube.vremanagement</groupId> <!-- <groupId>org.gcube.vremanagement</groupId> -->
<artifactId>hello-world-se-plugin</artifactId> <!-- <artifactId>hello-world-se-plugin</artifactId> -->
<version>[2.0.0, 3.0.0-SNAPSHOT)</version> <!-- <version>[2.0.0, 3.0.0-SNAPSHOT)</version> -->
<scope>test</scope> <!-- <scope>test</scope> -->
</dependency> <!-- </dependency> -->
</dependencies> </dependencies>
</project> </project>

View File

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