示例#1
0
  private void testReadWrite0(
      final String writeResource,
      final String start,
      final String end,
      final Class<?> beanType,
      final String expect,
      final String forbid)
      throws Exception {
    final Properties params =
        CsvItemReaderWriterTest.createParams(CsvProperties.BEAN_TYPE_KEY, beanType.getName());
    final File writeResourceFile = new File(CsvItemReaderWriterTest.tmpdir, writeResource);
    params.setProperty("writeResource", writeResourceFile.getPath());
    params.setProperty(CsvProperties.CELL_PROCESSORS_KEY, cellProcessors);

    if (start != null) {
      params.setProperty(CsvProperties.START_KEY, start);
    }
    if (end != null) {
      params.setProperty(CsvProperties.END_KEY, end);
    }
    if (this.partialNameMapping != null) {
      params.setProperty(CsvProperties.NAME_MAPPING_KEY, partialNameMapping);
    }
    params.setProperty(CsvProperties.HEADER_KEY, header);
    CsvItemReaderWriterTest.setRandomWriteMode(params);

    final long jobExecutionId = jobOperator.start(jobName, params);
    final JobExecutionImpl jobExecution =
        (JobExecutionImpl) jobOperator.getJobExecution(jobExecutionId);
    jobExecution.awaitTermination(CsvItemReaderWriterTest.waitTimeoutMinutes, TimeUnit.MINUTES);
    Assert.assertEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus());

    CsvItemReaderWriterTest.validate(writeResourceFile, expect, forbid);
  }
示例#2
0
 protected void awaitTermination(final JobExecutionImpl... exes) throws InterruptedException {
   final JobExecutionImpl exe = exes.length == 0 ? jobExecution : exes[0];
   exe.awaitTermination(getJobTimeoutSeconds(), TimeUnit.SECONDS);
   stepExecutions = jobOperator.getStepExecutions(exe.getExecutionId());
   if (!stepExecutions.isEmpty()) {
     stepExecution0 = (StepExecutionImpl) stepExecutions.get(0);
   }
 }