org.springframework.cloud.task.repository.TaskExplorer Java Examples

The following examples show how to use org.springframework.cloud.task.repository.TaskExplorer. 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: TestDependencies.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskExecutionService taskService(LauncherRepository launcherRepository,
		AuditRecordService auditRecordService,
		TaskRepository taskRepository,
		TaskExecutionInfoService taskExecutionInfoService,
		TaskDeploymentRepository taskDeploymentRepository,
		TaskExecutionCreationService taskExecutionRepositoryService,
		TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator,
		TaskExplorer taskExplorer, DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		OAuth2TokenUtilsService oauth2TokenUtilsService,
		TaskSaveService taskSaveService,
		TaskConfigurationProperties taskConfigurationProperties) {

	return new DefaultTaskExecutionService(
			launcherRepository, auditRecordService, taskRepository,
			taskExecutionInfoService, taskDeploymentRepository,
			taskExecutionRepositoryService, taskAppDeploymentRequestCreator,
			taskExplorer, dataflowTaskExecutionDao, dataflowTaskExecutionMetadataDao,
			oauth2TokenUtilsService, taskSaveService, taskConfigurationProperties);
}
 
Example #2
Source File: TaskServiceDependencies.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskExecutionService defaultTaskService(LauncherRepository launcherRepository,
		AuditRecordService auditRecordService, TaskRepository taskRepository,
		TaskExecutionInfoService taskExecutionInfoService,
		TaskDeploymentRepository taskDeploymentRepository,
		TaskExecutionCreationService taskExecutionRepositoryService,
		TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator,
		TaskExplorer taskExplorer, DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		OAuth2TokenUtilsService oauth2TokenUtilsService,
		TaskSaveService taskSaveService) {
	DefaultTaskExecutionService taskExecutionService = new DefaultTaskExecutionService(
			launcherRepository, auditRecordService, taskRepository,
			taskExecutionInfoService, taskDeploymentRepository,
			taskExecutionRepositoryService, taskAppDeploymentRequestCreator,
			taskExplorer, dataflowTaskExecutionDao, dataflowTaskExecutionMetadataDao,
			oauth2TokenUtilsService, taskSaveService, this.taskConfigurationProperties);
	taskExecutionService.setAutoCreateTaskDefinitions(this.taskConfigurationProperties.isAutoCreateTaskDefinitions());
	return taskExecutionService;
}
 
Example #3
Source File: TaskConfiguration.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskExecutionService taskService(LauncherRepository launcherRepository,
		AuditRecordService auditRecordService,
		TaskRepository taskRepository,
		TaskExecutionInfoService taskExecutionInfoService,
		TaskDeploymentRepository taskDeploymentRepository,
		TaskExecutionCreationService taskExecutionRepositoryService,
		TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator,
		TaskExplorer taskExplorer,
		DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		@Nullable OAuth2TokenUtilsService oauth2TokenUtilsService,
		TaskSaveService taskSaveService) {
	DefaultTaskExecutionService defaultTaskExecutionService =  new DefaultTaskExecutionService(
			launcherRepository, auditRecordService, taskRepository,
			taskExecutionInfoService, taskDeploymentRepository, taskExecutionRepositoryService,
			taskAppDeploymentRequestCreator, taskExplorer, dataflowTaskExecutionDao,
			dataflowTaskExecutionMetadataDao, oauth2TokenUtilsService, taskSaveService,
			this.taskConfigurationProperties);
	defaultTaskExecutionService.setAutoCreateTaskDefinitions(this.taskConfigurationProperties.isAutoCreateTaskDefinitions());
	return defaultTaskExecutionService;
}
 
Example #4
Source File: TaskServiceDependencies.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskDeleteService deleteTaskService(TaskExplorer taskExplorer, LauncherRepository launcherRepository,
		TaskDefinitionRepository taskDefinitionRepository,
		TaskDeploymentRepository taskDeploymentRepository,
		AuditRecordService auditRecordService,
		DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowJobExecutionDao dataflowJobExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		@Autowired(required = false) SchedulerService schedulerService) {

	return new DefaultTaskDeleteService(taskExplorer, launcherRepository, taskDefinitionRepository,
			taskDeploymentRepository,
			auditRecordService,
			dataflowTaskExecutionDao,
			dataflowJobExecutionDao,
			dataflowTaskExecutionMetadataDao,
			schedulerService);
}
 
