Search in sources :

Example 46 with Metric

use of com.axibase.tsd.api.model.metric.Metric 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 47 with Metric

use of com.axibase.tsd.api.model.metric.Metric in project atsd-api-test by axibase.

the class MetricCommandTest method testVersioning.

@Issue("3137")
@Test
public void testVersioning() throws Exception {
    Metric metric = new Metric(metric());
    metric.setVersioned(true);
    MetricCommand command = new MetricCommand(metric);
    CommandMethod.send(command);
    String assertMessage = String.format("Failed to insert metric with versioned: %s", metric.getVersioned());
    assertMetricExisting(assertMessage, metric);
}
Also used : 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 48 with Metric

use of com.axibase.tsd.api.model.metric.Metric 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)

Example 49 with Metric

use of com.axibase.tsd.api.model.metric.Metric in project atsd-api-test by axibase.

the class MetricCommandTest method testFilterExpression.

@Issue("3137")
@Test
public void testFilterExpression() throws Exception {
    Metric metric = new Metric(metric());
    metric.setFilter("expression");
    MetricCommand command = new MetricCommand(metric);
    CommandMethod.send(command);
    String assertMessage = String.format("Failed to insert metric with filter expression: %s", metric.getFilter());
    assertMetricExisting(assertMessage, metric);
}
Also used : 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 50 with Metric

use of com.axibase.tsd.api.model.metric.Metric in project atsd-api-test by axibase.

the class MetricDeleteTest method testUnknownMetric.

/* #NoTicket */
@Test
public void testUnknownMetric() throws Exception {
    final Metric metric = new Metric("deletemetric-4");
    assertEquals("Wrong response on unknown metric", NOT_FOUND.getStatusCode(), deleteMetric(metric.getName()).getStatus());
}
Also used : Metric(com.axibase.tsd.api.model.metric.Metric) Test(org.testng.annotations.Test)

Aggregations

Metric (com.axibase.tsd.api.model.metric.Metric)76 Test (org.testng.annotations.Test)58 Issue (io.qameta.allure.Issue)50 Series (com.axibase.tsd.api.model.series.Series)25 Entity (com.axibase.tsd.api.model.entity.Entity)21 Response (javax.ws.rs.core.Response)16 BeforeClass (org.testng.annotations.BeforeClass)15 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)13 MetricCommand (com.axibase.tsd.api.model.command.MetricCommand)10 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)7 BigDecimal (java.math.BigDecimal)7 MetricCheck (com.axibase.tsd.api.method.checks.MetricCheck)5 HashMap (java.util.HashMap)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 SeriesSearchResultRecord (com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord)3 Period (com.axibase.tsd.api.model.Period)2 Sample (com.axibase.tsd.api.model.series.Sample)2 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)2 SeriesSearchQuery (com.axibase.tsd.api.model.series.search.SeriesSearchQuery)2