private void checkPeriodicalSnapshotState()

in java/runner/src/intTest/java/com/epam/deltix/data/connectors/validator/L1DataValidator.java [101:142]


    private void checkPeriodicalSnapshotState(PackageHeaderInfo headerInfo) {
        long exchangeId = headerInfo.getEntries().get(0).getExchangeId();
        for (int i = 0; i < headerInfo.getEntries().size(); ++i) {
            if (headerInfo.getEntries().get(i).getExchangeId() != exchangeId) {
                sendMessageToLogger(headerInfo, TypeConstants.EXCHANGE_NULL, "We support only one exchangeId for snapshots", Severity.ERROR);
            }
        }

        long bestAskSnapshotPrice = Decimal64Utils.POSITIVE_INFINITY;
        long bestBidSnapshotPrice = Decimal64Utils.NEGATIVE_INFINITY;
        long bestAskSnapshotSize = Decimal64Utils.ZERO;
        long bestBidSnapshotSize = Decimal64Utils.ZERO;
        long bestAskBookPrice = Decimal64Utils.POSITIVE_INFINITY;
        long bestBidBookPrice = Decimal64Utils.NEGATIVE_INFINITY;
        long bestAskBookSize = Decimal64Utils.ZERO;
        long bestBidBookSize = Decimal64Utils.ZERO;

        for (int i = 0 ; i < headerInfo.getEntries().size(); ++i) {
            L1Entry l1Entry = (L1Entry)headerInfo.getEntries().get(i);
            validateEntry(headerInfo, l1Entry);
            if (l1Entry.getSide() == QuoteSide.ASK) {
                bestAskSnapshotPrice = l1Entry.getPrice();
                bestAskSnapshotSize = l1Entry.getSize();
            } else {
                bestBidSnapshotPrice = l1Entry.getPrice();
                bestBidSnapshotSize = l1Entry.getSize();
            }
        }
        DecimalLongDecimalLongPair askPair = bestAskDictionary.get(exchangeId, null);
        DecimalLongDecimalLongPair bidPair = bestBidDictionary.get(exchangeId, null);
        if (askPair != null) {
            bestAskBookPrice = askPair  .getFirst();
            bestAskBookSize = askPair.getSecond();
        } else return;;
        if (bidPair != null) {
            bestBidBookPrice = bidPair.getFirst();
            bestBidBookSize = bidPair.getSecond();
        } else return;
        if (Decimal64Utils.isNotEqual(bestAskSnapshotPrice, bestAskBookPrice) || Decimal64Utils.isNotEqual(bestBidSnapshotPrice, bestBidBookPrice) || Decimal64Utils.isNotEqual(bestAskSnapshotSize, bestAskBookSize) || Decimal64Utils.isNotEqual(bestBidSnapshotSize, bestBidBookSize)) {
            sendMessageToLogger(headerInfo, TypeConstants.EXCHANGE_NULL, "Current state of book doesn't equal to periodical snapshot.", Severity.ERROR);
        }
    }