Example #5
Source File: JobDependencies.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskDeleteService deleteTaskService(TaskExplorer taskExplorer, LauncherRepository launcherRepository,
		TaskDefinitionRepository taskDefinitionRepository,
		TaskDeploymentRepository taskDeploymentRepository,
		AuditRecordService auditRecordService,
		DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowJobExecutionDao dataflowJobExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		SchedulerService schedulerService) {

	return new DefaultTaskDeleteService(taskExplorer, launcherRepository, taskDefinitionRepository,
			taskDeploymentRepository,
			auditRecordService, dataflowTaskExecutionDao,
			dataflowJobExecutionDao,
			dataflowTaskExecutionMetadataDao,
			schedulerService);
}
 
Example #6
Source File: DefaultTaskDeleteService.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
public DefaultTaskDeleteService(TaskExplorer taskExplorer, LauncherRepository launcherRepository,
		TaskDefinitionRepository taskDefinitionRepository,
		TaskDeploymentRepository taskDeploymentRepository,
		AuditRecordService auditRecordService,
		DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowJobExecutionDao dataflowJobExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		SchedulerService schedulerService) {
	Assert.notNull(taskExplorer, "TaskExplorer must not be null");
	Assert.notNull(launcherRepository, "LauncherRepository must not be null");
	Assert.notNull(taskDefinitionRepository, "TaskDefinitionRepository must not be null");
	Assert.notNull(taskDeploymentRepository, "TaskDeploymentRepository must not be null");
	Assert.notNull(auditRecordService, "AuditRecordService must not be null");
	Assert.notNull(dataflowTaskExecutionDao, "DataflowTaskExecutionDao must not be null");
	Assert.notNull(dataflowJobExecutionDao, "DataflowJobExecutionDao must not be null");
	Assert.notNull(dataflowTaskExecutionMetadataDao, "DataflowTaskExecutionMetadataDao must not be null");
	this.taskExplorer = taskExplorer;
	this.launcherRepository = launcherRepository;
	this.taskDefinitionRepository = taskDefinitionRepository;
	this.taskDeploymentRepository = taskDeploymentRepository;
	this.auditRecordService = auditRecordService;
	this.dataflowTaskExecutionDao = dataflowTaskExecutionDao;
	this.dataflowJobExecutionDao = dataflowJobExecutionDao;
	this.dataflowTaskExecutionMetadataDao = dataflowTaskExecutionMetadataDao;
	this.schedulerService = schedulerService;
}
 
Example #7
Source File: JobDependencies.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public TaskExecutionService taskService(LauncherRepository launcherRepository,
		AuditRecordService auditRecordService, TaskRepository taskRepository,
		TaskExecutionInfoService taskExecutionInfoService,
		TaskDeploymentRepository taskDeploymentRepository,
		TaskExecutionCreationService taskExecutionRepositoryService,
		TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator,
		TaskExplorer taskExplorer, DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		OAuth2TokenUtilsService oauth2TokenUtilsService,
		TaskSaveService taskSaveService, TaskConfigurationProperties taskConfigurationProperties) {
	return new DefaultTaskExecutionService(
			launcherRepository, auditRecordService,
			taskRepository,
			taskExecutionInfoService, taskDeploymentRepository,
			taskExecutionRepositoryService, taskAppDeploymentRequestCreator,
			taskExplorer, dataflowTaskExecutionDao,
			dataflowTaskExecutionMetadataDao, oauth2TokenUtilsService,
			taskSaveService, taskConfigurationProperties);
}
 
Example #8
Source File: DefaultTaskExecutionInfoService.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the {@link DefaultTaskExecutionInfoService}.
 *
 * @param dataSourceProperties the data source properties.
 * @param appRegistryService URI registry this service will use to look up app URIs.
 * @param taskExplorer the explorer this service will use to lookup task executions
 * @param taskDefinitionRepository the {@link TaskDefinitionRepository} this service will
 *     use for task CRUD operations.
 * @param taskConfigurationProperties the properties used to define the behavior of tasks
 * @param launcherRepository the launcher repository
 * @param taskPlatforms the task platforms
 */
