Search in sources :

Example 6 with TaskSequence

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);
    }
}
Also used : TaskSequence(org.apache.lucene.benchmark.byTask.tasks.TaskSequence) StringReader(java.io.StringReader) Algorithm(org.apache.lucene.benchmark.byTask.utils.Algorithm) PerfTask(org.apache.lucene.benchmark.byTask.tasks.PerfTask)

Aggregations

TaskSequence (org.apache.lucene.benchmark.byTask.tasks.TaskSequence)6 Properties (java.util.Properties)3 PerfRunData (org.apache.lucene.benchmark.byTask.PerfRunData)3 AddDocTask (org.apache.lucene.benchmark.byTask.tasks.AddDocTask)3 CloseIndexTask (org.apache.lucene.benchmark.byTask.tasks.CloseIndexTask)3 CreateIndexTask (org.apache.lucene.benchmark.byTask.tasks.CreateIndexTask)3 PerfTask (org.apache.lucene.benchmark.byTask.tasks.PerfTask)3 Config (org.apache.lucene.benchmark.byTask.utils.Config)3 StringReader (java.io.StringReader)2 WhitespaceAnalyzer (org.apache.lucene.analysis.core.WhitespaceAnalyzer)2 Algorithm (org.apache.lucene.benchmark.byTask.utils.Algorithm)2 IndexReader (org.apache.lucene.index.IndexReader)2 Term (org.apache.lucene.index.Term)2 IndexSearcher (org.apache.lucene.search.IndexSearcher)2 TermQuery (org.apache.lucene.search.TermQuery)2 TopDocs (org.apache.lucene.search.TopDocs)2 RepSumByNameTask (org.apache.lucene.benchmark.byTask.tasks.RepSumByNameTask)1