use of org.apache.lucene.benchmark.byTask.tasks.TaskSequence in project lucene-solr by apache.
the class TestPerfTasksParse method testParseTaskSequenceRepetition.
/** Test the repetiotion parsing for sequential tasks */
public void testParseTaskSequenceRepetition() throws Exception {
String taskStr = "AddDoc";
String parsedTasks = "{ " + taskStr + " } : 1000";
Benchmark benchmark = new Benchmark(new StringReader(propPart + parsedTasks));
Algorithm alg = benchmark.getAlgorithm();
ArrayList<PerfTask> algTasks = alg.extractTasks();
boolean foundAdd = false;
for (final PerfTask task : algTasks) {
if (task.toString().indexOf(taskStr) >= 0) {
foundAdd = true;
}
if (task instanceof TaskSequence) {
assertEquals("repetions should be 1000 for " + parsedTasks, 1000, ((TaskSequence) task).getRepetitions());
assertFalse("sequence for " + parsedTasks + " should be sequential!", ((TaskSequence) task).isParallel());
}
assertTrue("Task " + taskStr + " was not found in " + alg.toString(), foundAdd);
}
}
Aggregations