Tabnine Logo
JobStep
Code IndexAdd Tabnine to your IDE (free)

How to use
JobStep
in
org.springframework.batch.core.step.job

Best Java code snippets using org.springframework.batch.core.step.job.JobStep (Showing top 18 results out of 315)

origin: spring-projects/spring-batch

JobStep step = new JobStep();
step.setName(getName());
super.enhance(step);
if (job != null) {
  step.setJob(job);
  step.setJobParametersExtractor(jobParametersExtractor);
step.setJobLauncher(jobLauncher);
try {
  step.afterPropertiesSet();
origin: spring-projects/spring-batch

/**
 * Test method for
 * {@link org.springframework.batch.core.step.job.JobStep#afterPropertiesSet()}
 * .
 */
@Test(expected = IllegalStateException.class)
public void testAfterPropertiesSetWithNoLauncher() throws Exception {
  step.setJob(new JobSupport("child"));
  step.setJobLauncher(null);
  step.afterPropertiesSet();
}
origin: spring-projects/spring-batch

@Test
public void testExecuteFailure() throws Exception {
  step.setJob(new JobSupport("child") {
    @Override
    public void execute(JobExecution execution) throws UnexpectedJobExecutionException {
      execution.setStatus(BatchStatus.FAILED);
      execution.setEndTime(new Date());
    }
  });
  step.afterPropertiesSet();
  step.execute(stepExecution);
  assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
}
origin: spring-projects/spring-batch

@Test
public void testStoppedChild() throws Exception {
  DefaultJobParametersExtractor jobParametersExtractor = new DefaultJobParametersExtractor();
  jobParametersExtractor.setKeys(new String[] {"foo"});
  ExecutionContext executionContext = stepExecution.getExecutionContext();
  executionContext.put("foo", "bar");
  step.setJobParametersExtractor(jobParametersExtractor);
  step.setJob(new JobSupport("child") {
    @Override
    public void execute(JobExecution execution)  {
      assertEquals(1, execution.getJobParameters().getParameters().size());
      execution.setStatus(BatchStatus.STOPPED);
      execution.setEndTime(new Date());
      jobRepository.update(execution);
    }
    @Override
    public boolean isRestartable() {
      return true;
    }
  });
  step.afterPropertiesSet();
  step.execute(stepExecution);
  JobExecution jobExecution = stepExecution.getJobExecution();
  jobExecution.setEndTime(new Date());
  jobRepository.update(jobExecution);
  assertEquals(BatchStatus.STOPPED, stepExecution.getStatus());
}

origin: org.springframework.batch/org.springframework.batch.core

@SuppressWarnings("serial")
private void configureJobStep(JobStep ts) throws Exception {
  configureAbstractStep(ts);
  if (job != null) {
    ts.setJob(job);
  }
  if (jobParametersExtractor != null) {
    ts.setJobParametersExtractor(jobParametersExtractor);
  }
  if (jobLauncher == null) {
    SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
    jobLauncher.setJobRepository(jobRepository);
    jobLauncher.afterPropertiesSet();
    this.jobLauncher = jobLauncher;
  }
  ts.setJobLauncher(jobLauncher);
}
origin: spring-projects/spring-batch

@Before
public void setUp() throws Exception {
  step.setName("step");
  MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
  jobRepository = factory.getObject();
  step.setJobRepository(jobRepository);
  JobExecution jobExecution = jobRepository.createJobExecution("job", new JobParameters());
  stepExecution = jobExecution.createStepExecution("step");
  jobRepository.add(stepExecution);
  SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
  jobLauncher.setJobRepository(jobRepository);
  jobLauncher.afterPropertiesSet();
  step.setJobLauncher(jobLauncher);
}
origin: spring-projects/spring-batch

/**
 * Test method for
 * {@link org.springframework.batch.core.step.job.JobStep#afterPropertiesSet()}
 * .
 */
@Test(expected = IllegalStateException.class)
public void testAfterPropertiesSet() throws Exception {
  step.afterPropertiesSet();
}
origin: spring-projects/spring-batch

stepExecution.setExitStatus(determineStepExitStatus(stepExecution, jobExecution));
origin: org.springframework.batch/org.springframework.batch.core

JobStep ts = new JobStep();
configureJobStep(ts);
return ts;
origin: spring-projects/spring-batch

ExecutionContext executionContext = stepExecution.getExecutionContext();
executionContext.put("foo", "bar");
step.setJobParametersExtractor(jobParametersExtractor);
step.setJob(new JobSupport("child") {
  @Override
  public void execute(JobExecution execution) throws UnexpectedJobExecutionException {
step.afterPropertiesSet();
step.execute(stepExecution);
assertEquals("FOO", stepExecution.getFailureExceptions().get(0).getMessage());
JobExecution jobExecution = stepExecution.getJobExecution();
step.execute(stepExecution);
assertEquals("FOO", stepExecution.getFailureExceptions().get(0).getMessage());
origin: spring-projects/spring-batch

@Test
public void testExecuteException() throws Exception {
  step.setJob(new JobSupport("child") {
    @Override
    public void execute(JobExecution execution) throws UnexpectedJobExecutionException {
      throw new RuntimeException("FOO");
    }
  });
  step.afterPropertiesSet();
  step.execute(stepExecution);
  assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
  assertEquals("FOO", stepExecution.getFailureExceptions().get(0).getMessage());
}
origin: org.springframework.batch/spring-batch-core

stepExecution.setExitStatus(determineStepExitStatus(stepExecution, jobExecution));
origin: apache/servicemix-bundles

JobStep step = new JobStep();
step.setName(getName());
super.enhance(step);
if (job != null) {
  step.setJob(job);
  step.setJobParametersExtractor(jobParametersExtractor);
step.setJobLauncher(jobLauncher);
try {
  step.afterPropertiesSet();
origin: spring-projects/spring-batch

  @Test
  public void testStepExecutionExitStatus() throws Exception {
    step.setJob(new JobSupport("child") {
      @Override
      public void execute(JobExecution execution) throws UnexpectedJobExecutionException {
        execution.setStatus(BatchStatus.COMPLETED);
        execution.setExitStatus(new ExitStatus("CUSTOM"));
        execution.setEndTime(new Date());
      }
    });
    step.afterPropertiesSet();
    step.execute(stepExecution);
    assertEquals("CUSTOM", stepExecution.getExitStatus().getExitCode());
  }
}
origin: apache/servicemix-bundles

stepExecution.setExitStatus(determineStepExitStatus(stepExecution, jobExecution));
origin: org.springframework.batch/spring-batch-core

JobStep step = new JobStep();
step.setName(getName());
super.enhance(step);
if (job != null) {
  step.setJob(job);
  step.setJobParametersExtractor(jobParametersExtractor);
step.setJobLauncher(jobLauncher);
try {
  step.afterPropertiesSet();
origin: spring-projects/spring-batch

/**
 * Test method for
 * {@link org.springframework.batch.core.step.AbstractStep#execute(org.springframework.batch.core.StepExecution)}
 * .
 */
@Test
public void testExecuteSunnyDay() throws Exception {
  step.setJob(new JobSupport("child") {
    @Override
    public void execute(JobExecution execution) throws UnexpectedJobExecutionException {
      execution.setStatus(BatchStatus.COMPLETED);
      execution.setEndTime(new Date());
    }
  });
  step.afterPropertiesSet();
  step.execute(stepExecution);
  assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
  assertTrue("Missing job parameters in execution context: " + stepExecution.getExecutionContext(), stepExecution
      .getExecutionContext().containsKey(JobStep.class.getName() + ".JOB_PARAMETERS"));
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

JobStep step = new JobStep();
step.setName(getName());
super.enhance(step);
if (job != null) {
  step.setJob(job);
  step.setJobParametersExtractor(jobParametersExtractor);
step.setJobLauncher(jobLauncher);
try {
  step.afterPropertiesSet();
org.springframework.batch.core.step.jobJobStep

Javadoc

A Step that delegates to a Job to do its work. This is a great tool for managing dependencies between jobs, and also to modularise complex step logic into something that is testable in isolation. The job is executed with parameters that can be extracted from the step execution, hence this step can also be usefully used as the worker in a parallel or partitioned execution.

Most used methods

  • setJob
    The Job to delegate to in this step.
  • setJobLauncher
    A JobLauncher is required to be able to run the enclosed Job.
  • setJobParametersExtractor
    The JobParametersExtractor is used to extract JobParametersExtractor from the StepExecution to run t
  • <init>
  • afterPropertiesSet
  • setName
  • determineStepExitStatus
    Determines the ExitStatus taking into consideration the ExitStatus from the StepExecution, which inv
  • execute
  • setJobRepository

Popular in Java

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now