org.springframework.cloud.task.repository.support.TaskExecutionDaoFactoryBean Java Examples

The following examples show how to use org.springframework.cloud.task.repository.support.TaskExecutionDaoFactoryBean. 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: JobCommandTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {
	Thread.sleep(2000);
	DataSource dataSource = applicationContext.getBean(DataSource.class);
	taskBatchDao = new JdbcTaskBatchDao(dataSource);
	JobRepositoryFactoryBean repositoryFactoryBean = new JobRepositoryFactoryBean();
	repositoryFactoryBean.setDataSource(dataSource);
	repositoryFactoryBean.setTransactionManager(new DataSourceTransactionManager(dataSource));
	jobRepository = repositoryFactoryBean.getObject();
	TaskExecutionDaoFactoryBean taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean(dataSource);
	dao = taskExecutionDaoFactoryBean.getObject();
	taskExecutionIds.add(createSampleJob(JOB_NAME_ORIG, 1));
	taskExecutionIds.add(createSampleJob(JOB_NAME_FOO, 1));
	taskExecutionIds.add(createSampleJob(JOB_NAME_FOOBAR, 2));
}
 
Example #2
Source File: TestDefaultConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
	if (this.context.getBeanNamesForType(DataSource.class).length == 1) {
		DataSource dataSource = this.context.getBean(DataSource.class);
		this.factoryBean = new TaskExecutionDaoFactoryBean(dataSource);
	}
	else {
		this.factoryBean = new TaskExecutionDaoFactoryBean();
	}
}
 
Example #3
Source File: TestConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
	if (this.dataSource != null) {
		this.taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean(
				this.dataSource);
	}
	else {
		this.taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean();
	}
}
 
Example #4
Source File: TaskInitializerTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Autowired
public void setDataSource(DataSource dataSource) {
	this.dataSource = dataSource;
	TaskExecutionDaoFactoryBean factoryBean = new TaskExecutionDaoFactoryBean(
			dataSource);
	this.taskExplorer = new SimpleTaskExplorer(factoryBean);
}
 
Example #5
Source File: TaskStartTests.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Autowired
public void setDataSource(DataSource dataSource) {
	this.dataSource = dataSource;
	TaskExecutionDaoFactoryBean factoryBean = new TaskExecutionDaoFactoryBean(
			dataSource);
	this.taskExplorer = new SimpleTaskExplorer(factoryBean);
	this.taskRepository = new SimpleTaskRepository(factoryBean);
}
 
Example #6
Source File: TaskLauncherTaskletTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void setup() throws Exception{
	this.taskRepositoryInitializer.setDataSource(this.dataSource);

	this.taskRepositoryInitializer.afterPropertiesSet();
	this.taskOperations = mock(TaskOperations.class);
	TaskExecutionDaoFactoryBean taskExecutionDaoFactoryBean =
			new TaskExecutionDaoFactoryBean(this.dataSource);
	this.taskRepository = new SimpleTaskRepository(taskExecutionDaoFactoryBean);
	this.taskExplorer = new SimpleTaskExplorer(taskExecutionDaoFactoryBean);
	this.composedTaskProperties.setIntervalTimeBetweenChecks(500);
}
 
Example #7
Source File: JobExecutionsDocumentation.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private void initialize() throws Exception {
	JobRepositoryFactoryBean repositoryFactoryBean = new JobRepositoryFactoryBean();
	repositoryFactoryBean.setDataSource(this.dataSource);
	repositoryFactoryBean.setTransactionManager(new DataSourceTransactionManager(this.dataSource));
	this.jobRepository = repositoryFactoryBean.getObject();
	this.dao = (new TaskExecutionDaoFactoryBean(this.dataSource)).getObject();
	this.taskBatchDao = new JdbcTaskBatchDao(this.dataSource);
}
 
