Java Code Examples for org.springframework.batch.core.explore.JobExplorer

The following examples show how to use org.springframework.batch.core.explore.JobExplorer. These examples are extracted from open source projects. 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 Project: spring-cloud-dataflow   Source File: JobDependencies.java    License: Apache License 2.0 6 votes vote down vote up
@Bean
public SimpleJobServiceFactoryBean simpleJobServiceFactoryBean(DataSource dataSource,
		JobRepositoryFactoryBean repositoryFactoryBean, JobExplorer jobExplorer,
		PlatformTransactionManager dataSourceTransactionManager) {
	SimpleJobServiceFactoryBean factoryBean = new SimpleJobServiceFactoryBean();
	factoryBean.setDataSource(dataSource);
	try {
		factoryBean.setJobRepository(repositoryFactoryBean.getObject());
		factoryBean.setJobLauncher(new SimpleJobLauncher());
		factoryBean.setJobExplorer(jobExplorer);
		factoryBean.setTransactionManager(dataSourceTransactionManager);
	}
	catch (Exception e) {
		throw new IllegalStateException(e);
	}
	return factoryBean;
}
 
Example 2
public TaskJobLauncherCommandLineRunnerFactoryBean(JobLauncher jobLauncher,
		JobExplorer jobExplorer, List<Job> jobs,
		TaskBatchProperties taskBatchProperties, JobRegistry jobRegistry,
		JobRepository jobRepository, BatchProperties batchProperties) {
	Assert.notNull(taskBatchProperties, "taskBatchProperties must not be null");
	Assert.notNull(batchProperties, "batchProperties must not be null");
	this.jobLauncher = jobLauncher;
	this.jobExplorer = jobExplorer;
	Assert.notEmpty(jobs, "jobs must not be null nor empty");
	this.jobs = jobs;
	this.jobNames = taskBatchProperties.getJobNames();
	this.jobRegistry = jobRegistry;
	this.taskBatchProperties = taskBatchProperties;
	if (StringUtils.hasText(batchProperties.getJob().getNames())) {
		this.jobNames = batchProperties.getJob().getNames();
	}
	else {
		this.jobNames = taskBatchProperties.getJobNames();
	}
	this.order = taskBatchProperties.getCommandLineRunnerOrder();
	this.jobRepository = jobRepository;
}
 
Example 3
Source Project: spring-graalvm-native   Source File: BatchConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(JobOperator.class)
public JobOperator jobOperator(ObjectProvider<JobParametersConverter> jobParametersConverter,
		JobExplorer jobExplorer, JobLauncher jobLauncher, ListableJobLocator jobRegistry,
		JobRepository jobRepository) throws Exception {
	System.out.println("FOOBAR");
	SimpleJobOperator factory = new SimpleJobOperator();
	factory.setJobExplorer(jobExplorer);
	factory.setJobLauncher(jobLauncher);
	factory.setJobRegistry(jobRegistry);
	factory.setJobRepository(jobRepository);
	jobParametersConverter.ifAvailable(factory::setJobParametersConverter);
	return factory;
}
 
Example 4
Source Project: spring-batch-rest   Source File: Fixtures.java    License: Apache License 2.0 5 votes vote down vote up
public static void configureForJobExecutionsService(JobExplorer jobExplorer) {
    when(jobExplorer.getJobInstances(eq(JOB_NAME_1), anyInt(), anyInt())).thenReturn(newArrayList(ji11, ji12));
    when(jobExplorer.getJobInstances(eq(JOB_NAME_2), anyInt(), anyInt())).thenReturn(newArrayList(ji21, ji22, ji23));

    when(jobExplorer.getJobExecutions(ji11)).thenReturn(newArrayList(je11));
    when(jobExplorer.getJobExecutions(ji12)).thenReturn(newArrayList(je12));

    when(jobExplorer.getJobExecutions(ji21)).thenReturn(newArrayList(je21));
    when(jobExplorer.getJobExecutions(ji22)).thenReturn(newArrayList(je22));
    when(jobExplorer.getJobExecutions(ji23)).thenReturn(newArrayList(je23, je24));
}
 