public DefaultTaskExecutionInfoService(DataSourceProperties dataSourceProperties,
		AppRegistryService appRegistryService,
		TaskExplorer taskExplorer,
		TaskDefinitionRepository taskDefinitionRepository,
		TaskConfigurationProperties taskConfigurationProperties,
		LauncherRepository launcherRepository,
		List<TaskPlatform> taskPlatforms) {
	Assert.notNull(dataSourceProperties, "DataSourceProperties must not be null");
	Assert.notNull(appRegistryService, "AppRegistryService must not be null");
	Assert.notNull(taskDefinitionRepository, "TaskDefinitionRepository must not be null");
	Assert.notNull(taskExplorer, "TaskExplorer must not be null");
	Assert.notNull(taskConfigurationProperties, "taskConfigurationProperties must not be null");
	Assert.notNull(launcherRepository, "launcherRepository must not be null");
	Assert.notEmpty(taskPlatforms, "taskPlatform must not be empty or null");

	this.dataSourceProperties = dataSourceProperties;
	this.appRegistryService = appRegistryService;
	this.taskExplorer = taskExplorer;
	this.taskDefinitionRepository = taskDefinitionRepository;
	this.taskConfigurationProperties = taskConfigurationProperties;
	this.launcherRepository = launcherRepository;
	this.taskPlatforms = taskPlatforms;
}
 
Example #9
Source File: TaskLifecycleListener.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
/**
 * @param taskRepository {@link TaskRepository} to record executions.
 * @param taskNameResolver {@link TaskNameResolver} used to determine task name for
 * task execution.
 * @param applicationArguments {@link ApplicationArguments} to be used for task
 * execution.
 * @param taskExplorer {@link TaskExplorer} to be used for task execution.
 * @param taskProperties {@link TaskProperties} to be used for the task execution.
 * @param taskListenerExecutorObjectFactory {@link TaskListenerExecutorObjectFactory}
 * to initialize TaskListenerExecutor for a task
 */
public TaskLifecycleListener(TaskRepository taskRepository,
		TaskNameResolver taskNameResolver, ApplicationArguments applicationArguments,
		TaskExplorer taskExplorer, TaskProperties taskProperties,
		TaskListenerExecutorObjectFactory taskListenerExecutorObjectFactory) {
	Assert.notNull(taskRepository, "A taskRepository is required");
	Assert.notNull(taskNameResolver, "A taskNameResolver is required");
	Assert.notNull(taskExplorer, "A taskExplorer is required");
	Assert.notNull(taskProperties, "TaskProperties is required");
	Assert.notNull(taskListenerExecutorObjectFactory,
			"A TaskListenerExecutorObjectFactory is required");

	this.taskRepository = taskRepository;
	this.taskNameResolver = taskNameResolver;
	this.applicationArguments = applicationArguments;
	this.taskExplorer = taskExplorer;
	this.taskProperties = taskProperties;
	this.taskListenerExecutorObjectFactory = taskListenerExecutorObjectFactory;
	this.taskMetrics = new TaskMetrics();
}
 
Example #10
Source File: TaskBatchAutoConfiguration.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskBatchExecutionListenerFactoryBean taskBatchExecutionListener(
		TaskExplorer taskExplorer) {
	TaskConfigurer taskConfigurer = null;
	if (!this.context.getBeansOfType(TaskConfigurer.class).isEmpty()) {
		taskConfigurer = this.context.getBean(TaskConfigurer.class);
	}
	if (taskConfigurer != null && taskConfigurer.getTaskDataSource() != null) {
		return new TaskBatchExecutionListenerFactoryBean(
				taskConfigurer.getTaskDataSource(), taskExplorer,
				this.taskProperties.getTablePrefix());
	}
	else {
		return new TaskBatchExecutionListenerFactoryBean(null, taskExplorer,
				this.taskProperties.getTablePrefix());
	}
}
 
