Tabnine Logo
MethodInvokingTaskletAdapter
Code IndexAdd Tabnine to your IDE (free)

How to use
MethodInvokingTaskletAdapter
in
org.springframework.batch.core.step.tasklet

Best Java code snippets using org.springframework.batch.core.step.tasklet.MethodInvokingTaskletAdapter (Showing top 20 results out of 315)

origin: spring-projects/spring-batch

/**
 * Delegate execution to the target object and translate the return value to
 * an {@link ExitStatus} by invoking a method in the delegate POJO. Ignores
 * the {@link StepContribution} and the attributes.
 *
 * @see Tasklet#execute(StepContribution, ChunkContext)
 */
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
  if (getArguments() == null) {
    setArguments(new Object[]{contribution, chunkContext});
  }
  contribution.setExitStatus(mapResult(invokeDelegateMethod()));
  return RepeatStatus.FINISHED;
}
origin: spring-projects/spring-batch

@Before
public void setUp() throws Exception {
  stepContribution = new StepContribution(mock(StepExecution.class));
  chunkContext = mock(ChunkContext.class);
  tasklet = new TestTasklet();
  adapter = new MethodInvokingTaskletAdapter();
  adapter.setTargetObject(tasklet);
}
origin: spring-projects/spring-batch

@Test(expected = IllegalArgumentException.class)
public void testIncorrectSignatureWithExtraParameter() throws Exception {
  adapter.setTargetMethod("execute10");
  adapter.execute(stepContribution, chunkContext);
}
origin: org.springframework.batch/org.springframework.batch.core

/**
 * Delegate execution to the target object and translate the return value to
 * an {@link ExitStatus} by invoking a method in the delegate POJO. Ignores
 * the {@link StepContribution} and the attributes.
 * 
 * @see Tasklet#execute(StepContribution, ChunkContext)
 */
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
  contribution.setExitStatus(mapResult(invokeDelegateMethod()));
  return RepeatStatus.FINISHED;
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Delegate execution to the target object and translate the return value to
 * an {@link ExitStatus} by invoking a method in the delegate POJO. Ignores
 * the {@link StepContribution} and the attributes.
 *
 * @see Tasklet#execute(StepContribution, ChunkContext)
 */
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
  contribution.setExitStatus(mapResult(invokeDelegateMethod()));
  return RepeatStatus.FINISHED;
}
origin: org.springframework.batch/spring-batch-core

/**
 * Delegate execution to the target object and translate the return value to
 * an {@link ExitStatus} by invoking a method in the delegate POJO. Ignores
 * the {@link StepContribution} and the attributes.
 *
 * @see Tasklet#execute(StepContribution, ChunkContext)
 */
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
  if (getArguments() == null) {
    setArguments(new Object[]{contribution, chunkContext});
  }
  contribution.setExitStatus(mapResult(invokeDelegateMethod()));
  return RepeatStatus.FINISHED;
}
origin: spring-projects/spring-batch

@Test
public void testArgumentSubsetWithoutArguments() throws Exception {
  adapter.setTargetMethod("execute5");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
}
origin: apache/servicemix-bundles

/**
 * Delegate execution to the target object and translate the return value to
 * an {@link ExitStatus} by invoking a method in the delegate POJO. Ignores
 * the {@link StepContribution} and the attributes.
 *
 * @see Tasklet#execute(StepContribution, ChunkContext)
 */
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
  if (getArguments() == null) {
    setArguments(new Object[]{contribution, chunkContext});
  }
  contribution.setExitStatus(mapResult(invokeDelegateMethod()));
  return RepeatStatus.FINISHED;
}
origin: spring-projects/spring-batch

@Test
public void testCompatibleReturnTypeWhenVoid() throws Exception {
  adapter.setTargetMethod("execute7");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
}
origin: spring-projects/spring-batch

