Search in sources :

Example 1 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class TokenEntityTest method testDeleteMethod.

@Test(description = "Tests entity delete endpoint.")
@Issue("6052")
public void testDeleteMethod() throws Exception {
    String entityName = Mocks.entity();
    String url = "/entities/" + entityName;
    String token = TokenRepository.getToken(username, HttpMethod.DELETE, url);
    Entity entity = new Entity(entityName);
    createOrReplaceEntityCheck(entity);
    deleteEntity(entityName, token);
    Checker.check(new DeletionCheck(new EntityCheck(entity)));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) DeletionCheck(com.axibase.tsd.api.method.checks.DeletionCheck) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) EntityTest(com.axibase.tsd.api.method.entity.EntityTest) Test(org.testng.annotations.Test)

Example 2 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class TokenEntityTest method testCreateMethod.

@Test(description = "Tests entity create or replace endpoint.")
@Issue("6052")
public void testCreateMethod() throws Exception {
    String entityName = Mocks.entity();
    String url = "/entities/" + entityName;
    String token = TokenRepository.getToken(username, HttpMethod.PUT, url);
    Entity entity = new Entity(entityName);
    createOrReplaceEntity(entity, token);
    Checker.check(new EntityCheck(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Issue(io.qameta.allure.Issue) EntityTest(com.axibase.tsd.api.method.entity.EntityTest) Test(org.testng.annotations.Test)

Example 3 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class TCPSenderTest method testDebugSend.

@Test
public void testDebugSend() throws Exception {
    Entity entity = new Entity(entity(), TAGS);
    entity.setTimeZoneID(TIMEZONE_ID);
    entity.setInterpolationMode(InterpolationMode.LINEAR);
    entity.setLabel(LABEL);
    String result = TCPSender.send(singletonList(new EntityCommand(entity)), true);
    assertEquals("ok", result);
    assertCheck(new EntityCheck(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Test(org.testng.annotations.Test)

Example 4 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class TradePropertyTest method prepareData.

@BeforeClass
public void prepareData() throws Exception {
    Entity entity = new Entity();
    entity.addTag("class_code", clazz());
    entity.setName(entity());
    Entity entityTwo = new Entity();
    entityTwo.addTag("class_code", clazz());
    entityTwo.setName(entityTwo());
    Entity entityThree = new Entity();
    entityThree.addTag("class_code", clazz());
    entityThree.setName(entityThree());
    Trade trade = fromISOString("2020-06-15T10:21:49.123456Z");
    Trade tradeTwo = fromISOString("2020-06-15T10:21:49.123456Z").setSymbol(symbolTwo());
    Trade tradeThree = fromISOString("2020-06-15T10:21:49.123456Z").setSymbol(symbolThree());
    insert(trade, tradeTwo, tradeThree);
    Checker.check(new EntityCheck(entity));
    Checker.check(new EntityCheck(entityTwo));
    Checker.check(new EntityCheck(entityThree));
    trade = fromISOString("2020-06-15T10:21:49.123456Z").setExchange("MOEX");
    insert(trade);
    TradeSessionSummary sessionSummary = new TradeSessionSummary(clazz(), symbol(), TradeSessionType.MORNING, TradeSessionStage.N, "2020-09-10T10:15:20Z");
    sessionSummary.addTag("rptseq", "2");
    sessionSummary.addTag("offer", "10.5");
    sessionSummary.addTag("assured", "true");
    sessionSummary.addTag("action", "test");
    sessionSummary.addTag("starttime", "10:15:20");
    sessionSummary.addTag("snapshot_datetime", "2020-09-10T10:15:20Z");
    TradeSessionSummaryMethod.importStatistics(sessionSummary);
    Property property = new Property();
    property.setType(SECURITY_DEFINITIONS);
    property.setEntity(entity.getName());
    property.setDate("2020-06-14T10:21:49.123Z");
    Map<String, String> tags = new HashMap<>();
    tags.put("roundlot", "10");
    tags.put("product", "5");
    tags.put("marketcode", "FOND");
    property.setTags(tags);
    PropertyMethod.insertPropertyCheck(property);
    property = new Property();
    property.setType(SECURITY_DEFINITIONS);
    property.setEntity(entity.getName());
    property.setDate("2020-06-15T10:21:49.123Z");
    property.setKey(Collections.singletonMap("a", "b"));
    tags = new HashMap<>();
    tags.put("roundlot", "20");
    tags.put("product", "17");
    tags.put("test", "8");
    property.setTags(tags);
    PropertyMethod.insertPropertyCheck(property);
    InstrumentStatistics instrumentStatistics = new InstrumentStatistics().setClazz(clazz()).setSymbol(symbol()).setTimestamp(ZonedDateTime.parse("2020-06-15T20:21:49.123456789Z")).addValue(2, // numoffers
    "1234").addValue(5, // numbids
    "5060").addValue(10, // bid
    "196.04");
    InstrumentStatistics instrumentStatisticsTwo = new InstrumentStatistics().setClazz(clazz()).setSymbol(symbolTwo()).setTimestamp(ZonedDateTime.parse("2020-06-15T20:21:49.123456789Z")).addValue(31, // auctvolume
    "10").addValue(41, // auctvalue
    "10.23").addValue(44, // prevprice
    "1.2").addValue(37, // assured
    "true").addValue(32, // prevdate
    "20210501").addValue(35, // plannedtime
    "11:12:13").addValue(66, // snapshot_start_datetime
    "2020-06-14T20:21:49.654321Z");
    InstrumentStatistics instrumentStatisticsThree = new InstrumentStatistics().setClazz(clazz()).setSymbol(symbolThree()).setTimestamp(ZonedDateTime.parse("2020-06-15T20:21:49.123456789Z")).addValue(31, // auctvolume
    "2").addValue(41, // auctvalue
    "1.2").addValue(44, // prevprice
    "2.5").addValue(37, // assured
    "false").addValue(32, // prevdate
    "20210502").addValue(35, // plannedtime
    "14:15:16").addValue(66, // snapshot_start_datetime
    "2020-06-16T20:21:49.123456Z");
    InstrumentStatisticsSender.send(instrumentStatistics, instrumentStatisticsTwo, instrumentStatisticsThree).waitUntilTradesInsertedAtMost(1, TimeUnit.MINUTES);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) HashMap(java.util.HashMap) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) Property(com.axibase.tsd.api.model.property.Property) BeforeClass(org.testng.annotations.BeforeClass)

Example 5 with EntityCheck

use of com.axibase.tsd.api.method.checks.EntityCheck in project atsd-api-test by axibase.

the class TradeStatFunctionTest method prepareData.

@BeforeClass
public void prepareData() throws Exception {
    Entity entity = new Entity();
    entity.addTag("class_code", clazz());
    entity.setName(entity());
    Entity entityTwo = new Entity();
    entityTwo.addTag("class_code", clazz());
    entityTwo.setName(entityTwo());
    Trade trade = fromISOString("2020-06-15T10:21:49.123456Z");
    Trade tradeTwo = fromISOString("2020-06-15T10:21:49.123456Z").setSymbol(symbolTwo());
    insert(trade, tradeTwo);
    Checker.check(new EntityCheck(entity));
    Checker.check(new EntityCheck(entityTwo));
    trade = fromISOString("2020-06-15T10:21:49.123456Z").setExchange("MOEX");
    insert(trade);
    List<TradeSessionSummary> list = new ArrayList<>();
    {
        TradeSessionSummary sessionSummary = new TradeSessionSummary(clazz(), symbol(), TradeSessionType.MORNING, TradeSessionStage.N, "2020-09-10T10:15:20.123456111Z");
        sessionSummary.addTag("rptseq", "1");
        list.add(sessionSummary);
    }
    {
        TradeSessionSummary sessionSummary = new TradeSessionSummary(clazz(), symbol(), TradeSessionType.MORNING, TradeSessionStage.L, "2020-09-10T10:15:20.654321222Z");
        sessionSummary.addTag("rptseq", "2");
        list.add(sessionSummary);
    }
    {
        TradeSessionSummary sessionSummary = new TradeSessionSummary(clazz(), symbol(), TradeSessionType.DAY, TradeSessionStage.N, "2020-09-10T13:25:20.123456333Z");
        sessionSummary.addTag("rptseq", "3");
        list.add(sessionSummary);
    }
    {
        TradeSessionSummary sessionSummary = new TradeSessionSummary(clazz(), symbol(), TradeSessionType.DAY, TradeSessionStage.O, "2020-09-10T14:15:20.654321444Z");
        sessionSummary.addTag("rptseq", "4");
        list.add(sessionSummary);
    }
    {
        TradeSessionSummary sessionSummary = new TradeSessionSummary(clazz(), symbol(), TradeSessionType.EVENING, TradeSessionStage.N, "2020-09-10T17:25:20.123456555Z");
        sessionSummary.addTag("rptseq", "5");
        list.add(sessionSummary);
    }
    {
        TradeSessionSummary sessionSummary = new TradeSessionSummary(clazz(), symbol(), TradeSessionType.EVENING, TradeSessionStage.S, "2020-09-10T18:15:20.654321666Z");
        sessionSummary.addTag("rptseq", "6");
        list.add(sessionSummary);
    }
    TradeSessionSummaryMethod.importStatistics(list);
    InstrumentStatistics instrumentStatistics = new InstrumentStatistics().setClazz(clazz()).setSymbol(symbol()).setTimestamp(ZonedDateTime.parse("2020-06-15T20:21:49.123456789Z")).addValue(2, // numoffers
    "1234").addValue(5, // numbids
    "5060").addValue(10, // bid
    "196.04");
    InstrumentStatisticsSender.send(instrumentStatistics).waitUntilTradesInsertedAtMost(1, TimeUnit.MINUTES);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) ArrayList(java.util.ArrayList) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)16 Entity (com.axibase.tsd.api.model.entity.Entity)16 Test (org.testng.annotations.Test)13 Issue (io.qameta.allure.Issue)12 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)4 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)4 EntityTest (com.axibase.tsd.api.method.entity.EntityTest)3 BeforeClass (org.testng.annotations.BeforeClass)3 DeletionCheck (com.axibase.tsd.api.method.checks.DeletionCheck)1 StringCommand (com.axibase.tsd.api.model.command.StringCommand)1 Trade (com.axibase.tsd.api.model.financial.Trade)1 Property (com.axibase.tsd.api.model.property.Property)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1