Search in sources :

Example 51 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class EntityGetTest method testEntityNameContainsCyrillic.

@Issue("1278")
@Test
public void testEntityNameContainsCyrillic() throws Exception {
    Entity entity = new Entity("getйёentity3");
    createOrReplaceEntityCheck(entity);
    assertEntityExisting(entity);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 52 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class EntityUpdateTest method testEntityNameContainsSlash.

@Issue("1278")
@Test
public void testEntityNameContainsSlash() throws Exception {
    final Entity entity = new Entity("update_entity/2");
    entity.addTag("t1", "tv1");
    createOrReplaceEntityCheck(entity);
    Map<String, String> newTags = new HashMap<>();
    newTags.put("t2", "tv2");
    assertUrlencodedPathHandledSuccessfullyOnUpdate(entity, newTags);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) HashMap(java.util.HashMap) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 53 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SeriesQueryWildcardEscapeTest method testEntitySpecialCharEscapeNotFound.

@Issue("4662")
@Test(description = "Test series query for entity name that contains wildcard and nothing were found", dataProvider = "provideSpecialCharacters")
public static void testEntitySpecialCharEscapeNotFound(char c) throws Exception {
    String entityName = ENTITY_PREFIX + c + "e2";
    String metricName = Mocks.metric();
    Series series = new Series(entityName, metricName);
    EntityMethod.createOrReplaceEntityCheck(new Entity(entityName));
    MetricMethod.createOrReplaceMetricCheck(new Metric(metricName));
    SeriesQuery seriesQuery = new SeriesQuery(series);
    String actualEntityName = SeriesMethod.querySeriesAsList(seriesQuery).get(0).getEntity();
    String expectedEntityName = ENTITY_PREFIX + '\\' + c + "e2";
    assertEquals("Wrong result when performing series query with entity that contains wildcard character " + c + " and no series were found", expectedEntityName, actualEntityName);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 54 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SeriesSearchTest method testAllFields.

@Issue("4404")
@Test(description = "Test all fields returned")
public void testAllFields() {
    Entity expectedEntity = EntityMethod.getEntity(resultRecord4.getEntity().getName());
    Metric expectedMetric = MetricMethod.getMetric(resultRecord4.getMetric().getName());
    SeriesSearchQuery query = new SeriesSearchQuery("sst_22*");
    query.addEntityFields("*");
    query.addEntityTags("*");
    query.addMetricFields("*");
    query.addMetricTags("*");
    SeriesSearchResult result = SeriesMethod.searchSeries(query);
    SeriesSearchResultRecord[] resultRecords = result.getData();
    assertTrue(resultRecords != null && resultRecords.length == 1, "Incorrect series count");
    SeriesSearchResultRecord resultRecord = resultRecords[0];
    Entity resultEntity = resultRecord.getEntity();
    Metric resultMetric = resultRecord.getMetric();
    assertEquals(resultEntity, expectedEntity);
    assertEquals(resultMetric, expectedMetric);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) SeriesSearchResultRecord(com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord) SeriesSearchQuery(com.axibase.tsd.api.model.series.search.SeriesSearchQuery) Metric(com.axibase.tsd.api.model.metric.Metric) SeriesSearchResult(com.axibase.tsd.api.model.series.search.SeriesSearchResult) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 55 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SeriesSearchTest method createSeries.

private static SeriesSearchResultRecord createSeries(String prefix) throws Exception {
    Entity entity = new Entity(prefix + Mocks.entity(), Collections.singletonMap(prefix + "entity_tag", prefix + "entity_value")).setLabel(prefix + Mocks.LABEL).setInterpolationMode(InterpolationMode.PREVIOUS).setTimeZoneID("Europe/Moscow").setEnabled(true);
    Metric metric = new Metric(prefix + Mocks.metric(), Collections.singletonMap(prefix + "metric_tag", prefix + "metric_value")).setLabel(prefix + Mocks.LABEL).setTimeZoneID("Europe/London").setEnabled(true).setInterpolate(InterpolationMode.PREVIOUS).setDescription(prefix + Mocks.DESCRIPTION).setDataType(DataType.DECIMAL).setTimePrecision("SECONDS").setEnabled(true).setPersistent(true).setFilter("name = '*'").setRetentionDays(0).setSeriesRetentionDays(0).setVersioned(false).setMinValue(new BigDecimal("1")).setMaxValue(new BigDecimal("200.1")).setInvalidAction("TRANSFORM").setUnits("kg");
    Map<String, String> tags = Collections.singletonMap(prefix + "tag", prefix + "value");
    Series series = new Series(entity.getName(), metric.getName(), tags);
    series.addSamples(Mocks.SAMPLE);
    EntityMethod.createOrReplaceEntityCheck(entity);
    MetricMethod.createOrReplaceMetricCheck(metric);
    SeriesMethod.insertSeriesCheck(series);
    return new SeriesSearchResultRecord(entity, metric, tags, 1.0);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) SeriesSearchResultRecord(com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord) Metric(com.axibase.tsd.api.model.metric.Metric) BigDecimal(java.math.BigDecimal)

Aggregations

Entity (com.axibase.tsd.api.model.entity.Entity)77 Test (org.testng.annotations.Test)60 Issue (io.qameta.allure.Issue)43 Metric (com.axibase.tsd.api.model.metric.Metric)21 Series (com.axibase.tsd.api.model.series.Series)21 BeforeClass (org.testng.annotations.BeforeClass)15 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)12 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)9 HashMap (java.util.HashMap)9 Property (com.axibase.tsd.api.model.property.Property)8 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)6 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)5 Response (javax.ws.rs.core.Response)5 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)4 File (java.io.File)4 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)3 SeriesSearchResultRecord (com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord)3 Sample (com.axibase.tsd.api.model.series.Sample)2 SeriesSearchQuery (com.axibase.tsd.api.model.series.search.SeriesSearchQuery)2 BigDecimal (java.math.BigDecimal)2