use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyDeleteTest method testEndDateEqDate.
@Test
public void testEndDateEqDate() throws Exception {
final Property property = new Property("delete-type1", "delete-entity1");
property.addTag("t1", "v1");
property.addKey("k1", "v1");
property.setDate("2016-06-01T12:00:00.000Z");
insertPropertyCheck(property);
PropertyQuery deleteQuery = new PropertyQuery();
deleteQuery.setType(property.getType());
deleteQuery.setEntity(property.getEntity());
deleteQuery.setEndDate(property.getDate());
assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
assertTrue("Property should be remain", propertyExist(property));
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyDeleteTest method testFutureDateExactTrue.
@Test
public void testFutureDateExactTrue() throws Exception {
final Property property = new Property("delete-type9", "delete-entity9");
property.addTag("t1", "v1");
property.addKey("k1", "v1");
property.setDate(getNextDay());
insertPropertyCheck(property);
PropertyQuery deleteQuery = new PropertyQuery();
deleteQuery.setType(property.getType());
deleteQuery.setEntity(property.getEntity());
deleteQuery.setExactMatch(true);
assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
assertTrue("Property should be remain", propertyExist(property));
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyDeleteTest method testFutureDateExactFalse.
@Test
public void testFutureDateExactFalse() throws Exception {
final Property property = new Property("delete-type8", "delete-entity8");
property.addTag("t1", "v1");
property.addKey("k1", "v1");
property.setDate(getNextDay());
insertPropertyCheck(property);
PropertyQuery deleteQuery = new PropertyQuery();
deleteQuery.setType(property.getType());
deleteQuery.setEntity(property.getEntity());
deleteQuery.setExactMatch(false);
assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
assertFalse("Property should be deleted", propertyExist(property));
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyDeleteTest method testEntityEmptyRaiseError.
@Test
public void testEntityEmptyRaiseError() throws Exception {
PropertyQuery deleteQuery = new PropertyQuery();
deleteQuery.setType("mock-type");
deleteQuery.setEntity("");
assertEquals("Delete query should fail if entity is absent", BAD_REQUEST.getStatusCode(), deleteProperty(deleteQuery).getStatus());
}
use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.
the class PropertyDeleteTest method testEmptyKeyExactFalse.
@Test
public void testEmptyKeyExactFalse() throws Exception {
final Property property = new Property("delete-type-6.11", "delete-entity6.11");
property.addTag("t1", "v1");
insertPropertyCheck(property);
Property secondProperty = new Property();
secondProperty.setType(property.getType());
secondProperty.setEntity(property.getEntity());
secondProperty.setType(property.getType());
secondProperty.setTags(property.getTags());
secondProperty.addKey("k2", "v2");
insertPropertyCheck(secondProperty);
PropertyQuery deleteQuery = new PropertyQuery();
deleteQuery.setType(property.getType());
deleteQuery.setEntity(property.getEntity());
deleteQuery.setExactMatch(false);
assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
assertFalse("First property should be deleted", propertyExist(property));
assertFalse("Second property should be deleted", propertyExist(secondProperty));
}
Aggregations