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)));
}
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());
}
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());
}
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);
}
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);
}
Aggregations