Improved test
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@161981 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8484ba1913
commit
53a47e7eb9
|
@ -6,6 +6,7 @@ package org.gcube.vremanagement.executor.client;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.acme.HWPluginStateNotification;
|
||||
import org.acme.HelloWorldPlugin;
|
||||
|
@ -17,6 +18,7 @@ import org.gcube.vremanagement.executor.client.plugins.ExecutorPlugin;
|
|||
import org.gcube.vremanagement.executor.client.proxies.SmartExecutorProxy;
|
||||
import org.gcube.vremanagement.executor.exception.PluginInstanceNotFoundException;
|
||||
import org.gcube.vremanagement.executor.exception.PluginNotFoundException;
|
||||
import org.gcube.vremanagement.executor.json.SEMapper;
|
||||
import org.gcube.vremanagement.executor.plugin.PluginState;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -67,7 +69,7 @@ public class DefaultExecutorTest extends ScopedTest {
|
|||
public void testOk() throws Exception {
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
long sleepTime = 10000; // 1000 millisec * 10 = 10 sec
|
||||
long sleepTime = TimeUnit.SECONDS.toMillis(10);
|
||||
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
||||
LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs);
|
||||
|
||||
|
@ -76,7 +78,8 @@ public class DefaultExecutorTest extends ScopedTest {
|
|||
launchParameter.addPluginStateNotifications(HWPluginStateNotification.class, notificationInputs);
|
||||
try {
|
||||
String executionIdentifier = proxy.launch(launchParameter);
|
||||
|
||||
logger.debug("Execution Identifier {}", executionIdentifier);
|
||||
|
||||
Thread.sleep(1000); // 1 sec
|
||||
Assert.assertEquals(PluginState.RUNNING, proxy.getStateEvolution(executionIdentifier).getPluginState());
|
||||
|
||||
|
@ -93,6 +96,27 @@ public class DefaultExecutorTest extends ScopedTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerilization() throws Exception {
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
long sleepTime = TimeUnit.SECONDS.toMillis(20);
|
||||
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
||||
int minuteinterval = 2;
|
||||
// Every 5 minutes, for 12 times (one hour totally).
|
||||
Scheduling scheduling = new Scheduling(60*minuteinterval,12,true);
|
||||
scheduling.setGlobal(false);
|
||||
|
||||
LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs, scheduling);
|
||||
Map<String, String> notificationInputs = new HashMap<String, String>();
|
||||
notificationInputs.put("Hello", "Hello World Notification:) :)");
|
||||
launchParameter.addPluginStateNotifications(HWPluginStateNotification.class, notificationInputs);
|
||||
|
||||
|
||||
|
||||
logger.debug(SEMapper.marshal(launchParameter));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testScheduledTaskNotPersisted() throws Exception {
|
||||
|
@ -101,7 +125,7 @@ public class DefaultExecutorTest extends ScopedTest {
|
|||
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
long sleepTime = 20000; // 1000 millisec * 20 = 20 sec
|
||||
long sleepTime = TimeUnit.SECONDS.toMillis(20);
|
||||
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
||||
int minuteinterval = 2;
|
||||
// Every 5 minutes, for 12 times (one hour totally).
|
||||
|
|
Loading…
Reference in New Issue