diff --git a/pom.xml b/pom.xml index a90cf98..d3171cd 100644 --- a/pom.xml +++ b/pom.xml @@ -127,15 +127,6 @@ test - - diff --git a/src/main/java/org/gcube/vremanagement/executor/configuration/jsonbased/JSONLaunchParameter.java b/src/main/java/org/gcube/vremanagement/executor/configuration/jsonbased/JSONLaunchParameter.java index 6fcc670..2962221 100644 --- a/src/main/java/org/gcube/vremanagement/executor/configuration/jsonbased/JSONLaunchParameter.java +++ b/src/main/java/org/gcube/vremanagement/executor/configuration/jsonbased/JSONLaunchParameter.java @@ -61,19 +61,6 @@ public class JSONLaunchParameter extends LaunchParameter { this.scope = SmartExecutorInitializator.getScopeFromToken(); } - @Deprecated - public JSONLaunchParameter(String pluginName, Map inputs, Scheduling scheduling, boolean persist) throws ParseException { - super(pluginName, inputs, scheduling, persist); - this.scope = SmartExecutorInitializator.getScopeFromToken(); - } - - @Deprecated - public JSONLaunchParameter(String pluginName, Map pluginCapabilities, Map inputs, Scheduling scheduling, boolean persist) throws ParseException { - super(pluginName, pluginCapabilities, inputs, scheduling, persist); - this.scheduling = new JSONScheduling(scheduling); - this.scope = SmartExecutorInitializator.getScopeFromToken(); - } - public JSONLaunchParameter(LaunchParameter parameter) throws ParseException { super(parameter.getPluginName(), parameter.getPluginCapabilities(), parameter.getInputs(), parameter.getScheduling()); this.scheduling = new JSONScheduling(parameter.getScheduling()); diff --git a/src/test/java/org/gcube/vremanagement/executor/configuration/ConfiguredTasksTest.java b/src/test/java/org/gcube/vremanagement/executor/configuration/ConfiguredTasksTest.java index ec3544b..ed29ec8 100644 --- a/src/test/java/org/gcube/vremanagement/executor/configuration/ConfiguredTasksTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/configuration/ConfiguredTasksTest.java @@ -20,6 +20,8 @@ import org.gcube.vremanagement.executor.exception.SchedulePersistenceException; import org.json.JSONException; import org.junit.Assert; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ @@ -27,6 +29,8 @@ import org.junit.Test; */ public class ConfiguredTasksTest { + private static Logger logger = LoggerFactory.getLogger(ConfiguredTasksTest.class); + public static final String TEST = "test"; public void checkOriginal(FileScheduledTaskConfiguration parser, int size){ @@ -39,7 +43,6 @@ public class ConfiguredTasksTest { Assert.assertEquals(1000, inputs.get(HelloWorldPlugin.SLEEP_TIME)); Assert.assertEquals(1, inputs.get(TEST)); Assert.assertEquals(null, parameter.getScheduling()); - Assert.assertEquals(true, parameter.isPersist()); parameter = (JSONLaunchParameter) configuredTasks.get(1); Assert.assertEquals(parameter.getPluginName(), HelloWorldPluginDeclaration.NAME); @@ -53,7 +56,7 @@ public class ConfiguredTasksTest { Assert.assertEquals(null, scheduling.getFirtStartTime()); Assert.assertEquals(null, scheduling.getEndTime()); Assert.assertEquals(false, scheduling.mustPreviousExecutionsCompleted()); - Assert.assertEquals(true, parameter.isPersist()); + Assert.assertEquals(true, scheduling.getGlobal()); parameter = (JSONLaunchParameter) configuredTasks.get(2); Assert.assertEquals(parameter.getPluginName(), HelloWorldPluginDeclaration.NAME); @@ -61,15 +64,16 @@ public class ConfiguredTasksTest { Assert.assertEquals(1000, inputs.get(HelloWorldPlugin.SLEEP_TIME)); Assert.assertEquals(3, inputs.get(TEST)); Assert.assertEquals(null, parameter.getScheduling()); - Assert.assertEquals(true, parameter.isPersist()); + Assert.assertEquals(true, scheduling.getGlobal()); } - + public static final String TASK_FILE_PATH = "/src/test/resources/"; @Test public void testLaunchConfiguredTask() throws SchedulePersistenceException, IOException, JSONException, ParseException { - String location = new File(".").getAbsolutePath(); - location = location + "/src/test/resources"; + File file = new File(".", TASK_FILE_PATH); + String location = file.getAbsolutePath(); + logger.trace("File location : {}", location); FileScheduledTaskConfiguration parser = new FileScheduledTaskConfiguration(location); checkOriginal(parser, 3); @@ -90,7 +94,6 @@ public class ConfiguredTasksTest { Assert.assertEquals(1000, inputs.get(HelloWorldPlugin.SLEEP_TIME)); Assert.assertEquals(4, inputs.get(TEST)); Assert.assertEquals(null, parameter.getScheduling()); - Assert.assertEquals(true, parameter.isPersist()); parser.releaseLaunch(parameter); diff --git a/src/test/java/org/gcube/vremanagement/executor/persistence/SmartExecutorPersistenceConnectorTest.java b/src/test/java/org/gcube/vremanagement/executor/persistence/SmartExecutorPersistenceConnectorTest.java index ccfe5c1..e686c48 100644 --- a/src/test/java/org/gcube/vremanagement/executor/persistence/SmartExecutorPersistenceConnectorTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/persistence/SmartExecutorPersistenceConnectorTest.java @@ -9,17 +9,13 @@ import java.util.List; import java.util.UUID; import org.acme.HelloWorldPluginDeclaration; -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.vremanagement.executor.api.types.LaunchParameter; import org.gcube.vremanagement.executor.configuration.ScheduledTaskConfiguration; import org.gcube.vremanagement.executor.configuration.ScheduledTaskConfigurationFactory; import org.gcube.vremanagement.executor.persistence.couchdb.CouchDBPersistenceConnector; import org.gcube.vremanagement.executor.plugin.PluginState; import org.gcube.vremanagement.executor.plugin.PluginStateEvolution; -import org.gcube.vremanagement.executor.pluginmanager.TestUtility; -import org.junit.After; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,16 +28,6 @@ public class SmartExecutorPersistenceConnectorTest { private static Logger logger = LoggerFactory.getLogger(SmartExecutorPersistenceConnectorTest.class); - @Before - public void bfore(){ - SecurityTokenProvider.instance.set(TestUtility.TOKEN); - } - - @After - public void after(){ - SecurityTokenProvider.instance.reset(); - } - @Test public void getConnectionTest() throws Exception { SmartExecutorPersistenceConnector persistenceConnector = SmartExecutorPersistenceFactory.getPersistenceConnector(); diff --git a/src/test/java/org/gcube/vremanagement/executor/pluginmanager/RunnablePluginTest.java b/src/test/java/org/gcube/vremanagement/executor/pluginmanager/RunnablePluginTest.java index 52aa923..81c75dc 100644 --- a/src/test/java/org/gcube/vremanagement/executor/pluginmanager/RunnablePluginTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/pluginmanager/RunnablePluginTest.java @@ -9,16 +9,13 @@ import java.util.UUID; import org.acme.HelloWorldPlugin; import org.acme.HelloWorldPluginDeclaration; -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.vremanagement.executor.exception.InputsNullException; import org.gcube.vremanagement.executor.exception.InvalidInputsException; 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.PluginStateNotification; -import org.junit.After; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,18 +28,6 @@ public class RunnablePluginTest { private static Logger logger = LoggerFactory.getLogger(SmartExecutorSchedulerTest.class); - @Before - public void before() throws Exception { - SecurityTokenProvider.instance.set(TestUtility.TOKEN); - SmartExecutorPersistenceFactory.getPersistenceConnector(); - } - - @After - public void after() throws Exception { - SecurityTokenProvider.instance.reset(); - SmartExecutorPersistenceFactory.getPersistenceConnector().close(); - } - @Test public void launchNullInputsTest() throws Exception { logger.debug("Testing Null inputs"); diff --git a/src/test/java/org/gcube/vremanagement/executor/pluginmanager/SmartExecutorSchedulerTest.java b/src/test/java/org/gcube/vremanagement/executor/pluginmanager/SmartExecutorSchedulerTest.java index 6fd39e6..78c1fdd 100644 --- a/src/test/java/org/gcube/vremanagement/executor/pluginmanager/SmartExecutorSchedulerTest.java +++ b/src/test/java/org/gcube/vremanagement/executor/pluginmanager/SmartExecutorSchedulerTest.java @@ -10,18 +10,14 @@ import java.util.UUID; import org.acme.HelloWorldPlugin; import org.acme.HelloWorldPluginDeclaration; -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; 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.scheduler.SmartExecutorScheduler; -import org.junit.AfterClass; import org.junit.Assert; -import org.junit.BeforeClass; import org.junit.Test; import org.quartz.CronExpression; import org.slf4j.Logger; @@ -38,19 +34,7 @@ public class SmartExecutorSchedulerTest { public static final String END = "END"; public static SmartExecutorPersistenceConnector pc; - - @BeforeClass - public static void before() throws Exception { - SecurityTokenProvider.instance.set(TestUtility.TOKEN); - pc = SmartExecutorPersistenceFactory.getPersistenceConnector(); - } - - @AfterClass - public static void after() throws Exception { - pc.close(); - SecurityTokenProvider.instance.reset(); - } - + public UUID scheduleTest(Scheduling scheduling, Long sleepTime) throws Exception { Map inputs = new HashMap(); if(sleepTime==null){ diff --git a/src/test/java/org/gcube/vremanagement/executor/pluginmanager/TestUtility.java b/src/test/java/org/gcube/vremanagement/executor/pluginmanager/TestUtility.java deleted file mode 100644 index 95a17bb..0000000 --- a/src/test/java/org/gcube/vremanagement/executor/pluginmanager/TestUtility.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * - */ -package org.gcube.vremanagement.executor.pluginmanager; - -/** - * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ - * - */ -public class TestUtility { - - public static final String TOKEN = ""; - -} diff --git a/src/test/resources/definedTasks.json b/src/test/resources/definedTasks.json index df7675c..72106a4 100644 --- a/src/test/resources/definedTasks.json +++ b/src/test/resources/definedTasks.json @@ -20,7 +20,8 @@ "scheduling" : { "delay" : "2000", "schedulingTimes" : "2", - "previuosExecutionsMustBeCompleted" : false + "previuosExecutionsMustBeCompleted" : false, + "global" : true } }, @@ -29,8 +30,7 @@ "inputs" : { "sleepTime" : 1000, "test" : 3 - }, - "persist" : true + } } ]