Search in sources :

Example 6 with StringCommand

use of com.axibase.tsd.api.model.command.StringCommand in project atsd-api-test by axibase.

the class MetricCommandTest method testIncorrectEnabled.

@Issue("3550")
@Issue("6319")
@Test(dataProvider = "incorrectEnabledProvider")
public void testIncorrectEnabled(String enabled) throws Exception {
    String metricName = metric();
    StringCommand command = new StringCommand(String.format("metric m:%s b:%s", metricName, enabled));
    String assertMessage = "Bad metric was accepted :: " + command;
    assertFalse(assertMessage, transport.send(command));
    Response serverResponse = MetricMethod.queryMetric(metricName);
    assertEquals(assertMessage, Util.responseFamily(serverResponse), Response.Status.Family.CLIENT_ERROR);
}
Also used : Response(javax.ws.rs.core.Response) StringCommand(com.axibase.tsd.api.model.command.StringCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 7 with StringCommand

use of com.axibase.tsd.api.model.command.StringCommand in project atsd-api-test by axibase.

the class MetricCommandTest method testIncorrectTimeZone.

@Issue("3137")
@Issue("6319")
@Test(dataProvider = "incorrectTimeZoneProvider")
public void testIncorrectTimeZone(String incorrectTimeZone) throws Exception {
    String metricName = metric();
    StringCommand incorrectCommand = new StringCommand(String.format("metric m:%s z:%s", metricName, incorrectTimeZone));
    String assertMessage = String.format("Metric with incorrect versioning field (%s) shouldn't be inserted", incorrectCommand);
    assertFalse(assertMessage, transport.send(incorrectCommand));
}
Also used : StringCommand(com.axibase.tsd.api.model.command.StringCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 8 with StringCommand

use of com.axibase.tsd.api.model.command.StringCommand in project atsd-api-test by axibase.

the class MetricCommandTest method testRawEnabled.

@Issue("3550")
@Issue("6319")
@Test(dataProvider = "correctEnabledProvider")
public void testRawEnabled(String enabled) throws Exception {
    String metricName = metric();
    Metric metric = new Metric(metricName);
    StringCommand command = new StringCommand(String.format("metric m:%s b:%s", metricName, enabled));
    String assertMessage = "Failed to set enabled (raw)";
    assertTrue(assertMessage, transport.send(command));
    Checker.check(new MetricCheck(metric));
    Metric actualMetric = MetricMethod.queryMetric(metricName).readEntity(Metric.class);
    assertEquals(assertMessage, enabled.replaceAll("[\\'\\\"]", ""), actualMetric.getEnabled().toString());
}
Also used : MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) Metric(com.axibase.tsd.api.model.metric.Metric) StringCommand(com.axibase.tsd.api.model.command.StringCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

StringCommand (com.axibase.tsd.api.model.command.StringCommand)8 Issue (io.qameta.allure.Issue)8 Test (org.testng.annotations.Test)8 Response (javax.ws.rs.core.Response)2 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)1 MetricCheck (com.axibase.tsd.api.method.checks.MetricCheck)1 Entity (com.axibase.tsd.api.model.entity.Entity)1 Metric (com.axibase.tsd.api.model.metric.Metric)1