Search in sources :

Example 41 with Property

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

the class PropertyQueryTest method testEntitiesWildcardStartChar.

@Issue("2979")
@Test
public void testEntitiesWildcardStartChar() throws Exception {
    final Property property = new Property("query-type59", "query-entity59");
    property.addTag("t1", "tv1");
    insertPropertyCheck(property);
    PropertyQuery query = new PropertyQuery();
    query.setType(property.getType());
    query.setEntities(Collections.singletonList("query-entity*"));
    query.setStartDate(MIN_QUERYABLE_DATE);
    query.setEndDate(MAX_QUERYABLE_DATE);
    assertInsertedPropertyReturned(property, query);
}
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 42 with Property

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

the class PropertyQueryTest method testKeyValueInteger.

@Issue("2416")
@Test
public void testKeyValueInteger() throws Exception {
    final Property property = new Property("query-type-68", "query-entity68");
    property.addTag("t1", "v1");
    property.addKey("k1", "111");
    insertPropertyCheck(property);
    Map<String, Object> query = new HashMap<>();
    query.put("type", property.getType());
    query.put("entity", property.getEntity());
    query.put("startDate", MIN_QUERYABLE_DATE);
    query.put("endDate", MAX_QUERYABLE_DATE);
    Map<String, Object> key = new HashMap<>();
    key.put("k1", 111);
    query.put("key", key);
    assertStoredPropertyDoesNotMatchToInserted(property, query);
}
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 43 with Property

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

the class PropertyQueryTest method testKeyTagExpressionUpperKey.

@Issue("2908")
@Test
public void testKeyTagExpressionUpperKey() throws Exception {
    final Property property = new Property("query-type54", "query-entity54");
    property.addTag("t1", "tv1");
    property.addKey("k1", "KV1");
    insertPropertyCheck(property);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    query.setKeyTagExpression("upper(keys.k1) == 'KV1'");
    assertInsertedPropertyReturned(property, query);
}
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 44 with Property

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

the class PropertyQueryTest method testLastDefault.

/**
 * #NoTicket
 */
@Test
public void testLastDefault() throws Exception {
    final Property property = new Property("query-type8", "query-entity8");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    property.setDate(getPreviousDay());
    insertPropertyCheck(property);
    final Property lastProperty = new Property();
    lastProperty.setType(property.getType());
    lastProperty.setEntity(property.getEntity());
    lastProperty.addTag("t2", "tv2");
    lastProperty.setDate(getCurrentDate());
    insertPropertyCheck(lastProperty);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), property.getEntity());
    String expected = jacksonMapper.writeValueAsString(Arrays.asList(property, lastProperty));
    String given = queryProperty(query).readEntity(String.class);
    assertTrue("Both properties should be returned if 'last' field is not specified", compareJsonString(expected, given));
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 45 with Property

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

the class PropertyQueryTest method testKeyMatchExactFalse.

/**
 * #NoTicket
 */
@Test
public void testKeyMatchExactFalse() throws Exception {
    final Property property = new Property("query-type11", "query-entity11");
    property.addTag("t1", "tv1");
    property.addKey("k1", "kv1");
    insertPropertyCheck(property);
    PropertyQuery query = prepareSimplePropertyQuery(property.getType(), "*");
    query.setKey(property.getKey());
    query.setExactMatch(false);
    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

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