use of io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria in project nem2-sdk-java by nemtech.
the class TransactionServiceTest method lastAssert.
@AfterEach
void lastAssert() {
Mockito.verify(receiptRepositoryMock, Mockito.atMost(1)).searchAddressResolutionStatements(Mockito.eq(new ResolutionStatementSearchCriteria().height(height)));
Mockito.verify(receiptRepositoryMock, Mockito.atMost(1)).searchMosaicResolutionStatements(Mockito.eq(new ResolutionStatementSearchCriteria().height(height)));
}
use of io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria in project nem2-sdk-java by nemtech.
the class ReceiptRepositoryOkHttpImpl method searchMosaicResolutionStatements.
@Override
public Observable<Page<MosaicResolutionStatement>> searchMosaicResolutionStatements(ResolutionStatementSearchCriteria criteria) {
BigInteger height = criteria.getHeight();
Integer pageSize = criteria.getPageSize();
Integer pageNumber = criteria.getPageNumber();
String offset = criteria.getOffset();
Order order = toDto(criteria.getOrder());
Callable<ResolutionStatementPage> callback = () -> getClient().searchMosaicResolutionStatements(height, pageSize, pageNumber, offset, order);
return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(mapper::createMosaicResolutionStatementFromDto).collect(Collectors.toList()))));
}
use of io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria in project nem2-sdk-java by nemtech.
the class ReceiptRepositoryOkHttpImplTest 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());
}
use of io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method getMerkleReceiptsFromAddresses.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMerkleReceiptsFromAddresses(RepositoryType type) {
Pair<Account, NamespaceId> testAccount = helper().getTestAccount(type);
helper().basicSendMosaicFromNemesis(type, testAccount.getRight());
BlockRepository blockRepository = getBlockRepository(type);
ReceiptRepository receiptRepository = getRepositoryFactory(type).createReceiptRepository();
PaginationStreamer<AddressResolutionStatement, ResolutionStatementSearchCriteria> streamer = ReceiptPaginationStreamer.addresses(receiptRepository);
List<AddressResolutionStatement> 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 searchMosaicResolutionStatements.
@Test
public void searchMosaicResolutionStatements() throws Exception {
ResolutionStatementDTO statement2 = new ResolutionStatementDTO();
ResolutionStatementInfoDTO mosaicResolutionStatement = new ResolutionStatementInfoDTO();
mosaicResolutionStatement.setStatement(statement2);
statement2.setUnresolved("9");
statement2.setHeight(BigInteger.valueOf(7L));
mockRemoteCall(toPage(mosaicResolutionStatement));
BigInteger height = BigInteger.valueOf(10L);
List<MosaicResolutionStatement> mosaicResolutionStatements = repository.searchMosaicResolutionStatements(new ResolutionStatementSearchCriteria().height(height)).toFuture().get().getData();
Assertions.assertEquals(1, mosaicResolutionStatements.size());
Assertions.assertEquals(BigInteger.valueOf(7L), mosaicResolutionStatements.get(0).getHeight());
Assertions.assertEquals(BigInteger.valueOf(9L), mosaicResolutionStatements.get(0).getUnresolved().getId());
}
Aggregations