Search in sources :

Example 31 with Entity

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

the class CSVUploadTest method testTimeRangeInMS.

@Issue("2957")
@Test
public void testTimeRangeInMS(Method method) throws Exception {
    Entity entity = new Entity("e-csv-simple-parser-ms-1");
    Metric metric = new Metric("m-csv-simple-parser-ms-1");
    File csvPath = resolvePath(Paths.get(RESOURCE_DIR, "test-time-range-ms.csv").toString());
    Response response = binaryCsvUpload(csvPath, SIMPLE_PARSER_MS);
    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, 2);
    List<Series> seriesList = SeriesMethod.querySeriesAsList(seriesQuery);
    Series series = seriesList.get(0);
    assertEquals("Managed to insert dataset with date out of range", 2, series.getData().size());
    assertEquals("Min storable date failed to save", MIN_STORABLE_DATE, series.getData().get(0).getRawDate());
    assertEquals("Incorrect stored value", "12.45", series.getData().get(0).getValue().toString());
    assertEquals("Max storable date failed to save", MAX_STORABLE_DATE, series.getData().get(1).getRawDate());
    assertEquals("Incorrect stored value", "10.8", series.getData().get(1).getValue().toString());
}
Also used : Response(javax.ws.rs.core.Response) Entity(com.axibase.tsd.api.model.entity.Entity) Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Metric(com.axibase.tsd.api.model.metric.Metric) File(java.io.File) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 32 with Entity

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

the class EntityCommandTest method testModels.

/**
 * Model test
 */
@Test
public void testModels() throws Exception {
    final Entity sourceEntity = new Entity(entity(), Mocks.TAGS);
    sourceEntity.setInterpolationMode(InterpolationMode.PREVIOUS);
    sourceEntity.setLabel(Mocks.LABEL);
    sourceEntity.setTimeZoneID(Mocks.TIMEZONE_ID);
    sourceEntity.setEnabled(true);
    EntityCommand command = new EntityCommand(sourceEntity);
    CommandMethod.send(command);
    String assertMessage = String.format("Inserted entity doesn't exist.%nCommand: %s", command);
    assertEntityExisting(assertMessage, sourceEntity);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Test(org.testng.annotations.Test)

Example 33 with Entity

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

the class EntityCommandTest method testAddNewEntityTagsMailformedForNewEntity.

@Issue("3111")
@Test
public void testAddNewEntityTagsMailformedForNewEntity() throws Exception {
    Entity entity = new Entity("ent-for-test-add-tags-mailformed");
    entity.addTag("hello 1", "world");
    PlainCommand command = new EntityCommand(entity);
    CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
    assertEquals(expectedResult, CommandMethod.send(command));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) CommandSendingResult(com.axibase.tsd.api.model.extended.CommandSendingResult) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 34 with Entity

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

the class EntityDeleteTest method testEntityNameContainsSlash.

@Issue("1278")
@Test
public void testEntityNameContainsSlash() throws Exception {
    final Entity entity = new Entity("deleteentity/2");
    createOrReplaceEntityCheck(entity);
    assertEquals("Fail to execute deleteEntity query", OK.getStatusCode(), deleteEntity(entity.getName()).getStatus());
    assertFalse("Entity should be deleted", entityExist(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 35 with Entity

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

the class EntityDeleteTest method testEntityNameContainsCyrillic.

@Issue("1278")
@Test
public void testEntityNameContainsCyrillic() throws Exception {
    Entity entity = new Entity("deleteйёentity3");
    createOrReplaceEntityCheck(entity);
    assertEquals("Fail to execute deleteEntity query", OK.getStatusCode(), deleteEntity(entity.getName()).getStatus());
    assertFalse("Entity should be deleted", entityExist(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) 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