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));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyInsertTest method testISOTimezoneZ.
@Issue("2850")
@Test
public void testISOTimezoneZ() {
Property property = new Property("test1", "property-insert-test-isoz");
property.addTag("test", "test");
property.setDate("2016-07-21T00:00:00Z");
insertProperty(property);
PropertyQuery propertyQuery = new PropertyQuery();
propertyQuery.setEntity("property-insert-test-isoz");
propertyQuery.setStartDate("2016-07-21T00:00:00.000Z");
propertyQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
propertyQuery.setType(property.getType());
List<Property> storedPropertyList = queryProperty(propertyQuery).readEntity(ResponseAsList.ofProperties());
Property storedProperty = storedPropertyList.get(0);
assertEquals("Incorrect property entity", property.getEntity(), storedProperty.getEntity());
assertEquals("Incorrect property tags", property.getTags(), storedProperty.getTags());
assertEquals("Incorrect property date", propertyQuery.getStartDate(), storedProperty.getDate());
}
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);
assertSame(Response.Status.Family.SUCCESSFUL, Util.responseFamily(insertProperty(property, updatedProperty)));
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 testLocalTimeUnsupported.
@Issue("2850")
@Test
public void testLocalTimeUnsupported() throws Exception {
String entityName = "property-insert-test-localtime";
String type = "test4";
Property property = new Property(type, entityName);
property.addTag("test", "test");
property.setDate("2016-06-09 20:00:00");
Response response = insertProperty(property);
assertEquals("Incorrect response status code", BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Error message mismatch", DATE_FILTER_INVALID_FORMAT, extractErrorMessage(response));
}
use of com.axibase.tsd.api.model.property.Property in project atsd-api-test by axibase.
the class PropertyInsertTest method testKeyValueSpaces.
@Issue("2416")
@Test
public void testKeyValueSpaces() throws Exception {
Property property = new Property("insert-property-t-6", "insert-property-e-6");
property.addKey("k1", " ");
property.addTag("t1", "tv1");
property.setDate("2016-06-09T09:50:00.000Z");
Response response = insertProperty(property);
Property storedProperty = new Property(property);
storedProperty.setKey(null);
assertSame("Incorrect response status code", Response.Status.Family.SUCCESSFUL, Util.responseFamily(response));
assertTrue("Fail to get inserted properties", propertyExist(storedProperty));
}
Aggregations