Tabnine Logo
org.springframework.batch.core.partition.support
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.batch.core.partition.support

Best Java code snippets using org.springframework.batch.core.partition.support (Showing top 20 results out of 315)

origin: spring-projects/spring-batch

/**
 * Check if a step execution is startable.
 * @param stepExecution the step execution to check
 * @param context the execution context of the step
 * @return true if the step execution is startable, false otherwise
 * @throws JobExecutionException if unable to check if the step execution is startable
 */
protected boolean isStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException {
  return getStartable(stepExecution, context);
}
origin: spring-projects/spring-batch

private StepExecution update(Set<StepExecution> split, StepExecution stepExecution, BatchStatus status)
    throws Exception {
  return update(split, stepExecution, status, true);
}
origin: spring-projects/spring-batch

/**
 * @see PartitionHandler#handle(StepExecutionSplitter, StepExecution)
 */
@Override
public Collection<StepExecution> handle(final StepExecutionSplitter stepSplitter,
    final StepExecution masterStepExecution) throws Exception {
  final Set<StepExecution> stepExecutions = stepSplitter.split(masterStepExecution, gridSize);
  return doHandle(masterStepExecution, stepExecutions);
}
origin: spring-projects/spring-batch

@Test
public void testCompleteStatusAfterFailure() throws Exception {
  SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, false, step.getName(),
      new SimplePartitioner());
  Set<StepExecution> split = provider.split(stepExecution, 2);
  assertEquals(2, split.size());
  StepExecution nextExecution = update(split, stepExecution, BatchStatus.COMPLETED, false);
  // If already complete in another JobExecution we don't execute again
  assertEquals(0, provider.split(nextExecution, 2).size());
}
origin: spring-projects/spring-batch

@Test
public void testGetStepName() {
  SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, true, step.getName(),
      new SimplePartitioner());
  assertEquals("step", provider.getStepName());
}
origin: spring-projects/spring-batch

@Test
public void testSimpleStepExecutionProviderJobRepositoryStep() throws Exception {
  SimpleStepExecutionSplitter splitter = new SimpleStepExecutionSplitter(jobRepository, true, step.getName(),
      new SimplePartitioner());
  Set<StepExecution> execs = splitter.split(stepExecution, 2);
  assertEquals(2, execs.size());
  for (StepExecution execution : execs) {
    assertNotNull("step execution partition is saved", execution.getId());
  }
}
origin: spring-projects/spring-batch

@Test
public void testAggregateNull() {
  aggregator.aggregate(result, null);
}
origin: spring-projects/spring-batch

@Before
public void setUp() throws Exception {
  handler.setStep(new StepSupport() {
    @Override
    public void execute(StepExecution stepExecution) throws JobInterruptedException {
      count++;
      stepExecutions.add(stepExecution.getStepName());
    }
  });
  handler.afterPropertiesSet();
}
origin: spring-projects/spring-batch

@Before
public void setUp() throws Exception {
  MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
  jobRepository = factory.getObject();
  step.setJobRepository(jobRepository);
  step.setName("partitioned");
}
origin: spring-projects/spring-batch

@Test(expected = IllegalStateException.class)
public void testMissingResource() {
  partitioner.setResources(new Resource[] { new FileSystemResource("does-not-exist") });
  partitioner.partition(0);
}
origin: spring-projects/spring-batch

@Override
public Map<String, ExecutionContext> partition(int gridSize) {
  Map<String, ExecutionContext> partitions = super.partition(gridSize);
  int i = 0;
  for (ExecutionContext context : partitions.values()) {
    context.put(PARTITION_KEY, PARTITION_KEY + (i++));
  }
  return partitions;
}
origin: spring-projects/spring-batch

@Before
public void setUp() {
  ResourceArrayPropertyEditor editor = new ResourceArrayPropertyEditor();
  editor.setAsText("classpath:jsrBaseContext.xml");
  partitioner.setResources((Resource[]) editor.getValue());
}
origin: spring-projects/spring-batch

@Test
public void testAggregateNull() {
  aggregator.aggregate(result, null);
}
origin: spring-projects/spring-batch

  @Override
  public void aggregate(StepExecution result, Collection<StepExecution> executions) {
    super.aggregate(result, executions);
    result.getExecutionContext().put("aggregated", true);
  }
});
origin: spring-projects/spring-batch

@Test
public void testCompleteStatusSameJobExecution() throws Exception {
  SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, false, step.getName(),
      new SimplePartitioner());
  Set<StepExecution> split = provider.split(stepExecution, 2);
  assertEquals(2, split.size());
  stepExecution = update(split, stepExecution, BatchStatus.COMPLETED);
  // If already complete in the same JobExecution we should execute again
  assertEquals(2, provider.split(stepExecution, 2).size());
}
origin: spring-projects/spring-batch

@Test
public void testAggregateEmpty() {
  aggregator.aggregate(result, Collections.<StepExecution> emptySet());
}
origin: spring-projects/spring-batch

@Test
public void testAggregateEmpty() {
  aggregator.aggregate(result, Collections.<StepExecution> emptySet());
}
origin: spring-projects/spring-batch

@Test
public void testRememberGridSize() throws Exception {
  SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, true, step.getName(),
      new SimplePartitioner());
  Set<StepExecution> split = provider.split(stepExecution, 2);
  assertEquals(2, split.size());
  stepExecution = update(split, stepExecution, BatchStatus.FAILED);
  assertEquals(2, provider.split(stepExecution, 3).size());
}
origin: spring-projects/spring-batch

@Test
public void testUnknownStatus() throws Exception {
  SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, true, step.getName(),
      new SimplePartitioner());
  Set<StepExecution> split = provider.split(stepExecution, 2);
  assertEquals(2, split.size());
  stepExecution = update(split, stepExecution, BatchStatus.UNKNOWN);
  try {
    provider.split(stepExecution, 2);
  }
  catch (JobExecutionException e) {
    String message = e.getMessage();
    assertTrue("Wrong message: " + message, message.contains("UNKNOWN"));
  }
}
origin: spring-projects/spring-batch

@Test
public void testAbandonedStatus() throws Exception {
  SimpleStepExecutionSplitter provider = new SimpleStepExecutionSplitter(jobRepository, true, step.getName(),
      new SimplePartitioner());
  Set<StepExecution> split = provider.split(stepExecution, 2);
  assertEquals(2, split.size());
  stepExecution = update(split, stepExecution, BatchStatus.ABANDONED);
  // If not already complete we don't execute again
  try {
    provider.split(stepExecution, 2);
  }
  catch (JobExecutionException e) {
    String message = e.getMessage();
    assertTrue("Wrong message: " + message, message.contains("ABANDONED"));
  }
}
org.springframework.batch.core.partition.support

Most used classes

  • PartitionStep
    Implementation of Step which partitions the execution and spreads the load using a PartitionHandler.
  • SimpleStepExecutionSplitter
    Generic implementation of StepExecutionSplitter that delegates to a Partitioner to generate Executio
  • StepExecutionAggregator
    Strategy for a aggregating step executions, usually when they are the result of partitioned or remot
  • TaskExecutorPartitionHandler
    A PartitionHandler that uses a TaskExecutor to execute the partitioned Step locally in multiple thre
  • PartitionNameProvider
    Optional interface for Partitioner implementations that need to use a custom naming scheme for part
  • AbstractPartitionHandler,
  • MultiResourcePartitioner,
  • SimplePartitioner,
  • DefaultStepExecutionAggregator,
  • RemoteStepExecutionAggregator,
  • SimpleStepExecutionSplitterTests
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