Example #11
Source File: TestDependencies.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskDeleteService deleteTaskService(TaskExplorer taskExplorer, LauncherRepository launcherRepository,
		TaskDefinitionRepository taskDefinitionRepository,
		TaskDeploymentRepository taskDeploymentRepository,
		AuditRecordService auditRecordService,
		DataflowTaskExecutionDao dataflowTaskExecutionDao,
		DataflowJobExecutionDao dataflowJobExecutionDao,
		DataflowTaskExecutionMetadataDao dataflowTaskExecutionMetadataDao,
		SchedulerService schedulerService) {
	return new DefaultTaskDeleteService(taskExplorer, launcherRepository, taskDefinitionRepository,
			taskDeploymentRepository,
			auditRecordService,
			dataflowTaskExecutionDao,
			dataflowJobExecutionDao,
			dataflowTaskExecutionMetadataDao,
			schedulerService);
}
 
Example #12
Source File: ComposedTaskRunnerStepFactoryTests.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskConfigurer taskConfigurer() {
	return new TaskConfigurer() {
		@Override
		public TaskRepository getTaskRepository() {
			return null;
		}

		@Override
		public PlatformTransactionManager getTransactionManager() {
			return null;
		}

		@Override
		public TaskExplorer getTaskExplorer() {
			return mock(TaskExplorer.class);
		}

		@Override
		public DataSource getTaskDataSource() {
			return mock(DataSource.class);
		}
	};
}
 
Example #13
Source File: TaskLauncherTasklet.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
public TaskLauncherTasklet(
		TaskOperations taskOperations, TaskExplorer taskExplorer,
		ComposedTaskProperties composedTaskProperties, String taskName,
		TaskProperties taskProperties) {
	Assert.hasText(taskName, "taskName must not be empty nor null.");
	Assert.notNull(taskOperations, "taskOperations must not be null.");
	Assert.notNull(taskExplorer, "taskExplorer must not be null.");
	Assert.notNull(composedTaskProperties,
			"composedTaskProperties must not be null");

	this.taskName = taskName;
	this.taskOperations = taskOperations;
	this.taskExplorer = taskExplorer;
	this.composedTaskProperties = composedTaskProperties;
	this.taskProperties = taskProperties;
}
 
Example #14
Source File: TaskBatchExecutionListenerTests.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleDataSources() {
	this.applicationContext = SpringApplication
			.run(JobConfigurationMultipleDataSources.class, ARGS);

	TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

	Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application",
			PageRequest.of(0, 1));

	Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(
			page.iterator().next().getExecutionId());

	assertThat(jobExecutionIds.size()).isEqualTo(1);
	assertThat(taskExplorer.getTaskExecution(jobExecutionIds.iterator().next())
			.getExecutionId()).isEqualTo(1);
}
 
Example #15
Source File: TaskBatchExecutionListenerTests.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@Test
public void testMapBased() {
	this.applicationContext = SpringApplication.run(JobConfiguration.class, ARGS);

	TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

	Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application",
			PageRequest.of(0, 1));

	Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(
			page.iterator().next().getExecutionId());

	assertThat(jobExecutionIds.size()).isEqualTo(1);
	assertThat((long) taskExplorer
			.getTaskExecutionIdByJobExecutionId(jobExecutionIds.iterator().next()))
					.isEqualTo(1);
}
 
Example #16
Source File: TaskBatchExecutionListenerTests.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleJobs() {
	this.applicationContext = SpringApplication.run(MultipleJobConfiguration.class,
			ARGS);

	TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

	Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application",
			PageRequest.of(0, 1));

	Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(
			page.iterator().next().getExecutionId());

	assertThat(jobExecutionIds.size()).isEqualTo(2);
	Iterator<Long> jobExecutionIdsIterator = jobExecutionIds.iterator();
	assertThat((long) taskExplorer
			.getTaskExecutionIdByJobExecutionId(jobExecutionIdsIterator.next()))
					.isEqualTo(1);
	assertThat((long) taskExplorer
			.getTaskExecutionIdByJobExecutionId(jobExecutionIdsIterator.next()))
					.isEqualTo(1);
}
 