Example #8
Source File: JobStepExecutionsDocumentation.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private void initialize() throws Exception {
	JobRepositoryFactoryBean repositoryFactoryBean = new JobRepositoryFactoryBean();
	repositoryFactoryBean.setDataSource(this.dataSource);
	repositoryFactoryBean.setTransactionManager(new DataSourceTransactionManager(this.dataSource));
	this.jobRepository = repositoryFactoryBean.getObject();
	this.dao = (new TaskExecutionDaoFactoryBean(this.dataSource)).getObject();
	this.taskBatchDao = new JdbcTaskBatchDao(this.dataSource);
}
 
Example #9
Source File: JobInstancesDocumentation.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private void initialize() throws Exception {
	JobRepositoryFactoryBean repositoryFactoryBean = new JobRepositoryFactoryBean();
	repositoryFactoryBean.setDataSource(this.dataSource);
	repositoryFactoryBean.setTransactionManager(new DataSourceTransactionManager(this.dataSource));
	this.jobRepository = repositoryFactoryBean.getObject();
	this.dao = (new TaskExecutionDaoFactoryBean(this.dataSource)).getObject();
	this.taskBatchDao = new JdbcTaskBatchDao(this.dataSource);
}
 
Example #10
Source File: TaskLauncherTaskletTests.java    From composed-task-runner with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception{
	this.taskRepositoryInitializer.setDataSource(this.dataSource);

	this.taskRepositoryInitializer.afterPropertiesSet();
	this.taskOperations = mock(TaskOperations.class);
	TaskExecutionDaoFactoryBean taskExecutionDaoFactoryBean =
			new TaskExecutionDaoFactoryBean(this.dataSource);
	this.taskRepository = new SimpleTaskRepository(taskExecutionDaoFactoryBean);
	this.taskExplorer = new SimpleTaskExplorer(taskExecutionDaoFactoryBean);
	this.composedTaskProperties.setIntervalTimeBetweenChecks(500);
}
 
Example #11
Source File: TestDependencies.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskRepository taskRepository(DataSource dataSource) {
	return new SimpleTaskRepository(new TaskExecutionDaoFactoryBean(dataSource));
}
 
Example #12
Source File: TaskServiceDependencies.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskRepository taskRepository(TaskExecutionDaoFactoryBean daoFactoryBean) {
	return new SimpleTaskRepository(daoFactoryBean);
}
 
Example #13
Source File: TaskServiceDependencies.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskExplorer taskExplorer(TaskExecutionDaoFactoryBean daoFactoryBean) {
	return new SimpleTaskExplorer(daoFactoryBean);
}
 
Example #14
Source File: TaskServiceDependencies.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskExecutionDaoFactoryBean taskExecutionDaoFactoryBean(DataSource dataSource) {
	return new TaskExecutionDaoFactoryBean(dataSource);
}
 
Example #15
Source File: JobDependencies.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskRepository taskRepository() {
	return new SimpleTaskRepository(new TaskExecutionDaoFactoryBean());
}
 
Example #16
Source File: JobDependencies.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskExplorer taskExplorer(TaskExecutionDaoFactoryBean daoFactoryBean) {
	return new SimpleTaskExplorer(daoFactoryBean);
}
 
Example #17
Source File: JobDependencies.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskExecutionDaoFactoryBean taskExecutionDaoFactoryBean(DataSource dataSource) {
	return new TaskExecutionDaoFactoryBean(dataSource);
}
 
Example #18
Source File: TaskPartitionerTests.java    From spring-cloud-task with Apache License 2.0 4 votes vote down vote up
@Autowired
public void setDataSource(DataSource dataSource) {
	this.taskExplorer = new SimpleTaskExplorer(new TaskExecutionDaoFactoryBean(dataSource));
}
 
Example #19
Source File: TaskLauncherSinkTests.java    From spring-cloud-task with Apache License 2.0 4 votes vote down vote up
@Autowired
public void setDataSource(DataSource dataSource) {
	this.dataSource = dataSource;
	this.taskExplorer = new SimpleTaskExplorer(
			new TaskExecutionDaoFactoryBean(dataSource));
}