Examples of JobSupport


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

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

   * {@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

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

        .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

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

    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

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

    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

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

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

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

    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

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

    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

Examples of org.springframework.batch.integration.JobSupport

public class JobRequestConverter {

  @ServiceActivator
  public JobLaunchRequest convert(String jobName) {
    Properties properties = new Properties();
    return new JobLaunchRequest(new JobSupport(jobName), new DefaultJobParametersConverter().getJobParameters(properties));
  }
View Full Code Here

Examples of org.springframework.batch.integration.JobSupport

    messageHandler = new JobLaunchingMessageHandler(jobLauncher);
  }

  @Test
  public void testSimpleDelivery() throws Exception{
    messageHandler.launch(new JobLaunchRequest(new JobSupport("testjob"), null));

    assertEquals("Wrong job count", 1, jobLauncher.jobs.size());
    assertEquals("Wrong job name", jobLauncher.jobs.get(0).getName(), "testjob");

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.