use of com.axibase.tsd.api.model.property.Property 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.property.Property 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.property.Property in project atsd-api-test by axibase.
the class PropertyInsertTest method testMultipleInsertSameTypeEntityKey.
/**
* #NoTicket - base tests
*/
@Test
public void testMultipleInsertSameTypeEntityKey() throws Exception {
final long firstTime = System.currentTimeMillis() - 5;
final long secondTime = System.currentTimeMillis();
final Property property = new Property("insert-type2", "insert-entity2");
property.addTag("t1", "v1");
property.addKey("k1", "v1");
property.setDate(firstTime);
final Property updatedProperty = new Property();
updatedProperty.setType(property.getType());
updatedProperty.setEntity(property.getEntity());
updatedProperty.setKey(property.getKey());
updatedProperty.setTags(new HashMap<String, String>() {
{
put("nt1", "ntv1");
}
});
updatedProperty.setDate(secondTime);
assertEquals(OK.getStatusCode(), insertProperty(property, updatedProperty).getStatus());
assertTrue("Updated property should exist", propertyExist(updatedProperty, true));
assertFalse("Old property should not exist", propertyExist(property, true));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyInsertTest method testTimeRangeMinSaved.
@Issue("2957")
@Test
public void testTimeRangeMinSaved() throws Exception {
Property property = new Property("t-time-range-p-1", "e-time-range--1");
property.addTag("ttr-t", "ttr-v");
property.setDate(MIN_STORABLE_DATE);
Response response = insertProperty(property);
assertEquals("Failed to insert property", response.getStatus(), OK.getStatusCode());
assertTrue(propertyExist(property));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyInsertTest method testMillisecondsUnsupported.
@Issue("2850")
@Test
public void testMillisecondsUnsupported() throws Exception {
String entityName = "property-insert-test-milliseconds";
String type = "test6";
Property property = new Property(type, entityName);
property.addTag("test", "test");
property.setDate("1465502400000");
Response response = insertProperty(property);
assertEquals("Incorrect response status code", BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Error message mismatch", DATE_FILTER_INVALID_FORMAT, extractErrorMessage(response));
}
Aggregations