Examples of RepeatTemplate


Examples of org.springframework.batch.repeat.support.RepeatTemplate

      public Object invoke(MethodInvocation invocation) throws Throwable {
        list.add("chain");
        return invocation.proceed();
      }
    });
    RepeatTemplate template = new RepeatTemplate();
    template.setCompletionPolicy(new SimpleCompletionPolicy(2));
    interceptor.setRepeatOperations(template);
    service.service();
    assertEquals(2, target.count);
    assertEquals(2, list.size());
  }
View Full Code Here

Examples of org.springframework.batch.repeat.support.RepeatTemplate

public class NestedRepeatCallbackTests extends TestCase {

  int count = 0;

  public void testExecute() throws Exception {
    NestedRepeatCallback callback = new NestedRepeatCallback(new RepeatTemplate(), new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        return RepeatStatus.continueIf(count <= 1);
      }
View Full Code Here

Examples of org.springframework.batch.repeat.support.RepeatTemplate

  BatchMessageListenerContainer container;

  @Test
  public void testReceiveAndExecuteWithCallback() throws Exception {
    RepeatTemplate template = new RepeatTemplate();
    template.setCompletionPolicy(new SimpleCompletionPolicy(2));
    container = getContainer(template);

    container.setMessageListener(new MessageListener() {
      @Override
      public void onMessage(Message arg0) {
View Full Code Here

Examples of org.springframework.batch.repeat.support.RepeatTemplate

  }

  @Test
  public void testReceiveAndExecuteWithCallbackReturningNull() throws Exception {
    RepeatTemplate template = new RepeatTemplate();
    template.setCompletionPolicy(new SimpleCompletionPolicy(2));
    container = getContainer(template);

    Session session = mock(Session.class);
    MessageConsumer consumer = mock(MessageConsumer.class);
    Message message = null;
View Full Code Here

Examples of org.springframework.batch.repeat.support.RepeatTemplate

  }

  @Test
  public void testTransactionalReceiveAndExecuteWithCallbackThrowingException() throws Exception {
    RepeatTemplate template = new RepeatTemplate();
    template.setCompletionPolicy(new SimpleCompletionPolicy(2));
    container = getContainer(template);
    container.setSessionTransacted(true);
    try {
      boolean received = doTestWithException(new IllegalStateException("No way!"), true, 2);
      assertFalse("Message received", received);
View Full Code Here

Examples of org.springframework.batch.repeat.support.RepeatTemplate

    }
  }

  @Test
  public void testNonTransactionalReceiveAndExecuteWithCallbackThrowingException() throws Exception {
    RepeatTemplate template = new RepeatTemplate();
    template.setCompletionPolicy(new SimpleCompletionPolicy(2));
    container = getContainer(template);
    container.setSessionTransacted(false);
    boolean received = doTestWithException(new IllegalStateException("No way!"), false, 2);
    assertTrue("Message not received but listener not transactional so this should be true", received);
  }
View Full Code Here

Examples of org.springframework.batch.repeat.support.RepeatTemplate

    assertTrue("Message not received but listener not transactional so this should be true", received);
  }

  @Test
  public void testNonTransactionalReceiveAndExecuteWithCallbackThrowingError() throws Exception {
    RepeatTemplate template = new RepeatTemplate();
    template.setCompletionPolicy(new SimpleCompletionPolicy(2));
    container = getContainer(template);
    container.setSessionTransacted(false);
    try {
      boolean received = doTestWithException(new RuntimeException("No way!"), false, 2);
      assertTrue("Message not received but listener not transactional so this should be true", received);
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.