Search in sources :

Example 6 with PlainCommand

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

the class BackslashCharEscapeTest method testType.

@Issue("2854")
@Test
public void testType() throws Exception {
    Property property = new Property("property-command-test\\-t5", "property-command-test-e5");
    property.setTags(DEFAULT_PROPERTY_TAGS);
    property.setDate(getCurrentDate());
    PlainCommand command = new PropertyCommand(property);
    CommandMethod.send(command);
    assertPropertyExisting("Inserted property can not be received", property);
}
Also used : PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) Property(com.axibase.tsd.api.model.property.Property) PropertyCommand(com.axibase.tsd.api.model.command.PropertyCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 7 with PlainCommand

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

the class DoubleBackslashCharEscapeTest method testType.

@Issue("2854")
@Test
public void testType() throws Exception {
    Property property = new Property("property-command-test\\\\-t7", "property-command-test-e7");
    property.setTags(DEFAULT_PROPERTY_TAGS);
    property.setDate(getCurrentDate());
    PlainCommand command = new PropertyCommand(property);
    CommandMethod.send(command);
    assertPropertyExisting("Inserted property can not be received", property);
}
Also used : PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) Property(com.axibase.tsd.api.model.property.Property) PropertyCommand(com.axibase.tsd.api.model.command.PropertyCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 8 with PlainCommand

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

the class LengthTest method testMaxLength.

@Issue("2412")
@Test
public void testMaxLength() throws Exception {
    final Property property = new Property(propertyType(), entity());
    property.setDate(Mocks.ISO_TIME);
    property.setKey(Collections.EMPTY_MAP);
    property.addTag("type", property.getType());
    PlainCommand command = new PropertyCommand(property);
    Integer currentLength = command.compose().length();
    for (int i = 0; currentLength < MAX_LENGTH; i++) {
        String tagName = "name" + property.getEntity() + i;
        String textValue = "sda" + property.getEntity() + i;
        String addedTag = String.format(" v:%s=%s", tagName, textValue);
        currentLength += addedTag.length();
        if (currentLength <= MAX_LENGTH) {
            property.addTag(tagName, textValue);
        } else {
            currentLength -= addedTag.length();
            break;
        }
    }
    while (currentLength != MAX_LENGTH) {
        property.setType(property.getType().concat("+"));
        currentLength++;
    }
    command = new PropertyCommand(property);
    assertEquals("Command length is not maximal", MAX_LENGTH, command.compose().length());
    CommandMethod.send(command);
    assertPropertyExisting("Inserted property can not be received", property);
}
Also used : PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) Property(com.axibase.tsd.api.model.property.Property) PropertyCommand(com.axibase.tsd.api.model.command.PropertyCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 9 with PlainCommand

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

the class AppendFieldTest method testDecimalFieldToTextField.

@Issue("3874")
@Test
public void testDecimalFieldToTextField() throws Exception {
    final String entityName = entity();
    final String metricDecimalToText = metric();
    Series series = new Series(entityName, metricDecimalToText);
    series.addSamples(Sample.ofDateDecimalText(ISO_TIME, DECIMAL_VALUE, TEXT_VALUE));
    List<PlainCommand> seriesCommandList = Arrays.asList(new SeriesCommand(singletonMap(metricDecimalToText, TEXT_VALUE), null, entityName, null, null, null, ISO_TIME, true), new SeriesCommand(null, singletonMap(metricDecimalToText, DECIMAL_VALUE.toString()), entityName, null, null, null, ISO_TIME, false));
    CommandMethod.send(seriesCommandList);
    assertTextDataEquals(series, "Addition decimal field to text field failed");
}
Also used : Series(com.axibase.tsd.api.model.series.Series) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) SeriesCommand(com.axibase.tsd.api.model.command.SeriesCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) CommandMethodTest(com.axibase.tsd.api.extended.CommandMethodTest)

Example 10 with PlainCommand

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

the class AppendFieldTest method testTextFieldAfterAdditionOfDecimalValue.

@Issue("3902")
@Test
public void testTextFieldAfterAdditionOfDecimalValue() throws Exception {
    final String entityName = entity();
    final String metricTextAfterDecimalAddition = metric();
    Series series = new Series(entityName, metricTextAfterDecimalAddition);
    series.addSamples(Sample.ofDateText(ISO_TIME, TEXT_VALUE));
    List<PlainCommand> seriesCommandList = Arrays.asList(new SeriesCommand(singletonMap(metricTextAfterDecimalAddition, TEXT_VALUE), null, entityName, null, null, null, ISO_TIME, true), new SeriesCommand(null, singletonMap(metricTextAfterDecimalAddition, DECIMAL_VALUE.toString()), entityName, null, null, null, ISO_TIME, null));
    CommandMethod.send(seriesCommandList);
    assertTextDataEquals(series, "Addition of decimal value corrupted text field");
}
Also used : Series(com.axibase.tsd.api.model.series.Series) PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) SeriesCommand(com.axibase.tsd.api.model.command.SeriesCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) CommandMethodTest(com.axibase.tsd.api.extended.CommandMethodTest)

Aggregations

PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)32 Issue (io.qameta.allure.Issue)31 Test (org.testng.annotations.Test)31 MessageCommand (com.axibase.tsd.api.model.command.MessageCommand)12 Message (com.axibase.tsd.api.model.message.Message)12 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)10 Property (com.axibase.tsd.api.model.property.Property)10 CommandMethodTest (com.axibase.tsd.api.extended.CommandMethodTest)5 SeriesCommand (com.axibase.tsd.api.model.command.SeriesCommand)5 Series (com.axibase.tsd.api.model.series.Series)5 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)4 Entity (com.axibase.tsd.api.model.entity.Entity)4 ArrayList (java.util.ArrayList)4 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)2 SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)1 IOException (java.io.IOException)1