refs #579: Use Persistence to persist Scheduled Task configuration on smart-executor
https://support.d4science.org/issues/579 Removed PluginDeclaration parameter which is not needed git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@119442 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bccb75077c
commit
dac74aed74
|
@ -13,7 +13,6 @@ import org.gcube.vremanagement.executor.exception.PluginInstanceNotFoundExceptio
|
||||||
import org.gcube.vremanagement.executor.exception.PluginNotFoundException;
|
import org.gcube.vremanagement.executor.exception.PluginNotFoundException;
|
||||||
import org.gcube.vremanagement.executor.exception.SchedulerNotFoundException;
|
import org.gcube.vremanagement.executor.exception.SchedulerNotFoundException;
|
||||||
import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceConnector;
|
import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceConnector;
|
||||||
import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
|
|
||||||
import org.gcube.vremanagement.executor.plugin.PluginState;
|
import org.gcube.vremanagement.executor.plugin.PluginState;
|
||||||
import org.gcube.vremanagement.executor.scheduler.SmartExecutorScheduler;
|
import org.gcube.vremanagement.executor.scheduler.SmartExecutorScheduler;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
|
@ -82,7 +81,6 @@ public class SmartExecutorImpl implements SmartExecutor {
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
/**{@inheritDoc}*/
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
|
||||||
public PluginState getIterationState(String executionIdentifier, int iterationNumber)
|
public PluginState getIterationState(String executionIdentifier, int iterationNumber)
|
||||||
throws PluginInstanceNotFoundException, ExecutorException {
|
throws PluginInstanceNotFoundException, ExecutorException {
|
||||||
try {
|
try {
|
||||||
|
@ -93,7 +91,7 @@ public class SmartExecutorImpl implements SmartExecutor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
/* *{@inheritDoc}* /
|
||||||
@Override
|
@Override
|
||||||
public PluginState getState(PluginDeclaration pluginDeclaration, String executionIdentifier)
|
public PluginState getState(PluginDeclaration pluginDeclaration, String executionIdentifier)
|
||||||
throws PluginInstanceNotFoundException, ExecutorException {
|
throws PluginInstanceNotFoundException, ExecutorException {
|
||||||
|
@ -105,7 +103,7 @@ public class SmartExecutorImpl implements SmartExecutor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
/**{@inheritDoc}* /
|
||||||
@Override
|
@Override
|
||||||
public PluginState getIterationState(PluginDeclaration pluginDeclaration, String executionIdentifier, int iterationNumber)
|
public PluginState getIterationState(PluginDeclaration pluginDeclaration, String executionIdentifier, int iterationNumber)
|
||||||
throws PluginInstanceNotFoundException, ExecutorException {
|
throws PluginInstanceNotFoundException, ExecutorException {
|
||||||
|
@ -116,6 +114,6 @@ public class SmartExecutorImpl implements SmartExecutor {
|
||||||
throw new PluginInstanceNotFoundException();
|
throw new PluginInstanceNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.vremanagement.executor.persistence.couchdb.CouchDBPersistenceConnector;
|
import org.gcube.vremanagement.executor.persistence.couchdb.CouchDBPersistenceConnector;
|
||||||
import org.gcube.vremanagement.executor.plugin.Plugin;
|
import org.gcube.vremanagement.executor.plugin.Plugin;
|
||||||
import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
|
|
||||||
import org.gcube.vremanagement.executor.plugin.PluginState;
|
import org.gcube.vremanagement.executor.plugin.PluginState;
|
||||||
import org.gcube.vremanagement.executor.plugin.PluginStateNotification;
|
import org.gcube.vremanagement.executor.plugin.PluginStateNotification;
|
||||||
|
|
||||||
|
@ -49,7 +48,7 @@ public abstract class SmartExecutorPersistenceConnector implements PluginStateNo
|
||||||
*/
|
*/
|
||||||
public abstract void close() throws Exception;
|
public abstract void close() throws Exception;
|
||||||
|
|
||||||
/**
|
/* *
|
||||||
* Retrieve the status of the iterationNumber (passed as parameter) of a
|
* Retrieve the status of the iterationNumber (passed as parameter) of a
|
||||||
* running/run plugin (using {@link PluginDeclaration}) which is/was
|
* running/run plugin (using {@link PluginDeclaration}) which is/was
|
||||||
* identified by the UUID passed as parameter.
|
* identified by the UUID passed as parameter.
|
||||||
|
@ -58,19 +57,20 @@ public abstract class SmartExecutorPersistenceConnector implements PluginStateNo
|
||||||
* @param iterationNumber the iteration number
|
* @param iterationNumber the iteration number
|
||||||
* @return the actual/last {@link PluginState} of the Plugin
|
* @return the actual/last {@link PluginState} of the Plugin
|
||||||
* @throws Exception if fails
|
* @throws Exception if fails
|
||||||
*/
|
* /
|
||||||
public abstract PluginState getPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid, int iterationNumber)
|
public abstract PluginState getPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid, int iterationNumber)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
/**
|
/* *
|
||||||
* Retrieve the status of the iterationNumber of the last running/run {@link Plugin} which is/was identified
|
* Retrieve the status of the iterationNumber of the last running/run {@link Plugin} which is/was identified
|
||||||
* by the UUID passed as parameter
|
* by the UUID passed as parameter
|
||||||
* @param pluginDeclaration The Plugin Declaration class
|
* @param pluginDeclaration The Plugin Declaration class
|
||||||
* @param uuid the execution identifier of the running/run {@link Plugin}
|
* @param uuid the execution identifier of the running/run {@link Plugin}
|
||||||
* @return the actual/last {@link PluginState} of the Plugin
|
* @return the actual/last {@link PluginState} of the Plugin
|
||||||
* @throws Exception if fails
|
* @throws Exception if fails
|
||||||
*/
|
* /
|
||||||
public abstract PluginState getLastPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid)
|
public abstract PluginState getLastPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the status of the iterationNumber (passed as parameter) of a running/run {@link Plugin} which is/was identified
|
* Retrieve the status of the iterationNumber (passed as parameter) of a running/run {@link Plugin} which is/was identified
|
||||||
|
@ -80,7 +80,6 @@ public abstract class SmartExecutorPersistenceConnector implements PluginStateNo
|
||||||
* @return the actual/last {@link PluginState} of the Plugin
|
* @return the actual/last {@link PluginState} of the Plugin
|
||||||
* @throws Exception if fails
|
* @throws Exception if fails
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public abstract PluginState getPluginInstanceState(UUID uuid, int iterationNumber)
|
public abstract PluginState getPluginInstanceState(UUID uuid, int iterationNumber)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
/**
|
/**
|
||||||
|
@ -90,7 +89,6 @@ public abstract class SmartExecutorPersistenceConnector implements PluginStateNo
|
||||||
* @return the actual/last {@link PluginState} of the Plugin
|
* @return the actual/last {@link PluginState} of the Plugin
|
||||||
* @throws Exception if fails
|
* @throws Exception if fails
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public abstract PluginState getLastPluginInstanceState(UUID uuid)
|
public abstract PluginState getLastPluginInstanceState(UUID uuid)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -154,30 +154,31 @@ public class CouchDBPersistenceConnector extends SmartExecutorPersistenceConnect
|
||||||
return reallyQuery(null, uuid, LAST);
|
return reallyQuery(null, uuid, LAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected final static int LAST = -1;
|
||||||
|
|
||||||
|
/* *
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
* /
|
||||||
@Override
|
@Override
|
||||||
public PluginState getPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid, int iterationNumber)
|
public PluginState getPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid, int iterationNumber)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
return reallyQuery(pluginDeclaration, uuid, iterationNumber);
|
return reallyQuery(pluginDeclaration, uuid, iterationNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final static int LAST = -1;
|
|
||||||
|
|
||||||
/**
|
/* *
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
* /
|
||||||
@Override
|
@Override
|
||||||
public PluginState getLastPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid) throws Exception {
|
public PluginState getLastPluginInstanceState(PluginDeclaration pluginDeclaration, UUID uuid) throws Exception {
|
||||||
return reallyQuery(pluginDeclaration, uuid, LAST);
|
return reallyQuery(pluginDeclaration, uuid, LAST);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
protected static final String MAP_REDUCE__DESIGN = "_design/";
|
protected static final String MAP_REDUCE__DESIGN = "_design/";
|
||||||
|
|
||||||
protected static final String PLUGIN_STATE_DOCUMENT = "pluginState";
|
protected static final String PLUGIN_STATE_DOCUMENT = "pluginState";
|
||||||
protected static final String PLUGIN_STATE_VIEW = "pluginState";
|
protected static final String PLUGIN_STATE = "pluginState";
|
||||||
protected static final String PLUGIN_STATE_DEPRECATED_VIEW = "pluginStateDeprecated";
|
protected static final String PLUGIN_STATE_VIEW_ABANDONED = "pluginStateABANDONED";
|
||||||
|
|
||||||
protected static final String SCHEDULED_TASKS_DOCUMENT = "scheduledTasks";
|
protected static final String SCHEDULED_TASKS_DOCUMENT = "scheduledTasks";
|
||||||
protected static final String ACTIVE_VIEW = "active";
|
protected static final String ACTIVE_VIEW = "active";
|
||||||
|
@ -209,29 +210,26 @@ public class CouchDBPersistenceConnector extends SmartExecutorPersistenceConnect
|
||||||
endKey.add(scope);
|
endKey.add(scope);
|
||||||
|
|
||||||
String pluginName = pluginDeclaration.getName();
|
String pluginName = pluginDeclaration.getName();
|
||||||
|
|
||||||
if(pluginName!=null && pluginName.compareTo("")!=0){
|
if(pluginName!=null && pluginName.compareTo("")!=0){
|
||||||
startKey.add(pluginName);
|
startKey.add(pluginName);
|
||||||
endKey.add(pluginName);
|
endKey.add(pluginName);
|
||||||
query = query.viewName(PLUGIN_STATE_VIEW);
|
query = query.viewName(PLUGIN_STATE_VIEW_ABANDONED);
|
||||||
}else{
|
}else{
|
||||||
query = query.viewName(PLUGIN_STATE_DEPRECATED_VIEW);
|
query = query.viewName(PLUGIN_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
startKey.add(uuid.toString());
|
startKey.add(uuid.toString());
|
||||||
endKey.add(uuid.toString());
|
endKey.add(uuid.toString());
|
||||||
|
|
||||||
if(iterationNumber==LAST){
|
if(iterationNumber != LAST){
|
||||||
startKey.add(1);
|
|
||||||
endKey.add("{}");
|
|
||||||
}else{
|
|
||||||
startKey.add(iterationNumber);
|
startKey.add(iterationNumber);
|
||||||
endKey.add(iterationNumber);
|
endKey.add(iterationNumber);
|
||||||
|
|
||||||
startKey.add(1);
|
|
||||||
endKey.add("{}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adding time interval
|
||||||
|
startKey.add(1);
|
||||||
|
endKey.add("{}");
|
||||||
|
|
||||||
query.startKey(startKey);
|
query.startKey(startKey);
|
||||||
query.endKey(endKey);
|
query.endKey(endKey);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class SmartExecutorPersistenceConnectorTest {
|
||||||
long timestamp = new Date().getTime();
|
long timestamp = new Date().getTime();
|
||||||
PluginStateEvolution pluginStateEvolution = new PluginStateEvolution(uuid, 1, timestamp, HelloWorldPluginDeclaration.class.newInstance(), states[i]);
|
PluginStateEvolution pluginStateEvolution = new PluginStateEvolution(uuid, 1, timestamp, HelloWorldPluginDeclaration.class.newInstance(), states[i]);
|
||||||
persistenceConnector.pluginStateEvolution(pluginStateEvolution);
|
persistenceConnector.pluginStateEvolution(pluginStateEvolution);
|
||||||
PluginState ps = persistenceConnector.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 1);
|
PluginState ps = persistenceConnector.getPluginInstanceState(uuid, 1);
|
||||||
Assert.assertEquals(states[i], ps);
|
Assert.assertEquals(states[i], ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,11 +92,11 @@ public class RunnablePluginTest {
|
||||||
pluginStateNotifications.add(persistenceConnector);
|
pluginStateNotifications.add(persistenceConnector);
|
||||||
HelloWorldPlugin helloWorldPlugin = new HelloWorldPlugin(hwpd);
|
HelloWorldPlugin helloWorldPlugin = new HelloWorldPlugin(hwpd);
|
||||||
RunnablePlugin<HelloWorldPlugin> rp = new RunnablePlugin<HelloWorldPlugin>(helloWorldPlugin, inputs, uuid, 1, pluginStateNotifications);
|
RunnablePlugin<HelloWorldPlugin> rp = new RunnablePlugin<HelloWorldPlugin>(helloWorldPlugin, inputs, uuid, 1, pluginStateNotifications);
|
||||||
Assert.assertEquals(PluginState.CREATED, persistenceConnector.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 1));
|
Assert.assertEquals(PluginState.CREATED, persistenceConnector.getPluginInstanceState(uuid, 1));
|
||||||
|
|
||||||
rp.run();
|
rp.run();
|
||||||
|
|
||||||
Assert.assertEquals(PluginState.DONE, persistenceConnector.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 1));
|
Assert.assertEquals(PluginState.DONE, persistenceConnector.getPluginInstanceState(uuid, 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,12 +117,8 @@ public class SmartExecutorSchedulerTest {
|
||||||
while(endTime <= (startTime + 12000)){
|
while(endTime <= (startTime + 12000)){
|
||||||
endTime = Calendar.getInstance().getTimeInMillis();
|
endTime = Calendar.getInstance().getTimeInMillis();
|
||||||
}
|
}
|
||||||
PluginState pluginState = pc.getLastPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid);
|
PluginState pluginState = pc.getLastPluginInstanceState(uuid);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
PluginState pluginStateFromDeprecation = pc.getLastPluginInstanceState(uuid);
|
|
||||||
Assert.assertEquals(PluginState.DONE, pluginStateFromDeprecation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -137,13 +133,8 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 5);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 5);
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
PluginState pluginStateFromDeprecation = pc.getPluginInstanceState(uuid, 5);
|
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginStateFromDeprecation);
|
|
||||||
|
|
||||||
}catch(PluginStateNotRetrievedException e){
|
}catch(PluginStateNotRetrievedException e){
|
||||||
// OK
|
// OK
|
||||||
logger.error("PluginStateNotRetrievedException this can be acceptable in some tests", e);
|
logger.error("PluginStateNotRetrievedException this can be acceptable in some tests", e);
|
||||||
|
@ -169,7 +160,7 @@ public class SmartExecutorSchedulerTest {
|
||||||
while(endTime <= (startTime + 10000)){
|
while(endTime <= (startTime + 10000)){
|
||||||
endTime = Calendar.getInstance().getTimeInMillis();
|
endTime = Calendar.getInstance().getTimeInMillis();
|
||||||
}
|
}
|
||||||
PluginState pluginState = pc.getLastPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid);
|
PluginState pluginState = pc.getLastPluginInstanceState(uuid);
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +175,7 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
smartExecutorScheduler.stop(uuid);
|
smartExecutorScheduler.stop(uuid);
|
||||||
|
|
||||||
PluginState pluginState = pc.getLastPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid);
|
PluginState pluginState = pc.getLastPluginInstanceState(uuid);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,10 +200,10 @@ public class SmartExecutorSchedulerTest {
|
||||||
endTime = Calendar.getInstance().getTimeInMillis();
|
endTime = Calendar.getInstance().getTimeInMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginState pluginState = pc.getLastPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), first);
|
PluginState pluginState = pc.getLastPluginInstanceState(first);
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
||||||
|
|
||||||
pluginState = pc.getLastPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), second);
|
pluginState = pc.getLastPluginInstanceState(second);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,11 +227,11 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=1; i<5; i++){
|
for(int i=1; i<5; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 5);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 5);
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -265,7 +256,7 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=1; i<5; i++){
|
for(int i=1; i<5; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i);
|
||||||
if(i%2!=0){
|
if(i%2!=0){
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}else{
|
}else{
|
||||||
|
@ -273,7 +264,7 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 5);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 5);
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -306,11 +297,11 @@ public class SmartExecutorSchedulerTest {
|
||||||
|
|
||||||
|
|
||||||
for(int i=0; i<expectedStates.length; i++){
|
for(int i=0; i<expectedStates.length; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i+1);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i+1);
|
||||||
Assert.assertEquals(expectedStates[i], pluginState);
|
Assert.assertEquals(expectedStates[i], pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 5);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 5);
|
||||||
Assert.assertEquals(PluginState.DISCARDED, pluginState);
|
Assert.assertEquals(PluginState.DISCARDED, pluginState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -327,11 +318,11 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<3; i++){
|
for(int i=0; i<3; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i+1);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i+1);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 4);
|
pc.getPluginInstanceState(uuid, 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,10 +347,10 @@ public class SmartExecutorSchedulerTest {
|
||||||
endTime = Calendar.getInstance().getTimeInMillis();
|
endTime = Calendar.getInstance().getTimeInMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 1);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 1);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
|
|
||||||
pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 2);
|
pc.getPluginInstanceState(uuid, 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,12 +377,12 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=1; i<5; i++){
|
for(int i=1; i<5; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 5);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 5);
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
||||||
}catch(PluginStateNotRetrievedException e){
|
}catch(PluginStateNotRetrievedException e){
|
||||||
// OK
|
// OK
|
||||||
|
@ -420,7 +411,7 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=1; i<5; i++){
|
for(int i=1; i<5; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i);
|
||||||
if(i%2!=0){
|
if(i%2!=0){
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}else{
|
}else{
|
||||||
|
@ -428,7 +419,7 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 5);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 5);
|
||||||
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
Assert.assertEquals(PluginState.STOPPED, pluginState);
|
||||||
}catch(PluginStateNotRetrievedException e){
|
}catch(PluginStateNotRetrievedException e){
|
||||||
// OK
|
// OK
|
||||||
|
@ -465,12 +456,12 @@ public class SmartExecutorSchedulerTest {
|
||||||
|
|
||||||
|
|
||||||
for(int i=0; i<expectedStates.length; i++){
|
for(int i=0; i<expectedStates.length; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i+1);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i+1);
|
||||||
Assert.assertEquals(expectedStates[i], pluginState);
|
Assert.assertEquals(expectedStates[i], pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 5);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 5);
|
||||||
Assert.assertEquals(PluginState.DISCARDED, pluginState);
|
Assert.assertEquals(PluginState.DISCARDED, pluginState);
|
||||||
}catch(PluginStateNotRetrievedException e){
|
}catch(PluginStateNotRetrievedException e){
|
||||||
// OK
|
// OK
|
||||||
|
@ -490,11 +481,11 @@ public class SmartExecutorSchedulerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<3; i++){
|
for(int i=0; i<3; i++){
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, i+1);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, i+1);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
}
|
}
|
||||||
|
|
||||||
pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 4);
|
pc.getPluginInstanceState(uuid, 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,10 +509,10 @@ public class SmartExecutorSchedulerTest {
|
||||||
endTime = Calendar.getInstance().getTimeInMillis();
|
endTime = Calendar.getInstance().getTimeInMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginState pluginState = pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 1);
|
PluginState pluginState = pc.getPluginInstanceState(uuid, 1);
|
||||||
Assert.assertEquals(PluginState.DONE, pluginState);
|
Assert.assertEquals(PluginState.DONE, pluginState);
|
||||||
|
|
||||||
pc.getPluginInstanceState(HelloWorldPluginDeclaration.class.newInstance(), uuid, 2);
|
pc.getPluginInstanceState(uuid, 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue