Search in sources :

Example 6 with CommandSendingResult

use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.

the class LengthTest method testMaxLengthOverflow.

@Issue("2412")
@Test
public void testMaxLengthOverflow() throws Exception {
    SeriesCommand seriesCommand = new SeriesCommand();
    seriesCommand.setTimeISO(ISO_TIME);
    seriesCommand.setEntityName(entity());
    Integer currentLength = seriesCommand.compose().length();
    Map<String, String> values = new HashMap<>();
    while (currentLength <= MAX_LENGTH) {
        Series series = new Series(seriesCommand.getEntityName(), metric());
        series.addSamples(Sample.ofDateInteger(ISO_TIME, 1));
        String appendix = FieldFormat.keyValue("m", series.getMetric(), "1");
        currentLength += appendix.length();
        values.put(series.getMetric(), "1");
    }
    seriesCommand.setValues(values);
    assertTrue("SeriesCommand length is not overflow", seriesCommand.compose().length() > MAX_LENGTH);
    CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
    assertEquals("Sending result must contain one failed command", expectedResult, CommandMethod.send(seriesCommand));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) CommandSendingResult(com.axibase.tsd.api.model.extended.CommandSendingResult) SeriesCommand(com.axibase.tsd.api.model.command.SeriesCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 7 with CommandSendingResult

use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.

the class MetricCommandTest method testIncorrectInterpolation.

@Issue("3137")
@Test(dataProvider = "incorrectInterpolationFieldProvider")
public void testIncorrectInterpolation(String value) throws Exception {
    String metricName = metric();
    String incorrectCommand = String.format("metric m:%s i:%s", metricName, value);
    CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
    String assertMessage = String.format("Metric with incorrect interpolate field (%s) shouldn't be inserted", value);
    assertEquals(assertMessage, expectedResult, CommandMethod.send(incorrectCommand));
}
Also used : CommandSendingResult(com.axibase.tsd.api.model.extended.CommandSendingResult) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 8 with CommandSendingResult

use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.

the class MetricCommandTest method testIncorrectTimeZone.

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

Example 9 with CommandSendingResult

use of com.axibase.tsd.api.model.extended.CommandSendingResult in project atsd-api-test by axibase.

the class MetricCommandTest method testRequired.

@Issue("3137")
@Test
public void testRequired() throws Exception {
    MetricCommand command = new MetricCommand((String) null);
    CommandSendingResult expectedResult = new CommandSendingResult(1, 0);
    assertEquals("Command without metric Name sholdn't be inserted", expectedResult, CommandMethod.send(command));
}
Also used : MetricCommand(com.axibase.tsd.api.model.command.MetricCommand) CommandSendingResult(com.axibase.tsd.api.model.extended.CommandSendingResult) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)9 Issue (io.qameta.allure.Issue)9 Test (org.testng.annotations.Test)9 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)2 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)1 MessageCommand (com.axibase.tsd.api.model.command.MessageCommand)1 MetricCommand (com.axibase.tsd.api.model.command.MetricCommand)1 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)1 SeriesCommand (com.axibase.tsd.api.model.command.SeriesCommand)1 Entity (com.axibase.tsd.api.model.entity.Entity)1 Message (com.axibase.tsd.api.model.message.Message)1 Property (com.axibase.tsd.api.model.property.Property)1 Series (com.axibase.tsd.api.model.series.Series)1