Package net.grinder.common

Examples of net.grinder.common.GrinderProperties


   * @see net.grinder.console.communication.AgentProcessControl#startAgent(java .util.Set,
   * net.grinder.common.GrinderProperties)
   */
  @Override
  public void startAgent(Set<AgentIdentity> agents, GrinderProperties properties) {
    final GrinderProperties propertiesToSend = properties != null ? properties : new GrinderProperties();
    for (AgentIdentity each : agents) {
      m_consoleCommunication.sendToAddressedAgents(new AgentAddress(each), new StartGrinderMessage(
          propertiesToSend, each.getNumber()));
    }
  }
View Full Code Here


    assertThat(buildJVMArgument, containsString("-Xmx"));
  }

  public PropertyBuilder createPropertyBuilder(String hostString) throws DirectoryException {
    Directory directory = new Directory(new File("."));
    GrinderProperties property = new GrinderProperties();

    return new PropertyBuilder(property, directory, true, hostString, NetworkUtils.getLocalHostName());
  }
View Full Code Here

  public void testStartAgentAndTest() throws InterruptedException, PersistenceException {
    AgentConfig agentConfig1 = Mockito.spy(agentConfig);
    AgentDaemon agent = new AgentDaemon(agentConfig1);
    URL scriptUrl = this.getClass().getResource("/grinder.properties");
    File scriptFile = new File(scriptUrl.getFile());
    GrinderProperties properties = new GrinderProperties(scriptFile);
    agent.run(properties);
    ThreadUtils.sleep(10000);
  }
View Full Code Here

      assertThat(testingList.size(), is(1));

      Long testCount = testService.count(getTestUser(), new Status[]{Status.TESTING});
      assertThat(testCount, is(1L));

      GrinderProperties properties = testService.getGrinderProperties(test);
      assertThat(properties, not(nullValue()));

    }

    createPerfTest("new Test2", Status.getProcessingOrTestingTestStatus()[0], new Date());
View Full Code Here

   * Run grinder with empty {@link GrinderProperties}.
   *
   * @throws GrinderException occurs when initialization is failed.
   */
  public void run() throws GrinderException {
    run(new GrinderProperties());
  }
