Search in sources :

Example 36 with Entity

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

the class EntityGetTest method testEntityNameContainsSlash.

@Issue("1278")
@Test
public void testEntityNameContainsSlash() throws Exception {
    Entity entity = new Entity("getentity/2");
    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 37 with Entity

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

the class EntityUpdateTest method testEntityNameContainsWhitespace.

@Issue("1278")
@Test
public void testEntityNameContainsWhitespace() throws Exception {
    Entity entity = new Entity("updateentity 1");
    assertEquals("Method should fail if entityName contains whitespace", BAD_REQUEST.getStatusCode(), updateEntity(entity).getStatus());
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 38 with Entity

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

the class EntityUpdateTest method testEntityNameContainsCyrillic.

@Issue("1278")
@Test
public void testEntityNameContainsCyrillic() throws Exception {
    Entity entity = new Entity("update_йёentity3");
    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 39 with Entity

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

the class PropertyDeleteTest method testEntityTagsExactTrue.

@Test
public void testEntityTagsExactTrue() throws Exception {
    final String entityTagsType = "$entity_tags";
    final Entity entity = new Entity("delete-entity10");
    entity.addTag("t1", "v1");
    entity.addTag("t2", "v2");
    final Property property = new Property();
    property.setType(entityTagsType);
    property.setEntity(entity.getName());
    property.setTags(entity.getTags());
    EntityMethod.createOrReplaceEntityCheck(entity);
    assertTrue(propertyExist(property));
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType("$entity_tags");
    deleteQuery.setEntity(entity.getName());
    deleteQuery.setExactMatch(true);
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertTrue(propertyExist(property));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 40 with Entity

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

the class CSVUploadTest method testFileWithLineBreak.

@Issue("3011")
@Test(dataProvider = "parserProvider")
public void testFileWithLineBreak(Method method, int numTest, String lineBreakType, String parser, Integer dataSize) throws Exception {
    String nameSuffix = String.format("-%s-parser-ms-%d", lineBreakType, numTest);
    Entity entity = new Entity("e" + nameSuffix);
    Metric metric = new Metric("m" + nameSuffix);
    String confFileName = String.format("test-%s-parser.csv", lineBreakType);
    File csvPath = resolvePath(Paths.get(RESOURCE_DIR, confFileName).toString());
    Response response = binaryCsvUpload(csvPath, parser, entity.getName());
    assertEquals("Failed to upload file", OK.getStatusCode(), response.getStatus());
    SeriesQuery seriesQuery = new SeriesQuery(entity.getName(), metric.getName(), MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
    assertSeriesQueryDataSize(seriesQuery, dataSize);
    Sample sample = SeriesMethod.querySeriesAsList(seriesQuery).get(0).getData().get(0);
    Calendar serverCalendar = new GregorianCalendar(TimeZone.getTimeZone(timezone));
    serverCalendar.clear();
    serverCalendar.set(2015, Calendar.MARCH, 24, 6, 17);
    assertEquals("Incorrect stored value", LINE_BREAKS_TEST_VALUE, sample.getValue().toString());
    assertEquals("Date failed to save", serverCalendar.getTime(), parseDate(sample.getRawDate()));
}
Also used : Response(javax.ws.rs.core.Response) Entity(com.axibase.tsd.api.model.entity.Entity) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Sample(com.axibase.tsd.api.model.series.Sample) Metric(com.axibase.tsd.api.model.metric.Metric) File(java.io.File) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

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