From bc167b7845a2ffe4c15c819d11035f728b3da289 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 10 Jul 2020 18:13:57 +0200 Subject: [PATCH 1/6] Switching to gcube-jackson --- pom.xml | 8 ++++---- .../gcube/vremanagement/executor/client/Constants.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 582b306..2c458e8 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.vremanagement smart-executor-client - 2.0.0 + 3.0.0-SNAPSHOT Smart Executor Client Smart Executor Client is a library designed to interact with Smart Executor exposed REST API @@ -30,7 +30,7 @@ org.gcube.distribution gcube-bom - 1.4.0 + 2.0.0-SNAPSHOT pom import @@ -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 @@ -106,4 +106,4 @@ - \ 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..5d1e64f 100644 --- a/src/main/java/org/gcube/vremanagement/executor/client/Constants.java +++ b/src/main/java/org/gcube/vremanagement/executor/client/Constants.java @@ -7,7 +7,7 @@ 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_NAME = "Smart Executor"; public static final String SERVICE_ENTRY_NAME = "org.gcube.vremanagement.executor.ResourceInitializer"; } From ac97709b81371f5a0d4a2a3ced94d8a30fc73e08 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 4 Aug 2020 17:17:29 +0200 Subject: [PATCH 2/6] Switched changelog to the new format --- CHANGELOG.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ changelog.xml | 36 ------------------------------ 2 files changed, 61 insertions(+), 36 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 changelog.xml diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f706469 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,61 @@ +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +# Changelog for Smart Executor Client + + +## [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] [r4.13.1] - 2019-02-26 + +- Fixed gCoreEndpoint filter using got ServiceEndpoints [#12984] + + +## [v1.6.0] [r4.10.0] - 2018-02-15 + +- Added client for REST interface of Smart Executor [#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] [r4.6.0] - 2017-07-25 + +- Exposed unSchedule(executionIdentifier) API + + +## [v1.4.0] [r4.3.0] - 2017-03-16 + +- Improved code + + +## [v1.3.0] [r4.1.0] - 2016-11-07 + +- 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] [r3.10.0] - 2016-02-08 + +- Added Unscheduling feature for repetitive task [#521] + + +## [v1.1.0] [r3.9.0] - 2015-12-09 + +- Added Recurrent and Scheduled Task support [#111] + + +## [v1.0.0] - 2015-02-05 + +- First Release + diff --git a/changelog.xml b/changelog.xml deleted file mode 100644 index 3470aee..0000000 --- a/changelog.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - New version fo the client to comply with new REST APIs provided by Smart Executor 2.0.0 #12997 - - - Fixed gCoreEndpoint filter using got ServiceEndpoints #12984 - - - 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 - - - Exposed unSchedule(executionIdentifier) API - - - Fixed classes javadoc - - - SmartExecutor has been passed to Authorization 2.0 (refs #4944 #2112) - Provided to plugins the possibility to define a custom notifier (refs #5089) - - - Using Persistence (CouchDB) to save Scheduled Task configuration (refs #579) - Added Unscheduling feature for repetitive task (refs #521) - - - Added Recurrent and Scheduled Task support (refs #111) - Saving Task Evolution on Persistence (CouchDB) (refs #89) - - - First Release - - \ No newline at end of file From 6206a091f47a792cdee1fb38c7ae5d838e2f1f44 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 22 Sep 2020 13:48:53 +0200 Subject: [PATCH 3/6] Removed service-archive creation which is deprecated --- pom.xml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 2c458e8..2d06759 100644 --- a/pom.xml +++ b/pom.xml @@ -91,19 +91,4 @@ - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - make-servicearchive - package - - - - - - + \ No newline at end of file From 8bf985b124557c60ad9074971c967a0c849b4f30 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 30 Sep 2020 11:23:37 +0200 Subject: [PATCH 4/6] Switched to new APIs which removed the PluginDeclaration class --- .../executor/client/SmartExecutorClient.java | 4 ++-- .../executor/client/SmartExecutorClientImpl.java | 6 +++--- .../executor/client/SmartExecutorClientTest.java | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) 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..037351d 100644 --- a/src/test/java/org/gcube/vremanagement/executor/client/SmartExecutorClientTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/client/SmartExecutorClientTest.java @@ -10,7 +10,7 @@ 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.PluginDefinition; import org.gcube.vremanagement.executor.plugin.PluginStateEvolution; import org.gcube.vremanagement.executor.plugin.ScheduledTask; import org.gcube.vremanagement.helloworld.HelloWorldPlugin; @@ -68,9 +68,9 @@ public class SmartExecutorClientTest extends ContextTest { 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 pluginDeclaration = plugins.get(0); Assert.assertTrue(pluginDeclaration.getName().compareTo(helloWorldPluginDeclaration.getName()) == 0); Assert.assertTrue( @@ -118,8 +118,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(); From d379a997aa4beeaf79d05d59faf14d9188dfbfeb Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 1 Oct 2020 12:51:35 +0200 Subject: [PATCH 5/6] 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) { From fcbcd6402af70e6845a75fb7d65a2a52e73be7ba Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 26 May 2021 10:25:53 +0200 Subject: [PATCH 6/6] fixed discovery parameters --- .../org/gcube/vremanagement/executor/client/Constants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 5d1e64f..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 = "Smart Executor"; + 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"; }