Package org.apache.lucene.benchmark.byTask.utils

Examples of org.apache.lucene.benchmark.byTask.utils.Algorithm


      throw new Exception("Error: cannot init PerfRunData!",e);
    }
   
    // parse algorithm
    try {
      algorithm = new Algorithm(runData);
    } catch (Exception e) {
      throw new Exception("Error: cannot understand algorithm!",e);
    }
  }
View Full Code Here


      }
      try {
        String algText = propPart+INDENT+testedTask;
        logTstParsing(algText);
        Benchmark benchmark = new Benchmark(new StringReader(algText));
        Algorithm alg = benchmark.getAlgorithm();
        ArrayList algTasks = alg.extractTasks();
        // must find a task with this name in the algorithm
        boolean foundName = false;
        boolean foundPar = false;
        String theTask = singleTaskAlgs[i].replaceAll(" +"," ").trim();
        for (Iterator iter = algTasks.iterator(); iter.hasNext();) {
          PerfTask task = (PerfTask) iter.next();
          foundName |= (task.toString().indexOf(theTask)>=0);
          foundPar |= (task instanceof TaskSequence && ((TaskSequence)task).isParallel());
        }
        assertTrue("Task "+testedTask+" was not found in "+alg.toString(),foundName);
        if (parOrSeq) {
          if (par) {
            assertTrue("Task "+testedTask+" was supposed to be parallel in "+alg.toString(),foundPar);
          } else {
            assertFalse("Task "+testedTask+" was not supposed to be parallel in "+alg.toString(),foundPar);
          }
        }
      } catch (Exception e) {
        System.out.flush();
        e.printStackTrace();
View Full Code Here

   */
  public void testParseParallelTaskSequenceRepetition() throws Exception {
    String taskStr = "AddDoc";
    String parsedTasks = "[ "+taskStr+" ] : 1000";
    Benchmark benchmark = new Benchmark(new StringReader(propPart+parsedTasks));
    Algorithm alg = benchmark.getAlgorithm();
    ArrayList algTasks = alg.extractTasks();
    boolean foundAdd = false;
    for (Iterator iter = algTasks.iterator(); iter.hasNext();) {
       PerfTask task = (PerfTask) iter.next();
       if (task.toString().indexOf(taskStr)>=0) {
          foundAdd = true;
       }
       if (task instanceof TaskSequence) {
         assertEquals("repetions should be 1000 for "+parsedTasks, 1000, ((TaskSequence) task).getRepetitions());
         assertTrue("sequence for "+parsedTasks+" should be parallel!", ((TaskSequence) task).isParallel());
       }
       assertTrue("Task "+taskStr+" was not found in "+alg.toString(),foundAdd);
    }
  }
View Full Code Here

   */
  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 algTasks = alg.extractTasks();
    boolean foundAdd = false;
    for (Iterator iter = algTasks.iterator(); iter.hasNext();) {
       PerfTask task = (PerfTask) iter.next();
       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);
    }
  }
View Full Code Here

  /** Test the repetiotion parsing for parallel tasks */
  public void testParseParallelTaskSequenceRepetition() throws Exception {
    String taskStr = "AddDoc";
    String parsedTasks = "[ "+taskStr+" ] : 1000";
    Benchmark benchmark = new Benchmark(new StringReader(propPart+parsedTasks));
    Algorithm alg = benchmark.getAlgorithm();
    ArrayList algTasks = alg.extractTasks();
    boolean foundAdd = false;
    for (Iterator iter = algTasks.iterator(); iter.hasNext();) {
       PerfTask task = (PerfTask) iter.next();
       if (task.toString().indexOf(taskStr)>=0) {
          foundAdd = true;
       }
       if (task instanceof TaskSequence) {
         assertEquals("repetions should be 1000 for "+parsedTasks, 1000, ((TaskSequence) task).getRepetitions());
         assertTrue("sequence for "+parsedTasks+" should be parallel!", ((TaskSequence) task).isParallel());
       }
       assertTrue("Task "+taskStr+" was not found in "+alg.toString(),foundAdd);
    }
  }
View Full Code Here

  /** 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 algTasks = alg.extractTasks();
    boolean foundAdd = false;
    for (Iterator iter = algTasks.iterator(); iter.hasNext();) {
       PerfTask task = (PerfTask) iter.next();
       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);
    }
  }
View Full Code Here

      throw new Exception("Error: cannot init PerfRunData!",e);
    }
   
    // parse algorithm
    try {
      algorithm = new Algorithm(runData);
    } catch (Exception e) {
      throw new Exception("Error: cannot understand algorithm!",e);
    }
  }
View Full Code Here

  /** Test the repetiotion parsing for parallel tasks */
  public void testParseParallelTaskSequenceRepetition() 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());
         assertTrue("sequence for "+parsedTasks+" should be parallel!", ((TaskSequence) task).isParallel());
       }
       assertTrue("Task "+taskStr+" was not found in "+alg.toString(),foundAdd);
    }
  }
View Full Code Here

  /** 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);
    }
  }
View Full Code Here

        if (config.get("query.maker", null) != null) {
          Class.forName(config.get("query.maker", null));
          config.set("query.maker", MockQueryMaker.class.getName());
        }
        PerfRunData data = new PerfRunData(config);
        new Algorithm(data);
      } catch (Throwable t) {
        throw new AssertionError("Could not parse sample file: " + algFile, t);
      }
      foundFiles = true;
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.benchmark.byTask.utils.Algorithm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.