Merge remote-tracking branch 'origin/feature/19647'

Conflicts:
	CHANGELOG.md
	pom.xml
This commit is contained in:
Luca Frosini 2021-06-08 12:24:47 +02:00
commit aeccfe1570
6 changed files with 47 additions and 59 deletions

View File

@ -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

21
pom.xml
View File

@ -10,7 +10,7 @@
<groupId>org.gcube.vremanagement</groupId>
<artifactId>smart-executor-client</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<name>Smart Executor Client</name>
<description>Smart Executor Client is a library designed to interact with Smart Executor exposed REST API</description>
@ -57,7 +57,7 @@
<dependency>
<groupId>org.gcube.vremanagement</groupId>
<artifactId>smart-executor-api</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<version>[3.0.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
@ -86,24 +86,9 @@
<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>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-servicearchive</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -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";
}

View File

@ -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<PluginDeclaration> getPlugins() throws IOException;
public List<PluginDefinition> getPlugins() throws IOException;
public String getLaunches();

View File

@ -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<PluginDeclaration> getPlugins() throws IOException {
public List<PluginDefinition> 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) {

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.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<PluginDeclaration> plugins = smartExecutorClient.getPlugins();
List<PluginDefinition> 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<ScheduledTask> 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<PluginDeclaration> plugins = client.getPlugins();
for(PluginDeclaration p : plugins) {
List<PluginDefinition> plugins = client.getPlugins();
for(PluginDefinition p : plugins) {
logger.debug("\tPlugin {}", p);
client.setPluginName(p.getName());
List<ScheduledTask> tasks = client.getScheduledLaunches();