Search in sources :

Example 1 with DeletionCheck

use of com.axibase.tsd.api.method.checks.DeletionCheck in project atsd-api-test by axibase.

the class TokenAlertTest method testDeleteMethod.

@Test(description = "Tests alert update endpoint with tokens.")
@Issue("6052")
public void testDeleteMethod() throws Exception {
    String url = "/alerts/delete";
    String token = TokenRepository.getToken(username, HttpMethod.POST, url);
    String entity = Mocks.entity();
    generateAlertForEntity(entity);
    AlertQuery query = new AlertQuery().setStartDate(Util.MIN_QUERYABLE_DATE).setEndDate(Util.MAX_QUERYABLE_DATE).setMetrics(Collections.singletonList(RULE_METRIC_NAME)).setEntity(entity);
    Alert alert = queryAlerts(query).readEntity(ResponseAsList.ofAlerts()).get(0);
    deleteAlerts(Collections.singletonList(new AlertDeleteQuery(alert.getId())), token);
    Checker.check(new DeletionCheck(new AlertCheck(query)));
}
Also used : AlertQuery(com.axibase.tsd.api.model.alert.AlertQuery) AlertDeleteQuery(com.axibase.tsd.api.model.alert.AlertDeleteQuery) AlertCheck(com.axibase.tsd.api.method.checks.AlertCheck) Alert(com.axibase.tsd.api.model.alert.Alert) DeletionCheck(com.axibase.tsd.api.method.checks.DeletionCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) AlertTest(com.axibase.tsd.api.method.alert.AlertTest)

Example 2 with DeletionCheck

use of com.axibase.tsd.api.method.checks.DeletionCheck in project atsd-api-test by axibase.

the class TokenEntityTest method testDeleteMethod.

@Test(description = "Tests entity delete endpoint.")
@Issue("6052")
public void testDeleteMethod() throws Exception {
    String entityName = Mocks.entity();
    String url = "/entities/" + entityName;
    String token = TokenRepository.getToken(username, HttpMethod.DELETE, url);
    Entity entity = new Entity(entityName);
    createOrReplaceEntityCheck(entity);
    deleteEntity(entityName, token);
    Checker.check(new DeletionCheck(new EntityCheck(entity)));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) DeletionCheck(com.axibase.tsd.api.method.checks.DeletionCheck) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) EntityTest(com.axibase.tsd.api.method.entity.EntityTest) Test(org.testng.annotations.Test)

Example 3 with DeletionCheck

use of com.axibase.tsd.api.method.checks.DeletionCheck in project atsd-api-test by axibase.

the class TokenMetricTest method testDeleteMethod.

@Test(description = "Tests metric delete endpoint.")
@Issue("6052")
public void testDeleteMethod() throws Exception {
    String metricName = Mocks.metric();
    String url = "/metrics/" + metricName;
    String token = TokenRepository.getToken(username, HttpMethod.DELETE, url);
    Metric metric = new Metric(metricName);
    createOrReplaceMetricCheck(metric);
    deleteMetric(metricName, token);
    Checker.check(new DeletionCheck(new MetricCheck(metric)));
}
Also used : MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) Metric(com.axibase.tsd.api.model.metric.Metric) DeletionCheck(com.axibase.tsd.api.method.checks.DeletionCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) MetricTest(com.axibase.tsd.api.method.metric.MetricTest)

Example 4 with DeletionCheck

use of com.axibase.tsd.api.method.checks.DeletionCheck in project atsd-api-test by axibase.

the class TokenEntityGroupTest method testDeleteMethod.

@Test(description = "Tests entity group delete endpoint.")
@Issue("6052")
public void testDeleteMethod() throws Exception {
    String entityGroupName = Mocks.entityGroup();
    String url = "/entity-groups/" + entityGroupName;
    String token = TokenRepository.getToken(username, HttpMethod.DELETE, url);
    EntityGroup entityGroup = new EntityGroup(entityGroupName);
    createOrReplaceEntityGroupCheck(entityGroup);
    deleteEntityGroup(entityGroupName, token);
    Checker.check(new DeletionCheck(new EntityGroupCheck(entityGroup)));
}
Also used : EntityGroupCheck(com.axibase.tsd.api.method.checks.EntityGroupCheck) EntityGroup(com.axibase.tsd.api.model.entitygroup.EntityGroup) DeletionCheck(com.axibase.tsd.api.method.checks.DeletionCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 5 with DeletionCheck

use of com.axibase.tsd.api.method.checks.DeletionCheck in project atsd-api-test by axibase.

the class TokenSeriesTest method testDeleteMethod.

@Test(description = "Tests series delete endpoint with tokens.")
@Issue("6052")
public void testDeleteMethod() throws Exception {
    // creating data for series that will be deleted
    String deletionEntity = Mocks.entity();
    String deletionMetric = Mocks.metric();
    Series deletionSeries = new Series(deletionEntity, deletionMetric);
    deletionSeries.addSamples(Sample.ofDateInteger(SAMPLE_TIME, VALUE));
    insertSeriesCheck(deletionSeries);
    String deleteURL = "/series/delete";
    SeriesQuery deleteQuery = new SeriesQuery(deletionEntity, deletionMetric);
    String deleteToken = TokenRepository.getToken(username, HttpMethod.POST, deleteURL);
    deleteSeries(Collections.singletonList(deleteQuery), deleteToken);
    // checking that series was successfully deleted
    Checker.check(new DeletionCheck(new SeriesCheck(Collections.singletonList(deletionSeries))));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) DeletionCheck(com.axibase.tsd.api.method.checks.DeletionCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SeriesTest(com.axibase.tsd.api.method.series.SeriesTest)

Aggregations

DeletionCheck (com.axibase.tsd.api.method.checks.DeletionCheck)7 Issue (io.qameta.allure.Issue)7 Test (org.testng.annotations.Test)7 AlertTest (com.axibase.tsd.api.method.alert.AlertTest)1 AlertCheck (com.axibase.tsd.api.method.checks.AlertCheck)1 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)1 EntityGroupCheck (com.axibase.tsd.api.method.checks.EntityGroupCheck)1 MetricCheck (com.axibase.tsd.api.method.checks.MetricCheck)1 PropertyCheck (com.axibase.tsd.api.method.checks.PropertyCheck)1 ReplacementTableCheck (com.axibase.tsd.api.method.checks.ReplacementTableCheck)1 SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)1 EntityTest (com.axibase.tsd.api.method.entity.EntityTest)1 MetricTest (com.axibase.tsd.api.method.metric.MetricTest)1 PropertyTest (com.axibase.tsd.api.method.property.PropertyTest)1 SeriesTest (com.axibase.tsd.api.method.series.SeriesTest)1 Alert (com.axibase.tsd.api.model.alert.Alert)1 AlertDeleteQuery (com.axibase.tsd.api.model.alert.AlertDeleteQuery)1 AlertQuery (com.axibase.tsd.api.model.alert.AlertQuery)1 Entity (com.axibase.tsd.api.model.entity.Entity)1 EntityGroup (com.axibase.tsd.api.model.entitygroup.EntityGroup)1