Search in sources :

Example 1 with SimpleJobLauncher

use of org.springframework.batch.core.launch.support.SimpleJobLauncher in project hub-alert by blackducksoftware.

the class CommonConfigTest method testRun.

@Test
public void testRun() throws Exception {
    final SimpleJobLauncher simpleJobLauncher = Mockito.mock(SimpleJobLauncher.class);
    C config = getConfigWithSimpleJobLauncher(simpleJobLauncher);
    final JobExecution jobExecution = Mockito.mock(JobExecution.class);
    final ExitStatus exitStatus = Mockito.mock(ExitStatus.class);
    Mockito.when(exitStatus.getExitCode()).thenReturn("exit");
    Mockito.when(exitStatus.getExitDescription()).thenReturn("description");
    Mockito.when(jobExecution.getExitStatus()).thenReturn(exitStatus);
    Mockito.when(simpleJobLauncher.run(Mockito.any(), Mockito.any())).thenReturn(jobExecution);
    config = Mockito.spy(config);
    final Job job = Mockito.mock(Job.class);
    Mockito.doReturn(job).when(config).createJob(Mockito.any(), Mockito.any(), Mockito.any());
    config.run();
    final boolean successfulRun = outputLogger.isLineContainingText("Job finished with status");
    assertTrue(successfulRun);
}
Also used : JobExecution(org.springframework.batch.core.JobExecution) ExitStatus(org.springframework.batch.core.ExitStatus) SimpleJobLauncher(org.springframework.batch.core.launch.support.SimpleJobLauncher) Job(org.springframework.batch.core.Job) Test(org.junit.Test)

Example 2 with SimpleJobLauncher

use of org.springframework.batch.core.launch.support.SimpleJobLauncher in project hub-alert by blackducksoftware.

the class Application method jobLauncher.

@Bean
public SimpleJobLauncher jobLauncher() throws Exception {
    final SimpleJobLauncher launcher = new SimpleJobLauncher();
    launcher.setJobRepository(jobRepository());
    return launcher;
}
Also used : SimpleJobLauncher(org.springframework.batch.core.launch.support.SimpleJobLauncher) MapJobRepositoryFactoryBean(org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with SimpleJobLauncher

use of org.springframework.batch.core.launch.support.SimpleJobLauncher in project RecordManager2 by moravianlibrary.

the class AppConfig method jobLauncher.

@Bean
public JobLauncher jobLauncher() throws Exception {
    SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
    jobLauncher.setJobRepository(jobRepository());
    jobLauncher.afterPropertiesSet();
    return jobLauncher;
}
Also used : SimpleJobLauncher(org.springframework.batch.core.launch.support.SimpleJobLauncher) JobRepositoryFactoryBean(org.springframework.batch.core.repository.support.JobRepositoryFactoryBean) JobExplorerFactoryBean(org.springframework.batch.core.explore.support.JobExplorerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with SimpleJobLauncher

use of org.springframework.batch.core.launch.support.SimpleJobLauncher in project tutorials by eugenp.

the class SpringConfig method getJobLauncher.

public JobLauncher getJobLauncher() throws Exception {
    SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
    // SimpleJobLauncher's methods Throws Generic Exception,
    // it would have been better to have a specific one
    jobLauncher.setJobRepository(getJobRepository());
    jobLauncher.afterPropertiesSet();
    return jobLauncher;
}
Also used : SimpleJobLauncher(org.springframework.batch.core.launch.support.SimpleJobLauncher)

Example 5 with SimpleJobLauncher

use of org.springframework.batch.core.launch.support.SimpleJobLauncher in project tutorials by eugenp.

the class ChunksConfig method jobLauncher.

@Bean
public JobLauncher jobLauncher() throws Exception {
    SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
    jobLauncher.setJobRepository(jobRepository());
    return jobLauncher;
}
Also used : SimpleJobLauncher(org.springframework.batch.core.launch.support.SimpleJobLauncher) MapJobRepositoryFactoryBean(org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

SimpleJobLauncher (org.springframework.batch.core.launch.support.SimpleJobLauncher)9 Bean (org.springframework.context.annotation.Bean)5 MapJobRepositoryFactoryBean (org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean)4 Test (org.junit.Test)1 ExitStatus (org.springframework.batch.core.ExitStatus)1 Job (org.springframework.batch.core.Job)1 JobExecution (org.springframework.batch.core.JobExecution)1 JobExplorerFactoryBean (org.springframework.batch.core.explore.support.JobExplorerFactoryBean)1 JobRepositoryFactoryBean (org.springframework.batch.core.repository.support.JobRepositoryFactoryBean)1