Package org.springframework.batch.core.configuration.xml

Examples of org.springframework.batch.core.configuration.xml.AbstractTestComponent


    assertTrue(factoryBean.getObject() instanceof StepListener);
  }

  @Test
  public void testEmptySignatureAnnotation() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @AfterWrite
      public void aMethod() {
        executed = true;
      }
    };
    factoryBean.setDelegate(delegate);
    @SuppressWarnings("unchecked")
    ItemWriteListener<String> listener = (ItemWriteListener<String>) factoryBean.getObject();
    listener.afterWrite(Arrays.asList("foo", "bar"));
    assertTrue(delegate.isExecuted());
  }
View Full Code Here


    assertTrue(delegate.isExecuted());
  }

  @Test
  public void testRightSignatureAnnotation() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @AfterWrite
      public void aMethod(List<String> items) {
        executed = true;
        assertEquals("foo", items.get(0));
        assertEquals("bar", items.get(1));
      }
    };
    factoryBean.setDelegate(delegate);
    @SuppressWarnings("unchecked")
    ItemWriteListener<String> listener = (ItemWriteListener<String>) factoryBean.getObject();
    listener.afterWrite(Arrays.asList("foo", "bar"));
    assertTrue(delegate.isExecuted());
  }
View Full Code Here

    assertTrue(delegate.isExecuted());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testWrongSignatureAnnotation() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @AfterWrite
      public void aMethod(Integer item) {
        executed = true;
      }
    };
View Full Code Here

    factoryBean.getObject();
  }

  @Test
  public void testEmptySignatureNamedMethod() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @SuppressWarnings("unused")
      public void aMethod() {
        executed = true;
      }
    };
    factoryBean.setDelegate(delegate);
    Map<String, String> metaDataMap = new HashMap<String, String>();
    metaDataMap.put(AFTER_WRITE.getPropertyName(), "aMethod");
    factoryBean.setMetaDataMap(metaDataMap);
    @SuppressWarnings("unchecked")
    ItemWriteListener<String> listener = (ItemWriteListener<String>) factoryBean.getObject();
    listener.afterWrite(Arrays.asList("foo", "bar"));
    assertTrue(delegate.isExecuted());
  }
View Full Code Here

    assertTrue(delegate.isExecuted());
  }

  @Test
  public void testRightSignatureNamedMethod() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @SuppressWarnings("unused")
      public void aMethod(List<String> items) {
        executed = true;
        assertEquals("foo", items.get(0));
        assertEquals("bar", items.get(1));
      }
    };
    factoryBean.setDelegate(delegate);
    Map<String, String> metaDataMap = new HashMap<String, String>();
    metaDataMap.put(AFTER_WRITE.getPropertyName(), "aMethod");
    factoryBean.setMetaDataMap(metaDataMap);
    @SuppressWarnings("unchecked")
    ItemWriteListener<String> listener = (ItemWriteListener<String>) factoryBean.getObject();
    listener.afterWrite(Arrays.asList("foo", "bar"));
    assertTrue(delegate.isExecuted());
  }
View Full Code Here

    assertTrue(delegate.isExecuted());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testWrongSignatureNamedMethod() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @SuppressWarnings("unused")
      public void aMethod(Integer item) {
        executed = true;
      }
    };
View Full Code Here

    assertEquals(listener1, listener2);
  }

  @Test
  public void testEmptySignatureAnnotation() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @AfterJob
      public void aMethod() {
        executed = true;
      }
    };
    factoryBean.setDelegate(delegate);
    JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
    listener.afterJob(new JobExecution(1L));
    assertTrue(delegate.isExecuted());
  }
View Full Code Here

    assertTrue(delegate.isExecuted());
  }

  @Test
  public void testRightSignatureAnnotation() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @AfterJob
      public void aMethod(JobExecution jobExecution) {
        executed = true;
        assertEquals(new Long(25), jobExecution.getId());
      }
    };
    factoryBean.setDelegate(delegate);
    JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
    listener.afterJob(new JobExecution(25L));
    assertTrue(delegate.isExecuted());
  }
View Full Code Here

    assertTrue(delegate.isExecuted());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testWrongSignatureAnnotation() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @AfterJob
      public void aMethod(Integer item) {
        executed = true;
      }
    };
View Full Code Here

    factoryBean.getObject();
  }

  @Test
  public void testEmptySignatureNamedMethod() {
    AbstractTestComponent delegate = new AbstractTestComponent() {
      @SuppressWarnings("unused")
      public void aMethod() {
        executed = true;
      }
    };
    factoryBean.setDelegate(delegate);
    Map<String, String> metaDataMap = new HashMap<String, String>();
    metaDataMap.put(AFTER_JOB.getPropertyName(), "aMethod");
    factoryBean.setMetaDataMap(metaDataMap);
    JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
    listener.afterJob(new JobExecution(1L));
    assertTrue(delegate.isExecuted());
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.configuration.xml.AbstractTestComponent

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.