Package org.springframework.batch.core.job

Examples of org.springframework.batch.core.job.JobSupport


   * {@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();
  }
View Full Code Here


   * {@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());
      }
View Full Code Here

        .getExecutionContext().containsKey(JobStep.class.getName() + ".JOB_PARAMETERS"));
  }

  @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());
      }
View Full Code Here

    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
  }

  @Test
  public void testExecuteException() throws Exception {
    step.setJob(new JobSupport("child") {
      @Override
      public void execute(JobExecution execution) throws UnexpectedJobExecutionException {
        throw new RuntimeException("FOO");
      }
    });
View Full Code Here

    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) throws UnexpectedJobExecutionException {
        assertEquals(1, execution.getJobParameters().getParameters().size());
        execution.setStatus(BatchStatus.FAILED);
        execution.setEndTime(new Date());
View Full Code Here

public class SpringBeanJobTests {

  @Test
  public void testBeanName() throws Exception {
    StaticApplicationContext context = new StaticApplicationContext();
    JobSupport configuration = new JobSupport();
    context.getAutowireCapableBeanFactory().initializeBean(configuration,
        "bean");
    context.refresh();
    assertNotNull(configuration.getName());
    configuration.setBeanName("foo");
    context.getAutowireCapableBeanFactory().initializeBean(configuration,
        "bean");
    assertEquals("bean", configuration.getName());
    context.close();
  }
View Full Code Here

    args.addGenericArgumentValue("foo");
    context.registerBeanDefinition("bean", new RootBeanDefinition(
        JobSupport.class, args, null));

    context.refresh();
    JobSupport configuration = (JobSupport) context
        .getBean("bean");
    assertNotNull(configuration.getName());
    assertEquals("foo", configuration.getName());
    configuration.setBeanName("bar");
    assertEquals("foo", configuration.getName());
    context.close();
  }
View Full Code Here

    args.addGenericArgumentValue("bar");
    context.registerBeanDefinition("parent", new RootBeanDefinition(
        JobSupport.class, args, null));
    context.registerBeanDefinition("bean", new ChildBeanDefinition("parent"));
    context.refresh();
    JobSupport configuration = (JobSupport) context
        .getBean("bean");
    assertNotNull(configuration.getName());
    assertEquals("bar", configuration.getName());
    configuration.setBeanName("foo");
    assertEquals("bar", configuration.getName());
    configuration.setName("foo");
    assertEquals("foo", configuration.getName());
    context.close();
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.job.JobSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.