Java Code Examples for org.springframework.cloud.task.repository.TaskExecution#setExitMessage()

The following examples show how to use org.springframework.cloud.task.repository.TaskExecution#setExitMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleTaskRepositoryJdbcTests.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateTaskExecutionNoParamMaxExitMessageSize() {
	SimpleTaskRepository simpleTaskRepository = new SimpleTaskRepository(
			new TaskExecutionDaoFactoryBean(this.dataSource));
	simpleTaskRepository.setMaxExitMessageSize(5);

	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(simpleTaskRepository);
	expectedTaskExecution.setExitMessage(
			new String(new char[SimpleTaskRepository.MAX_EXIT_MESSAGE_SIZE + 1]));
	expectedTaskExecution.setEndTime(new Date());
	expectedTaskExecution.setExitCode(0);
	TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution,
			simpleTaskRepository);
	assertThat(actualTaskExecution.getExitMessage().length()).isEqualTo(5);
}
 
Example 2
Source File: SimpleTaskRepositoryJdbcTests.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
private void verifyTaskRepositoryConstructor(Integer maxExitMessage,
		Integer maxErrorMessage, TaskRepository taskRepository) {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(taskRepository);
	expectedTaskExecution.setErrorMessage(new String(new char[maxErrorMessage + 1]));
	expectedTaskExecution.setExitMessage(new String(new char[maxExitMessage + 1]));
	expectedTaskExecution.setEndTime(new Date());
	expectedTaskExecution.setExitCode(0);

	TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution,
			taskRepository);
	assertThat(actualTaskExecution.getErrorMessage().length())
			.isEqualTo(maxErrorMessage.intValue());
	assertThat(actualTaskExecution.getExitMessage().length())
			.isEqualTo(maxExitMessage.intValue());
}
 
Example 3
Source File: ComposedTaskStepExecutionListenerTests.java    From composed-task-runner with Apache License 2.0 5 votes vote down vote up
private TaskExecution getDefaultTaskExecution (int exitCode,
		String exitMessage) {
	TaskExecution taskExecution = new TaskExecution();
	taskExecution.setExitMessage(exitMessage);
	taskExecution.setExitCode(exitCode);
	taskExecution.setEndTime(new Date());
	return taskExecution;
}
 
Example 4
Source File: ComposedTaskStepExecutionListenerTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private TaskExecution getDefaultTaskExecution (int exitCode,
		String exitMessage) {
	TaskExecution taskExecution = new TaskExecution();
	taskExecution.setExitMessage(exitMessage);
	taskExecution.setExitCode(exitCode);
	taskExecution.setEndTime(new Date());
	return taskExecution;
}
 
Example 5
Source File: MapTaskExecutionDao.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Override
public void completeTaskExecution(long executionId, Integer exitCode, Date endTime,
		String exitMessage, String errorMessage) {
	if (!this.taskExecutions.containsKey(executionId)) {
		throw new IllegalStateException(
				"Invalid TaskExecution, ID " + executionId + " not found.");
	}

	TaskExecution taskExecution = this.taskExecutions.get(executionId);
	taskExecution.setEndTime(endTime);
	taskExecution.setExitCode(exitCode);
	taskExecution.setExitMessage(exitMessage);
	taskExecution.setErrorMessage(errorMessage);
}
 
Example 6
Source File: SimpleTaskRepositoryJdbcTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext
public void testCompleteTaskExecution() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setEndTime(new Date());
	expectedTaskExecution.setExitCode(77);
	expectedTaskExecution.setExitMessage(UUID.randomUUID().toString());

	TaskExecution actualTaskExecution = TaskExecutionCreator
			.completeExecution(this.taskRepository, expectedTaskExecution);
	TestVerifierUtils.verifyTaskExecution(expectedTaskExecution, actualTaskExecution);
}
 
Example 7
Source File: SimpleTaskRepositoryJdbcTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext
public void testCreateTaskExecutionNoParamMaxExitDefaultMessageSize() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setExitMessage(
			new String(new char[SimpleTaskRepository.MAX_EXIT_MESSAGE_SIZE + 1]));
	expectedTaskExecution.setEndTime(new Date());
	expectedTaskExecution.setExitCode(0);
	TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution,
			this.taskRepository);
	assertThat(actualTaskExecution.getExitMessage().length())
			.isEqualTo(SimpleTaskRepository.MAX_EXIT_MESSAGE_SIZE);
}