Search in sources :

Example 41 with PropertyQuery

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

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

Example 43 with PropertyQuery

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

the class PropertyQueryTimezoneTest method testISOTimezonePlusHourMinute.

@Issue("2850")
@Test
public void testISOTimezonePlusHourMinute() throws Exception {
    PropertyQuery propertyQuery = buildPropertyQuery();
    propertyQuery.setStartDate("2016-05-21T01:23:00+01:23");
    List<Property> storedPropertyList = queryProperty(propertyQuery).readEntity(new GenericType<List<Property>>() {
    });
    Property storedProperty = storedPropertyList.get(0);
    assertEquals("Incorrect property entity", property.getEntity(), storedProperty.getEntity());
    assertEquals("Incorrect property tags", property.getTags(), storedProperty.getTags());
    assertEquals("Incorrect property date", property.getDate(), storedProperty.getDate());
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) List(java.util.List) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 44 with PropertyQuery

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

the class PropertyQueryTimezoneTest method testISOTimezoneMinusHourMinute.

@Issue("2850")
@Test
public void testISOTimezoneMinusHourMinute() throws Exception {
    PropertyQuery propertyQuery = buildPropertyQuery();
    propertyQuery.setStartDate("2016-05-20T22:37:00-01:23");
    List<Property> storedPropertyList = queryProperty(propertyQuery).readEntity(new GenericType<List<Property>>() {
    });
    Property storedProperty = storedPropertyList.get(0);
    assertEquals("Incorrect property entity", property.getEntity(), storedProperty.getEntity());
    assertEquals("Incorrect property tags", property.getTags(), storedProperty.getTags());
    assertEquals("Incorrect property date", property.getDate(), storedProperty.getDate());
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) List(java.util.List) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 45 with PropertyQuery

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

the class PropertyMethod method propertyTypeExist.

public static boolean propertyTypeExist(String propertyType) {
    final PropertyQuery q = new PropertyQuery();
    q.setEntity("*");
    q.setType(propertyType);
    q.setStartDate(MIN_STORABLE_DATE);
    q.setEndDate(MAX_STORABLE_DATE);
    q.setLimit(1);
    final Response response = queryProperty(q);
    if (response.getStatus() != OK.getStatusCode()) {
        throw new NotCheckedException("Fail to execute property query");
    }
    String given = response.readEntity(String.class);
    if ("[]".equals(given)) {
        return false;
    } else
        return true;
}
Also used : Response(javax.ws.rs.core.Response) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) NotCheckedException(com.axibase.tsd.api.util.NotCheckedException)

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