Search in sources :

Example 1 with Property

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

the class PropertyInsertTest method testMillisecondsUnsupported.

@Issue("2850")
@Test
public void testMillisecondsUnsupported() throws Exception {
    String entityName = "property-insert-test-milliseconds";
    String type = "test6";
    Property property = new Property(type, entityName);
    property.addTag("test", "test");
    property.setDate("1465502400000");
    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 2 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() {
    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(ResponseAsList.ofProperties());
    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) Property(com.axibase.tsd.api.model.property.Property) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 3 with Property

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

the class PropertyInsertTest method testMultipleInsertSameTypeEntityKey.

/**
 * #NoTicket - base tests
 */
@Test
public void testMultipleInsertSameTypeEntityKey() throws Exception {
    final long firstTime = System.currentTimeMillis() - 5;
    final long secondTime = System.currentTimeMillis();
    final Property property = new Property("insert-type2", "insert-entity2");
    property.addTag("t1", "v1");
    property.addKey("k1", "v1");
    property.setDate(firstTime);
    final Property updatedProperty = new Property();
    updatedProperty.setType(property.getType());
    updatedProperty.setEntity(property.getEntity());
    updatedProperty.setKey(property.getKey());
    updatedProperty.setTags(new HashMap<String, String>() {

        {
            put("nt1", "ntv1");
        }
    });
    updatedProperty.setDate(secondTime);
    assertSame(Response.Status.Family.SUCCESSFUL, Util.responseFamily(insertProperty(property, updatedProperty)));
    assertTrue("Updated property should exist", propertyExist(updatedProperty, true));
    assertFalse("Old property should not exist", propertyExist(property, true));
}
Also used : Property(com.axibase.tsd.api.model.property.Property) Test(org.testng.annotations.Test)

Example 4 with Property

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

the class PropertyInsertTest method testLocalTimeUnsupported.

@Issue("2850")
@Test
public void testLocalTimeUnsupported() throws Exception {
    String entityName = "property-insert-test-localtime";
    String type = "test4";
    Property property = new Property(type, entityName);
    property.addTag("test", "test");
    property.setDate("2016-06-09 20:00:00");
    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 5 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);
    assertSame("Incorrect response status code", Response.Status.Family.SUCCESSFUL, Util.responseFamily(response));
    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)161 Test (org.testng.annotations.Test)155 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)97 Issue (io.qameta.allure.Issue)96 Response (javax.ws.rs.core.Response)24 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)17 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)17 HashMap (java.util.HashMap)10 Entity (com.axibase.tsd.api.model.entity.Entity)9 Period (com.axibase.tsd.api.model.Period)6 Description (io.qameta.allure.Description)6 PropertyTest (com.axibase.tsd.api.method.property.PropertyTest)3 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)3 BeforeClass (org.testng.annotations.BeforeClass)3 PropertyCheck (com.axibase.tsd.api.method.checks.PropertyCheck)2 DeletionCheck (com.axibase.tsd.api.method.checks.DeletionCheck)1 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)1 EntityTest (com.axibase.tsd.api.method.entity.EntityTest)1 EntityMethodGroupResponse (com.axibase.tsd.api.model.entity.EntityMethodGroupResponse)1 EntityGroup (com.axibase.tsd.api.model.entitygroup.EntityGroup)1