Package net.grinder.common

Examples of net.grinder.common.GrinderProperties


   * @return created {@link GrinderProperties} instance
   */
  public GrinderProperties getGrinderProperties(PerfTest perfTest, ScriptHandler scriptHandler) {
    try {
      // Use default properties first
      GrinderProperties grinderProperties = new GrinderProperties(config.getHome().getDefaultGrinderProperties());

      User user = perfTest.getCreatedUser();

      // Get all files in the script path
      String scriptName = perfTest.getScriptName();
      FileEntry userDefinedGrinderProperties = fileEntryService.getOne(user,
          FilenameUtils.concat(FilenameUtils.getPath(scriptName), DEFAULT_GRINDER_PROPERTIES), -1L);
      if (!config.isSecurityEnabled() && userDefinedGrinderProperties != null) {
        // Make the property overridden by user property.
        GrinderProperties userProperties = new GrinderProperties();
        userProperties.load(new StringReader(userDefinedGrinderProperties.getContent()));
        grinderProperties.putAll(userProperties);
      }
      grinderProperties.setAssociatedFile(new File(DEFAULT_GRINDER_PROPERTIES));
      grinderProperties.setProperty(GRINDER_PROP_SCRIPT, scriptHandler.getScriptExecutePath(scriptName));

View Full Code Here


   */

  public AgentDaemon(AgentConfig agentConfig) {
    this.m_agentConfig = agentConfig;
    try {
      properties = new GrinderProperties(GrinderProperties.DEFAULT_PROPERTIES);
    } catch (GrinderException e) {
      throw processException("Exception occurred while creating agent daemon", e);
    }
  }
View Full Code Here

    // Check there is no agents are attached.
    assertThat(console1.getAllAttachedAgentsCount(), is(0));

    // Make one agent connect to console1
    GrinderProperties grinderProperties = new GrinderProperties();
    grinderProperties.setInt(GrinderProperties.CONSOLE_PORT, console1.getConsolePort());
    String localHostAddress = NetworkUtils.getLocalHostAddress();
    grinderProperties.setProperty(GrinderProperties.CONSOLE_HOST, localHostAddress);
    AgentIdentity next = getAgentIdentity(allAvailableAgents, 0);
    agentControllerServerDaemon.startAgent(grinderProperties, next);
    sleep(2000);
    assertThat(console1.getAllAttachedAgents().size(), is(1));
View Full Code Here

    // Start console
    SingleConsole console1 = new SingleConsole(getFreePort());
    console1.start();

    // Start one agent
    GrinderProperties grinderProperties = new GrinderProperties();
    grinderProperties.setInt(GrinderProperties.CONSOLE_PORT, console1.getConsolePort());

    agentControllerServerDaemon.startAgent(grinderProperties, agentIdentity);
    sleep(3000);
    assertThat(console1.getAllAttachedAgentsCount(), is(1));
View Full Code Here

    // Connect all available agents
    Set<AgentIdentity> allAvailableAgents = agentControllerServerDaemon.getAllAvailableAgents();
    assertThat(allAvailableAgents.size(), is(2));
    SingleConsole console1 = new SingleConsole(6372);
    console1.start();
    GrinderProperties grinderProperties = new GrinderProperties();
    grinderProperties.setInt(GrinderProperties.CONSOLE_PORT, console1.getConsolePort());

    agentControllerServerDaemon.startAgent(grinderProperties, getAgentIdentity(allAvailableAgents, 0));
    agentControllerServerDaemon.startAgent(grinderProperties, getAgentIdentity(allAvailableAgents, 1));
    sleep(1000);
    assertThat(console1.getAllAttachedAgents().size(), is(2));
View Full Code Here

  public void startAgent(GrinderProperties grinderProperties, AgentIdentity agentIdentity) {
    LOGGER.info("{} agent is started.", agentIdentity);
    final ConsoleCommunicationImplementationEx component = getComponent(ConsoleCommunicationImplementationEx.class);
    final AgentAddress address = new AgentAddress(agentIdentity);
    final String localConnectingAddress = component.getLocalConnectingAddress(address);
    final GrinderProperties prop = (GrinderProperties) grinderProperties.clone();
    prop.setProperty(GrinderProperties.CONSOLE_HOST, localConnectingAddress);
    component.sendToAddressedAgents(address,
        new StartGrinderMessage(prop, agentIdentity.getNumber()));
  }
View Full Code Here

   * @return unique id b/w from 0 to total thread count.
   * @since 3.2.3
   */
  public static int getThreadUniqId() {
    InternalScriptContext grinder = getGrinderInstance();
    GrinderProperties properties = grinder.getProperties();
    int totalProcessCount = properties.getInt("grinder.processes", 1);
    int totalThreadCount = properties.getInt("grinder.threads", 1);
    int agentNumber = grinder.getAgentNumber();
    int processNumber = grinder.getProcessNumber();
    int threadNumber = grinder.getThreadNumber();
    // Calc the current thread's unique id
    return (agentNumber * totalProcessCount * totalThreadCount) + (processNumber * totalThreadCount) + threadNumber;
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.