Search in sources :

Example 6 with MosaicResolutionStatement

use of io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement in project nem2-sdk-java by nemtech.

the class BlockRepositoryIntegrationTest method getMerkleReceiptsFromMosaics.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMerkleReceiptsFromMosaics(RepositoryType type) {
    BlockRepository blockRepository = getBlockRepository(type);
    ReceiptRepository receiptRepository = getRepositoryFactory(type).createReceiptRepository();
    PaginationStreamer<MosaicResolutionStatement, ResolutionStatementSearchCriteria> streamer = ReceiptPaginationStreamer.mosaics(receiptRepository);
    List<MosaicResolutionStatement> list = get(streamer.search(new ResolutionStatementSearchCriteria()).take(5).toList().toObservable());
    Assertions.assertFalse(list.isEmpty());
    list.forEach(s -> {
        String hash = s.generateHash(getNetworkType());
        MerkleProofInfo merkleProofInfo = get(blockRepository.getMerkleReceipts(s.getHeight(), hash));
        Assertions.assertFalse(merkleProofInfo.getMerklePath().isEmpty());
    });
}
Also used : ReceiptRepository(io.nem.symbol.sdk.api.ReceiptRepository) BlockRepository(io.nem.symbol.sdk.api.BlockRepository) ResolutionStatementSearchCriteria(io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria) MerkleProofInfo(io.nem.symbol.sdk.model.blockchain.MerkleProofInfo) MosaicResolutionStatement(io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ResolutionStatementSearchCriteria (io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria)6 MosaicResolutionStatement (io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement)6 BigInteger (java.math.BigInteger)5 ReceiptRepository (io.nem.symbol.sdk.api.ReceiptRepository)4 Page (io.nem.symbol.sdk.api.Page)3 AddressResolutionStatement (io.nem.symbol.sdk.model.receipt.AddressResolutionStatement)3 Observable (io.reactivex.Observable)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Test (org.junit.jupiter.api.Test)3 TransactionStatementSearchCriteria (io.nem.symbol.sdk.api.TransactionStatementSearchCriteria)2 ReceiptType (io.nem.symbol.sdk.model.receipt.ReceiptType)2 TransactionStatement (io.nem.symbol.sdk.model.receipt.TransactionStatement)2 ExceptionUtils (io.nem.symbol.core.utils.ExceptionUtils)1 StringEncoder (io.nem.symbol.core.utils.StringEncoder)1 BlockRepository (io.nem.symbol.sdk.api.BlockRepository)1 Listener (io.nem.symbol.sdk.api.Listener)1 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)1 TransactionRepository (io.nem.symbol.sdk.api.TransactionRepository)1 TransactionService (io.nem.symbol.sdk.api.TransactionService)1