View Full Code Here

    m_timer = new Timer(false);
    try {
      while (true) {
        m_logger.info(GrinderBuild.getName());
        ScriptLocation script = null;
        GrinderProperties properties;

        do {
          properties = createAndMergeProperties(grinderProperties,
              startMessage != null ? startMessage.getProperties() : null);
          properties.setProperty(GrinderProperties.CONSOLE_HOST, m_agentConfig.getControllerIP());
          m_agentIdentity.setName(m_agentConfig.getAgentHostID());
          final Connector connector = m_connectorFactory.create(properties);
          // We only reconnect if the connection details have changed.
          if (consoleCommunication != null && !consoleCommunication.getConnector().equals(connector)) {
            shutdownConsoleCommunication(consoleCommunication);
            consoleCommunication = null;
            // Accept any startMessage from previous console - see
            // bug 2092881.
          }

          if (consoleCommunication == null && connector != null) {
            try {
              consoleCommunication = new ConsoleCommunication(connector, grinderProperties.getProperty(
                  "grinder.user", "_default"));
              consoleCommunication.start();
              m_logger.info("Connect to console at {}", connector.getEndpointAsString());
            } catch (CommunicationException e) {
              if (m_proceedWithoutConsole) {
                m_logger.warn("{}, proceeding without the console; set "
                    + "grinder.useConsole=false to disable this warning.", e.getMessage());
              } else {
                m_logger.error(e.getMessage());
                return;
              }
            }
          }

          if (consoleCommunication != null && startMessage == null) {
            m_logger.info("Waiting for console signal");
            m_consoleListener.waitForMessage();

            if (m_consoleListener.received(ConsoleListener.START)) {
              startMessage = m_consoleListener.getLastStartGrinderMessage();
              continue; // Loop to handle new properties.
            } else {
              break; // Another message, check at end of outer while loop.
            }
          }

          if (startMessage != null) {

            final GrinderProperties messageProperties = startMessage.getProperties();
            final Directory fileStoreDirectory = m_fileStore.getDirectory();

            // Convert relative path to absolute path.
            messageProperties.setAssociatedFile(fileStoreDirectory.getFile(messageProperties
                .getAssociatedFile()));

            final File consoleScript = messageProperties.resolveRelativeFile(messageProperties.getFile(
                GrinderProperties.SCRIPT, GrinderProperties.DEFAULT_SCRIPT));

            // We only fall back to the agent properties if the start message
            // doesn't specify a script and there is no default script.
            if (messageProperties.containsKey(GrinderProperties.SCRIPT) || consoleScript.canRead()) {
              // The script directory may not be the file's direct parent.
              script = new ScriptLocation(fileStoreDirectory, consoleScript);
            }
            m_agentIdentity.setNumber(startMessage.getAgentNumber());
          } else {
View Full Code Here

    assertThat(singleConsole, not(nullValue()));
    assertThat(singleConsole.getConsolePort(), is(perfTest.getPort()));

    // Start agents
    perfTest.setAgentCount(1);
    GrinderProperties grinderProperties = perfTestService.getGrinderProperties(perfTest);
    singleConsole.setReportPath(perfTestService.getReportFileDirectory(perfTest));

    // Distribute files
    perfTestService.prepareDistribution(perfTest);
    perfTestRunnable.startAgentsOn(perfTest, grinderProperties, singleConsole);
View Full Code Here

      fanOutStreamSender = new FanOutStreamSender(1);
      deleteLogs(base);

      AbstractLanguageHandler handler = Lang.getByFileName(script).getHandler();
      AbstractGrinderClassPathProcessor classPathProcessor = handler.getClassPathProcessor();
      GrinderProperties properties = new GrinderProperties();
      PropertyBuilder builder = new PropertyBuilder(properties, new Directory(base), securityEnabled, hostString,
          NetworkUtils.getLocalHostName());
      properties.setInt("grinder.agents", 1);
      properties.setInt("grinder.processes", 1);
      properties.setInt("grinder.threads", 1);
      properties.setBoolean("grinder.script.validation", true);
      String grinderJVMClassPath = classPathProcessor.buildForemostClasspathBasedOnCurrentClassLoader(LOGGER)
          + File.pathSeparator + classPathProcessor.buildPatchClasspathBasedOnCurrentClassLoader(LOGGER)
          + File.pathSeparator + builder.buildCustomClassPath(true);
      properties.setProperty("grinder.jvm.classpath", grinderJVMClassPath);
      LOGGER.info("grinder.jvm.classpath  : {} ", grinderJVMClassPath);
      AgentIdentityImplementation agentIdentity = new AgentIdentityImplementation("validation");
      agentIdentity.setNumber(0);
      String newClassPath = classPathProcessor.buildClasspathBasedOnCurrentClassLoader(LOGGER);
      LOGGER.debug("validation class path " + newClassPath);
View Full Code Here

  public void doTest(final PerfTest perfTest) {
    SingleConsole singleConsole = null;
    try {
      singleConsole = startConsole(perfTest);
      ScriptHandler prepareDistribution = perfTestService.prepareDistribution(perfTest);
      GrinderProperties grinderProperties = perfTestService.getGrinderProperties(perfTest, prepareDistribution);
      startAgentsOn(perfTest, grinderProperties, checkCancellation(singleConsole));
      distributeFileOn(perfTest, checkCancellation(singleConsole));

      singleConsole.setReportPath(perfTestService.getReportFileDirectory(perfTest));
      runTestOn(perfTest, grinderProperties, checkCancellation(singleConsole));
View Full Code Here

   * Register the worker thread context.
   */
  public void attachWorkerThreadContext() {
    try {
      if (m_threadContexts.get() == null) {
        GrinderProperties properties = new GrinderProperties();
        properties.setInt("grinder.agents", 1);
        properties.setInt("grinder.processes", 1);
        properties.setInt("grinder.threads", 1);
        properties.setBoolean("grinder.logData", false);
        final ThreadContextImplementation threadContext = new ThreadContextImplementation(properties,
            m_statisticsServices, 0, LOGGER);
        m_threadContexts.threadCreated(threadContext);
        m_threadContexts.threadStarted(threadContext);
        threadContext.registerThreadLifeCycleListener(new SkeletonThreadLifeCycleListener() {
View Full Code Here

TOP

Related Classes of net.grinder.common.GrinderProperties

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.