Search in sources :

Example 96 with Property

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

the class PropertyInsertTest method testSameTimeSamePropertyConjunction.

@Issue("2957")
@Test
public void testSameTimeSamePropertyConjunction() throws Exception {
    final long timeMillis = System.currentTimeMillis();
    final Property property = new Property("insert-type8", "insert-entity8");
    property.addTag("t1", "tv1");
    property.setDate(timeMillis);
    insertPropertyCheck(property);
    final Property property2 = new Property();
    property2.setType(property.getType());
    property2.setEntity(property.getEntity());
    property2.setDate(timeMillis);
    property2.addTag("t2", "tv2");
    insertPropertyCheck(property2);
    final Property resultProperty = new Property();
    resultProperty.setType(property.getType());
    resultProperty.setEntity(property.getEntity());
    resultProperty.setDate(timeMillis);
    resultProperty.addTag("t1", "tv1");
    resultProperty.addTag("t2", "tv2");
    assertTrue(propertyExist(resultProperty));
}
Also used : Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 97 with Property

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

the class PropertyInsertTest method testISOTimezoneMinusHourMinute.

@Issue("2850")
@Test
public void testISOTimezoneMinusHourMinute() throws Exception {
    String entityName = "property-insert-test-iso-hm";
    Property property = new Property("test3", entityName);
    property.addTag("test", "test");
    property.setDate("2016-07-20T22:37:00-01:23");
    insertProperty(property);
    PropertyQuery propertyQuery = new PropertyQuery();
    propertyQuery.setType(property.getType());
    propertyQuery.setEntity(entityName);
    propertyQuery.setStartDate("2016-07-21T00:00:00.000Z");
    propertyQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
    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", propertyQuery.getStartDate(), storedProperty.getDate());
}
Also used : PropertyQuery(com.axibase.tsd.api.model.property.PropertyQuery) Period(com.axibase.tsd.api.model.Period) List(java.util.List) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 98 with Property

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

the class PropertyInsertTest method testTagValueNull.

@Issue("2416")
@Test
public void testTagValueNull() throws Exception {
    Property property = new Property("insert-property-t-3", "insert-property-e-3");
    property.addTag("t1", null);
    property.setDate("2016-06-09T09:50:00.000Z");
    Response response = insertProperty(property);
    assertEquals("Query should fail if tag contain only null values", BAD_REQUEST.getStatusCode(), response.getStatus());
    assertFalse("Inserted property should not be stored", propertyExist(property));
}
Also used : Response(javax.ws.rs.core.Response) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 99 with Property

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

the class PropertyInsertTest method testXXTimezoneUnsupported.

@Issue("2850")
@Test
public void testXXTimezoneUnsupported() throws Exception {
    String entityName = "property-insert-test-xx-timezone";
    String type = "test5";
    Property property = new Property(type, entityName);
    property.addTag("test", "test");
    property.setDate("2016-06-09T09:50:00-1010");
    Response response = insertProperty(property);
    assertEquals("Incorrect response status code", BAD_REQUEST.getStatusCode(), response.getStatus());
    assertEquals("Error message mismatch", DATE_FILTER_INVALID_FORMAT, extractErrorMessage(response));
}
Also used : Response(javax.ws.rs.core.Response) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 100 with Property

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

the class PropertyInsertTest method testKeyValueNull.

@Issue("2416")
@Test
public void testKeyValueNull() throws Exception {
    Property property = new Property("insert-property-t-1", "insert-property-e-1");
    property.addKey("k1", null);
    property.addTag("t1", "tv1");
    property.setDate("2016-06-09T09:50:00.000Z");
    Response response = insertProperty(property);
    Property storedProperty = new Property(property);
    storedProperty.setKey(new HashMap<String, String>());
    assertEquals("Incorrect response status code", OK.getStatusCode(), response.getStatus());
    assertTrue("Fail to get inserted properties", propertyExist(storedProperty));
}
Also used : Response(javax.ws.rs.core.Response) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) 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