Example 5
private Collection<StepExecution> getStepExecutions() {
	JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class);
	List<JobInstance> jobInstances = jobExplorer.findJobInstancesByJobName("job", 0, 1);
	assertEquals(1, jobInstances.size());
	JobInstance jobInstance = jobInstances.get(0);
	List<JobExecution> jobExecutions = jobExplorer.getJobExecutions(jobInstance);
	assertEquals(1, jobExecutions.size());
	JobExecution jobExecution = jobExecutions.get(0);
	return jobExecution.getStepExecutions();
}
 
Example 6
@Bean
BatchConfigurer myBatchConfigurer(DataSource dataSource,
		Jackson2ExecutionContextStringSerializer myJackson2ExecutionContextStringSerializer,
		PlatformTransactionManager transactionManager) {
	return new DefaultBatchConfigurer(dataSource) {
		@Override
		protected JobExplorer createJobExplorer() throws Exception {
			JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
			jobExplorerFactoryBean.setDataSource(dataSource);
			jobExplorerFactoryBean
					.setSerializer(myJackson2ExecutionContextStringSerializer);
			jobExplorerFactoryBean.afterPropertiesSet();
			return jobExplorerFactoryBean.getObject();
		}

		@Override
		protected JobRepository createJobRepository() throws Exception {
			JobRepositoryFactoryBean jobRepositoryFactoryBean = new JobRepositoryFactoryBean();
			jobRepositoryFactoryBean.setDataSource(dataSource);
			jobRepositoryFactoryBean
					.setSerializer(myJackson2ExecutionContextStringSerializer);
			jobRepositoryFactoryBean.setTransactionManager(transactionManager);
			jobRepositoryFactoryBean.afterPropertiesSet();
			return jobRepositoryFactoryBean.getObject();
		}
	};
}
 
Example 7
Source Project: CogStack-Pipeline   Source File: JobConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public StepExecutionRequestHandler stepExecutionRequestHandler(
        JobExplorer jobExplorer, BeanFactoryStepLocator stepLocator){
    StepExecutionRequestHandler handler = new StepExecutionRequestHandler();
    handler.setJobExplorer(jobExplorer);
    handler.setStepLocator(stepLocator);
    return handler;
}
 
Example 8
Source Project: CogStack-Pipeline   Source File: BatchConfigurer.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
@Autowired
public JobExplorer jobExplorer(@Qualifier("jobRepositoryDataSource")
                                           DataSource dataSource) throws Exception{
    JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
    factory.setDataSource(dataSource);
    
    factory.afterPropertiesSet();
    return factory.getObject();
}
 
Example 9
@Bean
@Profile("worker")
public DeployerStepExecutionHandler stepExecutionHandler(JobExplorer jobExplorer) {
	DeployerStepExecutionHandler handler = new DeployerStepExecutionHandler(this.context, jobExplorer, this.jobRepository);

	return handler;
}
 
Example 10
private Collection<StepExecution> getStepExecutions() {
	JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class);
	List<JobInstance> jobInstances = jobExplorer.findJobInstancesByJobName("job", 0, 1);
	assertEquals(1, jobInstances.size());
	JobInstance jobInstance = jobInstances.get(0);
	List<JobExecution> jobExecutions = jobExplorer.getJobExecutions(jobInstance);
	assertEquals(1, jobExecutions.size());
	JobExecution jobExecution = jobExecutions.get(0);
	return jobExecution.getStepExecutions();
}
 
Example 11
Source Project: spring-cloud-dataflow   Source File: TaskConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public SimpleJobServiceFactoryBean simpleJobServiceFactoryBean(DataSource dataSource,
		JobRepositoryFactoryBean repositoryFactoryBean, JobExplorer jobExplorer,
		PlatformTransactionManager dataSourceTransactionManager) throws Exception {
	SimpleJobServiceFactoryBean factoryBean = new SimpleJobServiceFactoryBean();
	factoryBean.setDataSource(dataSource);
	factoryBean.setJobRepository(repositoryFactoryBean.getObject());
	factoryBean.setJobLauncher(new SimpleJobLauncher());
	factoryBean.setDataSource(dataSource);
	factoryBean.setJobExplorer(jobExplorer);
	factoryBean.setTransactionManager(dataSourceTransactionManager);
	return factoryBean;
}
 
