Search in sources :

Example 1 with MetricCheck

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());
}
Also used : MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) MetricCommand(com.axibase.tsd.api.model.command.MetricCommand) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 2 with MetricCheck

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());
}
Also used : MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) MetricCommand(com.axibase.tsd.api.model.command.MetricCommand) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 3 with MetricCheck

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)));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 4 with MetricCheck

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());
}
Also used : MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 5 with MetricCheck

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());
}
Also used : MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) MetricCommand(com.axibase.tsd.api.model.command.MetricCommand) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

MetricCheck (com.axibase.tsd.api.method.checks.MetricCheck)5 Metric (com.axibase.tsd.api.model.metric.Metric)5 Issue (io.qameta.allure.Issue)5 Test (org.testng.annotations.Test)5 MetricCommand (com.axibase.tsd.api.model.command.MetricCommand)3 SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)1 Series (com.axibase.tsd.api.model.series.Series)1