Example #17
Source File: ComposedTaskRunnerStepFactoryTests.java    From composed-task-runner with Apache License 2.0 6 votes vote down vote up
@Bean
public TaskConfigurer taskConfigurer() {
	return new TaskConfigurer() {
		@Override
		public TaskRepository getTaskRepository() {
			return null;
		}

		@Override
		public PlatformTransactionManager getTransactionManager() {
			return null;
		}

		@Override
		public TaskExplorer getTaskExplorer() {
			return mock(TaskExplorer.class);
		}

		@Override
		public DataSource getTaskDataSource() {
			return mock(DataSource.class);
		}
	};
}
 
Example #18
Source File: TaskLauncherTasklet.java    From composed-task-runner with Apache License 2.0 6 votes vote down vote up
public TaskLauncherTasklet(
		TaskOperations taskOperations, TaskExplorer taskExplorer,
		ComposedTaskProperties composedTaskProperties, String taskName,
		TaskProperties taskProperties) {
	Assert.hasText(taskName, "taskName must not be empty nor null.");
	Assert.notNull(taskOperations, "taskOperations must not be null.");
	Assert.notNull(taskExplorer, "taskExplorer must not be null.");
	Assert.notNull(composedTaskProperties,
			"composedTaskProperties must not be null");

	this.taskName = taskName;
	this.taskOperations = taskOperations;
	this.taskExplorer = taskExplorer;
	this.composedTaskProperties = composedTaskProperties;
	this.taskProperties = taskProperties;
}
 
Example #19
Source File: JobDependencies.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@Bean
public TaskExecutionInfoService taskDefinitionRetriever(AppRegistryService registry,
		TaskExplorer taskExplorer, TaskDefinitionRepository taskDefinitionRepository,
		TaskConfigurationProperties taskConfigurationProperties, LauncherRepository launcherRepository,
		List<TaskPlatform> taskPlatforms) {
	return new DefaultTaskExecutionInfoService(new DataSourceProperties(),
			registry, taskExplorer, taskDefinitionRepository,
			taskConfigurationProperties, launcherRepository, taskPlatforms);
}
 
Example #20
Source File: TestDependencies.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@Bean
public TaskExecutionInfoService taskDefinitionRetriever(AppRegistryService registry,
		TaskExplorer taskExplorer, TaskDefinitionRepository taskDefinitionRepository,
		TaskConfigurationProperties taskConfigurationProperties, LauncherRepository launcherRepository,
		List<TaskPlatform> platforms) {
	return new DefaultTaskExecutionInfoService(new DataSourceProperties(),
			registry, taskExplorer, taskDefinitionRepository,
			taskConfigurationProperties, launcherRepository, platforms);
}
 
Example #21
Source File: TaskLifecycleListenerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testExternalExecutionId() {
	ConfigurableEnvironment environment = new StandardEnvironment();
	MutablePropertySources propertySources = environment.getPropertySources();
	Map<String, Object> myMap = new HashMap<>();
	myMap.put("spring.cloud.task.external-execution-id", "myid");
	propertySources
			.addFirst(new MapPropertySource("EnvrionmentTestPropsource", myMap));
	this.context.setEnvironment(environment);
	this.context.refresh();
	this.taskExplorer = this.context.getBean(TaskExplorer.class);

	verifyTaskExecution(0, false, null, null, "myid");
}
 
Example #22
Source File: TaskExecutionController.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@code TaskExecutionController} that retrieves Task Execution information
 * from a the {@link TaskExplorer}
 *
 * @param explorer the explorer this controller will use for retrieving task execution
 *     information.
 * @param taskExecutionService used to launch tasks
 * @param taskDefinitionRepository the task definition repository
 * @param taskExecutionInfoService the task execution information service
 * @param taskDeleteService the task deletion service
 */
public TaskExecutionController(TaskExplorer explorer, TaskExecutionService taskExecutionService,
		TaskDefinitionRepository taskDefinitionRepository, TaskExecutionInfoService taskExecutionInfoService,
		TaskDeleteService taskDeleteService) {
	Assert.notNull(explorer, "explorer must not be null");
	Assert.notNull(taskExecutionService, "taskExecutionService must not be null");
	Assert.notNull(taskDefinitionRepository, "taskDefinitionRepository must not be null");
	Assert.notNull(taskExecutionInfoService, "taskDefinitionRetriever must not be null");
	Assert.notNull(taskDeleteService, "taskDeleteService must not be null");
	this.taskExecutionService = taskExecutionService;
	this.explorer = explorer;
	this.taskDefinitionRepository = taskDefinitionRepository;
	this.taskExecutionInfoService = taskExecutionInfoService;
	this.taskDeleteService = taskDeleteService;
}
 
