Search in sources :

Example 81 with PropertyQuery

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

the class PropertyQueryTest method testEntityTagsTagsAsPartKeyExactFalse.

/**
 * #NoTicket
 */
@Test
public void testEntityTagsTagsAsPartKeyExactFalse() throws Exception {
    final Entity entity = new Entity("query-entity22");
    entity.addTag("t1", "tv1");
    entity.addTag("t2", "tv2");
    EntityMethod.createOrReplaceEntityCheck(entity);
    PropertyQuery query = prepareSimplePropertyQuery(ENTITY_TAGS_PROPERTY_TYPE, entity.getName());
    query.addKey("t1", "tv1");
    query.setExactMatch(false);
    String given = queryProperty(query).readEntity(String.class);
    String emptyJsonList = "[]";
    assertTrue("No property should be returned", compareJsonString(emptyJsonList, given));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Test(org.testng.annotations.Test)

Example 82 with PropertyQuery

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

the class PropertyQueryTest method testStartDateInFuture.

/**
 * #NoTicket
 */
@Test
public void testStartDateInFuture() throws Exception {
    final Property property = new Property("query-type19", "query-entity19");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    property.setDate(getNextDay());
    insertPropertyCheck(property);
    PropertyQuery query = new PropertyQuery(property.getType(), property.getEntity(), property.getKey());
    query.setStartDate(property.getDate());
    query.setInterval(new Period(2, TimeUnit.DAY));
    assertInsertedPropertyReturned(property, query);
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Period(com.axibase.tsd.api.model.Period) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 83 with PropertyQuery

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

the class PropertyQueryTest method testOnlyTypeSpecified.

/**
 * #NoTicket
 */
@Test
public void testOnlyTypeSpecified() throws Exception {
    PropertyQuery query = new PropertyQuery();
    query.setType("mock-type");
    Response response = queryProperty(query);
    assertEquals("Query should fail if DateFiled is not specified", BAD_REQUEST.getStatusCode(), response.getStatus());
    assertEquals("Error message mismatch", ErrorTemplate.DATE_FILTER_COMBINATION_REQUIRED, extractErrorMessage(response));
}
Also used : Response(javax.ws.rs.core.Response) PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Test(org.testng.annotations.Test)

Example 84 with PropertyQuery

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

the class PropertyQueryTest method testStartPastEndFuture.

/**
 * #NoTicket
 */
@Test
public void testStartPastEndFuture() throws Exception {
    final Property property = new Property("query-type3", "query-entity3");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    property.setDate(getCurrentDate());
    insertPropertyCheck(property);
    PropertyQuery query = new PropertyQuery(property.getType(), property.getEntity());
    query.setStartDate(Util.ISOFormat(getPreviousDay()));
    query.setEndDate(Util.ISOFormat(getNextDay()));
    assertInsertedPropertyReturned(property, query);
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 85 with PropertyQuery

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

the class PropertyQueryTest method testDefaultQueryExactDefault.

/**
 * #NoTicket
 */
@Test
public void testDefaultQueryExactDefault() throws Exception {
    final Property property = new Property("query-type2", "query-entity2");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    property.setDate(getCurrentDate());
    insertPropertyCheck(property);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    assertInsertedPropertyReturned(property, query);
}
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