Search in sources :

Example 6 with MosaicSearchCriteria

use of io.nem.symbol.sdk.api.MosaicSearchCriteria 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);
}
Also used : MosaicPaginationStreamer(io.nem.symbol.sdk.api.MosaicPaginationStreamer) MosaicInfo(io.nem.symbol.sdk.model.mosaic.MosaicInfo) MosaicRepository(io.nem.symbol.sdk.api.MosaicRepository) MosaicSearchCriteria(io.nem.symbol.sdk.api.MosaicSearchCriteria) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

MosaicSearchCriteria (io.nem.symbol.sdk.api.MosaicSearchCriteria)6 MosaicInfo (io.nem.symbol.sdk.model.mosaic.MosaicInfo)5 Address (io.nem.symbol.sdk.model.account.Address)4 MosaicPaginationStreamer (io.nem.symbol.sdk.api.MosaicPaginationStreamer)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 EnumSource (org.junit.jupiter.params.provider.EnumSource)3 MosaicRepository (io.nem.symbol.sdk.api.MosaicRepository)2 PublicAccount (io.nem.symbol.sdk.model.account.PublicAccount)2 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)2 Test (org.junit.jupiter.api.Test)2 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)1 RestrictionMosaicRepository (io.nem.symbol.sdk.api.RestrictionMosaicRepository)1 MosaicDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicDTO)1 MosaicInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicInfoDTO)1 MosaicDTO (io.nem.symbol.sdk.openapi.vertx.model.MosaicDTO)1 MosaicInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.MosaicInfoDTO)1