private CollectionProperty getValues() {
   CollectionProperty threadValues = (CollectionProperty) getProperty(THREAD_VALUES);
   if (threadValues.size() > 0) {
     return (CollectionProperty)
         threadValues.get(getThreadContext().getThreadNum() % threadValues.size());
   }
   return new CollectionProperty("noname", new LinkedList<Object>());
 }
  private void initiateConnectors() {
    oldValues.clear();
    JMeterProperty prop = getMetricSettings();
    connectors.clear();
    if (!(prop instanceof CollectionProperty)) {
      log.warn("Got unexpected property: " + prop);
      return;
    }
    CollectionProperty rows = (CollectionProperty) prop;

    for (int i = 0; i < rows.size(); i++) {
      // the array contains all the servers
      //  ArrayList<Object> row = (ArrayList<Object>) rows.get(i).getObjectValue();
      //      //add aws data for testing

      String instanceID = "i-f1986494"; // ((JMeterProperty) row.get(0)).getStringValue();
      String credentials_path =
          "AwsCredentials.properties"; // ((JMeterProperty) row.get(1)).getStringValue();
      String metricType = "CPUUtilization"; // ((JMeterProperty) row.get(2)).getStringValue();
      String statisticType = "Average"; // ((JMeterProperty) row.get(3)).getStringValue();
      long startTime = 1000 * 60 * 25;
      int awsInterval = 60;
      StandardUnit unit = StandardUnit.Percent;
      initiateConnector(
          instanceID, credentials_path, i, metricType, statisticType, unit, startTime, awsInterval);
    }

    Iterator<Object> it = connectors.keySet().iterator();
    while (it.hasNext()) {
      Object key = it.next();
      try {
        connectors.get(key).connect();
      } catch (IOException ex) {
        log.error("Error connecting to CloudWatch", ex);
        connectors.put(key, new UnavailableAgentConnector(ex));
      }
    }
  }
Пример #3
0
 /*
  * (non-Javadoc)
  *
  * @see Object#clone()
  */
 public Object clone() {
   CollectionProperty prop = (CollectionProperty) super.clone();
   prop.value = cloneCollection();
   return prop;
 }