Example 12
Source Project: spring-batch-lightmin   Source File: DefaultJobService.java    License: Apache License 2.0 5 votes vote down vote up
public DefaultJobService(final JobOperator jobOperator,
                         final JobRegistry jobRegistry,
                         final JobExplorer jobExplorer,
                         final LightminJobExecutionDao lightminJobExecutionDao) {
    this.jobOperator = jobOperator;
    this.jobRegistry = jobRegistry;
    this.jobExplorer = jobExplorer;
    this.lightminJobExecutionDao = lightminJobExecutionDao;
}
 
Example 13
@Test
public void testSimpleConfiguration() {
	ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
			.withUserConfiguration(SimpleConfiguration.class)
			.withConfiguration(
					AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
							BatchAutoConfiguration.class,
							SingleStepJobAutoConfiguration.class))
			.withPropertyValues("spring.batch.job.jobName=job",
					"spring.batch.job.stepName=step1",
					"spring.batch.job.chunkSize=5");

	applicationContextRunner.run((context) -> {
		JobLauncher jobLauncher = context.getBean(JobLauncher.class);

		Job job = context.getBean(Job.class);

		ListItemWriter itemWriter = context.getBean(ListItemWriter.class);

		JobExecution jobExecution = jobLauncher.run(job, new JobParameters());

		JobExplorer jobExplorer = context.getBean(JobExplorer.class);

		while (jobExplorer.getJobExecution(jobExecution.getJobId()).isRunning()) {
			Thread.sleep(1000);
		}

		List<Map<Object, Object>> writtenItems = itemWriter.getWrittenItems();

		assertThat(writtenItems.size()).isEqualTo(3);

		assertThat(writtenItems.get(0).get("item")).isEqualTo("foo");
		assertThat(writtenItems.get(1).get("item")).isEqualTo("bar");
		assertThat(writtenItems.get(2).get("item")).isEqualTo("baz");
	});
}
 
Example 14
@Test
public void testCustomLineMapper() {
	ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
			.withUserConfiguration(CustomLineMapperConfiguration.class)
			.withConfiguration(
					AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
							BatchAutoConfiguration.class,
							SingleStepJobAutoConfiguration.class,
							FlatFileItemReaderAutoConfiguration.class))
			.withPropertyValues("spring.batch.job.jobName=job",
					"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
					"spring.batch.job.flatfilereader.name=fixedWidthConfiguration",
					"spring.batch.job.flatfilereader.resource=/test.txt",
					"spring.batch.job.flatfilereader.strict=true");

	applicationContextRunner.run((context) -> {
		JobLauncher jobLauncher = context.getBean(JobLauncher.class);

		Job job = context.getBean(Job.class);

		ListItemWriter itemWriter = context.getBean(ListItemWriter.class);

		JobExecution jobExecution = jobLauncher.run(job, new JobParameters());

		JobExplorer jobExplorer = context.getBean(JobExplorer.class);

		while (jobExplorer.getJobExecution(jobExecution.getJobId()).isRunning()) {
			Thread.sleep(1000);
		}

		List writtenItems = itemWriter.getWrittenItems();

		assertThat(writtenItems.size()).isEqualTo(8);
	});
}
 
Example 15
@Test
public void testCustomMapping() {
	ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
			.withUserConfiguration(CustomMappingConfiguration.class)
			.withConfiguration(AutoConfigurations.of(
					PropertyPlaceholderAutoConfiguration.class,
					BatchAutoConfiguration.class,
					SingleStepJobAutoConfiguration.class,
					FlatFileItemReaderAutoConfiguration.class, RangeConverter.class))
			.withPropertyValues("spring.batch.job.jobName=job",
					"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
					"spring.batch.job.flatfilereader.name=fixedWidthConfiguration",
					"spring.batch.job.flatfilereader.resource=/test.txt",
					"spring.batch.job.flatfilereader.maxItemCount=1",
					"spring.batch.job.flatfilereader.strict=true");

	applicationContextRunner.run((context) -> {
		JobLauncher jobLauncher = context.getBean(JobLauncher.class);

		Job job = context.getBean(Job.class);

		ListItemWriter itemWriter = context.getBean(ListItemWriter.class);

		JobExecution jobExecution = jobLauncher.run(job, new JobParameters());

		JobExplorer jobExplorer = context.getBean(JobExplorer.class);

		while (jobExplorer.getJobExecution(jobExecution.getJobId()).isRunning()) {
			Thread.sleep(1000);
		}

		List<Map<Object, Object>> writtenItems = itemWriter.getWrittenItems();

		assertThat(writtenItems.size()).isEqualTo(1);
		assertThat(writtenItems.get(0).get("one")).isEqualTo("1 2 3");
		assertThat(writtenItems.get(0).get("two")).isEqualTo("4 5 six");
	});
}
 
