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);
}
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);
}
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);
}
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");
}
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");
}
Aggregations