Search in sources :

Example 6 with Property

use of com.axibase.tsd.api.model.property.Property 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 7 with Property

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

the class PropertyDeleteTest method testEntityTooLong.

@Test
public void testEntityTooLong() throws Exception {
    final Property property = new Property("delete-type-18", appendChar(new StringBuilder(), 'a', 5000).append("type-18").toString());
    property.addTag("t1", "v1");
    property.addKey("k1", "v1");
    insertPropertyCheck(property);
    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("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 8 with Property

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

the class PropertyDeleteTest method testKeyValueInteger.

@Issue("2416")
@Test
public void testKeyValueInteger() throws Exception {
    final Property property = new Property("delete-type-28", "delete-entity28");
    property.addTag("t1", "v1");
    property.addKey("k1", "111");
    insertPropertyCheck(property);
    Map<String, Object> deleteQuery = new HashMap<>();
    deleteQuery.put("type", property.getType());
    deleteQuery.put("entity", property.getEntity());
    deleteQuery.put("startDate", MIN_QUERYABLE_DATE);
    deleteQuery.put("endDate", MAX_QUERYABLE_DATE);
    Map<String, Object> key = new HashMap<>();
    key.put("k1", 111);
    deleteQuery.put("key", key);
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertFalse("Property should be deleted", propertyExist(property));
}
Also used : HashMap(java.util.HashMap) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 9 with Property

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

the class PropertyDeleteTest method testKeyValueBoolean.

@Issue("2416")
@Test
public void testKeyValueBoolean() throws Exception {
    final Property property = new Property("delete-type-29", "delete-entity29");
    property.addTag("t1", "v1");
    property.addKey("k1", "true");
    insertPropertyCheck(property);
    Map<String, Object> deleteQuery = new HashMap<>();
    deleteQuery.put("type", property.getType());
    deleteQuery.put("entity", property.getEntity());
    deleteQuery.put("startDate", MIN_QUERYABLE_DATE);
    deleteQuery.put("endDate", MAX_QUERYABLE_DATE);
    Map<String, Object> key = new HashMap<>();
    key.put("k1", true);
    deleteQuery.put("key", key);
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertFalse("Property should be deleted", propertyExist(property));
}
Also used : HashMap(java.util.HashMap) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 10 with Property

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

the class PropertyDeleteTest method testExtraKeyExactFalse.

@Test
public void testExtraKeyExactFalse() throws Exception {
    final Property property = new Property("delete-type13", "delete-entity13");
    property.addTag("t1", "v1");
    property.addKey("k1", "kv1");
    insertPropertyCheck(property);
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType(property.getType());
    deleteQuery.setEntity(property.getEntity());
    deleteQuery.setKey(property.getKey());
    deleteQuery.addKey("k2", "kv2");
    deleteQuery.setExactMatch(false);
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertTrue("Property should 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)

Aggregations

Property (com.axibase.tsd.api.model.property.Property)146 Test (org.testng.annotations.Test)143 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)94 Issue (io.qameta.allure.Issue)84 Response (javax.ws.rs.core.Response)23 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)10 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)10 HashMap (java.util.HashMap)9 Entity (com.axibase.tsd.api.model.entity.Entity)8 List (java.util.List)6 Period (com.axibase.tsd.api.model.Period)5 EntityGroup (com.axibase.tsd.api.model.entitygroup.EntityGroup)1 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)1 Series (com.axibase.tsd.api.model.series.Series)1 BeforeClass (org.testng.annotations.BeforeClass)1