use of org.springframework.batch.item.ExecutionContext 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());
}
use of org.springframework.batch.item.ExecutionContext in project pinpoint by naver.
the class AlarmPartitioner method partition.
@Override
public Map<String, ExecutionContext> partition(int gridSize) {
int partitionCount = calculateGroupCount();
Map<String, ExecutionContext> mapContext = new HashMap<>();
for (int i = 1; i <= partitionCount; i++) {
ExecutionContext executionContext = new ExecutionContext();
executionContext.put(PARTITION_NUMBER, i);
mapContext.put(PARTITION_NUMBER + "_" + i, executionContext);
}
return mapContext;
}
use of org.springframework.batch.item.ExecutionContext in project RecordManager2 by moravianlibrary.
the class DateIntervalPartitionerTest method test.
@Test
public void test() {
Date from = OAIGranularity.stringToDate("2010-06-30T01:20:00Z");
Date to = OAIGranularity.stringToDate("2012-09-30T01:20");
DateIntervalPartitioner interval = new DateIntervalPartitioner(from, to, Period.months(1), "to", "from");
Map<String, ExecutionContext> intervals = interval.partition(0);
Assert.assertEquals(intervals.size(), 28);
}
use of org.springframework.batch.item.ExecutionContext in project tutorials by eugenp.
the class LinesWriter method beforeStep.
@Override
public void beforeStep(StepExecution stepExecution) {
ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext();
this.lines = (List<Line>) executionContext.get("lines");
fu = new FileUtils("output.csv");
logger.debug("Lines Writer initialized.");
}
use of org.springframework.batch.item.ExecutionContext in project pinpoint by naver.
the class AlarmReaderTest method readTest.
@Test
public void readTest() {
StepExecution stepExecution = new StepExecution("alarmStep", null);
ExecutionContext executionContext = new ExecutionContext();
stepExecution.setExecutionContext(executionContext);
AlarmReader reader = new AlarmReader(dataCollectorFactory, applicationIndexDao, alarmService);
reader.beforeStep(stepExecution);
for (int i = 0; i < 7; i++) {
assertNotNull(reader.read());
}
assertNull(reader.read());
}
Aggregations