Package org.apache.jorphan.collections

Examples of org.apache.jorphan.collections.SearchByClass$Test


    this.monitor = monitor;
    threadVars = new JMeterVariables();
    testTree = test;
    compiler = new TestCompiler(testTree, threadVars);
    controller = (Controller) testTree.getArray()[0];
    SearchByClass threadListenerSearcher = new SearchByClass(TestListener.class);
    test.traverse(threadListenerSearcher);
    testListeners = threadListenerSearcher.getSearchResults();
    notifier = note;
    running = true;
  }
View Full Code Here


   *
   * @see java.lang.Runnable#run()
   */
  public void run() {
    log.info("running clientengine run method");
    testListeners = new SearchByClass(TestListener.class);
    sampleListeners = new ConvertListeners();
    HashTree testTree = getTestTree();
    synchronized(testTree) {
      testTree.traverse(testListeners);
      testTree.traverse(sampleListeners);
View Full Code Here

  public void run() {
    log.info("Running the test!");
    running = true;
    testList = new ArrayList();

    SearchByClass testPlan = new SearchByClass(TestPlan.class);
    getTestTree().traverse(testPlan);
    Object[] plan = testPlan.getSearchResults().toArray();
    if (plan.length == 0) {
      System.err.println("Could not find the TestPlan!");
      log.error("Could not find the TestPlan!");
      System.exit(1);
    }
    if (((TestPlan) plan[0]).isSerialized()) {
      serialized = true;
    }
        JMeterContextService.startTest();
        try {
          compileTree();
      } catch (RuntimeException e) {
        log.error("Error occurred compiling the tree:",e);
        JMeterUtils.reportErrorToUser("Error occurred compiling the tree: - see log file");
        return; // no point continuing
        }
    /**
     * Notification of test listeners needs to happen after function
     * replacement, but before setting RunningVersion to true.
     */
    testListeners = new SearchByClass(TestListener.class);
    getTestTree().traverse(testListeners);
   
    //  Merge in any additional test listeners
    // currently only used by the function parser
    testListeners.getSearchResults().addAll(testList);
    testList = null; // no longer needed
   
    if (!startListenersLater )notifyTestListenersOfStart();
    getTestTree().traverse(new TurnElementsOn());
        if (startListenersLater)notifyTestListenersOfStart();

    List testLevelElements = new LinkedList(getTestTree().list(getTestTree().getArray()[0]));
    removeThreadGroups(testLevelElements);
    SearchByClass searcher = new SearchByClass(ThreadGroup.class);
    getTestTree().traverse(searcher);
    TestCompiler.initialize();
    // for each thread group, generate threads
    // hand each thread the sampler controller
    // and the listeners, and the timer
    Iterator iter = searcher.getSearchResults().iterator();

    /*
     * Here's where the test really starts. Run a Full GC now: it's no harm
     * at all (just delays test start by a tiny amount) and hitting one too
     * early in the test can impair results for short tests.
     */
    System.gc();

    notifier = new ListenerNotifier();

    schcdule_run = true;
    JMeterContextService.getContext().setSamplingStarted(true);
    int groupCount = 0;
        JMeterContextService.clearTotalThreads();
        startingGroups = true;
    while (iter.hasNext()) {
      groupCount++;
      ThreadGroup group = (ThreadGroup) iter.next();
      int numThreads = group.getNumThreads();
            JMeterContextService.addTotalThreads(numThreads);
      boolean onErrorStopTest = group.getOnErrorStopTest();
      boolean onErrorStopThread = group.getOnErrorStopThread();
      String groupName = group.getName();
      int rampUp = group.getRampUp();
      float perThreadDelay = ((float) (rampUp * 1000) / (float) numThreads);
      log.info("Starting " + numThreads + " threads for group " + groupName + ". Ramp up = " + rampUp + ".");

      if (onErrorStopTest) {
        log.info("Test will stop on error");
      } else if (onErrorStopThread) {
        log.info("Thread will stop on error");
      } else {
        log.info("Continue on error");
      }

            ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
            threadGroupTree.add(group, testLevelElements);
      for (int i = 0; running && i < numThreads; i++) {
                final JMeterThread jmeterThread = new JMeterThread(cloneTree(threadGroupTree), this, notifier);
                jmeterThread.setThreadNum(i);
        jmeterThread.setThreadGroup(group);
View Full Code Here

  public void run() {
    log.info("Running the test!");
    running = true;
    testList = new ArrayList();

    SearchByClass testPlan = new SearchByClass(TestPlan.class);
    getTestTree().traverse(testPlan);
    Object[] plan = testPlan.getSearchResults().toArray();
    if (plan.length == 0) {
      System.err.println("Could not find the TestPlan!");
      log.error("Could not find the TestPlan!");
      System.exit(1);
    }
    if (((TestPlan) plan[0]).isSerialized()) {
      serialized = true;
    }
    JMeterContextService.startTest();
    compileTree();
    /**
     * Notification of test listeners needs to happen after function
     * replacement, but before setting RunningVersion to true.
     */
    testListeners = new SearchByClass(TestListener.class);
    getTestTree().traverse(testListeners);
    Collection col = testListeners.getSearchResults();
    col.addAll(testList);
    testList = null;
    notifyTestListenersOfStart();
    getTestTree().traverse(new TurnElementsOn());

    List testLevelElements = new LinkedList(getTestTree().list(getTestTree().getArray()[0]));
    removeThreadGroups(testLevelElements);
    SearchByClass searcher = new SearchByClass(ThreadGroup.class);
    getTestTree().traverse(searcher);
    TestCompiler.initialize();
    // for each thread group, generate threads
    // hand each thread the sampler controller
    // and the listeners, and the timer
    JMeterThread[] threads;
    Iterator iter = searcher.getSearchResults().iterator();

    /*
     * Here's where the test really starts. Run a Full GC now: it's no harm
     * at all (just delays test start by a tiny amount) and hitting one too
     * early in the test can impair results for short tests.
     */
    System.gc();

    notifier = new ListenerNotifier();

    schcdule_run = true;
    JMeterContextService.getContext().setSamplingStarted(true);
    int groupCount = 0;
    while (iter.hasNext()) {
      groupCount++;
      ThreadGroup group = (ThreadGroup) iter.next();
      int numThreads = group.getNumThreads();
      boolean onErrorStopTest = group.getOnErrorStopTest();
      boolean onErrorStopThread = group.getOnErrorStopThread();
      String groupName = group.getName();
      int rampUp = group.getRampUp();
      float perThreadDelay = ((float) (rampUp * 1000) / (float) numThreads);
      threads = new JMeterThread[numThreads];

      log.info("Starting " + numThreads + " threads for group " + groupName + ". Ramp up = " + rampUp + ".");

      if (onErrorStopTest) {
        log.info("Test will stop on error");
      } else if (onErrorStopThread) {
        log.info("Thread will stop on error");
      } else {
        log.info("Continue on error");
      }

      for (int i = 0; running && i < threads.length; i++) {
        ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
        threadGroupTree.add(group, testLevelElements);
        threads[i] = new JMeterThread(cloneTree(threadGroupTree), this, notifier);
        threads[i].setThreadNum(i);
        threads[i].setThreadGroup(group);
        threads[i].setInitialContext(JMeterContextService.getContext());
View Full Code Here

     *
     * @see java.lang.Runnable#run()
     */
    public void run() {
        log.info("running clientengine run method");
        SearchByClass testListeners = new SearchByClass(TestListener.class);
        ConvertListeners sampleListeners = new ConvertListeners();
        HashTree testTree = test;
        PreCompiler compiler = new PreCompiler(true); // limit the changes to client only test elements
        synchronized(testTree) {
            testTree.traverse(compiler);
View Full Code Here

            JMeterTreeModel treeModel = new JMeterTreeModel(new Object());// Create non-GUI version to avoid headless problems
            JMeterTreeNode root = (JMeterTreeNode) treeModel.getRoot();
            treeModel.addSubTree(tree, root);

            // Hack to resolve ModuleControllers in non GUI mode
            SearchByClass replaceableControllers = new SearchByClass(ReplaceableController.class);
            tree.traverse(replaceableControllers);
            Collection replaceableControllersRes = replaceableControllers.getSearchResults();
            for (Iterator iter = replaceableControllersRes.iterator(); iter.hasNext();) {
                ReplaceableController replaceableController = (ReplaceableController) iter.next();
                replaceableController.resolveReplacementSubTree(root);
            }
View Full Code Here

        this.monitor = monitor;
        threadVars = new JMeterVariables();
        testTree = test;
        compiler = new TestCompiler(testTree, threadVars);
        controller = (Controller) testTree.getArray()[0];
        SearchByClass threadListenerSearcher = new SearchByClass(TestListener.class);
        test.traverse(threadListenerSearcher);
        testListeners = threadListenerSearcher.getSearchResults();
        notifier = note;
        running = true;
    }
View Full Code Here

    public void run() {
        log.info("Running the test!");
        running = true;

        SearchByClass testPlan = new SearchByClass(TestPlan.class);
        test.traverse(testPlan);
        Object[] plan = testPlan.getSearchResults().toArray();
        if (plan.length == 0) {
            System.err.println("Could not find the TestPlan!");
            log.error("Could not find the TestPlan!");
            System.exit(1);
        }
        if (((TestPlan) plan[0]).isSerialized()) {
            serialized = true;
        }
        JMeterContextService.startTest();
        try {
            PreCompiler compiler = new PreCompiler();
            test.traverse(compiler);
        } catch (RuntimeException e) {
            log.error("Error occurred compiling the tree:",e);
            JMeterUtils.reportErrorToUser("Error occurred compiling the tree: - see log file");
            return; // no point continuing
        }
        /**
         * Notification of test listeners needs to happen after function
         * replacement, but before setting RunningVersion to true.
         */
        SearchByClass testListeners = new SearchByClass(TestListener.class);
        test.traverse(testListeners);

        // Merge in any additional test listeners
        // currently only used by the function parser
        testListeners.getSearchResults().addAll(testList);
        testList.clear(); // no longer needed

        testListenersSave = testListeners;

        if (!startListenersLater ) { notifyTestListenersOfStart(testListeners); }
        test.traverse(new TurnElementsOn());
        if (startListenersLater) { notifyTestListenersOfStart(testListeners); }

        List testLevelElements = new LinkedList(test.list(test.getArray()[0]));
        removeThreadGroups(testLevelElements);
        SearchByClass searcher = new SearchByClass(ThreadGroup.class);
        test.traverse(searcher);
        TestCompiler.initialize();
        // for each thread group, generate threads
        // hand each thread the sampler controller
        // and the listeners, and the timer
        Iterator iter = searcher.getSearchResults().iterator();

        /*
         * Here's where the test really starts. Run a Full GC now: it's no harm
         * at all (just delays test start by a tiny amount) and hitting one too
         * early in the test can impair results for short tests.
         */
        System.gc();

        ListenerNotifier notifier = new ListenerNotifier();

        JMeterContextService.getContext().setSamplingStarted(true);
        int groupCount = 0;
        JMeterContextService.clearTotalThreads();
        startingGroups = true;
        while (running && iter.hasNext()) {// for each thread group
            groupCount++;
            ThreadGroup group = (ThreadGroup) iter.next();
            int numThreads = group.getNumThreads();
            JMeterContextService.addTotalThreads(numThreads);
            boolean onErrorStopTest = group.getOnErrorStopTest();
            boolean onErrorStopTestNow = group.getOnErrorStopTestNow();
            boolean onErrorStopThread = group.getOnErrorStopThread();
            String groupName = group.getName();
            int rampUp = group.getRampUp();
            float perThreadDelay = ((float) (rampUp * 1000) / (float) numThreads);
            log.info("Starting " + numThreads + " threads for group " + groupName + ". Ramp up = " + rampUp + ".");

            if (onErrorStopTest) {
                log.info("Test will stop on error");
            } else if (onErrorStopTestNow) {
                log.info("Test will stop abruptly on error");
            } else if (onErrorStopThread) {
                log.info("Thread will stop on error");
            } else {
                log.info("Thread will continue on error");
            }

            ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
            threadGroupTree.add(group, testLevelElements);
            for (int i = 0; running && i < numThreads; i++) {
                final JMeterThread jmeterThread = new JMeterThread(cloneTree(threadGroupTree), this, notifier);
                jmeterThread.setThreadNum(i);
                jmeterThread.setThreadGroup(group);
View Full Code Here

     * @see java.lang.Runnable#run()
     */
    public void run()
    {
        log.warn("running clientengine run method");
        testListeners = new SearchByClass(TestListener.class);
        getTestTree().traverse(testListeners);
        sampleListeners = new ConvertListeners();
        getTestTree().traverse(sampleListeners);
        try
        {
View Full Code Here

        this.monitor = monitor;
        threadVars = new JMeterVariables();
        testTree = test;
        compiler = new TestCompiler(testTree, threadVars);
        controller = (Controller) testTree.getArray()[0];
        SearchByClass threadListenerSearcher =
            new SearchByClass(TestListener.class);
        test.traverse(threadListenerSearcher);
        testListeners = threadListenerSearcher.getSearchResults();
        notifier = note;
    }
View Full Code Here

TOP

Related Classes of org.apache.jorphan.collections.SearchByClass$Test

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.