org.springframework.batch.core.StepExecution Java Examples
The following examples show how to use
org.springframework.batch.core.StepExecution.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JobCommandTests.java From spring-cloud-dataflow with Apache License 2.0 | 9 votes |
private static long createSampleJob(String jobName, int jobExecutionCount) { JobInstance instance = jobRepository.createJobInstance(jobName, new JobParameters()); jobInstances.add(instance); TaskExecution taskExecution = dao.createTaskExecution(jobName, new Date(), new ArrayList<>(), null); Map<String, JobParameter> jobParameterMap = new HashMap<>(); jobParameterMap.put("foo", new JobParameter("FOO", true)); jobParameterMap.put("bar", new JobParameter("BAR", false)); JobParameters jobParameters = new JobParameters(jobParameterMap); JobExecution jobExecution; for (int i = 0; i < jobExecutionCount; i++) { jobExecution = jobRepository.createJobExecution(instance, jobParameters, null); taskBatchDao.saveRelationship(taskExecution, jobExecution); StepExecution stepExecution = new StepExecution("foobar", jobExecution); jobRepository.add(stepExecution); } return taskExecution.getExecutionId(); }
Example #2
Source File: SpringBatchStepScopeIntegrationTest.java From tutorials with MIT License | 6 votes |
@Test public void givenMockedStep_whenReaderCalled_thenSuccess() throws Exception { // given StepExecution stepExecution = MetaDataInstanceFactory.createStepExecution(defaultJobParameters()); // when StepScopeTestUtils.doInStepScope(stepExecution, () -> { BookRecord bookRecord; itemReader.open(stepExecution.getExecutionContext()); while ((bookRecord = itemReader.read()) != null) { // then assertThat(bookRecord.getBookName(), is("Foundation")); assertThat(bookRecord.getBookAuthor(), is("Asimov I.")); assertThat(bookRecord.getBookISBN(), is("ISBN 12839")); assertThat(bookRecord.getBookFormat(), is("hardcover")); assertThat(bookRecord.getPublishingYear(), is("2018")); } itemReader.close(); return null; }); }
Example #3
Source File: SimpleJobService.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Override public StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId) throws NoSuchJobExecutionException, NoSuchStepExecutionException { JobExecution jobExecution = getJobExecution(jobExecutionId); StepExecution stepExecution = stepExecutionDao.getStepExecution(jobExecution, stepExecutionId); if (stepExecution == null) { throw new NoSuchStepExecutionException("There is no StepExecution with jobExecutionId=" + jobExecutionId + " and id=" + stepExecutionId); } try { stepExecution.setExecutionContext(executionContextDao.getExecutionContext(stepExecution)); } catch (Exception e) { logger.info("Cannot load execution context for step execution: " + stepExecution); } return stepExecution; }
Example #4
Source File: CampusInterceptor.java From olat with Apache License 2.0 | 6 votes |
/** * Generates an appropriate statistic of the processed, <br> * delegates the cleanup and the metric notification. * * @param se * the StepExecution */ @Override @Transactional(propagation = Propagation.REQUIRES_NEW) public ExitStatus afterStep(StepExecution se) { LOG.info(se); statisticDao.save(createImportStatistic(se)); if (CampusProcessStep.IMPORT_CONTROLFILE.name().equalsIgnoreCase(se.getStepName())) { if (se.getWriteCount() != getFixedNumberOfFilesToBeExported()) { // if (se.getReadCount() != getFixedNumberOfFilesToBeExported() || se.getWriteCount() != getFixedNumberOfFilesToBeExported()) { notifyMetrics(se); return ExitStatus.FAILED; } } removeOldDataIfExist(se); notifyMetrics(se); return null; }
Example #5
Source File: JobExecutionDeserializationTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Test public void testDeserializationOfSingleJobExecution() throws IOException { final ObjectMapper objectMapper = DataFlowTemplate.prepareObjectMapper(new ObjectMapper()); final InputStream inputStream = JobExecutionDeserializationTests.class .getResourceAsStream("/SingleJobExecutionJson.txt"); final String json = new String(StreamUtils.copyToByteArray(inputStream)); final JobExecutionResource jobExecutionInfoResource = objectMapper.readValue(json, JobExecutionResource.class); assertNotNull(jobExecutionInfoResource); assertEquals(Long.valueOf(1), jobExecutionInfoResource.getJobId()); assertEquals("ff.job", jobExecutionInfoResource.getName()); assertEquals("COMPLETED", jobExecutionInfoResource.getJobExecution().getStatus().name()); assertEquals(1, jobExecutionInfoResource.getJobExecution().getStepExecutions().size()); final StepExecution stepExecution = jobExecutionInfoResource.getJobExecution().getStepExecutions().iterator().next(); assertNotNull(stepExecution); final ExecutionContext stepExecutionExecutionContext = stepExecution.getExecutionContext(); assertNotNull(stepExecutionExecutionContext); assertEquals(2, stepExecutionExecutionContext.size()); }
Example #6
Source File: SpringBatchBuildReportHandler.java From spring-cloud-release-tools with Apache License 2.0 | 6 votes |
private List<Table> buildTable(List<StepExecution> stepContexts) { return stepContexts.stream().map(step -> { String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS") .format(step.getStartTime()); long millis = ChronoUnit.MILLIS.between(step.getStartTime().toInstant(), step.getEndTime().toInstant()); ExecutionContext context = step.getExecutionContext(); ExecutionResultReport entity = (ExecutionResultReport) context.get("entity"); if (entity == null) { return null; } String projectName = TrainPostReleaseReleaserTask.class .isAssignableFrom(entity.getReleaserTaskType()) ? "postRelease" : entity.getProjectName(); return new Table(date, time(millis), projectName, entity.getShortName(), entity.getDescription(), entity.getState(), entity.getExceptions()); }).filter(Objects::nonNull).collect(Collectors.toCollection(LinkedList::new)); }
Example #7
Source File: AlarmReaderTest.java From pinpoint with Apache License 2.0 | 6 votes |
@Test public void readTest3() { StepExecution stepExecution = new StepExecution("alarmStep", null); ExecutionContext executionContext = new ExecutionContext(); stepExecution.setExecutionContext(executionContext); AlarmServiceImpl alarmService = new AlarmServiceImpl(mock(AlarmDao.class)) { @Override public java.util.List<Rule> selectRuleByApplicationId(String applicationId) { return new LinkedList<>(); } }; AlarmReader reader = new AlarmReader(dataCollectorFactory, applicationIndexDao, alarmService); reader.beforeStep(stepExecution); assertNull(reader.read()); }
Example #8
Source File: ComposedRunnerVisitorTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Test public void testSequentialAndSplit() { setupContextForGraph("AAA && <BBB||CCC||DDD> && EEE"); Collection<StepExecution> stepExecutions = getStepExecutions(); Set<String> stepNames = getStepNames(stepExecutions); assertEquals(5, stepExecutions.size()); assertTrue(stepNames.contains("AAA_0")); assertTrue(stepNames.contains("BBB_0")); assertTrue(stepNames.contains("CCC_0")); assertTrue(stepNames.contains("DDD_0")); assertTrue(stepNames.contains("EEE_0")); List<StepExecution> sortedStepExecution = getSortedStepExecutions(stepExecutions); assertEquals("AAA_0", sortedStepExecution.get(0).getStepName()); assertEquals("EEE_0", sortedStepExecution.get(4).getStepName()); }
Example #9
Source File: StepExecutionJacksonMixInTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
/** * Assert that by using the {@link ExecutionContextJacksonMixIn} Jackson renders the * Step Execution Context correctly. * * @throws JsonProcessingException if a Json generation error occurs. */ @Test public void testSerializationOfSingleStepExecution() throws JsonProcessingException { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.addMixIn(StepExecution.class, StepExecutionJacksonMixIn.class); objectMapper.addMixIn(ExecutionContext.class, ExecutionContextJacksonMixIn.class); final StepExecution stepExecution = getStepExecution(); final String result = objectMapper.writeValueAsString(stepExecution); assertThat(result, not(containsString("\"executionContext\":{\"dirty\":true,\"empty\":false}"))); assertThat(result, containsString("\"executionContext\":{\"dirty\":true,\"empty\":false,\"values\":[{")); assertThat(result, containsString("{\"counter\":1234}")); assertThat(result, containsString("{\"myDouble\":1.123456}")); assertThat(result, containsString("{\"Josh\":4444444444}")); assertThat(result, containsString("{\"awesomeString\":\"Yep\"}")); assertThat(result, containsString("{\"hello\":\"world\"")); assertThat(result, containsString("{\"counter2\":9999}")); }
Example #10
Source File: JobExecutionEvent.java From spring-cloud-task with Apache License 2.0 | 6 votes |
/** * Constructor for the StepExecution to initialize the DTO. * @param original the StepExecution to build this DTO around. */ public JobExecutionEvent(JobExecution original) { this.jobParameters = new JobParametersEvent( original.getJobParameters().getParameters()); this.jobInstance = new JobInstanceEvent(original.getJobInstance().getId(), original.getJobInstance().getJobName()); for (StepExecution stepExecution : original.getStepExecutions()) { this.stepExecutions.add(new StepExecutionEvent(stepExecution)); } this.status = original.getStatus(); this.startTime = original.getStartTime(); this.createTime = original.getCreateTime(); this.endTime = original.getEndTime(); this.lastUpdated = original.getLastUpdated(); this.exitStatus = new ExitStatus(original.getExitStatus()); this.executionContext = original.getExecutionContext(); this.failureExceptions = original.getFailureExceptions(); this.jobConfigurationName = original.getJobConfigurationName(); this.setId(original.getId()); this.setVersion(original.getVersion()); }
Example #11
Source File: SpringBatchIntegrationTest.java From tutorials with MIT License | 6 votes |
@Test public void givenReferenceOutput_whenStep1Executed_thenSuccess() throws Exception { // given FileSystemResource expectedResult = new FileSystemResource(EXPECTED_OUTPUT); FileSystemResource actualResult = new FileSystemResource(TEST_OUTPUT); // when JobExecution jobExecution = jobLauncherTestUtils.launchStep("step1", defaultJobParameters()); Collection<StepExecution> actualStepExecutions = jobExecution.getStepExecutions(); ExitStatus actualJobExitStatus = jobExecution.getExitStatus(); // then assertThat(actualStepExecutions.size(), is(1)); assertThat(actualJobExitStatus.getExitCode(), is("COMPLETED")); AssertFile.assertFileEquals(expectedResult, actualResult); }
Example #12
Source File: ComposedRunnerVisitorTests.java From composed-task-runner with Apache License 2.0 | 6 votes |
@Test public void testSequentialTransitionAndSplit() { setupContextForGraph("AAA && FFF 'FAILED' -> EEE && <BBB||CCC> && DDD"); Collection<StepExecution> stepExecutions = getStepExecutions(); Set<String> stepNames = getStepNames(stepExecutions); assertEquals(5, stepExecutions.size()); assertTrue(stepNames.contains("AAA_0")); assertTrue(stepNames.contains("BBB_0")); assertTrue(stepNames.contains("CCC_0")); assertTrue(stepNames.contains("DDD_0")); assertTrue(stepNames.contains("FFF_0")); List<StepExecution> sortedStepExecution = getSortedStepExecutions(stepExecutions); assertEquals("AAA_0", sortedStepExecution.get(0).getStepName()); assertEquals("DDD_0", sortedStepExecution.get(4).getStepName()); }
Example #13
Source File: SpringSmtpMailSender.java From pinpoint with Apache License 2.0 | 6 votes |
@Override public void sendEmail(AlarmChecker checker, int sequenceCount, StepExecution stepExecution) { List<String> receivers = userGroupService.selectEmailOfMember(checker.getuserGroupId()); if (receivers.size() == 0) { return; } try{ AlarmMailTemplate mailTemplate = new AlarmMailTemplate(checker, pinpointUrl, batchEnv, sequenceCount); MimeMessage message = springMailSender.createMimeMessage(); message.setFrom(senderEmailAddress); message.setRecipients(Message.RecipientType.TO, getReceivers(receivers)); final String subject = mailTemplate.createSubject(); message.setSubject(subject); message.setContent(mailTemplate.createBody(), "text/html"); springMailSender.send(message); logger.info("send email : {}", subject); }catch(Exception e){ logger.error("can't send alarm email. {}", checker.getRule(), e); } }
Example #14
Source File: EventTransformer.java From spring-batch-lightmin with Apache License 2.0 | 6 votes |
public static StepExecutionEventInfo transformToStepExecutionEventInfo(final StepExecution stepExecution, final String applicationName) { final StepExecutionEventInfo stepExecutionEventInfo = new StepExecutionEventInfo(); stepExecutionEventInfo.setApplicationName(applicationName); stepExecutionEventInfo.setJobName(stepExecution.getJobExecution().getJobInstance().getJobName()); stepExecutionEventInfo.setStepName(stepExecution.getStepName()); stepExecutionEventInfo.setExitStatus(BatchToResourceMapper.map(stepExecution.getExitStatus())); stepExecutionEventInfo.setReadCount(stepExecution.getReadCount()); stepExecutionEventInfo.setWriteCount(stepExecution.getWriteCount()); stepExecutionEventInfo.setCommitCount(stepExecution.getCommitCount()); stepExecutionEventInfo.setRollbackCount(stepExecution.getRollbackCount()); stepExecutionEventInfo.setReadSkipCount(stepExecution.getReadSkipCount()); stepExecutionEventInfo.setProcessSkipCount(stepExecution.getProcessSkipCount()); stepExecutionEventInfo.setWriteSkipCount(stepExecution.getWriteSkipCount()); return stepExecutionEventInfo; }
Example #15
Source File: StepExecutionEvent.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (!(obj instanceof StepExecution) || getId() == null) { return super.equals(obj); } StepExecution other = (StepExecution) obj; return this.stepName.equals(other.getStepName()) && (this.jobExecutionId == other.getJobExecutionId()) && getId().equals(other.getId()); }
Example #16
Source File: StepExecutionEventTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Test public void testHashCode() { StepExecution stepExecution = getBasicStepExecution(); StepExecutionEvent stepExecutionEvent = new StepExecutionEvent(stepExecution); assertThat(stepExecutionEvent.toString()) .isEqualTo("StepExecutionEvent: id=null, version=null, " + "name=STEP_NAME, status=STARTING, exitStatus=EXECUTING, " + "readCount=0, filterCount=0, writeCount=0 readSkipCount=0, " + "writeSkipCount=0, processSkipCount=0, commitCount=0, " + "rollbackCount=0, exitDescription="); }
Example #17
Source File: DeployerStepExecutionHandlerTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Test public void testRuntimeException() throws Exception { StepExecution workerStep = new StepExecution("workerStep", new JobExecution(1L), 2L); when(this.environment.containsProperty( DeployerPartitionHandler.SPRING_CLOUD_TASK_JOB_EXECUTION_ID)) .thenReturn(true); when(this.environment.containsProperty( DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_EXECUTION_ID)) .thenReturn(true); when(this.environment .containsProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME)) .thenReturn(true); when(this.environment .getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME)) .thenReturn("workerStep"); when(this.beanFactory.getBeanNamesForType(Step.class)) .thenReturn(new String[] { "workerStep", "foo", "bar" }); when(this.environment.getProperty( DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_EXECUTION_ID)) .thenReturn("2"); when(this.environment .getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_JOB_EXECUTION_ID)) .thenReturn("1"); when(this.jobExplorer.getStepExecution(1L, 2L)).thenReturn(workerStep); when(this.environment .getProperty(DeployerPartitionHandler.SPRING_CLOUD_TASK_STEP_NAME)) .thenReturn("workerStep"); when(this.beanFactory.getBean("workerStep", Step.class)).thenReturn(this.step); doThrow(new RuntimeException("expected")).when(this.step).execute(workerStep); this.handler.run(); verify(this.jobRepository).update(this.stepExecutionArgumentCaptor.capture()); assertThat(this.stepExecutionArgumentCaptor.getValue().getStatus()) .isEqualTo(BatchStatus.FAILED); }
Example #18
Source File: MetricsListener.java From spring-boot-starter-batch-web with Apache License 2.0 | 5 votes |
@Override public ExitStatus afterStep(StepExecution stepExecution) { // Calculate step execution time // Why is stepExecution.getEndTime().getTime() not available here? (see AbstractStep) long stepDuration = System.currentTimeMillis() - stepExecution.getStartTime().getTime(); meterRegistry.gauge(METRIC_NAME, Arrays.asList(// new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), // new ImmutableTag("name", "duration")// ), stepDuration); long itemCount = stepExecution.getWriteCount() + stepExecution.getSkipCount(); meterRegistry.gauge(METRIC_NAME, Arrays.asList(// new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), // new ImmutableTag("name", "item.count")// ), itemCount); // Calculate execution time per item long durationPerItem = 0; if (itemCount > 0) { durationPerItem = stepDuration / itemCount; } meterRegistry.gauge(METRIC_NAME, Arrays.asList(// new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), // new ImmutableTag("name", "item.duration")// ), durationPerItem); // Export metrics from StepExecution to MetricRepositories Set<Entry<String, Object>> metrics = stepExecution.getExecutionContext().entrySet(); for (Entry<String, Object> metric : metrics) { if (metric.getValue() instanceof Number) { meterRegistry.gauge(METRIC_NAME, Arrays.asList(// new ImmutableTag("context", getStepExecutionIdentifier(stepExecution)), // new ImmutableTag("name", metric.getKey())// ), (Number) metric.getValue()); } } return null; }
Example #19
Source File: ComposedRunnerVisitorTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Test public void testSuccessBasicTransitionWithTransition() { setupContextForGraph("AAA 'FAILED' -> BBB && CCC 'FAILED' -> DDD '*' -> EEE"); Collection<StepExecution> stepExecutions = getStepExecutions(); Set<String> stepNames = getStepNames(stepExecutions); assertEquals(3, stepExecutions.size()); assertTrue(stepNames.contains("AAA_0")); assertTrue(stepNames.contains("CCC_0")); assertTrue(stepNames.contains("EEE_0")); List<StepExecution> sortedStepExecution = getSortedStepExecutions(stepExecutions); assertEquals("AAA_0", sortedStepExecution.get(0).getStepName()); assertEquals("EEE_0", sortedStepExecution.get(2).getStepName()); }
Example #20
Source File: ComposedRunnerVisitorTests.java From composed-task-runner with Apache License 2.0 | 5 votes |
@Test public void nestedSplit() { setupContextForGraph("<<AAA || BBB > && CCC || DDD>", "--splitThreadCorePoolSize=5"); Collection<StepExecution> stepExecutions = getStepExecutions(); Set<String> stepNames = getStepNames(stepExecutions); assertEquals(4, stepExecutions.size()); assertTrue(stepNames.contains("AAA_0")); assertTrue(stepNames.contains("BBB_0")); assertTrue(stepNames.contains("CCC_0")); assertTrue(stepNames.contains("DDD_0")); }
Example #21
Source File: StepExecutionEventTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
private StepExecution getBasicStepExecution() { JobInstance jobInstance = new JobInstance(JOB_INSTANCE_ID, JOB_NAME); JobParameters jobParameters = new JobParameters(); JobExecution jobExecution = new JobExecution(jobInstance, JOB_EXECUTION_ID, jobParameters, JOB_CONFIGURATION_NAME); return new StepExecution(STEP_NAME, jobExecution); }
Example #22
Source File: TestDependencies.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
@Bean public Jackson2ObjectMapperBuilderCustomizer dataflowObjectMapperBuilderCustomizer() { return (builder) -> { builder.dateFormat(new ISO8601DateFormatWithMilliSeconds()); builder.mixIn(StepExecution.class, StepExecutionJacksonMixIn.class); builder.mixIn(ExecutionContext.class, ExecutionContextJacksonMixIn.class); builder.modules(new JavaTimeModule()); }; }
Example #23
Source File: DeployerPartitionHandlerTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
private StepExecution getStepExecutionFinish(StepExecution stepExecutionStart, BatchStatus status) { StepExecution workerStepExecutionFinish = new StepExecution( stepExecutionStart.getStepName(), stepExecutionStart.getJobExecution()); workerStepExecutionFinish.setId(stepExecutionStart.getId()); workerStepExecutionFinish.setStatus(status); return workerStepExecutionFinish; }
Example #24
Source File: StepExecutionResource.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
/** * Create a new StepExecutionResource * * @param jobExecutionId the job execution id, must not be null * @param stepExecution the step execution, must not be null * @param stepType the step type */ public StepExecutionResource(Long jobExecutionId, StepExecution stepExecution, String stepType) { Assert.notNull(jobExecutionId, "jobExecutionId must not be null."); Assert.notNull(stepExecution, "stepExecution must not be null."); this.stepExecution = stepExecution; this.jobExecutionId = jobExecutionId; this.stepType = stepType; }
Example #25
Source File: ComposedRunnerVisitorTests.java From composed-task-runner with Apache License 2.0 | 5 votes |
private Set<String> getStepNames(Collection<StepExecution> stepExecutions) { Set<String> result = new HashSet<>(); for (StepExecution stepExecution : stepExecutions) { result.add(stepExecution.getStepName()); } return result; }
Example #26
Source File: StepExecutionEventTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Test public void testException() { RuntimeException exception = new RuntimeException("EXPECTED EXCEPTION"); StepExecution stepExecution = getBasicStepExecution(); stepExecution.addFailureException(exception); StepExecutionEvent stepExecutionEvent = new StepExecutionEvent(stepExecution); assertThat(stepExecutionEvent.getFailureExceptions().size()).isEqualTo(1); assertThat(stepExecution.getFailureExceptions().get(0)).isEqualTo(exception); }
Example #27
Source File: ItemReaderWriterConfig.java From batchers with Apache License 2.0 | 5 votes |
@Bean(destroyMethod = "") @StepScope public JpaPagingItemReader<TaxCalculation> wsCallItemReader(@Value("#{jobParameters[year]}") Long year, @Value("#{jobParameters[month]}") Long month, @Value("#{stepExecution}") StepExecution stepExecution) { JpaPagingItemReader<TaxCalculation> employeeItemReader = new JpaPagingItemReader<>(); employeeItemReader.setEntityManagerFactory(persistenceConfig.entityManagerFactory()); employeeItemReader.setQueryString(TaxCalculation.FIND_BY_YEAR_AND_MONTH_QUERY); Map<String, Object> queryParams = new HashMap<>(); queryParams.put("year", year.intValue()); queryParams.put("month", month.intValue()); queryParams.put("jobExecutionId", stepExecution.getJobExecutionId()); employeeItemReader.setParameterValues(queryParams); employeeItemReader.setSaveState(false); return employeeItemReader; }
Example #28
Source File: FailedStepStepExecutionListener.java From batchers with Apache License 2.0 | 5 votes |
@Override public ExitStatus afterStep(StepExecution stepExecution) { if (someItemsGotSkippedDueToTaxWebServiceExceptions(stepExecution)) { //stepExecution.setStatus(BatchStatus.FAILED); return ExitStatus.FAILED; } return ExitStatus.COMPLETED; }
Example #29
Source File: BaseJobDecider.java From spring-boot-doma2-sample with Apache License 2.0 | 5 votes |
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { val context = jobExecution.getExecutionContext(); if (!decideToProceed(context)) { return new FlowExecutionStatus(EXECUTION_STATUS_SKIP); } return FlowExecutionStatus.COMPLETED; }
Example #30
Source File: IncrementalColumnRangePartitionerTests.java From spring-cloud-task-app-starters with Apache License 2.0 | 5 votes |
@Test public void testNoPartitions() { partitioner.setPartitions(1); partitioner.beforeStep(new StepExecution("step1", new JobExecution(5l))); Map<String, ExecutionContext> partitions = partitioner.partition(1); assertEquals(1, partitions.size()); assertTrue(partitions.containsKey("partition0")); assertEquals("", partitions.get("partition0").get("partClause")); assertEquals("", partitions.get("partition0").get("partSuffix")); }