Removed the need of PluginDeclaration class
This commit is contained in:
parent
f64d3d9952
commit
97a7036929
|
@ -20,7 +20,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
|
|||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
||||
import org.gcube.vremanagement.executor.api.types.Scheduling;
|
||||
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.Ref;
|
||||
import org.gcube.vremanagement.executor.plugin.RunOn;
|
||||
|
@ -54,7 +54,7 @@ public class SEMapper {
|
|||
mapper.registerSubtypes(RunOn.class);
|
||||
mapper.registerSubtypes(Ref.class);
|
||||
|
||||
mapper.registerSubtypes(PluginDeclaration.class);
|
||||
mapper.registerSubtypes(PluginDefinition.class);
|
||||
mapper.registerSubtypes(PluginStateEvolution.class);
|
||||
|
||||
mapper.registerSubtypes(LaunchParameter.class);
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package org.gcube.vremanagement.executor.persistence;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.vremanagement.executor.plugin.Plugin;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginState;
|
||||
|
||||
/**
|
||||
* This class is used to persist the execution state
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class Persistence<P extends PersistenceConnector> {
|
||||
|
||||
protected final String name;
|
||||
protected final P persistenceConnector;
|
||||
protected final UUID uuid;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param persistenceConnector the {@link PersistenceConnector} which
|
||||
* created and/or opened the connection to DB
|
||||
* @param name the name get from {@link PluginDeclaration}) related to the
|
||||
* running {@link Plugin}
|
||||
* @param uuid the execution identifier
|
||||
*/
|
||||
@Deprecated
|
||||
public Persistence(P persistenceConnector, String name, UUID uuid){
|
||||
this.name = name;
|
||||
this.persistenceConnector = persistenceConnector;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Persist the new state of plugin
|
||||
* @param timestamp the time of the new {@link PluginState}
|
||||
* @param pluginState the {@link PluginState} value
|
||||
* @throws Exception if fails
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void addEvolution(long timestamp, PluginState pluginState)
|
||||
throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* @return the actual (or the last temporal) {@link PluginState} value
|
||||
* @throws Exception if fails to retrieve the {@link PluginState} from DB
|
||||
*/
|
||||
@Deprecated
|
||||
public PluginState getState() throws Exception {
|
||||
return persistenceConnector.getLastPluginInstanceState(uuid);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.persistence;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.vremanagement.executor.plugin.Plugin;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginState;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginStateNotification;
|
||||
|
||||
/**
|
||||
* Model the connector which create or open the connection to DB
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class PersistenceConnector extends PluginStateNotification {
|
||||
|
||||
public PersistenceConnector(){
|
||||
super(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public PersistenceConnector(Map<String, String> inputs){
|
||||
super(inputs);
|
||||
}
|
||||
|
||||
protected static PersistenceConnector persistenceConnector;
|
||||
|
||||
/**
|
||||
* @return the persistenceConnector
|
||||
*/
|
||||
public static PersistenceConnector getPersistenceConnector() {
|
||||
return persistenceConnector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param persistenceConnector the persistenceConnector to set
|
||||
*/
|
||||
public static void setPersistenceConnector(
|
||||
PersistenceConnector persistenceConnector) {
|
||||
PersistenceConnector.persistenceConnector = persistenceConnector;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is used to provide a location where creating persistence
|
||||
* files
|
||||
* @param location directory where creating the DB file
|
||||
*/
|
||||
public PersistenceConnector(String location) {
|
||||
this();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the connection to DB
|
||||
* @throws Exception if fails
|
||||
*/
|
||||
public abstract void close() throws Exception;
|
||||
|
||||
/**
|
||||
* Retrieve the status of the iterationNumber (passed as parameter) of a running/run {@link Plugin} which is/was identified
|
||||
* by the UUID passed as parameter
|
||||
* @param uuid the execution identifier of the running/run {@link Plugin}
|
||||
* @param iterationNumber the
|
||||
* @return the actual/last {@link PluginState} of the Plugin
|
||||
* @throws Exception if fails
|
||||
*/
|
||||
public abstract PluginState getPluginInstanceState(UUID uuid, int iterationNumber)
|
||||
throws Exception;
|
||||
/**
|
||||
* Retrieve the status of the iterationNumber of the last running/run {@link Plugin} which is/was identified
|
||||
* by the UUID passed as parameter
|
||||
* @param uuid the execution identifier of the running/run {@link Plugin}
|
||||
* @return the actual/last {@link PluginState} of the Plugin
|
||||
* @throws Exception if fails
|
||||
*/
|
||||
public abstract PluginState getLastPluginInstanceState(UUID uuid)
|
||||
throws Exception;
|
||||
|
||||
|
||||
}
|
|
@ -1,23 +1,41 @@
|
|||
package org.gcube.vremanagement.executor.plugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* This interface represent the contract for a plugin runnable by the executor.
|
||||
* This class represent the contract for a plugin runnable by the executor.
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*
|
||||
* This class is deprecated use {@link ExecutorPlugin} instead
|
||||
*/
|
||||
public abstract class Plugin<T extends PluginDeclaration> {
|
||||
public abstract class Plugin implements PluginDefinition {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(Plugin.class);
|
||||
|
||||
|
||||
public static final String PLUGIN_PROPERTIES_FILENAME = "plugin.properties";
|
||||
|
||||
public static final String GROUP_PROPERTY = "groupId";
|
||||
public static final String NAME_PROPERTY = "artifactId";
|
||||
public static final String VERSION_PROPERTY = "version";
|
||||
public static final String DESCRIPTION_PROPERTY = "description";
|
||||
|
||||
protected Properties properties;
|
||||
|
||||
protected UUID uuid;
|
||||
protected int iterationNumber;
|
||||
|
||||
protected T pluginDeclaration;
|
||||
protected PercentageSetter percentageSetter;
|
||||
|
||||
public Plugin(T pluginDeclaration){
|
||||
this.pluginDeclaration = pluginDeclaration;
|
||||
public Plugin(){
|
||||
logger.debug(String.format("Initializing %s", this.getClass().getSimpleName()));
|
||||
|
||||
this.percentageSetter = new PercentageSetter() {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -29,13 +47,42 @@ public abstract class Plugin<T extends PluginDeclaration> {
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
properties = new Properties();
|
||||
|
||||
try {
|
||||
InputStream input = getClass().getClassLoader().getResourceAsStream(PLUGIN_PROPERTIES_FILENAME);
|
||||
properties.load(input);
|
||||
} catch(IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pluginDeclaration
|
||||
*/
|
||||
public T getPluginDeclaration() {
|
||||
return pluginDeclaration;
|
||||
logger.debug(String.format("%s initialized", this.getClass().getSimpleName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return properties.getProperty(GROUP_PROPERTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return properties.getProperty(NAME_PROPERTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return properties.getProperty(VERSION_PROPERTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return properties.getProperty(DESCRIPTION_PROPERTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,String> getSupportedCapabilities() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.plugin;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.vremanagement.executor.json.SEMapper;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*
|
||||
*/
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY)
|
||||
@JsonDeserialize(as=PluginDeclarationImpl.class)
|
||||
@JsonTypeName(value="PluginDeclaration")
|
||||
public interface PluginDeclaration {
|
||||
|
||||
/**
|
||||
* This method is used by executor to ask to Plugin to initialize itself.
|
||||
* In some cases the plugin does not need the initialization. In that case
|
||||
* the plugin can just implement an empty method.
|
||||
*/
|
||||
public void init() throws Exception;
|
||||
|
||||
/**
|
||||
* This method is used by executor to retrieve the name of the Plugin
|
||||
* @return the name of the plugin used by the Executor to refer to the
|
||||
* plugin implementation class.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* This method is used by executor to retrieve an human oriented description
|
||||
* and it will be published on the ServiceEndpoint created by the executor
|
||||
* @return the plugin description.
|
||||
*/
|
||||
public String getDescription();
|
||||
|
||||
/**
|
||||
* This method is used by executor to retrieve the plugin version.
|
||||
* It will be published on the ServiceEndpoint created by the executor
|
||||
* @return the plugin version
|
||||
*/
|
||||
public String getVersion();
|
||||
|
||||
/**
|
||||
* This method is used by the Executor to get a key-value {@link Map}
|
||||
* to be published on IS (on Generic Resource), so a client which want to
|
||||
* launch a Plugin only under certain condition can query the Generic
|
||||
* Resource in the proper way to obtain its own filtered list.
|
||||
* @return the {@link Map} with the supported capabilities
|
||||
*/
|
||||
public Map<String,String> getSupportedCapabilities();
|
||||
|
||||
/**
|
||||
* Used to retrieve the class which run the plugin
|
||||
* @return the class which run the plugin
|
||||
*/
|
||||
@JsonIgnore
|
||||
public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation();
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.plugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.vremanagement.executor.json.SEMapper;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
class PluginDeclarationImpl implements PluginDeclaration {
|
||||
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected String version;
|
||||
protected Map<String,String> supportedCapabilities;
|
||||
|
||||
protected PluginDeclarationImpl() {
|
||||
supportedCapabilities = new HashMap<String,String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,String> getSupportedCapabilities() {
|
||||
return supportedCapabilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return SEMapper.getInstance().marshal(this);
|
||||
} catch(Exception e) {
|
||||
return "PluginDeclarationImpl [name=" + name + ", description=" + description + ", version=" + version
|
||||
+ ", supportedCapabilities=" + supportedCapabilities + "]";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.plugin;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.vremanagement.executor.json.SEMapper;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY)
|
||||
@JsonDeserialize(as=PluginDefinitionImpl.class)
|
||||
@JsonTypeName(value="PluginDefinition")
|
||||
public interface PluginDefinition {
|
||||
|
||||
/**
|
||||
* This method is used by executor to retrieve the Plugin group
|
||||
* It will be published on the IS instance created by the executor
|
||||
* @return the plugin group.
|
||||
*/
|
||||
public String getGroup();
|
||||
|
||||
/**
|
||||
* This method is used by executor to retrieve the Plugin name
|
||||
* It will be published on the IS instance created by the executor
|
||||
* @return the plugin name.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* This method is used by executor to retrieve the plugin version.
|
||||
* It will be published on the IS instance created by the executor
|
||||
* @return the plugin version.
|
||||
*/
|
||||
public String getVersion();
|
||||
|
||||
/**
|
||||
* This method is used by executor to retrieve the Plugin human oriented description.
|
||||
* It will be published on the IS instance created by the executor
|
||||
* @return the plugin description.
|
||||
*/
|
||||
public String getDescription();
|
||||
|
||||
/**
|
||||
* This method is used by the Executor to get a key-value {@link Map}
|
||||
* to be published on IS , so a client which want to
|
||||
* launch a Plugin only under certain condition can query the IS
|
||||
* to obtain its own filtered list.
|
||||
* @return the {@link Map} with the supported capabilities
|
||||
*/
|
||||
public Map<String,String> getSupportedCapabilities();
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.plugin;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.vremanagement.executor.json.SEMapper;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
* Used for JSON serialization only
|
||||
*/
|
||||
class PluginDefinitionImpl implements PluginDefinition {
|
||||
|
||||
protected String group;
|
||||
protected String name;
|
||||
protected String version;
|
||||
protected String description;
|
||||
protected Map<String, String> supportedCapabilities;
|
||||
|
||||
protected PluginDefinitionImpl() {}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getSupportedCapabilities() {
|
||||
return supportedCapabilities;
|
||||
}
|
||||
|
||||
public void setSupportedCapabilities(Map<String, String> supportedCapabilities) {
|
||||
this.supportedCapabilities = supportedCapabilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return SEMapper.getInstance().marshal(this);
|
||||
} catch(Exception e) {
|
||||
return "PluginDefinitionImpl [group=" + group + ", name=" + name + ", version=" + version + ", description="
|
||||
+ description + "]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -5,8 +5,6 @@ package org.gcube.vremanagement.executor.plugin;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import org.gcube.vremanagement.executor.exception.InvalidPluginStateEvolutionException;
|
||||
|
@ -19,27 +17,20 @@ import org.gcube.vremanagement.executor.json.SEMapper;
|
|||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY)
|
||||
public class PluginStateEvolution {
|
||||
|
||||
@XmlElement
|
||||
protected UUID uuid;
|
||||
|
||||
@XmlElement
|
||||
protected int iteration;
|
||||
|
||||
@XmlElement
|
||||
protected long timestamp;
|
||||
|
||||
protected PluginDeclaration pluginDeclaration;
|
||||
protected PluginDefinition pluginDefinition;
|
||||
|
||||
@XmlElement
|
||||
protected PluginState pluginState;
|
||||
|
||||
@XmlElement
|
||||
protected int percentage;
|
||||
|
||||
@XmlElement
|
||||
protected RunOn runOn;
|
||||
|
||||
|
||||
public PluginStateEvolution(){
|
||||
|
||||
}
|
||||
|
@ -48,17 +39,17 @@ public class PluginStateEvolution {
|
|||
*
|
||||
* @param uuid the UUID which identify the current execution
|
||||
* @param timestamp the time of the new {@link PluginState}
|
||||
* @param pluginDeclaration the pluginDeclaration
|
||||
* @param pluginDefinition the pluginDeclaration
|
||||
* @param pluginState the {@link PluginState} value
|
||||
* @throws Exception if fails
|
||||
*/
|
||||
public PluginStateEvolution(UUID uuid, int iteration, long timestamp,
|
||||
PluginDeclaration pluginDeclaration,
|
||||
PluginDefinition pluginDefinition,
|
||||
PluginState pluginState, Integer percentage) throws InvalidPluginStateEvolutionException {
|
||||
this.uuid = uuid;
|
||||
this.iteration = iteration;
|
||||
this.timestamp = timestamp;
|
||||
this.pluginDeclaration = pluginDeclaration;
|
||||
this.pluginDefinition = pluginDefinition;
|
||||
this.pluginState = pluginState;
|
||||
switch (pluginState) {
|
||||
case CREATED:
|
||||
|
@ -100,8 +91,8 @@ public class PluginStateEvolution {
|
|||
* @return the pluginDeclaration
|
||||
*/
|
||||
@JsonGetter
|
||||
public PluginDeclaration getPluginDeclaration() {
|
||||
return pluginDeclaration;
|
||||
public PluginDefinition getPluginDefinition() {
|
||||
return pluginDefinition;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,14 +131,14 @@ public class PluginStateEvolution {
|
|||
+ "uuid:%s,"
|
||||
+ "iteration:%d,"
|
||||
+ "timestamp:%d,"
|
||||
+ "pluginDeclaration:%s,"
|
||||
+ "pluginDefinition:%s,"
|
||||
+ "pluginState:%s,"
|
||||
+ "percentage:%d"
|
||||
+ "}",
|
||||
uuid,
|
||||
iteration,
|
||||
timestamp,
|
||||
pluginDeclaration,
|
||||
pluginDefinition,
|
||||
pluginState,
|
||||
percentage);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@ import org.gcube.com.fasterxml.jackson.core.JsonParseException;
|
|||
import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import org.gcube.vremanagement.executor.exception.InvalidPluginStateEvolutionException;
|
||||
import org.gcube.vremanagement.executor.json.SEMapper;
|
||||
import org.gcube.vremanagement.executor.plugin.Plugin;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginDefinition;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginState;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginStateEvolution;
|
||||
import org.junit.Test;
|
||||
|
@ -80,19 +79,16 @@ public class SerializationTest {
|
|||
|
||||
@Test
|
||||
public void testPluginEvolutionState() throws InvalidPluginStateEvolutionException, JAXBException {
|
||||
PluginDeclaration pluginDeclaration = new PluginDeclaration(){
|
||||
PluginDefinition pluginDeclaration = new PluginDefinition() {
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return PluginDeclaration.class.getSimpleName();
|
||||
public String getGroup() {
|
||||
return "SmartExecutorGroup";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return PluginDeclaration.class.getSimpleName() + " Description";
|
||||
public String getName() {
|
||||
return PluginDefinition.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,20 +96,20 @@ public class SerializationTest {
|
|||
return "1.0.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return PluginDefinition.class.getSimpleName() + " Description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getSupportedCapabilities() {
|
||||
return new HashMap<String, String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return String.format("%s :{ %s - %s - %s }",
|
||||
PluginDeclaration.class.getSimpleName(),
|
||||
PluginDefinition.class.getSimpleName(),
|
||||
getName(), getVersion(), getDescription());
|
||||
}
|
||||
|
||||
|
@ -145,7 +141,7 @@ public class SerializationTest {
|
|||
@Test
|
||||
public void testUnmarshallPluginList() throws JsonParseException, JsonMappingException, IOException {
|
||||
String pluginList = "[{\"@class\":\"PluginDeclaration\",\"description\":\"Hello World Description\",\"supportedCapabilities\":{\"FakeKey\":\"FakeValue\"},\"version\":\"1.1.2\",\"name\":\"HelloWorld\"}]";
|
||||
List<PluginDeclaration> list = SEMapper.getInstance().unmarshalList(PluginDeclaration.class, pluginList);
|
||||
logger.debug("{}", SEMapper.getInstance().marshal(PluginDeclaration.class, list));
|
||||
List<PluginDefinition> list = SEMapper.getInstance().unmarshalList(PluginDefinition.class, pluginList);
|
||||
logger.debug("{}", SEMapper.getInstance().marshal(PluginDefinition.class, list));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,19 +26,16 @@ public class PluginStateEvolutionTest {
|
|||
UUID uuid = UUID.randomUUID();
|
||||
int iteration = 2;
|
||||
long timestamp = Calendar.getInstance().getTimeInMillis();
|
||||
PluginDeclaration pluginDeclaration = new PluginDeclaration(){
|
||||
PluginDefinition pluginDeclaration = new PluginDefinition(){
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return PluginDeclaration.class.getSimpleName();
|
||||
public String getGroup() {
|
||||
return "SmartExecutorGroup";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return PluginDeclaration.class.getSimpleName() + " Description";
|
||||
public String getName() {
|
||||
return PluginDefinition.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,20 +43,20 @@ public class PluginStateEvolutionTest {
|
|||
return "1.0.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return PluginDefinition.class.getSimpleName() + " Description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getSupportedCapabilities() {
|
||||
return new HashMap<String, String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Plugin<? extends PluginDeclaration>> getPluginImplementation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return String.format("%s :{ %s - %s - %s }",
|
||||
PluginDeclaration.class.getSimpleName(),
|
||||
PluginDefinition.class.getSimpleName(),
|
||||
getName(), getVersion(), getDescription());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue