use of com.axibase.tsd.api.method.checks.MetricCheck in project atsd-api-test by axibase.
the class MetricCommandTest method testEnabled.
@Issue("3550")
@Test
public void testEnabled() throws Exception {
String metricName = metric();
Metric metric = new Metric(metricName);
MetricCommand command = new MetricCommand(metric);
command.setEnabled(true);
CommandMethod.send(command);
Checker.check(new MetricCheck(metric));
Metric actualMetric = MetricMethod.queryMetric(metricName).readEntity(Metric.class);
assertTrue("Failed to set enabled", actualMetric.getEnabled());
}
use of com.axibase.tsd.api.method.checks.MetricCheck in project atsd-api-test by axibase.
the class MetricCommandTest method testNullEnabled.
@Issue("3550")
@Test
public void testNullEnabled() throws Exception {
String metricName = metric();
Metric metric = new Metric(metricName);
MetricCommand command = new MetricCommand(metricName);
command.setEnabled(null);
CommandMethod.send(command);
Checker.check(new MetricCheck(metric));
Metric actualMetric = MetricMethod.queryMetric(metricName).readEntity(Metric.class);
assertTrue("Failed to omit enabled", actualMetric.getEnabled());
}
use of com.axibase.tsd.api.method.checks.MetricCheck in project atsd-api-test by axibase.
the class TcpParsingTest method testNetworkParser.
/*
The main problem of #4411 was that series command after metric command with newlines
is interpreted as metric command also.
For example
metric m:"metric-name" d:"Some
description"
series e:"entity-name" m:"some-other-metric-name"=123
*/
@Issue("4411")
@Test(description = "Test that series command that follows metric command with newline " + "is parsed correctly")
public void testNetworkParser() throws Exception {
Metric expectedMetric = new Metric(METRIC_NAME);
expectedMetric.setDescription(METRIC_DESCRIPTION);
Series expectedSeries = new Series(ENTITY_NAME, METRIC_NAME);
expectedSeries.addSamples(Sample.ofDateInteger(Mocks.ISO_TIME, METRIC_VALUE));
TCPSender.send(NETWORK_COMMAND);
Checker.check(new MetricCheck(expectedMetric));
Checker.check(new SeriesCheck(Collections.singletonList(expectedSeries)));
}
use of com.axibase.tsd.api.method.checks.MetricCheck in project atsd-api-test by axibase.
the class MetricCommandTest method testRawEnabled.
@Issue("3550")
@Test(dataProvider = "correctEnabledProvider")
public void testRawEnabled(String enabled) throws Exception {
String metricName = metric();
Metric metric = new Metric(metricName);
String command = String.format("metric m:%s b:%s", metricName, enabled);
CommandMethod.send(command);
Checker.check(new MetricCheck(metric));
Metric actualMetric = MetricMethod.queryMetric(metricName).readEntity(Metric.class);
assertEquals("Failed to set enabled (raw)", enabled.replaceAll("[\\'\\\"]", ""), actualMetric.getEnabled().toString());
}
use of com.axibase.tsd.api.method.checks.MetricCheck in project atsd-api-test by axibase.
the class MetricCommandTest method testDisabled.
@Issue("3550")
@Test
public void testDisabled() throws Exception {
String metricName = metric();
Metric metric = new Metric(metricName);
MetricCommand command = new MetricCommand(metric);
command.setEnabled(false);
CommandMethod.send(command);
Checker.check(new MetricCheck(metric));
Metric actualMetric = MetricMethod.queryMetric(metricName).readEntity(Metric.class);
assertFalse("Failed to set disabled", actualMetric.getEnabled());
}
Aggregations