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

The following examples show how to use org.springframework.cloud.task.repository.TaskExecution#getStartTime() . 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: TaskExecutionResource.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor to initialize the TaskExecutionResource using a
 * {@link TaskExecution} and {@link TaskManifest}.
 *
 * @param taskExecution contains the {@link TaskExecution}
 * @param taskManifest contains the (@link TaskManifest}
 */
public TaskExecutionResource(TaskExecution taskExecution, TaskManifest taskManifest) {
	Assert.notNull(taskExecution, "taskExecution must not be null");
	Assert.notNull(taskManifest, "taskManifest must not be null");
	this.executionId = taskExecution.getExecutionId();
	this.exitCode = taskExecution.getExitCode();
	this.taskName = taskExecution.getTaskName();
	this.exitMessage = taskExecution.getExitMessage();
	this.arguments = Collections.unmodifiableList(taskExecution.getArguments());
	this.startTime = taskExecution.getStartTime();
	this.endTime = taskExecution.getEndTime();
	this.errorMessage = taskExecution.getErrorMessage();
	this.externalExecutionId = taskExecution.getExternalExecutionId();
	this.resourceUrl = taskManifest.getTaskDeploymentRequest().getResource().toString();
	this.appProperties = taskManifest.getTaskDeploymentRequest().getDefinition().getProperties();
	this.deploymentProperties = taskManifest.getTaskDeploymentRequest().getDeploymentProperties();
}
 
Example 2
Source File: TaskExecutionResource.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor to initialize the TaskExecutionResource using a
 * {@link TaskExecution}.
 *
 * @param taskExecution contains the {@link TaskExecution}
 */
public TaskExecutionResource(TaskExecution taskExecution) {
	Assert.notNull(taskExecution, "taskExecution must not be null");
	this.executionId = taskExecution.getExecutionId();
	this.exitCode = taskExecution.getExitCode();
	this.taskName = taskExecution.getTaskName();
	this.exitMessage = taskExecution.getExitMessage();
	this.arguments = Collections.unmodifiableList(taskExecution.getArguments());
	this.startTime = taskExecution.getStartTime();
	this.endTime = taskExecution.getEndTime();
	this.errorMessage = taskExecution.getErrorMessage();
	this.externalExecutionId = taskExecution.getExternalExecutionId();
}
 
Example 3
Source File: TestVerifierUtils.java    From spring-cloud-task with Apache License 2.0 4 votes vote down vote up
/**
 * Verifies that all the fields in between the expected and actual are the same.
 * @param expectedTaskExecution The expected value for the task execution.
 * @param actualTaskExecution The actual value for the task execution.
 */
public static void verifyTaskExecution(TaskExecution expectedTaskExecution,
		TaskExecution actualTaskExecution) {
	assertThat(actualTaskExecution.getExecutionId())
			.as("taskExecutionId must be equal")
			.isEqualTo(expectedTaskExecution.getExecutionId());
	if (actualTaskExecution.getStartTime() != null) {
		assertThat(actualTaskExecution.getStartTime()).as("startTime must be equal")
				.hasSameTimeAs(expectedTaskExecution.getStartTime());
	}
	if (actualTaskExecution.getEndTime() != null) {
		assertThat(actualTaskExecution.getEndTime()).as("endTime must be equal")
				.hasSameTimeAs(expectedTaskExecution.getEndTime());
	}
	assertThat(actualTaskExecution.getExitCode()).as("exitCode must be equal")
			.isEqualTo(expectedTaskExecution.getExitCode());
	assertThat(actualTaskExecution.getTaskName()).as("taskName must be equal")
			.isEqualTo(expectedTaskExecution.getTaskName());
	assertThat(actualTaskExecution.getExitMessage()).as("exitMessage must be equal")
			.isEqualTo(expectedTaskExecution.getExitMessage());
	assertThat(actualTaskExecution.getErrorMessage()).as("errorMessage must be equal")
			.isEqualTo(expectedTaskExecution.getErrorMessage());
	assertThat(actualTaskExecution.getExternalExecutionId())
			.as("externalExecutionId must be equal")
			.isEqualTo(expectedTaskExecution.getExternalExecutionId());
	assertThat(actualTaskExecution.getParentExecutionId())
			.as("parentExecutionId must be equal")
			.isEqualTo(expectedTaskExecution.getParentExecutionId());

	if (expectedTaskExecution.getArguments() != null) {
		assertThat(actualTaskExecution.getArguments())
				.as("arguments should not be null").isNotNull();
		assertThat(actualTaskExecution.getArguments().size())
				.as("arguments result set count should match expected count")
				.isEqualTo(expectedTaskExecution.getArguments().size());
	}
	else {
		assertThat(actualTaskExecution.getArguments()).as("arguments should be null")
				.isNull();
	}
	Set<String> args = new HashSet<>();
	for (String param : expectedTaskExecution.getArguments()) {
		args.add(param);
	}
	for (String arg : actualTaskExecution.getArguments()) {
		assertThat(args.contains(arg)).as("arg must exist in the repository")
				.isTrue();
	}
}