Package org.springframework.batch.core.job

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


   *
   */
  @Before
  public void setUp() throws Exception {

    job = new JobSupport("foo") {
      @Override
      public JobParametersIncrementer getJobParametersIncrementer() {
        return new JobParametersIncrementer() {
          @Override
          public JobParameters getNext(JobParameters parameters) {
View Full Code Here


*/
public class ReferenceJobFactoryTests {
 
  @Test
  public void testGroupName() throws Exception {
    ReferenceJobFactory factory = new ReferenceJobFactory(new JobSupport("foo"));
    assertEquals("foo", factory.getJobName());
  }
View Full Code Here

  @Test
  public void testAfterInitializationWithCorrectType() throws Exception {
    MapJobRegistry registry = new MapJobRegistry();
    processor.setJobRegistry(registry);
    JobSupport job = new JobSupport();
    job.setBeanName("foo");
    assertNotNull(processor.postProcessAfterInitialization(job, "bar"));
    assertEquals("[foo]", registry.getJobNames().toString());
  }
View Full Code Here

  @Test
  public void testAfterInitializationWithGroupName() throws Exception {
    MapJobRegistry registry = new MapJobRegistry();
    processor.setJobRegistry(registry);
    processor.setGroupName("jobs");
    JobSupport job = new JobSupport();
    job.setBeanName("foo");
    assertNotNull(processor.postProcessAfterInitialization(job, "bar"));
    assertEquals("[jobs.foo]", registry.getJobNames().toString());
  }
View Full Code Here

  @Test
  public void testAfterInitializationWithDuplicate() throws Exception {
    MapJobRegistry registry = new MapJobRegistry();
    processor.setJobRegistry(registry);
    JobSupport job = new JobSupport();
    job.setBeanName("foo");
    processor.postProcessAfterInitialization(job, "bar");
    try {
      processor.postProcessAfterInitialization(job, "spam");
      fail("Expected FatalBeanException");
    }
View Full Code Here

  @Test
  public void testUnregisterOnDestroy() throws Exception {
    MapJobRegistry registry = new MapJobRegistry();
    processor.setJobRegistry(registry);
    JobSupport job = new JobSupport();
    job.setBeanName("foo");
    assertNotNull(processor.postProcessAfterInitialization(job, "bar"));
    processor.destroy();
    assertEquals("[]", registry.getJobNames().toString());
  }
View Full Code Here

   */
  @Test
  public void testCreateRepository() throws Exception {
    tested.afterPropertiesSet();
    JobRepository repository = tested.getObject();
    Job job = new JobSupport("jobName");
    JobParameters jobParameters = new JobParameters();

    repository.createJobExecution(job.getName(), jobParameters);

    try {
      repository.createJobExecution(job.getName(), jobParameters);
      fail("Expected JobExecutionAlreadyRunningException");
    }
    catch (JobExecutionAlreadyRunningException e) {
      // expected
    }
View Full Code Here

  /**
   * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#unregister(String)}.
   * @throws Exception
   */
  public void testUnregister() throws Exception {
    registry.register(new ReferenceJobFactory(new JobSupport("foo")));
    assertNotNull(registry.getJob("foo"));
    registry.unregister("foo");
    try {
      assertNull(registry.getJob("foo"));
      fail("Expected NoSuchJobConfigurationException");
View Full Code Here

  /**
   * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#getJob(java.lang.String)}.
   */
  public void testReplaceDuplicateConfiguration() throws Exception {
    registry.register(new ReferenceJobFactory(new JobSupport("foo")));
    try {
      registry.register(new ReferenceJobFactory(new JobSupport("foo")));
      fail("Expected DuplicateJobConfigurationException");
    } catch (DuplicateJobException e) {
      // unexpected: even if the job is different we want a DuplicateJobException
      assertTrue(e.getMessage().indexOf("foo")>=0);
    }
View Full Code Here

  /**
   * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#getJob(java.lang.String)}.
   */
  public void testRealDuplicateConfiguration() throws Exception {
    JobFactory jobFactory = new ReferenceJobFactory(new JobSupport("foo"));
    registry.register(jobFactory);
    try {
      registry.register(jobFactory);
      fail("Unexpected DuplicateJobConfigurationException");
    } catch (DuplicateJobException e) {
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.