Fixing bugs
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@142150 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ce406ee802
commit
4467cc4bb7
|
@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory;
|
|||
*/
|
||||
public class RunnablePlugin<T extends Plugin<? extends PluginDeclaration>> implements Runnable {
|
||||
|
||||
private static final String LOCALHOST = "localhost";
|
||||
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
|
@ -92,10 +94,15 @@ public class RunnablePlugin<T extends Plugin<? extends PluginDeclaration>> imple
|
|||
|
||||
taskUsageRecord.setConsumerId(SmartExecutorInitializator.getClientInfo().getId());
|
||||
|
||||
RunOn runOn = ScheduledTask.generateRunOn();
|
||||
Ref hnRef = runOn.getHostingNode();
|
||||
taskUsageRecord.setRefHostingNodeId(hnRef.getId());
|
||||
taskUsageRecord.setHost(hnRef.getAddress());
|
||||
try{
|
||||
RunOn runOn = ScheduledTask.generateRunOn();
|
||||
Ref hnRef = runOn.getHostingNode();
|
||||
taskUsageRecord.setRefHostingNodeId(hnRef.getId());
|
||||
taskUsageRecord.setHost(hnRef.getAddress());
|
||||
}catch(Exception e){
|
||||
taskUsageRecord.setRefHostingNodeId(LOCALHOST);
|
||||
taskUsageRecord.setHost(LOCALHOST);
|
||||
}
|
||||
|
||||
|
||||
HashMap<String, Serializable> map =
|
||||
|
@ -128,7 +135,7 @@ public class RunnablePlugin<T extends Plugin<? extends PluginDeclaration>> imple
|
|||
try {
|
||||
Calendar taskEndTime = Calendar.getInstance();
|
||||
taskEndTime.setTimeInMillis(actualStateEvolution.getTimestamp());
|
||||
taskUsageRecord.setTaskStartTime(taskEndTime);
|
||||
taskUsageRecord.setTaskEndTime(taskEndTime);
|
||||
|
||||
PluginState pluginState = actualStateEvolution.getPluginState();
|
||||
switch (pluginState) {
|
||||
|
|
|
@ -29,4 +29,13 @@ public class SmartExecutorImplTest {
|
|||
runnablePlugin.launch(inputs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void helloWorldFullTest() throws Exception{
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
long sleepTime = 10000;
|
||||
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
||||
Plugin<? extends PluginDeclaration> runnablePlugin = PluginManager.instantiatePlugin(HelloWorldPluginDeclaration.NAME);
|
||||
runnablePlugin.launch(inputs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,13 +3,14 @@ package org.gcube.vremanagement.executor.pluginmanager;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.acme.HelloWorldPluginDeclaration;
|
||||
import org.gcube.vremanagement.executor.ScopedTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class PluginManagerTest {
|
||||
public class PluginManagerTest extends ScopedTest {
|
||||
|
||||
@Test
|
||||
public void getInstance(){
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.UUID;
|
|||
|
||||
import org.acme.HelloWorldPlugin;
|
||||
import org.acme.HelloWorldPluginDeclaration;
|
||||
import org.gcube.vremanagement.executor.ScopedTest;
|
||||
import org.gcube.vremanagement.executor.exception.InputsNullException;
|
||||
import org.gcube.vremanagement.executor.exception.InvalidInputsException;
|
||||
import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceConnector;
|
||||
|
@ -24,7 +25,7 @@ import org.slf4j.LoggerFactory;
|
|||
* @author Luca Frosini (ISTI - CNR)
|
||||
*
|
||||
*/
|
||||
public class RunnablePluginTest {
|
||||
public class RunnablePluginTest extends ScopedTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SmartExecutorSchedulerTest.class);
|
||||
|
||||
|
|
|
@ -10,11 +10,13 @@ import java.util.UUID;
|
|||
|
||||
import org.acme.HelloWorldPlugin;
|
||||
import org.acme.HelloWorldPluginDeclaration;
|
||||
import org.gcube.vremanagement.executor.ScopedTest;
|
||||
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
||||
import org.gcube.vremanagement.executor.api.types.Scheduling;
|
||||
import org.gcube.vremanagement.executor.exception.PluginStateNotRetrievedException;
|
||||
import org.gcube.vremanagement.executor.exception.UnableToInterruptTaskException;
|
||||
import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceConnector;
|
||||
import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceFactory;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginState;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginStateEvolution;
|
||||
import org.gcube.vremanagement.executor.scheduler.SmartExecutorScheduler;
|
||||
|
@ -27,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class SmartExecutorSchedulerTest {
|
||||
public class SmartExecutorSchedulerTest extends ScopedTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SmartExecutorSchedulerTest.class);
|
||||
|
||||
|
@ -52,6 +54,8 @@ public class SmartExecutorSchedulerTest {
|
|||
UUID uuid = smartExecutorScheduler.schedule(parameter);
|
||||
logger.debug("Scheduled Job with ID {}", uuid);
|
||||
|
||||
pc = SmartExecutorPersistenceFactory.getPersistenceConnector();
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue