use of org.springframework.batch.core.StepExecution in project head by mifos.
the class MifosScheduler method getJobFailDescription.
public String getJobFailDescription(String jobName) {
String failDescription = null;
JobExplorer explorer = getBatchJobExplorer();
List<JobInstance> jobInstances = explorer.getJobInstances(jobName, 0, 1);
if (jobInstances.size() > 0) {
List<JobExecution> jobExecutions = explorer.getJobExecutions(jobInstances.get(0));
if (jobExecutions.size() > 0) {
Collection<StepExecution> steps = jobExecutions.get(0).getStepExecutions();
if (steps.size() > 0) {
StepExecution step = steps.iterator().next();
if (!step.getExitStatus().getExitDescription().isEmpty()) {
failDescription = step.getExitStatus().getExitDescription();
}
}
}
}
return failDescription;
}
use of org.springframework.batch.core.StepExecution in project pinpoint by naver.
the class AlarmReaderTest method readTest3.
@Test
public void readTest3() {
StepExecution stepExecution = new StepExecution("alarmStep", null);
ExecutionContext executionContext = new ExecutionContext();
stepExecution.setExecutionContext(executionContext);
AlarmServiceImpl alarmService = new AlarmServiceImpl(mock(AlarmDao.class), mock(WebhookSendInfoDao.class)) {
@Override
public List<Rule> selectRuleByApplicationId(String applicationId) {
return new LinkedList<>();
}
};
AlarmReader reader = new AlarmReader(dataCollectorFactory, applicationIndexDao, alarmService);
reader.beforeStep(stepExecution);
assertNull(reader.read());
}
use of org.springframework.batch.core.StepExecution in project pinpoint by naver.
the class ReaderTest method readTest2.
@Test
public void readTest2() {
StepExecution stepExecution = new StepExecution("alarmStep", null);
ExecutionContext executionContext = new ExecutionContext();
executionContext.put(AlarmPartitioner.PARTITION_NUMBER, 2);
stepExecution.setExecutionContext(executionContext);
AlarmReader reader = new AlarmReader(dataCollectorFactory, applicationIndexDao, alarmService);
reader.beforeStep(stepExecution);
for (int i = 0; i < 2; i++) {
assertNotNull(reader.read());
}
assertNull(reader.read());
}
use of org.springframework.batch.core.StepExecution in project pinpoint by naver.
the class ReaderTest method readTest.
@Test
public void readTest() {
StepExecution stepExecution = new StepExecution("alarmStep", null);
ExecutionContext executionContext = new ExecutionContext();
executionContext.put(AlarmPartitioner.PARTITION_NUMBER, 1);
stepExecution.setExecutionContext(executionContext);
AlarmReader reader = new AlarmReader(dataCollectorFactory, applicationIndexDao, alarmService);
reader.beforeStep(stepExecution);
for (int i = 0; i < 5; i++) {
assertNotNull(reader.read());
}
assertNull(reader.read());
}
use of org.springframework.batch.core.StepExecution in project pinpoint by naver.
the class ReaderTest method readTest3.
@Test
public void readTest3() {
StepExecution stepExecution = new StepExecution("alarmStep", null);
ExecutionContext executionContext = new ExecutionContext();
executionContext.put(AlarmPartitioner.PARTITION_NUMBER, 2);
stepExecution.setExecutionContext(executionContext);
AlarmServiceImpl alarmService = new AlarmServiceImpl() {
@Override
public java.util.List<Rule> selectRuleByApplicationId(String applicationId) {
return new LinkedList<Rule>();
}
};
AlarmReader reader = new AlarmReader(dataCollectorFactory, applicationIndexDao, alarmService);
reader.beforeStep(stepExecution);
assertNull(reader.read());
}
Aggregations