Search in sources :

Example 1 with AccountRestrictionsInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsInfoDTO in project nem2-sdk-java by nemtech.

the class RestrictionAccountRepositoryVertxImplTest method shouldGetAccountRestrictions.

@Test
public void shouldGetAccountRestrictions() 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(info);
    AccountRestrictions accountRestrictions = repository.getAccountRestrictions(address).toFuture().get();
    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());
}
Also used : AccountRestrictionDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionDTO) AccountRestrictionsDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsDTO) Address(io.nem.symbol.sdk.model.account.Address) AccountRestrictionsInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsInfoDTO) AccountRestrictions(io.nem.symbol.sdk.model.account.AccountRestrictions) Test(org.junit.jupiter.api.Test)

Example 2 with AccountRestrictionsInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsInfoDTO 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());
}
Also used : AccountRestrictionDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionDTO) AccountRestrictionSearchCriteria(io.nem.symbol.sdk.api.AccountRestrictionSearchCriteria) AccountRestrictionsDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsDTO) Address(io.nem.symbol.sdk.model.account.Address) AccountRestrictionsInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsInfoDTO) AccountRestrictions(io.nem.symbol.sdk.model.account.AccountRestrictions) Test(org.junit.jupiter.api.Test)

Aggregations

AccountRestrictions (io.nem.symbol.sdk.model.account.AccountRestrictions)2 Address (io.nem.symbol.sdk.model.account.Address)2 AccountRestrictionDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionDTO)2 AccountRestrictionsDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsDTO)2 AccountRestrictionsInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.AccountRestrictionsInfoDTO)2 Test (org.junit.jupiter.api.Test)2 AccountRestrictionSearchCriteria (io.nem.symbol.sdk.api.AccountRestrictionSearchCriteria)1