Package net.grinder.engine.controller

Examples of net.grinder.engine.controller.AgentControllerIdentityImplementation


    agentManagerService.getAllVisible();
    agentManagerService.getAllActive();
    agentManagerService.stopAgent(0L);
    agentManagerService.requestShareAgentSystemDataModel(0L);
    agentManagerService.getSystemDataModel("127.0.0.1", "127.0.0.1");
    AgentControllerIdentityImplementation monitor = new AgentControllerIdentityImplementation(NetworkUtils.DEFAULT_LOCAL_HOST_NAME,
        "127.0.0.1");
    monitor.setRegion(spiedConfig.getRegion());
    agentManagerService.addAgentMonitoringTarget(monitor);
    agentManagerService.stopAgent(new AgentControllerIdentityImplementation(NetworkUtils.DEFAULT_LOCAL_HOST_NAME, "127.0.0.1"));
    agentManagerService.collectAgentSystemData();
  }
View Full Code Here


    agentManager.getMaxAgentSizePerConsole();
  }

  @Test
  public void testConvert() {
    agentManager.convert(new AgentControllerIdentityImplementation("test", "127.0.0.1"));
  }
View Full Code Here

    List<AgentInfo> removedAgents = newArrayList(0);

    Set<AgentIdentity> allAttachedAgents = getAgentManager().getAllAttachedAgents();
    Map<String, AgentControllerIdentityImplementation> attachedAgentMap = Maps.newHashMap();
    for (AgentIdentity agentIdentity : allAttachedAgents) {
      AgentControllerIdentityImplementation agentControllerIdentity = cast(agentIdentity);
      attachedAgentMap.put(createKey(agentControllerIdentity), agentControllerIdentity);
    }

    // If region is not specified retrieved all
    Map<String, AgentInfo> agentInDBMap = newHashMap();
    // step1. check all agents in DB, whether they are attached to
    // controller.
    for (AgentInfo each : getAllLocal()) {
      final String agentKey = createKey(each);
      if (!agentInDBMap.containsKey(agentKey)) {
        agentInDBMap.put(agentKey, each);
      } else {
        removedAgents.add(each);
      }
    }

    for (Map.Entry<String, AgentInfo> each : agentInDBMap.entrySet()) {
      String agentKey = each.getKey();
      AgentInfo agentInfo = each.getValue();
      AgentControllerIdentityImplementation agentIdentity = attachedAgentMap.remove(agentKey);
      if (agentIdentity == null) {
        // this agent is not attached to controller
        agentInfo.setState(AgentControllerState.INACTIVE);
        stateUpdatedAgents.add(agentInfo);
      } else if (!hasSameInfo(agentInfo, agentIdentity)) {
        agentInfo.setRegion(agentIdentity.getRegion());
        agentInfo.setPort(agentManager.getAgentConnectingPort(agentIdentity));
        agentInfo.setVersion(agentManager.getAgentVersion(agentIdentity));
        updatedAgents.add(agentInfo);
      } else if (!hasSameState(agentInfo, agentIdentity)) {
        agentInfo.setState(agentManager.getAgentState(agentIdentity));
View Full Code Here

  public List<AgentInfo> getAllLocalWithFullInfo() {
    Map<String, AgentInfo> agentInfoMap = createLocalAgentMap();
    Set<AgentIdentity> allAttachedAgents = getAgentManager().getAllAttachedAgents();
    List<AgentInfo> agentList = new ArrayList<AgentInfo>(allAttachedAgents.size());
    for (AgentIdentity eachAgentIdentity : allAttachedAgents) {
      AgentControllerIdentityImplementation agentControllerIdentity = cast(eachAgentIdentity);
      agentList.add(createAgentInfo(agentControllerIdentity, agentInfoMap));
    }
    return agentList;
  }
View Full Code Here

   */
  @Override
  public AgentControllerIdentityImplementation getAgentIdentityByIpAndName(String ip, String name) {
    Set<AgentIdentity> allAttachedAgents = getAgentManager().getAllAttachedAgents();
    for (AgentIdentity eachAgentIdentity : allAttachedAgents) {
      AgentControllerIdentityImplementation agentIdentity = cast(eachAgentIdentity);
      if (StringUtils.equals(ip, agentIdentity.getIp()) && StringUtils.equals(name, agentIdentity.getName())) {
        return agentIdentity;
      }
    }
    return null;
  }
View Full Code Here

    AgentInfo findOne = agentManagerRepository.findOne(id);
    if (findOne == null) {
      return null;
    }
    if (includeAgentIdentity) {
      AgentControllerIdentityImplementation agentIdentityByIp = getAgentIdentityByIpAndName(findOne.getIp(),
          findOne.getName());
      return fillUp(findOne, agentIdentityByIp);
    } else {
      return findOne;
    }
View Full Code Here

   * org.ngrinder.service.IAgentManagerService#getSystemDataModel
   * (java.lang.String, java.lang.String)
   */
  @Override
  public SystemDataModel getSystemDataModel(String ip, String name) {
    AgentControllerIdentityImplementation agentIdentity = getAgentIdentityByIpAndName(ip, name);
    return agentIdentity != null ? getAgentManager().getSystemDataModel(agentIdentity) : new SystemDataModel();
  }
View Full Code Here

    this.agentConfig = agentConfig;
    this.version = agentConfig.getInternalProperties().getProperty(PROP_INTERNAL_NGRINDER_VERSION);
    this.m_agentControllerServerListener = new AgentControllerServerListener(m_eventSynchronisation, LOGGER);
    // Set it with the default name
    this.m_agentIdentity = new AgentControllerIdentityImplementation(agentConfig.getAgentHostID(), NetworkUtils.DEFAULT_LOCAL_HOST_ADDRESS);
    this.m_agentIdentity.setRegion(agentConfig.getRegion());
    this.agentSystemDataCollector = new SystemDataCollector();
    this.agentSystemDataCollector.setAgentHome(agentConfig.getHome().getDirectory());
    this.agentSystemDataCollector.refresh();
  }
View Full Code Here

    agentControllerServerDaemon.start();
    agentControllerServerDaemon.setAgentDownloadRequestListener(this);
    agentControllerServerDaemon.addLogArrivedListener(new LogArrivedListener() {
      @Override
      public void logArrived(String testId, AgentAddress agentAddress, byte[] logs) {
        AgentControllerIdentityImplementation agentIdentity = convert(agentAddress.getIdentity());
        if (ArrayUtils.isEmpty(logs)) {
          LOGGER.error("Log is arrived from {} but no log content", agentIdentity.getIp());
        }
        File logFile = null;
        try {
          logFile = new File(config.getHome().getPerfTestLogDirectory(testId.replace("test_", "")),
              agentIdentity.getName() + "-" + agentIdentity.getRegion() + "-log.zip");
          FileUtils.writeByteArrayToFile(logFile, logs);
        } catch (IOException e) {
          LOGGER.error("Error while write logs from {} to {}", agentAddress.getIdentity().getName(),
              logFile.getAbsolutePath());
          LOGGER.error("Error is following", e);
View Full Code Here

                  ClusteredAgentRequest agentRequest = cast(agentRequestCache.get(each).get());
                  if (agentRequest.getRequestType() ==
                      ClusteredAgentRequest.RequestType.EXPIRE_LOCAL_CACHE) {
                    expireLocalCache();
                  } else {
                    AgentControllerIdentityImplementation agentIdentity = getAgentIdentityByIpAndName(
                        agentRequest.getAgentIp(), agentRequest.getAgentName());
                    if (agentIdentity != null) {
                      agentRequest.getRequestType().process(ClusteredAgentManagerService.this,
                          agentIdentity);
                    }
View Full Code Here

TOP

Related Classes of net.grinder.engine.controller.AgentControllerIdentityImplementation

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.