Search in sources :

Example 61 with PropertyQuery

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));
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 62 with PropertyQuery

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));
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 63 with PropertyQuery

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));
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 64 with PropertyQuery

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());
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Test(org.testng.annotations.Test)

Example 65 with PropertyQuery

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));
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Aggregations

PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)112 Test (org.testng.annotations.Test)109 Property (com.axibase.tsd.api.model.property.Property)94 Issue (io.qameta.allure.Issue)44 Entity (com.axibase.tsd.api.model.entity.Entity)12 Response (javax.ws.rs.core.Response)11 Period (com.axibase.tsd.api.model.Period)6 List (java.util.List)6 NotCheckedException (com.axibase.tsd.api.util.NotCheckedException)1