diff --git a/CHANGELOG.md b/CHANGELOG.md index 984b4c9..f706469 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,55 +3,59 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for Smart Executor Client -## [v2.0.0-SNAPSHOT] +## [v3.0.0-SNAPSHOT] [r5.0.0] - + +- Switched smart-executor JSON management to gcube-jackson [#19647] +- Redesigned HTTP APIs to comply with RESTful architectural style [#12997] +- Added API to retrieve scheduled tasks [#10780] + + +## [v.2.0.0] - New version of the client to comply with new REST APIs provided by Smart Executor 2.0.0 [#12997] -## [v1.7.0] - 2019-02-26 +## [v1.7.0] [r4.13.1] - 2019-02-26 - Fixed gCoreEndpoint filter using got ServiceEndpoints [#12984] -## [v1.6.0] - 2017-02-15 +## [v1.6.0] [r4.10.0] - 2018-02-15 - Added client for REST interface of Smart Executor [#5109] -- Created fallback client presenting as REST client but using SOAP API to support old SmartExecutor instances with new code [#5109] - Deprecated old SOAP client [#5109] +- Created fallback client presenting as REST client but using SOAP API to support old SmartExecutor instances with new code [#5109] +- Changed pom.xml to use new make-servicearchive directive [#10170] -## [v1.5.0] - 2017-25-07 +## [v1.5.0] [r4.6.0] - 2017-07-25 - Exposed unSchedule(executionIdentifier) API -## [v1.4.0] - 2017-03-16 +## [v1.4.0] [r4.3.0] - 2017-03-16 -- Fixed classes javadoc +- Improved code -## [v1.3.0] - 2016-11-07 +## [v1.3.0] [r4.1.0] - 2016-11-07 -- SmartExecutor has been passed to Authorization 2.0 [#4944 #2112] +- SmartExecutor has been migrated to Authorization 2.0 [#4944] [#2112] - Provided to plugins the possibility to define a custom notifier [#5089] +- Using newly created gcube-bom [#2363] -## [v1.2.0] - 2016-02-08 +## [v1.2.0] [r3.10.0] - 2016-02-08 -- Using Persistence (CouchDB) to save Scheduled Task configuration [#579] - Added Unscheduling feature for repetitive task [#521] -## [v1.1.0] - 2015-12-09 +## [v1.1.0] [r3.9.0] - 2015-12-09 - Added Recurrent and Scheduled Task support [#111] -- Saving Task Evolution on Persistence (CouchDB) [#89] ## [v1.0.0] - 2015-02-05 -- First Release - - - +- First Release diff --git a/pom.xml b/pom.xml index a77b5ff..abe6329 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.vremanagement smart-executor-client - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT Smart Executor Client Smart Executor Client is a library designed to interact with Smart Executor exposed REST API @@ -57,7 +57,7 @@ org.gcube.vremanagement smart-executor-api - [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) + [3.0.0-SNAPSHOT, 4.0.0-SNAPSHOT) org.gcube.common @@ -86,24 +86,9 @@ org.gcube.vremanagement hello-world-se-plugin - [1.0.0, 2.0.0-SNAPSHOT) + [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) test - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - make-servicearchive - package - - - - - \ No newline at end of file diff --git a/src/main/java/org/gcube/vremanagement/executor/client/Constants.java b/src/main/java/org/gcube/vremanagement/executor/client/Constants.java index ef3069e..9ec69e1 100644 --- a/src/main/java/org/gcube/vremanagement/executor/client/Constants.java +++ b/src/main/java/org/gcube/vremanagement/executor/client/Constants.java @@ -6,8 +6,8 @@ package org.gcube.vremanagement.executor.client; public class Constants { /* Used for REST*/ - public static final String SERVICE_CLASS = "VREManagement"; - public static final String SERVICE_NAME = "SmartExecutor"; + public static final String SERVICE_CLASS = "org.gcube.vremanagement"; + public static final String SERVICE_NAME = "smart-executor"; public static final String SERVICE_ENTRY_NAME = "org.gcube.vremanagement.executor.ResourceInitializer"; } diff --git a/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClient.java b/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClient.java index a1cb06a..190cca2 100644 --- a/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClient.java +++ b/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClient.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.UUID; import org.gcube.vremanagement.executor.api.types.LaunchParameter; -import org.gcube.vremanagement.executor.plugin.PluginDeclaration; +import org.gcube.vremanagement.executor.plugin.PluginDefinition; import org.gcube.vremanagement.executor.plugin.PluginStateEvolution; import org.gcube.vremanagement.executor.plugin.ScheduledTask; @@ -15,7 +15,7 @@ public interface SmartExecutorClient { public String getAvailablePlugins(); - public List getPlugins() throws IOException; + public List getPlugins() throws IOException; public String getLaunches(); diff --git a/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java b/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java index 7a875e1..7b2e1c3 100644 --- a/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java +++ b/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java @@ -21,7 +21,7 @@ import org.gcube.vremanagement.executor.api.rest.RestConstants; import org.gcube.vremanagement.executor.api.types.LaunchParameter; import org.gcube.vremanagement.executor.exception.ExecutorException; import org.gcube.vremanagement.executor.json.SEMapper; -import org.gcube.vremanagement.executor.plugin.PluginDeclaration; +import org.gcube.vremanagement.executor.plugin.PluginDefinition; import org.gcube.vremanagement.executor.plugin.PluginStateEvolution; import org.gcube.vremanagement.executor.plugin.ScheduledTask; import org.slf4j.Logger; @@ -147,9 +147,9 @@ public class SmartExecutorClientImpl implements SmartExecutorClient { } @Override - public List getPlugins() throws IOException { + public List getPlugins() throws IOException { String pluginList = getAvailablePlugins(); - return SEMapper.getInstance().unmarshalList(PluginDeclaration.class,pluginList); + return SEMapper.getInstance().unmarshalList(PluginDefinition.class,pluginList); } private String getScheduledTask(String name) { 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 c58a87e..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.PluginDeclaration; +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(); + List plugins = smartExecutorClient.getPlugins(); Assert.assertTrue(plugins.size() == 1); - PluginDeclaration 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) { @@ -118,8 +117,8 @@ public class SmartExecutorClientTest extends ContextTest { logger.debug("Host {}", SmartExecutorClientImpl.getHostFromCompleteURL(host)); SmartExecutorClientImpl client = new SmartExecutorClientImpl(); client.setAddress(host); - List plugins = client.getPlugins(); - for(PluginDeclaration p : plugins) { + List plugins = client.getPlugins(); + for(PluginDefinition p : plugins) { logger.debug("\tPlugin {}", p); client.setPluginName(p.getName()); List tasks = client.getScheduledLaunches();