Example usage for org.springframework.batch.test MetaDataInstanceFactory createJobExecution

List of usage examples for org.springframework.batch.test MetaDataInstanceFactory createJobExecution

Introduction

In this page you can find the example usage for org.springframework.batch.test MetaDataInstanceFactory createJobExecution.

Prototype

public static JobExecution createJobExecution(String jobName, Long instanceId, Long executionId,
        JobParameters jobParameters) 

Source Link

Document

Create a JobExecution with the parameters provided.

Usage

From source file:com.github.jrrdev.mantisbtsync.core.jobs.projects.ProjectsUserWriterTest.java

public StepExecution getStepExecution() {

    final Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    final JobParameters jobParams = new JobParameters(map);
    final JobExecution exec = MetaDataInstanceFactory.createJobExecution("testJob", 1L, 1L, jobParams);

    exec.getExecutionContext().put("mantis.loop.project_id", BigInteger.ONE);

    final StepExecution stepExecution = exec.createStepExecution("testStep");
    return stepExecution;
}

From source file:com.github.jrrdev.mantisbtsync.core.jobs.projects.ProjectsReadersTest.java

public JobExecution getJobExecution() {
    if (jobExecution == null) {
        final Map<String, JobParameter> map = new HashMap<String, JobParameter>();
        map.put("mantis.username", new JobParameter("toto"));
        map.put("mantis.password", new JobParameter("passwd"));

        final JobParameters jobParams = new JobParameters(map);
        jobExecution = MetaDataInstanceFactory.createJobExecution("testJob", 1L, 1L, jobParams);

        jobExecution.getExecutionContext().put("mantis.acess_level", BigInteger.TEN);
        jobExecution.getExecutionContext().put("mantis.loop.project_id", BigInteger.ONE);
    }/*w  w w .java2  s  .  c om*/

    return jobExecution;
}