Пример #1
0
    public TreeItem(SummarySingleDto metricDto) {

      MetricNameDto metricName = metricDto.getMetricName();
      this.key =
          getTestItemId(metricDto.getMetricName().getTest())
              + metricDto.getMetricName().getMetricName();
      put(NAME, metricName.getMetricDisplayName());
      put(TEST_DESCRIPTION, metricName.getTest().getDescription());
      put(TEST_NAME, getItemKey(metricName));

      for (SummaryMetricValueDto metricValue : metricDto.getValues()) {
        String value = metricValue.getValueRepresentation();

        // highlight results according to decision when available
        if (metricValue.getDecision() != null) {
          String toolTip =
              "Decision for metric during test run. Green - value in limits. Yellow - value crossed warning limits. Red - value outside limits";
          switch (metricValue.getDecision()) {
            case OK:
              value =
                  "<p title=\""
                      + toolTip
                      + "\" style=\"color:green;font-weight:700;display:inline;\">"
                      + value
                      + "</p>";
              break;
            case WARNING:
              value =
                  "<p title=\""
                      + toolTip
                      + "\" style=\"color:#B8860B;font-weight:700;display:inline;\">"
                      + value
                      + "</p>";
              break;
            default:
              value =
                  "<p title=\""
                      + toolTip
                      + "\" style=\"color:red;font-weight:700;display:inline;\">"
                      + value
                      + "</p>";
              break;
          }
        }

        put(SESSION_HEADER + metricValue.getSessionId(), value);
      }
    }
Пример #2
0
 private String getItemKey(MetricNameDto metricName) {
   return metricName.getTest().getDescription()
       + metricName.getTest().getTaskName()
       + metricName.getMetricName();
 }