Example 16
@Test
public void testFormattedFieldExtractorFileGeneration() {
	ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
			.withUserConfiguration(FormattedFieldExtractorJobConfiguration.class)
			.withConfiguration(
					AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
							BatchAutoConfiguration.class,
							SingleStepJobAutoConfiguration.class,
							FlatFileItemWriterAutoConfiguration.class))
			.withPropertyValues("spring.batch.job.jobName=job",
					"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
					"spring.batch.job.flatfilewriter.name=fooWriter",
					String.format(
							"spring.batch.job.flatfilewriter.resource=file://%s",
							this.outputFile.getAbsolutePath()),
					"spring.batch.job.flatfilewriter.encoding=UTF-8",
					"spring.batch.job.flatfilewriter.formatted=true",
					"spring.batch.job.flatfilewriter.names=item",
					"spring.batch.job.flatfilewriter.format=item = %s");

	applicationContextRunner.run((context) -> {
		JobLauncher jobLauncher = context.getBean(JobLauncher.class);

		Job job = context.getBean(Job.class);

		JobExecution jobExecution = jobLauncher.run(job, new JobParameters());

		JobExplorer jobExplorer = context.getBean(JobExplorer.class);

		while (jobExplorer.getJobExecution(jobExecution.getJobId()).isRunning()) {
			Thread.sleep(1000);
		}

		AssertFile.assertLineCount(3, this.outputFile);

		String results = FileCopyUtils.copyToString(new InputStreamReader(
				new FileSystemResource(this.outputFile).getInputStream()));
		assertThat(results).isEqualTo("item = f\nitem = b\nitem = b\n");
	});
}
 
Example 17
@Test
public void testFieldExtractorFileGeneration() {
	ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
			.withUserConfiguration(FieldExtractorConfiguration.class)
			.withConfiguration(
					AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
							BatchAutoConfiguration.class,
							SingleStepJobAutoConfiguration.class,
							FlatFileItemWriterAutoConfiguration.class))
			.withPropertyValues("spring.batch.job.jobName=job",
					"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
					"spring.batch.job.flatfilewriter.name=fooWriter",
					String.format(
							"spring.batch.job.flatfilewriter.resource=file://%s",
							this.outputFile.getAbsolutePath()),
					"spring.batch.job.flatfilewriter.encoding=UTF-8",
					"spring.batch.job.flatfilewriter.delimited=true");

	applicationContextRunner.run((context) -> {
		JobLauncher jobLauncher = context.getBean(JobLauncher.class);

		Job job = context.getBean(Job.class);

		JobExecution jobExecution = jobLauncher.run(job, new JobParameters());

		JobExplorer jobExplorer = context.getBean(JobExplorer.class);

		while (jobExplorer.getJobExecution(jobExecution.getJobId()).isRunning()) {
			Thread.sleep(1000);
		}

		AssertFile.assertLineCount(3, this.outputFile);

		String results = FileCopyUtils.copyToString(new InputStreamReader(
				new FileSystemResource(this.outputFile).getInputStream()));
		assertThat(results).isEqualTo("f\nb\nb\n");
	});
}
 
