use of org.springframework.batch.core.JobExecution in project hub-alert by blackducksoftware.
the class CommonConfig method createJobExecution.
public JobExecution createJobExecution() throws Exception {
final JobParameters param = new JobParametersBuilder().addString(JOB_ID_PROPERTY_NAME, createJobID()).toJobParameters();
final JobExecution execution = jobLauncher.run(createJob(reader(), processor(), writer()), param);
return execution;
}
use of org.springframework.batch.core.JobExecution in project camel by apache.
the class SpringBatchEndpointTest method shouldReturnJobExecution.
@Test
public void shouldReturnJobExecution() throws Exception {
// Given
JobExecution jobExecution = mock(JobExecution.class);
when(jobLauncher.run(eq(job), any(JobParameters.class))).thenReturn(jobExecution);
// When
sendBody("direct:start", "Start the job, please.");
// Then
mockEndpoint.expectedBodiesReceived(jobExecution);
}
use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class KrameriusHarvestJobTest method execute.
@Test
public void execute() throws Exception {
init();
Job job = jobRegistry.getJob("krameriusHarvestJob");
Map<String, JobParameter> params = new HashMap<String, JobParameter>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(99002L));
JobParameters jobParams = new JobParameters(params);
JobExecution execution = jobLauncher.run(job, jobParams);
Assert.assertEquals(execution.getExitStatus(), ExitStatus.COMPLETED);
}
use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class DeleteAllHarvestsJobTest method execute.
@Test
public void execute() throws Exception {
JobExecution exec = jobExecutor.execute("deleteAllHarvestsJob", new JobParameters());
Assert.assertEquals(exec.getExitStatus(), ExitStatus.COMPLETED);
}
use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class OAIHarvestJobTest method testJobParamsTransformation.
@Test
public void testJobParamsTransformation() throws Exception {
reset(httpClient);
InputStream response0 = this.getClass().getResourceAsStream("/sample/Identify.xml");
InputStream response1 = this.getClass().getResourceAsStream("/sample/ListRecordsFrom.xml");
expect(httpClient.executeGet("http://aleph.mzk.cz/OAI?verb=Identify")).andReturn(response0);
expect(httpClient.executeGet("http://aleph.mzk.cz/OAI?verb=ListRecords&metadataPrefix=marc21&from=2015-01-02T01%3A00%3A00Z")).andReturn(response1);
replay(httpClient);
Map<String, JobParameter> params = new HashMap<>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(300L));
params.put(Constants.JOB_PARAM_FROM_DATE, new JobParameter(new Date(1420156800000L)));
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_HARVEST, new JobParameters(params));
Assert.assertEquals(exec.getExitStatus(), ExitStatus.COMPLETED);
reset(httpClient);
response0 = this.getClass().getResourceAsStream("/sample/Identify.xml");
response1 = this.getClass().getResourceAsStream("/sample/ListRecordsFrom.xml");
expect(httpClient.executeGet("http://aleph.mzk.cz/OAI?verb=Identify")).andReturn(response0);
expect(httpClient.executeGet("http://aleph.mzk.cz/OAI?verb=ListRecords&metadataPrefix=marc21&from=2015-01-03T01%3A00%3A00Z")).andReturn(response1);
replay(httpClient);
params = new HashMap<>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter("300"));
params.put(Constants.JOB_PARAM_FROM_DATE, new JobParameter("2015-01-03T01:00:00Z"));
exec = jobExecutor.execute(Constants.JOB_ID_HARVEST, new JobParameters(params));
Assert.assertEquals(exec.getExitStatus(), ExitStatus.COMPLETED);
}
Aggregations