use of io.nem.symbol.sdk.api.MosaicPaginationStreamer in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method searchByOwnerAddressInvalid.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchByOwnerAddressInvalid(RepositoryType type) {
MosaicSearchCriteria criteria = new MosaicSearchCriteria();
Address address = Account.generateNewAccount(getNetworkType()).getAddress();
criteria.ownerAddress(address);
MosaicPaginationStreamer streamer = new MosaicPaginationStreamer(getMosaicRepository(type));
List<MosaicInfo> mosaics = get(streamer.search(criteria).toList().toObservable());
Assertions.assertTrue(mosaics.isEmpty());
}
use of io.nem.symbol.sdk.api.MosaicPaginationStreamer in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method searchByOwnerAddress.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchByOwnerAddress(RepositoryType type) {
MosaicSearchCriteria criteria = new MosaicSearchCriteria();
Address address = testAccount.getAddress();
criteria.ownerAddress(address);
MosaicPaginationStreamer streamer = new MosaicPaginationStreamer(getMosaicRepository(type));
List<MosaicInfo> mosaics = get(streamer.search(criteria).toList().toObservable());
mosaics.forEach(m -> Assertions.assertEquals(address, m.getOwnerAddress()));
Assertions.assertFalse(mosaics.isEmpty());
}
use of io.nem.symbol.sdk.api.MosaicPaginationStreamer in project nem2-sdk-java by nemtech.
the class MosaicRepositoryIntegrationTest method searchUsingOffset.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchUsingOffset(RepositoryType type) {
MosaicRepository mosaicRepository = getMosaicRepository(type);
MosaicPaginationStreamer streamer = new MosaicPaginationStreamer(mosaicRepository);
MosaicSearchCriteria criteria = new MosaicSearchCriteria();
criteria.setPageSize(10);
int offsetIndex = 2;
List<MosaicInfo> mosaicsWithoutOffset = get(streamer.search(criteria).toList().toObservable());
criteria.setOffset(mosaicsWithoutOffset.get(offsetIndex).getRecordId().get());
List<MosaicInfo> mosaicFromOffsets = get(streamer.search(criteria).toList().toObservable());
PaginationTester.sameEntities(mosaicsWithoutOffset.stream().skip(offsetIndex + 1).collect(Collectors.toList()), mosaicFromOffsets);
}
Aggregations