Example 18
@Test
public void testCustomLineAggregatorFileGeneration() {
	ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
			.withUserConfiguration(LineAggregatorConfiguration.class)
			.withConfiguration(
					AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
							BatchAutoConfiguration.class,
							SingleStepJobAutoConfiguration.class,
							FlatFileItemWriterAutoConfiguration.class))
			.withPropertyValues("spring.batch.job.jobName=job",
					"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
					"spring.batch.job.flatfilewriter.name=fooWriter",
					String.format(
							"spring.batch.job.flatfilewriter.resource=file://%s",
							this.outputFile.getAbsolutePath()),
					"spring.batch.job.flatfilewriter.encoding=UTF-8");

	applicationContextRunner.run((context) -> {
		JobLauncher jobLauncher = context.getBean(JobLauncher.class);

		Job job = context.getBean(Job.class);

		JobExecution jobExecution = jobLauncher.run(job, new JobParameters());

		JobExplorer jobExplorer = context.getBean(JobExplorer.class);

		while (jobExplorer.getJobExecution(jobExecution.getJobId()).isRunning()) {
			Thread.sleep(1000);
		}

		AssertFile.assertLineCount(3, this.outputFile);

		String results = FileCopyUtils.copyToString(new InputStreamReader(
				new FileSystemResource(this.outputFile).getInputStream()));
		assertThat(results).isEqualTo("{item=foo}\n{item=bar}\n{item=baz}\n");
	});
}
 
Example 19
@Test
public void testHeaderFooterFileGeneration() {
	ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
			.withUserConfiguration(HeaderFooterConfiguration.class)
			.withConfiguration(
					AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
							BatchAutoConfiguration.class,
							SingleStepJobAutoConfiguration.class,
							FlatFileItemWriterAutoConfiguration.class))
			.withPropertyValues("spring.batch.job.jobName=job",
					"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
					"spring.batch.job.flatfilewriter.name=fooWriter",
					String.format(
							"spring.batch.job.flatfilewriter.resource=file://%s",
							this.outputFile.getAbsolutePath()),
					"spring.batch.job.flatfilewriter.encoding=UTF-8",
					"spring.batch.job.flatfilewriter.delimited=true",
					"spring.batch.job.flatfilewriter.names=item");

	applicationContextRunner.run((context) -> {
		JobLauncher jobLauncher = context.getBean(JobLauncher.class);

		Job job = context.getBean(Job.class);

		JobExecution jobExecution = jobLauncher.run(job, new JobParameters());

		JobExplorer jobExplorer = context.getBean(JobExplorer.class);

		while (jobExplorer.getJobExecution(jobExecution.getJobId()).isRunning()) {
			Thread.sleep(1000);
		}

		AssertFile.assertLineCount(5, this.outputFile);

		String results = FileCopyUtils.copyToString(new InputStreamReader(
				new FileSystemResource(this.outputFile).getInputStream()));
		assertThat(results).isEqualTo("header\nfoo\nbar\nbaz\nfooter");
	});
}
 
Example 20
/**
 * Create a new {@link TaskJobLauncherCommandLineRunner}.
 * @param jobLauncher to launch jobs
 * @param jobExplorer to check the job repository for previous executions
 * @param jobRepository to check if a job instance exists with the given parameters
 * when running a job
 * @param taskBatchProperties the properties used to configure the
 * taskBatchProperties.
 */
public TaskJobLauncherCommandLineRunner(JobLauncher jobLauncher,
		JobExplorer jobExplorer, JobRepository jobRepository,
		TaskBatchProperties taskBatchProperties) {
	super(jobLauncher, jobExplorer, jobRepository);
	this.taskJobLauncher = jobLauncher;
	this.taskJobExplorer = jobExplorer;
	this.taskJobRepository = jobRepository;
	this.taskBatchProperties = taskBatchProperties;
}
 
Example 21
/**
 * Constructor initializing the DeployerPartitionHandler instance.
 * @param taskLauncher the launcher used to execute partitioned tasks.
 * @param jobExplorer used to acquire the status of the job.
 * @param resource the url to the app to be launched.
 * @param stepName the name of the step.
 * @deprecated Use the constructor that accepts {@link TaskRepository} as well as the
 * this constructor's set of parameters.
 */
@Deprecated
public DeployerPartitionHandler(TaskLauncher taskLauncher, JobExplorer jobExplorer,
		Resource resource, String stepName) {
	Assert.notNull(taskLauncher, "A taskLauncher is required");
	Assert.notNull(jobExplorer, "A jobExplorer is required");
	Assert.notNull(resource, "A resource is required");
	Assert.hasText(stepName, "A step name is required");

	this.taskLauncher = taskLauncher;
	this.jobExplorer = jobExplorer;
	this.resource = resource;
	this.stepName = stepName;
}
 
