diff --git a/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/partition/DeployerPartitionHandler.java b/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/partition/DeployerPartitionHandler.java index d526e925..d69453c9 100644 --- a/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/partition/DeployerPartitionHandler.java +++ b/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/partition/DeployerPartitionHandler.java @@ -215,19 +215,19 @@ public class DeployerPartitionHandler implements PartitionHandler, EnvironmentAw private void launchWorker(StepExecution workerStepExecution) { //TODO: Refactor these to be passed as command line args once SCD-20 is complete // https://github.com/spring-cloud/spring-cloud-deployer/issues/20 - Map parameters = getParameters(this.taskExecution.getParameters()); - parameters.put(SPRING_CLOUD_TASK_JOB_EXECUTION_ID, + Map arguments = getArguments(this.taskExecution.getArguments()); + arguments.put(SPRING_CLOUD_TASK_JOB_EXECUTION_ID, String.valueOf(workerStepExecution.getJobExecution().getId())); - parameters.put(SPRING_CLOUD_TASK_STEP_EXECUTION_ID, + arguments.put(SPRING_CLOUD_TASK_STEP_EXECUTION_ID, String.valueOf(workerStepExecution.getId())); - parameters.put(SPRING_CLOUD_TASK_STEP_NAME, this.stepName); + arguments.put(SPRING_CLOUD_TASK_STEP_NAME, this.stepName); AppDefinition definition = new AppDefinition(String.format("%s:%s:%s", taskExecution.getTaskName(), workerStepExecution.getJobExecution().getJobInstance().getJobName(), workerStepExecution.getStepName()), - parameters); + arguments); Map environmentProperties = new HashMap<>(this.environmentProperties.size()); environmentProperties.putAll(getCurrentEnvironmentProperties()); @@ -295,15 +295,15 @@ public class DeployerPartitionHandler implements PartitionHandler, EnvironmentAw return status.equals(BatchStatus.COMPLETED) || status.isGreaterThan(BatchStatus.STARTED); } - private Map getParameters(List parameters) { - Map parameterMap = new HashMap<>(parameters.size()); + private Map getArguments(List arguments) { + Map argumentMap = new HashMap<>(arguments.size()); - for (String parameter : parameters) { - String[] pieces = parameter.split("="); - parameterMap.put(pieces[0], pieces[1]); + for (String argument : arguments) { + String[] pieces = argument.split("="); + argumentMap.put(pieces[0], pieces[1]); } - return parameterMap; + return argumentMap; } @Override diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java index 2051e038..5aaecabb 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/listener/TaskLifecycleListener.java @@ -231,7 +231,7 @@ public class TaskLifecycleListener implements ApplicationListener parameters; + private List arguments; public TaskExecution() { - parameters = new ArrayList<>(); + arguments = new ArrayList<>(); } public TaskExecution(long executionId, Integer exitCode, String taskName, Date startTime, Date endTime, - String exitMessage, List parameters) { + String exitMessage, List arguments) { - Assert.notNull(parameters, "parameters must not be null"); + Assert.notNull(arguments, "arguments must not be null"); Assert.notNull(startTime, "startTime must not be null"); this.executionId = executionId; this.exitCode = exitCode; this.taskName = taskName; this.exitMessage = exitMessage; - this.parameters = new ArrayList<>(parameters); + this.arguments = new ArrayList<>(arguments); this.startTime = (Date)startTime.clone(); this.endTime = (endTime != null) ? (Date)endTime.clone() : null; } @@ -127,12 +127,12 @@ public class TaskExecution { this.exitMessage = exitMessage; } - public List getParameters() { - return parameters; + public List getArguments() { + return arguments; } - public void setParameters(List parameters) { - this.parameters = new ArrayList<> (parameters); + public void setArguments(List arguments) { + this.arguments = new ArrayList<> (arguments); } @Override @@ -144,7 +144,7 @@ public class TaskExecution { ", startTime=" + startTime + ", endTime=" + endTime + ", exitMessage='" + exitMessage + '\'' + - ", parameters=" + parameters + + ", arguments=" + arguments + '}'; } } diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/TaskRepository.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/TaskRepository.java index d21fdafe..4755ca13 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/TaskRepository.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/TaskRepository.java @@ -47,11 +47,11 @@ public interface TaskRepository { * * @param taskName the name that associated with the task execution. * @param startTime the time task began. - * @param parameters list of key/value pairs that configure the task. + * @param arguments list of key/value pairs that configure the task. * @return the initial {@link TaskExecution} */ @Transactional TaskExecution createTaskExecution(String taskName, - Date startTime,List parameters); + Date startTime,List arguments); } diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDao.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDao.java index 9a264ae0..70fb190d 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDao.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDao.java @@ -71,7 +71,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { + "(TASK_EXECUTION_ID, START_TIME, TASK_NAME, LAST_UPDATED)" + "values (?, ?, ?, ?)"; - private static final String CREATE_TASK_PARAMETER = "INSERT into " + private static final String CREATE_TASK_ARGUMENT = "INSERT into " + "%PREFIX%EXECUTION_PARAMS(TASK_EXECUTION_ID, TASK_PARAM ) values (?, ?)"; private static final String CHECK_TASK_EXECUTION_EXISTS = "SELECT COUNT(*) FROM " @@ -86,7 +86,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { + "EXIT_MESSAGE, LAST_UPDATED " + "from %PREFIX%EXECUTION where TASK_EXECUTION_ID = ?"; - private static final String FIND_PARAMS_FROM_ID = "SELECT TASK_EXECUTION_ID, " + private static final String FIND_ARGUMENT_FROM_ID = "SELECT TASK_EXECUTION_ID, " + "TASK_PARAM from %PREFIX%EXECUTION_PARAMS where TASK_EXECUTION_ID = ?"; private static final String TASK_EXECUTION_COUNT = "SELECT COUNT(*) FROM " + @@ -126,17 +126,17 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { @Override public TaskExecution createTaskExecution(String taskName, - Date startTime, List parameters) { + Date startTime, List arguments) { long taskExecutionId = getNextExecutionId(); TaskExecution taskExecution = new TaskExecution(taskExecutionId, null, taskName, - startTime, null, null, parameters); + startTime, null, null, arguments); Object[] queryParameters = new Object[]{ taskExecutionId, startTime, taskName, new Date()}; jdbcTemplate.update( getQuery(SAVE_TASK_EXECUTION), queryParameters, new int[]{ Types.BIGINT, Types.TIMESTAMP, Types.VARCHAR, Types.TIMESTAMP }); - insertTaskParameters(taskExecutionId, parameters); + insertTaskArguments(taskExecutionId, arguments); return taskExecution; } @@ -175,7 +175,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { try { TaskExecution taskExecution = jdbcTemplate.queryForObject(getQuery(GET_EXECUTION_BY_ID), new TaskExecutionRowMapper(), executionId); - taskExecution.setParameters(getTaskParameters(executionId)); + taskExecution.setArguments(getTaskArguments(executionId)); return taskExecution; } catch (EmptyResultDataAccessException e) { @@ -321,15 +321,15 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { } /** - * Convenience method that inserts all parameters from the provided - * task parameters. + * Convenience method that inserts all arguments from the provided + * task arguments. * - * @param executionId The executionId to which the params are associated. - * @param taskParameters The parameters to be stored. + * @param executionId The executionId to which the arguments are associated. + * @param taskArguments The arguments to be stored. */ - private void insertTaskParameters(long executionId, List taskParameters) { - for (String param : taskParameters) { - insertParameter(executionId, param); + private void insertTaskArguments(long executionId, List taskArguments) { + for (String args : taskArguments) { + insertArgument(executionId, args); } } @@ -337,13 +337,13 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { * Convenience method that inserts an individual records into the * TASK_EXECUTION_PARAMS table. */ - private void insertParameter(long executionId, String param) { + private void insertArgument(long executionId, String param) { int[] argTypes = new int[]{ Types.BIGINT, Types.VARCHAR }; Object[] args = new Object[]{ executionId, param }; - jdbcTemplate.update(getQuery(CREATE_TASK_PARAMETER), args, argTypes); + jdbcTemplate.update(getQuery(CREATE_TASK_ARGUMENT), args, argTypes); } - private List getTaskParameters(long executionId){ + private List getTaskArguments(long executionId){ final List params= new ArrayList<>(); RowCallbackHandler handler = new RowCallbackHandler() { @Override @@ -352,7 +352,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { } }; - jdbcTemplate.query(getQuery(FIND_PARAMS_FROM_ID), new Object[] { executionId }, + jdbcTemplate.query(getQuery(FIND_ARGUMENT_FROM_ID), new Object[] { executionId }, handler); return params; } @@ -374,7 +374,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao { rs.getTimestamp("START_TIME"), rs.getTimestamp("END_TIME"), rs.getString("EXIT_MESSAGE"), - getTaskParameters(id)); + getTaskArguments(id)); } private Integer getNullableExitCode(ResultSet rs) throws SQLException { diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDao.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDao.java index 1df21568..b9405c17 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDao.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDao.java @@ -53,10 +53,10 @@ public class MapTaskExecutionDao implements TaskExecutionDao { @Override public TaskExecution createTaskExecution(String taskName, - Date startTime, List parameters) { + Date startTime, List arguments) { long taskExecutionId = getNextExecutionId(); TaskExecution taskExecution = new TaskExecution(taskExecutionId, null, taskName, - startTime, null, null, parameters); + startTime, null, null, arguments); taskExecutions.put(taskExecutionId, taskExecution); return taskExecution; } diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/TaskExecutionDao.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/TaskExecutionDao.java index a5633c12..91f2c1a8 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/TaskExecutionDao.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/dao/TaskExecutionDao.java @@ -36,11 +36,11 @@ public interface TaskExecutionDao { * * @param taskName the name that associated with the task execution. * @param startTime the time task began. - * @param parameters list of key/value pairs that configure the task. + * @param arguments list of key/value pairs that configure the task. * @return A fully qualified {@link TaskExecution} instance. */ TaskExecution createTaskExecution( String taskName, - Date startTime, List parameters); + Date startTime, List arguments); /** * Update and existing {@link TaskExecution}. diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/support/SimpleTaskRepository.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/support/SimpleTaskRepository.java index 6bd88842..d706a1b4 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/support/SimpleTaskRepository.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/support/SimpleTaskRepository.java @@ -71,11 +71,11 @@ public class SimpleTaskRepository implements TaskRepository { @Override public TaskExecution createTaskExecution(String taskName, - Date startTime,List parameters) { + Date startTime,List arguments) { initialize(); validateCreateInformation(startTime, taskName); TaskExecution taskExecution = - taskExecutionDao.createTaskExecution(taskName, startTime, parameters); + taskExecutionDao.createTaskExecution(taskName, startTime, arguments); logger.debug("Creating: " + taskExecution.toString()); return taskExecution; } diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/listener/TaskLifecycleListenerTests.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/listener/TaskLifecycleListenerTests.java index d1648e1e..4e2b3341 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/listener/TaskLifecycleListenerTests.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/listener/TaskLifecycleListenerTests.java @@ -135,7 +135,7 @@ public class TaskLifecycleListenerTests { assertTrue(taskExecutionsByName.iterator().hasNext()); TaskExecution taskExecution = taskExecutionsByName.iterator().next(); - assertEquals(numberOfParams, taskExecution.getParameters().size()); + assertEquals(numberOfParams, taskExecution.getArguments().size()); assertEquals(exitCode, taskExecution.getExitCode()); if(exception != null) { diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDaoTests.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDaoTests.java index 7d7153c6..6e43b2f8 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDaoTests.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/JdbcTaskExecutionDaoTests.java @@ -57,9 +57,9 @@ public class JdbcTaskExecutionDaoTests { @Test @DirtiesContext public void saveTaskExecution() { - TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoParam(); + TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoArg(); expectedTaskExecution = dao.createTaskExecution(expectedTaskExecution.getTaskName(), expectedTaskExecution.getStartTime(), - expectedTaskExecution.getParameters()); + expectedTaskExecution.getArguments()); TestVerifierUtils.verifyTaskExecution(expectedTaskExecution, TestDBUtils.getTaskExecutionFromDB(dataSource, expectedTaskExecution.getExecutionId())); @@ -68,9 +68,9 @@ public class JdbcTaskExecutionDaoTests { @Test @DirtiesContext public void completeTaskExecution() { - TaskExecution expectedTaskExecution = TestVerifierUtils.endSampleTaskExecutionNoParam(); + TaskExecution expectedTaskExecution = TestVerifierUtils.endSampleTaskExecutionNoArg(); expectedTaskExecution = dao.createTaskExecution(expectedTaskExecution.getTaskName(), - expectedTaskExecution.getStartTime(), expectedTaskExecution.getParameters()); + expectedTaskExecution.getStartTime(), expectedTaskExecution.getArguments()); dao.completeTaskExecution(expectedTaskExecution.getExecutionId(), expectedTaskExecution.getExitCode(), expectedTaskExecution.getEndTime(), expectedTaskExecution.getExitMessage()); @@ -83,7 +83,7 @@ public class JdbcTaskExecutionDaoTests { public void completeTaskExecutionWithNoCreate() { JdbcTaskExecutionDao dao = new JdbcTaskExecutionDao(dataSource); - TaskExecution expectedTaskExecution = TestVerifierUtils.endSampleTaskExecutionNoParam(); + TaskExecution expectedTaskExecution = TestVerifierUtils.endSampleTaskExecutionNoArg(); dao.completeTaskExecution(expectedTaskExecution.getExecutionId(), expectedTaskExecution.getExitCode(), expectedTaskExecution.getEndTime(), expectedTaskExecution.getExitMessage()); diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDaoTests.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDaoTests.java index 776f8fdb..ee81b931 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDaoTests.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/MapTaskExecutionDaoTests.java @@ -34,9 +34,9 @@ public class MapTaskExecutionDaoTests { @Test public void saveTaskExecution(){ MapTaskExecutionDao dao = new MapTaskExecutionDao(); - TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoParam(); + TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoArg(); expectedTaskExecution = dao.createTaskExecution(expectedTaskExecution.getTaskName(), - expectedTaskExecution.getStartTime(), expectedTaskExecution.getParameters()); + expectedTaskExecution.getStartTime(), expectedTaskExecution.getArguments()); Map taskExecutionMap = dao.getTaskExecutions(); assertNotNull("taskExecutionMap must not be null", taskExecutionMap); TestVerifierUtils.verifyTaskExecution(expectedTaskExecution, @@ -46,9 +46,9 @@ public class MapTaskExecutionDaoTests { @Test public void completeTaskExecution(){ MapTaskExecutionDao dao = new MapTaskExecutionDao(); - TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoParam(); + TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoArg(); expectedTaskExecution = dao.createTaskExecution(expectedTaskExecution.getTaskName(), - expectedTaskExecution.getStartTime(), expectedTaskExecution.getParameters()); + expectedTaskExecution.getStartTime(), expectedTaskExecution.getArguments()); dao.completeTaskExecution(expectedTaskExecution.getExecutionId(), expectedTaskExecution.getExitCode(), expectedTaskExecution.getEndTime(), expectedTaskExecution.getExitMessage()); diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/support/SimpleTaskExplorerTests.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/support/SimpleTaskExplorerTests.java index 727318d9..7cce0f03 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/support/SimpleTaskExplorerTests.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/support/SimpleTaskExplorerTests.java @@ -308,7 +308,7 @@ public class SimpleTaskExplorerTests { private TaskExecution createAndSaveTaskExecution(int i) { TaskExecution taskExecution = TestVerifierUtils.createSampleTaskExecution(i); taskExecution = this.taskRepository.createTaskExecution(taskExecution.getTaskName(), - taskExecution.getStartTime(), taskExecution.getParameters()); + taskExecution.getStartTime(), taskExecution.getArguments()); return taskExecution; } diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TaskExecutionCreator.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TaskExecutionCreator.java index 5b412e22..3e42e027 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TaskExecutionCreator.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TaskExecutionCreator.java @@ -37,9 +37,9 @@ public class TaskExecutionCreator { * @return the taskExecution created. */ public static TaskExecution createAndStoreTaskExecutionNoParams(TaskRepository taskRepository) { - TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoParam(); + TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoArg(); expectedTaskExecution = taskRepository.createTaskExecution(expectedTaskExecution.getTaskName(), - expectedTaskExecution.getStartTime(), expectedTaskExecution.getParameters()); + expectedTaskExecution.getStartTime(), expectedTaskExecution.getArguments()); return expectedTaskExecution; } @@ -50,13 +50,13 @@ public class TaskExecutionCreator { * @return the taskExecution created. */ public static TaskExecution createAndStoreTaskExecutionWithParams(TaskRepository taskRepository) { - TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoParam(); + TaskExecution expectedTaskExecution = TestVerifierUtils.createSampleTaskExecutionNoArg(); List params = new ArrayList(); params.add(UUID.randomUUID().toString()); params.add(UUID.randomUUID().toString()); - expectedTaskExecution.setParameters(params); + expectedTaskExecution.setArguments(params); expectedTaskExecution = taskRepository.createTaskExecution(expectedTaskExecution.getTaskName(), - expectedTaskExecution.getStartTime(), expectedTaskExecution.getParameters()); + expectedTaskExecution.getStartTime(), expectedTaskExecution.getArguments()); return expectedTaskExecution; } diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestDBUtils.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestDBUtils.java index 6f130479..694dfab6 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestDBUtils.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestDBUtils.java @@ -16,10 +16,6 @@ package org.springframework.cloud.task.util; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; @@ -28,7 +24,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; - import javax.sql.DataSource; import org.springframework.batch.item.database.Order; @@ -44,6 +39,10 @@ import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.MetaDataAccessException; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + /** * Provides a suite of tools that allow tests the ability to retrieve results from a * relational database. @@ -168,10 +167,10 @@ public class TestDBUtils { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); List> rows = jdbcTemplate.queryForList(sql); - List params = new ArrayList<>(); + List arguments = new ArrayList<>(); for (Map row : rows) { - params.add((String) row.get("TASK_PARAM")); + arguments.add((String) row.get("TASK_PARAM")); } - taskExecution.setParameters(params); + taskExecution.setArguments(arguments); } } diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestVerifierUtils.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestVerifierUtils.java index 523bb59a..e3438394 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestVerifierUtils.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/util/TestVerifierUtils.java @@ -47,7 +47,7 @@ import static org.mockito.Mockito.when; */ public class TestVerifierUtils { - public static final int PARAM_SIZE = 5; + public static final int ARG_SIZE = 5; /** * Creates a mock {@link Appender} to be added to the root logger. @@ -79,11 +79,11 @@ public class TestVerifierUtils { } /** - * Creates a fully populated TaskExecution (except params) for testing. + * Creates a fully populated TaskExecution (except args) for testing. * * @return */ - public static TaskExecution createSampleTaskExecutionNoParam() { + public static TaskExecution createSampleTaskExecutionNoArg() { Random randomGenerator = new Random(); Date startTime = new Date(); long executionId = randomGenerator.nextLong(); @@ -94,11 +94,11 @@ public class TestVerifierUtils { } /** - * Creates a fully populated TaskExecution (except params) for testing. + * Creates a fully populated TaskExecution (except args) for testing. * * @return */ - public static TaskExecution endSampleTaskExecutionNoParam() { + public static TaskExecution endSampleTaskExecutionNoArg() { Random randomGenerator = new Random(); int exitCode = randomGenerator.nextInt(); Date startTime = new Date(); @@ -120,12 +120,12 @@ public class TestVerifierUtils { Random randomGenerator = new Random(); Date startTime = new Date(); String taskName = UUID.randomUUID().toString(); - List params = new ArrayList<>(PARAM_SIZE); - for (int i = 0 ; i < PARAM_SIZE ; i++){ - params.add(UUID.randomUUID().toString()); + List args = new ArrayList<>(ARG_SIZE); + for (int i = 0; i < ARG_SIZE; i++){ + args.add(UUID.randomUUID().toString()); } return new TaskExecution(executionId, null, taskName, - startTime, null, null, params); + startTime, null, null, args); } /** @@ -153,22 +153,22 @@ public class TestVerifierUtils { assertEquals("exitMessage must be equal", expectedTaskExecution.getExitMessage(), actualTaskExecution.getExitMessage()); - if (expectedTaskExecution.getParameters() != null) { - assertNotNull("parameters should not be null", - actualTaskExecution.getParameters()); - assertEquals("parameters result set count should match expected count", - expectedTaskExecution.getParameters().size(), - actualTaskExecution.getParameters().size()); + if (expectedTaskExecution.getArguments() != null) { + assertNotNull("arguments should not be null", + actualTaskExecution.getArguments()); + assertEquals("arguments result set count should match expected count", + expectedTaskExecution.getArguments().size(), + actualTaskExecution.getArguments().size()); } else { - assertNull("parameters should be null", actualTaskExecution.getParameters()); + assertNull("arguments should be null", actualTaskExecution.getArguments()); } - Set params = new HashSet(); - for (String param : expectedTaskExecution.getParameters()) { - params.add(param); + Set args = new HashSet(); + for (String param : expectedTaskExecution.getArguments()) { + args.add(param); } - for (String param : actualTaskExecution.getParameters()) { - assertTrue("param must exist in the repository", params.contains(param)); + for (String arg : actualTaskExecution.getArguments()) { + assertTrue("arg must exist in the repository", args.contains(arg)); } } diff --git a/spring-cloud-task-docs/src/main/asciidoc/features.adoc b/spring-cloud-task-docs/src/main/asciidoc/features.adoc index a2e0dceb..33d437db 100644 --- a/spring-cloud-task-docs/src/main/asciidoc/features.adoc +++ b/spring-cloud-task-docs/src/main/asciidoc/features.adoc @@ -83,7 +83,7 @@ assumed to be 0. of the task (as indicated via an `ApplicationFailedEvent`), the stack trace for that exception will be stored here. -|`parameters` +|`arguments` |A `List` of the string command line arguments as they were passed into the executable boot application. |=== diff --git a/spring-cloud-task-docs/src/main/asciidoc/getting-started.adoc b/spring-cloud-task-docs/src/main/asciidoc/getting-started.adoc index 98cdb77e..1432996a 100644 --- a/spring-cloud-task-docs/src/main/asciidoc/getting-started.adoc +++ b/spring-cloud-task-docs/src/main/asciidoc/getting-started.adoc @@ -272,17 +272,17 @@ $ mvn clean spring-boot:run 2016-01-25 11:08:10.185 INFO 12943 --- [ main] com.example.SampleTask : No active profile set, falling back to default profiles: default 2016-01-25 11:08:10.226 INFO 12943 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2a2c3676: startup date [Mon Jan 25 11:08:10 CST 2016]; root of context hierarchy 2016-01-25 11:08:11.051 INFO 12943 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup -2016-01-25 11:08:11.065 INFO 12943 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Creating: TaskExecution{executionId=0, externalExecutionID='null', exitCode=0, taskName='application', startTime=Mon Jan 25 11:08:11 CST 2016, endTime=null, statusCode='null', exitMessage='null', parameters=[]} +2016-01-25 11:08:11.065 INFO 12943 --- [ main] o.s.c.t.r.support.SimpleTaskRepository : Creating: TaskExecution{executionId=0, externalExecutionID='null', exitCode=0, taskName='application', startTime=Mon Jan 25 11:08:11 CST 2016, endTime=null, statusCode='null', exitMessage='null', arguments=[]} Hello World! 2016-01-25 11:08:11.071 INFO 12943 --- [ main] com.example.SampleTask : Started SampleTask in 1.095 seconds (JVM running for 3.826) 2016-01-25 11:08:11.220 INFO 12943 --- [ Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@2a2c3676: startup date [Mon Jan 25 11:08:10 CST 2016]; root of context hierarchy -2016-01-25 11:08:11.222 INFO 12943 --- [ Thread-1] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution{executionId=0, externalExecutionID='null', exitCode=0, taskName='application', startTime=Mon Jan 25 11:08:11 CST 2016, endTime=Mon Jan 25 11:08:11 CST 2016, statusCode='null', exitMessage='null', parameters=[]} +2016-01-25 11:08:11.222 INFO 12943 --- [ Thread-1] o.s.c.t.r.support.SimpleTaskRepository : Updating: TaskExecution{executionId=0, externalExecutionID='null', exitCode=0, taskName='application', startTime=Mon Jan 25 11:08:11 CST 2016, endTime=Mon Jan 25 11:08:11 CST 2016, statusCode='null', exitMessage='null', arguments=[]} 2016-01-25 11:08:11.222 INFO 12943 --- [ Thread-1] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown ---- If you notice, there are three lines of interest in the above output: * `SimpleTaskRepository` logged out the creation of the entry in the `TaskRepository`. -* The execution of our `CommandLineRunner`, demonstrated by the "Helo World!" output. -* `SimpleTaskREpository` logging the completion of the task in the `TaskRepository`. +* The execution of our `CommandLineRunner`, demonstrated by the "Hello World!" output. +* `SimpleTaskRepository` logging the completion of the task in the `TaskRepository`. diff --git a/spring-cloud-task-samples/taskprocessor/README.adoc b/spring-cloud-task-samples/taskprocessor/README.adoc index d7cc341d..4f9cdfa0 100644 --- a/spring-cloud-task-samples/taskprocessor/README.adoc +++ b/spring-cloud-task-samples/taskprocessor/README.adoc @@ -16,7 +16,7 @@ by executing the following build in the timestamp-task module: $ ./mvnw clean install ---- -== The parameters offered by the TaskProcessor are as follows: +== The arguments offered by the TaskProcessor are as follows: * *group* establishes the group for the task maven coordinates. Default is `io.spring`. * *artifact* establishes the artifact for the task maven coordinates. Default is `timestamp-task`. * *classifiers* establishes the classifier for the task maven coordinates. Default is null. diff --git a/spring-cloud-task-stream/src/main/java/org/springframework/cloud/task/launcher/TaskLaunchRequest.java b/spring-cloud-task-stream/src/main/java/org/springframework/cloud/task/launcher/TaskLaunchRequest.java index 40acd20c..f3d54326 100644 --- a/spring-cloud-task-stream/src/main/java/org/springframework/cloud/task/launcher/TaskLaunchRequest.java +++ b/spring-cloud-task-stream/src/main/java/org/springframework/cloud/task/launcher/TaskLaunchRequest.java @@ -62,7 +62,7 @@ public class TaskLaunchRequest implements Serializable{ } /** - * Returns an unmodifiable list of parameters that will be used for the task execution + * Returns an unmodifiable list of arguments that will be used for the task execution */ public List getCommandlineArguments() { return Collections.unmodifiableList(commandlineArguments);