Examples of ThreadGroup


Examples of org.apache.jmeter.threads.ThreadGroup

  {
    JMeterUtils.getProperties(propsFile);
    SamplerController sc = createTestSample(url);
    ol = new OutputListener(outfile);
    engine = new StandardJMeterEngine();
    ThreadGroup tGroup = new ThreadGroup();
    tGroup.addListener(ol);
    tGroup.addSamplerController(sc);
    tGroup.setName("Group 1");
    tGroup.setNumThreads(1);
    tGroup.addTimer(new GaussianRandomTimer());
    engine.addThreadGroup(tGroup);

  }
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

    *@param  atts                     !ToDo (Parameter description)
    *@exception  java.lang.Exception  !ToDo (Exception description)
    ***********************************************************/
   public void setAtts(Attributes atts) throws java.lang.Exception
   {
      group = new ThreadGroup();
      group.setName(atts.getValue("name"));
      try
      {
        group.setNumThreads(Integer.parseInt(atts.getValue("numThreads")));
        group.setRampUp(Integer.parseInt(atts.getValue("rampUp")));
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

    *@param  out                      !ToDo (Parameter description)
    *@exception  java.io.IOException  !ToDo (Exception description)
    ***********************************************************/
   public void save(Saveable s, Writer out) throws java.io.IOException
   {
      ThreadGroup save = (ThreadGroup)s;
      out.write("<ThreadGroup name=\"");
      out.write(JMeterHandler.convertToXML(save.getName()));
      out.write("\" numThreads=\"");

      out.write(String.valueOf(save.getNumThreads()));

      out.write("\" rampUp=\"");
      out.write(String.valueOf(save.getRampUp()));
      out.write("\"");

      out.write(">\n");
      Collection controllers = new LinkedList();
      controllers.add(save.getSamplerController());
      JMeterHandler.writeControllers(controllers, out);
      JMeterHandler.writeTimers(save.getTimers(), out);
      JMeterHandler.writeListeners(save.getListeners(), out);
      out.write("</ThreadGroup>\n");
   }
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

        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 + ".");
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

      guiPackage = GuiPackage.getInstance();
      Collection groups = TestPlan.createTestPlan(null).compileTestPlan();
      engine = new ReflectionJMeterEngine();
      for (Iterator i = groups.iterator(); i.hasNext();)
      {
        ThreadGroup tg = (ThreadGroup) i.next();
        if (log.isDebugEnabled())
        {
          log.debug("actionPerformed1 : threadgroup - " + tg);
        }
        engine.addThreadGroup(tg);
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

    int lcLoops = 0;
    boolean lcContinueForever = false;
    running = true;
    JMeterThread jMeterThread;
    Iterator iter = threadGroups.iterator();
    ThreadGroup thisThreadGroup = null;
    boolean runThis = false;
    while(iter.hasNext())
    {
      // look for threadGroup with MethodConfig element
      thisThreadGroup = (ThreadGroup)iter.next();
      GenericController control = (GenericController)
    thisThreadGroup.getSamplerController().clone();
      List subControllerList = control.getSubControllers();
      List configElementList = control.getConfigElements();
      Iterator subControllersIterator = subControllerList.iterator();
      if(catClass.isDebugEnabled())
      {
        catClass.debug("runTest1 : thisThreadGroup - " + thisThreadGroup);
        catClass.debug("runTest1 : controller - " + control);
        catClass.debug("runTest1 : configElementList - " + configElementList);
        catClass.debug("runTest1 : subControllerList - " + subControllerList);
      }
      while(subControllersIterator.hasNext())
      {
        SamplerController samplerController = (SamplerController)
    subControllersIterator.next();
        if(catClass.isDebugEnabled())
        {
          catClass.debug("runTest1 : samplerController type - "
    + samplerController.getClass());
        }
        if(samplerController instanceof JndiTestSample)
        {
          runThis = true;
        }
      }
      if(runThis)
      {
        catClass.debug("runTest1 : running ThreadGroup with JndiTestSample");
        // Change the ThreadGroup looping to 1 'cos you only need to
        // run the JNDISampler once to do reflection
        // Ensure that sampleController of ThreadGroup is a LoopController
        // which is a certainty but still in case things change in the future
        // this should flag it
        LoopController lc = null;
        if(control instanceof LoopController)
        {
          lc = (LoopController)control;
          lcLoops = lc.getLoops();
          lcContinueForever = lc.getContinueForever();
          lc.setContinueForever(false);
    lc.setLoops(1);
          thisThreadGroup.setSamplerController(lc);
        }
        runThis = false;
        jMeterThread = new JMeterThread(thisThreadGroup);
        Thread newThread = new Thread(jMeterThread);
        newThread.start();
        try
        {
          newThread.join();
        }
        catch(InterruptedException e)
        {
          catClass.error(e);
          System.out.println(e);
        }
        lc.setContinueForever(lcContinueForever);
        lc.setLoops(lcLoops);
        thisThreadGroup.setSamplerController(lc);
      }
    }
    catClass.debug("End : runTest1");
  }
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

  private void makeListenersRemote()
  {
    Iterator iter = groups.iterator();
    while(iter.hasNext())
    {
      ThreadGroup item = (ThreadGroup)iter.next();
      try
      {
        RemoteSampleListener rsl =
            new RemoteSampleListenerImpl(new LinkedList(item.getListeners()));
        item.clearListeners();
        item.addRemoteListener(rsl);
      }
      catch(RemoteException e)
      {
        e.printStackTrace();
      }
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

    // keep track of all the threads generated
    Thread[] threadList;
    Iterator iter = threadGroups.iterator();
    while(iter.hasNext())
    {
      ThreadGroup group = (ThreadGroup)iter.next();
      threadCount = threadStartCount;
      while(threadCount <= threadEndCount)
      {
        if(catClass.isDebugEnabled())
        {
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

    // and the listeners, and the timer
    JMeterThread[] threads;
    Iterator iter = threadGroups.iterator();
    while(iter.hasNext())
    {
      ThreadGroup group = (ThreadGroup)iter.next();
      group.resetThreadCount();
      threads = new JMeterThread[group.getNumThreads()];
      for(int i = 0; i < threads.length; i++)
      {
        threads[i] = new JMeterThread(group);
        Thread newThread = new Thread(threads[i]);
        allThreads.add(threads[i]);
View Full Code Here

Examples of org.apache.jmeter.threads.ThreadGroup

      guiPackage = GuiPackage.getInstance();
      Collection groups = TestPlan.createTestPlan(null).compileTestPlan();
      engine = new ReflectionJMeterEngine();
      for(Iterator i = groups.iterator(); i.hasNext();)
      {
        ThreadGroup tg = (ThreadGroup)i.next();
        if(catClass.isDebugEnabled())
        {
          catClass.debug("actionPerformed1 : threadgroup - " + tg);
        }
        engine.addThreadGroup(tg);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.