Search in sources :

Example 21 with Metric

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

the class MetricSeriesTest method testMetricNameContainsCyrillic.

@Issue("1278")
@Test
public void testMetricNameContainsCyrillic() throws Exception {
    final Metric metric = new Metric("seriesйёmetric-3");
    createOrReplaceMetricCheck(metric);
    assertTrue("series array should be empty", compareJsonString("[]", queryMetricSeries(metric.getName()).readEntity(String.class)));
}
Also used : Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 22 with Metric

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

the class MetricSeriesTest method testUnknownMetric.

@Test
public void testUnknownMetric() throws Exception {
    final Metric metric = new Metric("seriesmetric-4");
    assertEquals("Unknown metric should return NotFound", NOT_FOUND.getStatusCode(), queryMetricSeries(metric.getName()).getStatus());
}
Also used : Metric(com.axibase.tsd.api.model.metric.Metric) Test(org.testng.annotations.Test)

Example 23 with Metric

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

the class MetricUpdateTest method testMetricTagNameIsLowerCased.

@Issue("3141")
@Test
public void testMetricTagNameIsLowerCased() throws Exception {
    final String TAG_NAME = "NeWtAg";
    final String TAG_VALUE = "value";
    Metric metric = new Metric("update-metric-with-tag");
    Response createResponse = createOrReplaceMetric(metric);
    assertEquals("Failed to create metric", OK.getStatusCode(), createResponse.getStatus());
    createOrReplaceMetricCheck(metric);
    Map<String, String> tags = new HashMap<>();
    tags.put("NeWtAg", "value");
    metric.setTags(tags);
    Response updateResponse = updateMetric(metric);
    assertEquals("Failed to update metric", OK.getStatusCode(), updateResponse.getStatus());
    Response queryResponse = queryMetric(metric.getName());
    assertEquals("Failed to query metric", OK.getStatusCode(), queryResponse.getStatus());
    Metric updatedMetric = queryResponse.readEntity(Metric.class);
    assertEquals("Wrong metric name", metric.getName(), updatedMetric.getName());
    Map<String, String> expectedTags = new HashMap<>();
    expectedTags.put(TAG_NAME.toLowerCase(), TAG_VALUE);
    assertEquals("Wrong metric tags", expectedTags, updatedMetric.getTags());
}
Also used : Response(javax.ws.rs.core.Response) HashMap(java.util.HashMap) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 24 with Metric

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

the class CSVInsertTest method testEntityNames.

@Issue("1278")
@Test(dataProvider = "entityNameProvider")
public void testEntityNames(String queryName, String expectedName) throws Exception {
    Entity entity = new Entity(queryName);
    Metric metric = new Metric(metric());
    String csvPayload = String.format("time, %s%n0, 0%n", metric.getName());
    Response response = csvInsert(entity.getName(), csvPayload);
    String assertMessage = String.format("Failed to insert entity with name: %s", entity);
    assertEquals(assertMessage, OK.getStatusCode(), response.getStatus());
    entity.setName(expectedName);
    assertEntityExisting(entity);
}
Also used : Response(javax.ws.rs.core.Response) Entity(com.axibase.tsd.api.model.entity.Entity) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 25 with Metric

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

the class LikeEscapeTest method prepareTest.

@BeforeClass
public void prepareTest() throws Exception {
    Map<String, String> testTags = Collections.singletonMap(prefix + "tag", prefix + "value");
    Entity entity = new Entity(TEST_ENTITY, testTags).setLabel(prefix + Mocks.LABEL);
    Metric metric = new Metric(TEST_METRIC, testTags).setLabel(prefix + Mocks.LABEL).setDescription(prefix + Mocks.DESCRIPTION).setUnits(prefix + "units");
    Series series = new Series(TEST_ENTITY, TEST_METRIC, testTags);
    series.addSamples(Sample.ofDateIntegerText(Mocks.ISO_TIME, 1, prefix + Mocks.TEXT_VALUE));
    EntityMethod.createOrReplaceEntityCheck(entity);
    MetricMethod.createOrReplaceMetricCheck(metric);
    SeriesMethod.insertSeriesCheck(series);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Series(com.axibase.tsd.api.model.series.Series) Metric(com.axibase.tsd.api.model.metric.Metric) BeforeClass(org.testng.annotations.BeforeClass)

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