Example #1
0
  private void parseReporting(Element configRoot, LocalBenchmark localBenchmark) {
    Element reportsEl = (Element) configRoot.getElementsByTagName("reports").item(0);
    NodeList reportElList = reportsEl.getElementsByTagName("report");
    for (int i = 0; i < reportElList.getLength(); i++) {
      if (reportElList.item(i) instanceof Element) {
        ReportDesc reportDesc = new ReportDesc();
        Element thisReportEl = (Element) reportElList.item(i);
        if (thisReportEl.getAttribute("includeAll") != null) {
          String inclAll = ConfigHelper.getStrAttribute(thisReportEl, "includeAll");
          if (inclAll.equalsIgnoreCase("true")) {
            reportDesc.setIncludeAll(true);
            reportDesc.addReportItems(all);
            localBenchmark.addReportDesc(reportDesc);
            reportDesc.setReportName(ConfigHelper.getStrAttribute(thisReportEl, "name"));
            continue;
          }
        }

        NodeList itemsEl = thisReportEl.getElementsByTagName("item");
        for (int j = 0; j < itemsEl.getLength(); j++) {
          Element itemEl = (Element) itemsEl.item(j);
          String productName = ConfigHelper.getStrAttribute(itemEl, "product");
          String productConfig = ConfigHelper.getStrAttribute(itemEl, "config");
          reportDesc.addReportItem(productName, productConfig);
        }
        reportDesc.setReportName(ConfigHelper.getStrAttribute(thisReportEl, "name"));
        localBenchmark.addReportDesc(reportDesc);
      }
    }
  }
Example #2
0
 private void parseBenchmarkElement(LocalBenchmark result, Element configRoot)
     throws InstantiationException, IllegalAccessException, ClassNotFoundException {
   Element benchmark = (Element) configRoot.getElementsByTagName("benchmark").item(0);
   for (int i = 0; i < benchmark.getChildNodes().getLength(); i++) {
     Node node = benchmark.getChildNodes().item(i);
     if (node instanceof Element) {
       Element nodeEl = (Element) node;
       CacheWrapperStressor stressor = StressorHelper.getStressor(nodeEl.getNodeName());
       Map<String, String> attrValues = new HashMap<String, String>();
       for (int j = 0; j < nodeEl.getAttributes().getLength(); j++) {
         Attr attr = (Attr) nodeEl.getAttributes().item(j);
         attrValues.put(attr.getName(), attr.getValue());
       }
       ConfigHelper.setValues(stressor, attrValues, true);
       result.addStressor(stressor);
     }
   }
 }