@Test
public void testCompatibleReturnTypeWhenBoolean() throws Exception {
  adapter.setTargetMethod("execute6");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
}
origin: spring-projects/spring-batch

@Test
public void testArgumentSubsetWithOnlyChunkContextAndCompatibleReturnTypeVoid() throws Exception {
  adapter.setTargetMethod("execute9");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
  assertEquals(tasklet.getChunkContext(), chunkContext);
}
origin: spring-projects/spring-batch

@Test
public void testArgumentSubsetWithOnlyStepContributionAndCompatibleReturnTypeBoolean() throws Exception {
  adapter.setTargetMethod("execute8");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
  assertEquals(tasklet.getStepContribution(), stepContribution);
}
origin: spring-projects/spring-batch

@Test
public void testMapResultWithNull() throws Exception {
  tasklet.setTargetMethod("process");
  StepContribution contribution = stepExecution.createStepContribution();
  tasklet.execute(contribution,null);
  assertEquals(ExitStatus.COMPLETED, contribution.getExitStatus());
}
origin: spring-projects/spring-batch

@Test
public void testArgumentSubsetWithOnlyChunkContext() throws Exception {
  adapter.setTargetMethod("execute3");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
  assertEquals(tasklet.getChunkContext(), chunkContext);
}
origin: spring-projects/spring-batch

@Test
public void testExitStatusReturnType() throws Exception {
  adapter.setTargetMethod("execute11");
  adapter.execute(stepContribution, chunkContext);
  assertEquals(new ExitStatus("DONE"), stepContribution.getExitStatus());
}
origin: spring-projects/spring-batch

@Test
public void testExecuteWithExitStatus() throws Exception {
  tasklet.setTargetMethod("execute");
  StepContribution contribution = stepExecution.createStepContribution();
  tasklet.execute(contribution,null);
  assertEquals(ExitStatus.NOOP, contribution.getExitStatus());
}
origin: spring-projects/spring-batch

@Test
public void testMapResultWithNonNull() throws Exception {
  tasklet.setTargetMethod("process");
  this.result = "foo";
  StepContribution contribution = stepExecution.createStepContribution();
  tasklet.execute(contribution,null);
  assertEquals(ExitStatus.COMPLETED, contribution.getExitStatus());
}
origin: spring-projects/spring-batch

@Test
public void testArgumentSubsetWithOnlyStepContribution() throws Exception {
  adapter.setTargetMethod("execute4");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
  assertEquals(tasklet.getStepContribution(), stepContribution);
}
origin: spring-projects/spring-batch

@Test
public void testNonExitStatusReturnType() throws Exception {
  adapter.setTargetMethod("execute12");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
  assertEquals(ExitStatus.COMPLETED, stepContribution.getExitStatus());
}
origin: spring-projects/spring-batch

@Test
public void testDifferentParametersOrder() throws Exception {
  adapter.setTargetMethod("execute2");
  RepeatStatus repeatStatus = adapter.execute(stepContribution, chunkContext);
  assertEquals(RepeatStatus.FINISHED, repeatStatus);
  assertEquals(tasklet.getStepContribution(), stepContribution);
  assertEquals(tasklet.getChunkContext(), chunkContext);
}
org.springframework.batch.core.step.taskletMethodInvokingTaskletAdapter

Javadoc

A Tasklet that wraps a method in a POJO. By default the return value is ExitStatus#COMPLETED unless the delegate POJO itself returns an ExitStatus. The POJO method is usually going to have no arguments, but a static argument or array of arguments can be used by setting the arguments property.

Most used methods

  • invokeDelegateMethod
  • mapResult
    If the result is an ExitStatus already just return that, otherwise return ExitStatus#COMPLETED.
  • getArguments
  • setArguments
  • <init>
  • execute
    Delegate execution to the target object and translate the return value to an ExitStatus by invoking
  • setTargetMethod
  • setTargetObject

Popular in Java

  • Finding current android device location
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now