Search in sources :

Example 26 with Property

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

the class PropertyInsertTest method testKeyValueBoolean.

@Issue("2416")
@Test
public void testKeyValueBoolean() throws Exception {
    final Property storedProperty = new Property("insert-property-t-10", "insert-property-e-10");
    storedProperty.addTag("t1", "tv1");
    storedProperty.addKey("k1", "true");
    Map<String, Object> property = new HashMap<>();
    property.put("type", storedProperty.getType());
    property.put("entity", storedProperty.getEntity());
    property.put("tags", storedProperty.getTags());
    Map<String, Object> key = new HashMap<>();
    key.put("k1", true);
    property.put("key", key);
    Response response = insertProperty(property);
    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) HashMap(java.util.HashMap) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 27 with Property

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

the class PropertyInsertTest method testKeyValueSpaces.

@Issue("2416")
@Test
public void testKeyValueSpaces() throws Exception {
    Property property = new Property("insert-property-t-6", "insert-property-e-6");
    property.addKey("k1", "   ");
    property.addTag("t1", "tv1");
    property.setDate("2016-06-09T09:50:00.000Z");
    Response response = insertProperty(property);
    Property storedProperty = new Property(property);
    storedProperty.setKey(null);
    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)

Example 28 with Property

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

the class PropertyInsertTest method testISOTimezoneZ.

@Issue("2850")
@Test
public void testISOTimezoneZ() throws Exception {
    Property property = new Property("test1", "property-insert-test-isoz");
    property.addTag("test", "test");
    property.setDate("2016-07-21T00:00:00Z");
    insertProperty(property);
    PropertyQuery propertyQuery = new PropertyQuery();
    propertyQuery.setEntity("property-insert-test-isoz");
    propertyQuery.setStartDate("2016-07-21T00:00:00.000Z");
    propertyQuery.setInterval(new Period(1, TimeUnit.MILLISECOND));
    propertyQuery.setType(property.getType());
    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 29 with Property

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

the class PropertyInsertTest method testTimeRangeMaxTimeOverflow.

@Issue("2957")
@Test
public void testTimeRangeMaxTimeOverflow() throws Exception {
    Property property = new Property("t-time-range-p-4", "e-time-range-p-4");
    property.addTag("ttr-t", "ttr-v");
    property.setDate(Util.addOneMS(MAX_STORABLE_DATE));
    Response response = insertProperty(property);
    assertNotSame("Managed to insert property with date out of range", response.getStatus(), OK.getStatusCode());
    assertFalse(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 30 with Property

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

the class PropertyInsertTest method testKeyValueInteger.

@Issue("2416")
@Test
public void testKeyValueInteger() throws Exception {
    final Property storedProperty = new Property("insert-property-t-9", "insert-property-e-9");
    storedProperty.addTag("t1", "tv1");
    storedProperty.addKey("k1", "111");
    Map<String, Object> property = new HashMap<>();
    property.put("type", storedProperty.getType());
    property.put("entity", storedProperty.getEntity());
    property.put("tags", storedProperty.getTags());
    Map<String, Object> key = new HashMap<>();
    key.put("k1", 111);
    property.put("key", key);
    Response response = insertProperty(property);
    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) HashMap(java.util.HashMap) 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