use of io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria 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());
});
}
use of io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria in project nem2-sdk-java by nemtech.
the class ReceiptRepositoryVertxImplTest method searchAddressResolutionStatements.
@Test
public void searchAddressResolutionStatements() throws Exception {
ResolutionStatementInfoDTO addressResolutionStatement = new ResolutionStatementInfoDTO();
Address address = Address.generateRandom(this.networkType);
ResolutionStatementDTO statement1 = new ResolutionStatementDTO();
addressResolutionStatement.setStatement(statement1);
statement1.setUnresolved(address.encoded());
statement1.setHeight(BigInteger.valueOf(6L));
mockRemoteCall(toPage(addressResolutionStatement));
BigInteger height = BigInteger.valueOf(10L);
List<AddressResolutionStatement> addressResolutionStatements = repository.searchAddressResolutionStatements(new ResolutionStatementSearchCriteria().height(height)).toFuture().get().getData();
Assertions.assertEquals(1, addressResolutionStatements.size());
Assertions.assertEquals(BigInteger.valueOf(6L), addressResolutionStatements.get(0).getHeight());
Assertions.assertEquals(address, addressResolutionStatements.get(0).getUnresolved());
}
Aggregations