Example #23
Source File: TaskServiceDependencies.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@Bean
public TaskExecutionInfoService taskDefinitionRetriever(AppRegistryService registry,
		TaskExplorer taskExplorer, TaskDefinitionRepository taskDefinitionRepository,
		TaskConfigurationProperties taskConfigurationProperties, LauncherRepository launcherRepository,
	List<TaskPlatform> taskPlatforms) {
	return new DefaultTaskExecutionInfoService(this.dataSourceProperties,
			registry, taskExplorer, taskDefinitionRepository,
			taskConfigurationProperties, launcherRepository, taskPlatforms);
}
 
Example #24
Source File: JobDependencies.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@Bean
public TaskExecutionController taskExecutionController(TaskExplorer explorer,
		TaskExecutionService taskExecutionService,
		TaskDefinitionRepository taskDefinitionRepository, TaskExecutionInfoService taskExecutionInfoService,
		TaskDeleteService taskDeleteService) {
	return new TaskExecutionController(explorer, taskExecutionService, taskDefinitionRepository,
			taskExecutionInfoService,
			taskDeleteService);
}
 
Example #25
Source File: TaskLifecycleConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Autowired
public TaskLifecycleConfiguration(TaskProperties taskProperties,
		ConfigurableApplicationContext context, TaskRepository taskRepository,
		TaskExplorer taskExplorer, TaskNameResolver taskNameResolver,
		ObjectProvider<ApplicationArguments> applicationArguments) {

	this.taskProperties = taskProperties;
	this.context = context;
	this.taskRepository = taskRepository;
	this.taskExplorer = taskExplorer;
	this.taskNameResolver = taskNameResolver;
	this.applicationArguments = applicationArguments.getIfAvailable();
}
 
Example #26
Source File: TaskLifecycleListenerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testTaskUpdate() {
	this.context.refresh();
	this.taskExplorer = this.context.getBean(TaskExplorer.class);

	this.context.publishEvent(new ApplicationReadyEvent(new SpringApplication(),
			new String[0], this.context));

	verifyTaskExecution(0, true, 0);
}
 
Example #27
Source File: PrefixTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testPrefix() {
	this.applicationContext = SpringApplication.run(JobConfiguration.class,
			"--spring.cloud.task.tablePrefix=FOO_");

	TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

	Set<Long> jobIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(1);
	assertThat(jobIds.size()).isEqualTo(1);
	assertThat(jobIds.contains(1L));
}
 
Example #28
Source File: TaskBatchExecutionListenerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
private void validateContext() {
	TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

	Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application",
			PageRequest.of(0, 1));

	Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(
			page.iterator().next().getExecutionId());

	assertThat(jobExecutionIds.size()).isEqualTo(1);
	assertThat(taskExplorer.getTaskExecution(jobExecutionIds.iterator().next())
			.getExecutionId()).isEqualTo(1);

}
 
Example #29
Source File: TaskBatchExecutionListenerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Test
public void testAutobuiltDataSourceNoJob() {
	this.applicationContext = SpringApplication.run(NoJobConfiguration.class, ARGS);

	TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

	Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application",
			PageRequest.of(0, 1));

	Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(
			page.iterator().next().getExecutionId());

	assertThat(jobExecutionIds.size()).isEqualTo(0);
}
 
Example #30
Source File: TaskJobLauncherCommandLineRunnerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
private void validateContext() {
	TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

	Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application",
			PageRequest.of(0, 1));

	Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(
			page.iterator().next().getExecutionId());

	assertThat(jobExecutionIds.size()).isEqualTo(1);
	assertThat(taskExplorer.getTaskExecution(jobExecutionIds.iterator().next())
			.getExecutionId()).isEqualTo(1);
}