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

The following examples show how to use org.springframework.cloud.task.repository.TaskExecution#setExternalExecutionId() . 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: DefaultTaskExecutionServiceTests.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Test
@DirtiesContext
public void getCFTaskLogByTaskIdOtherThanLatest() {
	String taskName = "test-task";
	String platformName = "cf-test-platform";
	String taskDeploymentId = "12345";
	TaskDeployment taskDeployment = new TaskDeployment();
	taskDeployment.setPlatformName(platformName);
	taskDeployment.setTaskDeploymentId(taskDeploymentId);
	taskDeployment.setTaskDefinitionName(taskName);
	this.taskDeploymentRepository.save(taskDeployment);
	TaskExecution taskExecution = new TaskExecution();
	taskExecution.setStartTime(new Date());
	taskExecution.setTaskName(taskName);
	taskExecution.setExternalExecutionId("12346");
	this.taskRepository.createTaskExecution(taskExecution);
	this.launcherRepository.save(new Launcher(platformName,
			TaskPlatformFactory.CLOUDFOUNDRY_PLATFORM_TYPE, taskLauncher));
	assertEquals("", this.taskExecutionService.getLog(platformName, taskDeploymentId));
}
 
Example 2
Source File: MapTaskExecutionDao.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Override
public TaskExecution startTaskExecution(long executionId, String taskName,
		Date startTime, List<String> arguments, String externalExecutionid,
		Long parentExecutionId) {
	TaskExecution taskExecution = this.taskExecutions.get(executionId);
	taskExecution.setTaskName(taskName);
	taskExecution.setStartTime(startTime);
	taskExecution.setArguments(arguments);
	taskExecution.setParentExecutionId(parentExecutionId);
	if (externalExecutionid != null) {
		taskExecution.setExternalExecutionId(externalExecutionid);
	}
	return taskExecution;
}
 
Example 3
Source File: MapTaskExecutionDao.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Override
public void updateExternalExecutionId(long taskExecutionId,
		String externalExecutionId) {
	TaskExecution taskExecution = this.taskExecutions.get(taskExecutionId);
	Assert.notNull(taskExecution,
			"Invalid TaskExecution, ID " + taskExecutionId + " not found.");
	taskExecution.setExternalExecutionId(externalExecutionId);
}
 
Example 4
Source File: BaseTaskExecutionDaoTestCases.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
protected TaskExecution getTaskExecution(String taskName,
		String externalExecutionId) {
	TaskExecution taskExecution = new TaskExecution();
	taskExecution.setTaskName(taskName);
	taskExecution.setExternalExecutionId(externalExecutionId);
	taskExecution.setStartTime(new Date());
	return taskExecution;
}
 
Example 5
Source File: JdbcTaskExecutionDaoTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext
public void testStartExecutionWithNullExternalExecutionIdNonExisting() {
	TaskExecution expectedTaskExecution = initializeTaskExecutionWithExternalExecutionId();

	this.dao.startTaskExecution(expectedTaskExecution.getExecutionId(),
			expectedTaskExecution.getTaskName(), expectedTaskExecution.getStartTime(),
			expectedTaskExecution.getArguments(), "BAR");
	expectedTaskExecution.setExternalExecutionId("BAR");
	TestVerifierUtils.verifyTaskExecution(expectedTaskExecution,
			TestDBUtils.getTaskExecutionFromDB(this.dataSource,
					expectedTaskExecution.getExecutionId()));
}
 
Example 6
Source File: SimpleTaskRepositoryMapTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdateExternalExecutionId() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setExternalExecutionId(UUID.randomUUID().toString());
	this.taskRepository.updateExternalExecutionId(
			expectedTaskExecution.getExecutionId(),
			expectedTaskExecution.getExternalExecutionId());
	TestVerifierUtils.verifyTaskExecution(expectedTaskExecution,
			getSingleTaskExecutionFromMapRepository(
					expectedTaskExecution.getExecutionId()));
}
 
Example 7
Source File: SimpleTaskRepositoryMapTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdateNullExternalExecutionId() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setExternalExecutionId(null);
	this.taskRepository.updateExternalExecutionId(
			expectedTaskExecution.getExecutionId(),
			expectedTaskExecution.getExternalExecutionId());
	TestVerifierUtils.verifyTaskExecution(expectedTaskExecution,
			getSingleTaskExecutionFromMapRepository(
					expectedTaskExecution.getExecutionId()));
}
 
Example 8
Source File: SimpleTaskRepositoryMapTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testInvalidExecutionIdForExternalExecutionIdUpdate() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setExternalExecutionId(null);
	this.taskRepository.updateExternalExecutionId(-1,
			expectedTaskExecution.getExternalExecutionId());
}
 
Example 9
Source File: SimpleTaskRepositoryJdbcTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdateExternalExecutionId() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setExternalExecutionId(UUID.randomUUID().toString());
	this.taskRepository.updateExternalExecutionId(
			expectedTaskExecution.getExecutionId(),
			expectedTaskExecution.getExternalExecutionId());
	TestVerifierUtils.verifyTaskExecution(expectedTaskExecution,
			TestDBUtils.getTaskExecutionFromDB(this.dataSource,
					expectedTaskExecution.getExecutionId()));
}
 
Example 10
Source File: SimpleTaskRepositoryJdbcTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdateNullExternalExecutionId() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setExternalExecutionId(null);
	this.taskRepository.updateExternalExecutionId(
			expectedTaskExecution.getExecutionId(),
			expectedTaskExecution.getExternalExecutionId());
	TestVerifierUtils.verifyTaskExecution(expectedTaskExecution,
			TestDBUtils.getTaskExecutionFromDB(this.dataSource,
					expectedTaskExecution.getExecutionId()));
}
 
Example 11
Source File: SimpleTaskRepositoryJdbcTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalStateException.class)
public void testInvalidExecutionIdForExternalExecutionIdUpdate() {
	TaskExecution expectedTaskExecution = TaskExecutionCreator
			.createAndStoreTaskExecutionNoParams(this.taskRepository);
	expectedTaskExecution.setExternalExecutionId(null);
	this.taskRepository.updateExternalExecutionId(-1,
			expectedTaskExecution.getExternalExecutionId());
}
 
Example 12
Source File: SimpleTaskExplorerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
private TaskExecution getSimpleTaskExecution() {
	TaskExecution taskExecution = new TaskExecution();
	taskExecution.setTaskName(TASK_NAME);
	taskExecution.setStartTime(new Date());
	taskExecution.setExternalExecutionId(EXTERNAL_EXECUTION_ID);
	return taskExecution;
}