Search in sources :

Example 31 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.

the class PropertyDeleteTest method testCommonTypeEntityTypeEntityKey.

@Test
public void testCommonTypeEntityTypeEntityKey() throws Exception {
    final Property property = new Property("delete-type-6", "delete-entity6");
    property.addTag("t1", "v1");
    property.addKey("k1", "v1");
    insertPropertyCheck(property);
    Property secondProperty = new Property(null, "delete-entity6-2");
    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.setKey(property.getKey());
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertFalse("First property should be deleted", propertyExist(property));
    assertTrue("Second property should remain", 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)

Example 32 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.

the class PropertyDeleteTest method testKeyValueEmptyExactTrue.

@Issue("2416")
@Test
public void testKeyValueEmptyExactTrue() throws Exception {
    final Property property = new Property("delete-type-24", "delete-entity24");
    property.addTag("t1", "v1");
    insertPropertyCheck(property);
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType(property.getType());
    deleteQuery.setEntity(property.getEntity());
    deleteQuery.addKey("k1", "");
    deleteQuery.setExactMatch(true);
    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) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 33 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.

the class PropertyDeleteTest method testKeyValueContainsSpaces.

@Issue("2416")
@Test
public void testKeyValueContainsSpaces() throws Exception {
    final Property property = new Property("delete-type-27", "delete-entity27");
    property.addTag("t1", "v1");
    property.addKey("k1", "kv1");
    insertPropertyCheck(property);
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType(property.getType());
    deleteQuery.setEntity(property.getEntity());
    deleteQuery.addKey("k1", "  kv1   ");
    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) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 34 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.

the class PropertyDeleteTest method testTypeStartEndRaiseError.

@Test
public void testTypeStartEndRaiseError() throws Exception {
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType("mock-type");
    deleteQuery.setStartDate(MIN_QUERYABLE_DATE);
    deleteQuery.setEndDate(MAX_QUERYABLE_DATE);
    assertEquals("Fail to execute delete query", BAD_REQUEST.getStatusCode(), deleteProperty(deleteQuery).getStatus());
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Test(org.testng.annotations.Test)

Example 35 with PropertyQuery

use of com.axibase.tsd.api.model.property.PropertyQuery in project atsd-api-test by axibase.

the class PropertyDeleteTest method testTypeOnlyRaiseError.

@Test
public void testTypeOnlyRaiseError() throws Exception {
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType("mock-type");
    assertEquals("Fail to execute delete query", BAD_REQUEST.getStatusCode(), deleteProperty(deleteQuery).getStatus());
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) 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