use of io.nem.symbol.sdk.api.AccountRestrictionSearchCriteria in project nem2-sdk-java by nemtech.
the class RestrictionAccountRepositoryVertxImpl method search.
@Override
public Observable<Page<AccountRestrictions>> search(AccountRestrictionSearchCriteria criteria) {
String address = toDto(criteria.getAddress());
Integer pageSize = criteria.getPageSize();
Integer pageNumber = criteria.getPageNumber();
String offset = criteria.getOffset();
Order order = toDto(criteria.getOrder());
Consumer<Handler<AsyncResult<AccountRestrictionsPage>>> handlerConsumer = (h) -> getClient().searchAccountRestrictions(address, pageSize, pageNumber, offset, order, h);
return this.call(handlerConsumer, this::toPage);
}
use of io.nem.symbol.sdk.api.AccountRestrictionSearchCriteria in project nem2-sdk-java by nemtech.
the class RestrictionAccountRepositoryOkHttpImplTest method search.
@Test
public void search() throws Exception {
Address address = Address.generateRandom(this.networkType);
AccountRestrictionsDTO dto = new AccountRestrictionsDTO();
dto.setAddress(address.encoded());
AccountRestrictionDTO restriction = new AccountRestrictionDTO();
restriction.setRestrictionFlags(AccountRestrictionFlagsEnum.NUMBER_32770);
restriction.setValues(Collections.singletonList("9636553580561478212"));
dto.setRestrictions(Collections.singletonList(restriction));
dto.setVersion(1);
AccountRestrictionsInfoDTO info = new AccountRestrictionsInfoDTO();
info.setAccountRestrictions(dto);
mockRemoteCall(toPage(info));
AccountRestrictions accountRestrictions = repository.search(new AccountRestrictionSearchCriteria()).toFuture().get().getData().get(0);
Assertions.assertEquals(address, accountRestrictions.getAddress());
Assertions.assertEquals(1, accountRestrictions.getRestrictions().size());
Assertions.assertEquals(AccountMosaicRestrictionFlags.BLOCK_MOSAIC, accountRestrictions.getRestrictions().get(0).getRestrictionFlags());
Assertions.assertEquals(Collections.singletonList(MapperUtils.toMosaicId("9636553580561478212")), accountRestrictions.getRestrictions().get(0).getValues());
}
use of io.nem.symbol.sdk.api.AccountRestrictionSearchCriteria in project nem2-sdk-java by nemtech.
the class MerkleLoaderIntegrationTest method accountRestrictions.
public List<Arguments> accountRestrictions() {
RepositoryFactory repositoryFactory = getRepositoryFactory(DEFAULT_REPOSITORY_TYPE);
RestrictionAccountRepository repository = repositoryFactory.createRestrictionAccountRepository();
return getArguments(repository, new AccountRestrictionSearchCriteria());
}
use of io.nem.symbol.sdk.api.AccountRestrictionSearchCriteria in project nem2-sdk-java by nemtech.
the class RestrictionAccountRepositoryVertxImplTest method search.
@Test
public void search() throws Exception {
Address address = Address.generateRandom(this.networkType);
AccountRestrictionsDTO dto = new AccountRestrictionsDTO();
dto.setAddress(address.encoded());
AccountRestrictionDTO restriction = new AccountRestrictionDTO();
restriction.setRestrictionFlags(AccountRestrictionFlagsEnum.NUMBER_32770);
restriction.setValues(Collections.singletonList("9636553580561478212"));
dto.setRestrictions(Collections.singletonList(restriction));
dto.setVersion(1);
AccountRestrictionsInfoDTO info = new AccountRestrictionsInfoDTO();
info.setAccountRestrictions(dto);
mockRemoteCall(toPage(info));
AccountRestrictions accountRestrictions = repository.search(new AccountRestrictionSearchCriteria()).toFuture().get().getData().get(0);
Assertions.assertEquals(address, accountRestrictions.getAddress());
Assertions.assertEquals(1, accountRestrictions.getRestrictions().size());
Assertions.assertEquals(AccountMosaicRestrictionFlags.BLOCK_MOSAIC, accountRestrictions.getRestrictions().get(0).getRestrictionFlags());
Assertions.assertEquals(Collections.singletonList(MapperUtils.toMosaicId("9636553580561478212")), accountRestrictions.getRestrictions().get(0).getValues());
}
Aggregations