Search in sources :

Example 11 with Property

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

the class PropertyDeleteTest method testEntityTagsExactTrue.

@Test
public void testEntityTagsExactTrue() throws Exception {
    final String entityTagsType = "$entity_tags";
    final Entity entity = new Entity("delete-entity10");
    entity.addTag("t1", "v1");
    entity.addTag("t2", "v2");
    final Property property = new Property();
    property.setType(entityTagsType);
    property.setEntity(entity.getName());
    property.setTags(entity.getTags());
    EntityMethod.createOrReplaceEntityCheck(entity);
    assertTrue(propertyExist(property));
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType("$entity_tags");
    deleteQuery.setEntity(entity.getName());
    deleteQuery.setExactMatch(true);
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertTrue(propertyExist(property));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 12 with Property

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

the class PropertyDeleteTest method testTypeEntityExactFalse.

@Test
public void testTypeEntityExactFalse() throws Exception {
    final Property property = new Property("delete-type-5", "delete-entity5");
    property.addTag("t1", "v1");
    property.addKey("k1", "v1");
    insertPropertyCheck(property);
    Property secondProperty = new Property();
    secondProperty.setType(property.getType());
    secondProperty.setEntity(property.getEntity());
    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)

Example 13 with Property

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

the class PropertyDeleteTest method testTimestampZeroNoDateFilter.

@Test
public void testTimestampZeroNoDateFilter() throws Exception {
    final Property property = new Property("delete-type20", "delete-entity20");
    property.addTag("t1", "v1");
    property.setDate(MIN_STORABLE_DATE);
    insertPropertyCheck(property);
    PropertyQuery deleteQuery = new PropertyQuery();
    deleteQuery.setType(property.getType());
    deleteQuery.setEntity(property.getEntity());
    assertEquals("Fail to execute delete query", OK.getStatusCode(), deleteProperty(deleteQuery).getStatus());
    assertFalse("Property should be removed", 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 14 with Property

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

the class PropertyDeleteTest method testKeyValueTooLong.

@Test
public void testKeyValueTooLong() throws Exception {
    final Property property = new Property("delete-type-6.5", "delete-entity6.5");
    property.addTag("t1", "v1");
    property.addKey("kv1", appendChar(new StringBuilder(), 'a', 10000).append("-value").toString());
    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 15 with Property

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

the class PropertyDeleteTest method testEmptyKeyExactTrue.

@Test
public void testEmptyKeyExactTrue() throws Exception {
    final Property property = new Property("delete-type-6.1", "delete-entity6.1");
    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(true);
    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)

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