private String metricName;
private Double value;
private String formattedValue;
+ private String alertStatus;
+ private String alertText;
private String data;
private String characteristicKey;
private String characteristicName;
return this;
}
+ @CheckForNull
+ public String getAlertStatus() {
+ return alertStatus;
+ }
+
+ public Measure setAlertStatus(@Nullable String alertStatus) {
+ this.alertStatus = alertStatus;
+ return this;
+ }
+
+ @CheckForNull
+ public String getAlertText() {
+ return alertText;
+ }
+
+ public Measure setAlertText(@Nullable String alertText) {
+ this.alertText = alertText;
+ return this;
+ }
+
@CheckForNull
public String getData() {
return data;
private boolean excludeRules = true;
private boolean excludeRuleSeverities = true;
private Boolean includeTrends = null;
+ private Boolean includeAlerts = null;
private Boolean verbose = Boolean.FALSE;
public ResourceQuery() {
return this;
}
+ public Boolean isIncludeAlerts() {
+ return includeAlerts;
+ }
+
+ public ResourceQuery setIncludeAlerts(Boolean includeAlerts) {
+ this.includeAlerts = includeAlerts;
+ return this;
+ }
+
@Override
public String getUrl() {
StringBuilder url = new StringBuilder(BASE_URL);
appendUrlParameter(url, "includetrends", includeTrends);
appendUrlParameter(url, "characteristics", characteristicKeys);
appendUrlParameter(url, "languages", languages);
+ appendUrlParameter(url, "includealerts", includeAlerts);
appendUrlParameter(url, "verbose", verbose);
return url.toString();
}
.setMetricName(utils.getString(json, "name"))
.setValue(utils.getDouble(json, "val"))
.setFormattedValue(utils.getString(json, "frmt_val"))
+ .setAlertStatus(utils.getString(json, "alert"))
+ .setAlertText(utils.getString(json, "alert_text"))
.setTrend(utils.getInteger(json, "trend"))
.setVar(utils.getInteger(json, "var"))
.setData(utils.getString(json, "data"))
assertThat(query.getUrl()).isEqualTo(("/api/resources?includetrends=true&verbose=false&"));
}
+ @Test
+ public void measuresWithAlerts() {
+ ResourceQuery query = new ResourceQuery();
+ query.setIncludeAlerts(true);
+
+ assertThat(query.getUrl()).isEqualTo(("/api/resources?includealerts=true&verbose=false&"));
+ }
+
@Test
public void measuresOnRules() {
ResourceQuery query = new ResourceQuery().setMetrics("violations");