Example 22
public DeployerPartitionHandler(TaskLauncher taskLauncher, JobExplorer jobExplorer,
		Resource resource, String stepName, TaskRepository taskRepository) {
	Assert.notNull(taskLauncher, "A taskLauncher is required");
	Assert.notNull(jobExplorer, "A jobExplorer is required");
	Assert.notNull(resource, "A resource is required");
	Assert.hasText(stepName, "A step name is required");
	Assert.notNull(taskRepository, "A TaskRepository is required");

	this.taskLauncher = taskLauncher;
	this.jobExplorer = jobExplorer;
	this.resource = resource;
	this.stepName = stepName;
	this.taskRepository = taskRepository;
}
 
Example 23
public DeployerStepExecutionHandler(BeanFactory beanFactory, JobExplorer jobExplorer,
		JobRepository jobRepository) {
	Assert.notNull(beanFactory, "A beanFactory is required");
	Assert.notNull(jobExplorer, "A jobExplorer is required");
	Assert.notNull(jobRepository, "A jobRepository is required");

	this.stepLocator = new BeanFactoryStepLocator();
	((BeanFactoryStepLocator) this.stepLocator).setBeanFactory(beanFactory);

	this.jobExplorer = jobExplorer;
	this.jobRepository = jobRepository;
}
 
Example 24
@Bean
public TaskJobLauncherCommandLineRunnerFactoryBean jobLauncherCommandLineRunner(
		JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs,
		JobRegistry jobRegistry, JobRepository jobRepository,
		BatchProperties batchProperties) {
	TaskJobLauncherCommandLineRunnerFactoryBean taskJobLauncherCommandLineRunnerFactoryBean;
	taskJobLauncherCommandLineRunnerFactoryBean = new TaskJobLauncherCommandLineRunnerFactoryBean(
			jobLauncher, jobExplorer, jobs, this.properties, jobRegistry,
			jobRepository, batchProperties);

	return taskJobLauncherCommandLineRunnerFactoryBean;
}
 
Example 25
@Test
public void testNoTaskJobLauncher() {
	String[] enabledArgs = new String[] {
			"--spring.cloud.task.batch.failOnJobFailure=true",
			"--spring.cloud.task.batch.failOnJobFailurePollInterval=500",
			"--spring.batch.job.enabled=false" };
	this.applicationContext = SpringApplication.run(new Class[] {
			TaskJobLauncherCommandLineRunnerTests.JobWithFailureConfiguration.class },
			enabledArgs);
	JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class);
	assertThat(jobExplorer.getJobNames().size()).isEqualTo(0);
}
 
Example 26
private void validateDeprecatedConstructorValidation(TaskLauncher taskLauncher,
		JobExplorer jobExplorer, Resource resource, String stepName,
		String expectedMessage) {
	try {
		new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, stepName,
				this.taskRepository);
	}
	catch (IllegalArgumentException iae) {
		assertThat(iae.getMessage()).isEqualTo(expectedMessage);
	}
}
 
Example 27
private void validateConstructorValidation(TaskLauncher taskLauncher,
		JobExplorer jobExplorer, Resource resource, String stepName,
		TaskRepository taskRepository, String expectedMessage) {
	try {
		new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, stepName,
				taskRepository);
	}
	catch (IllegalArgumentException iae) {
		assertThat(iae.getMessage()).isEqualTo(expectedMessage);
	}
}
 
Example 28
private void validateConstructorValidation(BeanFactory beanFactory,
		JobExplorer jobExplorer, JobRepository jobRepository, String message) {
	try {
		new DeployerStepExecutionHandler(beanFactory, jobExplorer, jobRepository);
	}
	catch (IllegalArgumentException iae) {
		assertThat(iae.getMessage()).isEqualTo(message);
	}
}
 
Example 29
Source Project: batchers   Source File: AbstractEmployeeJobConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public JobExplorer jobExplorer() throws Exception {
    JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
    factory.setDataSource(dataSource);
    factory.afterPropertiesSet();
    return factory.getObject();
}
 
Example 30
public JobMonitoringController(JobOperator jobOperator, JobExplorer jobExplorer,
		RunningExecutionTracker runningExecutionTracker) {
	super();
	this.jobOperator = jobOperator;
	this.jobExplorer = jobExplorer;
	this.runningExecutionTracker = runningExecutionTracker;
}