diff --git a/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java b/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java index 87ea0e7..5767ab2 100644 --- a/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/client/DefaultExecutorTest.java @@ -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 inputs = new HashMap(); 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 inputs = new HashMap(); + 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 notificationInputs = new HashMap(); + 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 inputs = new HashMap(); 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).