Search in sources :

Example 1 with MultisigAccountGraphInfo

use of io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo in project nem2-sdk-java by nemtech.

the class MultisigRepositoryOkHttpImplTest method getMultisigAccountGraphInfo.

@Test
void getMultisigAccountGraphInfo() throws Exception {
    MultisigAccountGraphInfoDTO dto = new MultisigAccountGraphInfoDTO();
    dto.setLevel(10);
    dto.setMultisigEntries(new ArrayList<>());
    dto.getMultisigEntries().add(createMultisigAccountInfoDTO());
    List<MultisigAccountGraphInfoDTO> dtos = new ArrayList<>();
    dtos.add(dto);
    mockRemoteCall(dtos);
    MultisigAccountGraphInfo multisigAccountInfo = repository.getMultisigAccountGraphInfo(account.getAddress()).toFuture().get();
    Assertions.assertEquals(1, multisigAccountInfo.getMultisigEntries().size());
    List<MultisigAccountInfo> multisigAccountInfos = multisigAccountInfo.getMultisigEntries().get(10);
    Assertions.assertEquals(1, multisigAccountInfos.size());
    assertMultisignAccountInfo(multisigAccountInfos.get(0));
}
Also used : MultisigAccountGraphInfo(io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo) ArrayList(java.util.ArrayList) MultisigAccountInfo(io.nem.symbol.sdk.model.account.MultisigAccountInfo) MultisigAccountGraphInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MultisigAccountGraphInfoDTO) Test(org.junit.jupiter.api.Test)

Example 2 with MultisigAccountGraphInfo

use of io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo in project nem2-sdk-java by nemtech.

the class MultisigRepositoryVertxImplTest method getMultisigAccountGraphInfo.

@Test
void getMultisigAccountGraphInfo() throws Exception {
    MultisigAccountGraphInfoDTO dto = new MultisigAccountGraphInfoDTO();
    dto.setLevel(10);
    dto.setMultisigEntries(new ArrayList<>());
    dto.getMultisigEntries().add(createMultisigAccountInfoDTO());
    List<MultisigAccountGraphInfoDTO> dtos = new ArrayList<>();
    dtos.add(dto);
    mockRemoteCall(dtos);
    MultisigAccountGraphInfo multisigAccountInfo = repository.getMultisigAccountGraphInfo(account.getAddress()).toFuture().get();
    Assertions.assertEquals(1, multisigAccountInfo.getMultisigEntries().size());
    List<MultisigAccountInfo> multisigAccountInfos = multisigAccountInfo.getMultisigEntries().get(10);
    Assertions.assertEquals(1, multisigAccountInfos.size());
    assertMultisignAccountInfo(multisigAccountInfos.get(0));
}
Also used : MultisigAccountGraphInfo(io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo) ArrayList(java.util.ArrayList) MultisigAccountInfo(io.nem.symbol.sdk.model.account.MultisigAccountInfo) MultisigAccountGraphInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MultisigAccountGraphInfoDTO) Test(org.junit.jupiter.api.Test)

Example 3 with MultisigAccountGraphInfo

use of io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo in project nem2-sdk-java by nemtech.

the class AggregateTransactionServiceTest method getMaxCosignatures.

@Test
void getMaxCosignatures() throws ExecutionException, InterruptedException {
    Map<Integer, List<MultisigAccountInfo>> infoMap = new HashMap<>();
    MultisigAccountInfo multisigAccountInfo1 = new MultisigAccountInfo("a", 1, multisig1.getAddress(), 1, 1, Arrays.asList(account1.getAddress(), account2.getAddress(), account3.getAddress()), Collections.emptyList());
    infoMap.put(-3, Collections.singletonList(multisigAccountInfo1));
    MultisigAccountInfo multisigAccountInfo2 = new MultisigAccountInfo("a", 1, multisig2.getAddress(), 1, 1, Arrays.asList(account4.getAddress(), account2.getAddress(), account3.getAddress()), Collections.emptyList());
    infoMap.put(-2, Collections.singletonList(multisigAccountInfo2));
    MultisigAccountGraphInfo multisigAccountGraphInfo = new MultisigAccountGraphInfo(infoMap);
    Mockito.when(multisigRepository.getMultisigAccountGraphInfo(Mockito.eq(account1.getAddress()))).thenReturn(Observable.just(multisigAccountGraphInfo));
    Integer maxConsignatures = service.getMaxCosignatures(account1.getAddress()).toFuture().get();
    Assertions.assertEquals(4, maxConsignatures);
}
Also used : BigInteger(java.math.BigInteger) MultisigAccountGraphInfo(io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo) HashMap(java.util.HashMap) MultisigAccountInfo(io.nem.symbol.sdk.model.account.MultisigAccountInfo) List(java.util.List) Test(org.junit.jupiter.api.Test)

Example 4 with MultisigAccountGraphInfo

use of io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo in project nem2-sdk-java by nemtech.

the class MultisigRepositoryIntegrationTest method getMultisigAccountGraphInfo.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMultisigAccountGraphInfo(RepositoryType type) {
    Account multisigAccount = helper().getMultisigAccount(type).getLeft();
    MultisigAccountGraphInfo multisigAccountGraphInfos = get(this.getRepositoryFactory(type).createMultisigRepository().getMultisigAccountGraphInfo(multisigAccount.getAddress()));
    assertEquals(2, multisigAccountGraphInfos.getLevelsNumber().size());
    assertEquals(2, multisigAccountGraphInfos.getMultisigEntries().size());
    assertEquals(1, multisigAccountGraphInfos.getMultisigEntries().get(0).size());
    assertEquals(1, multisigAccountGraphInfos.getMultisigEntries().get(0).size());
    assertEquals(2, multisigAccountGraphInfos.getMultisigEntries().get(1).size());
    assertEquals(multisigAccount.getAddress(), multisigAccountGraphInfos.getMultisigEntries().get(0).get(0).getAccountAddress());
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) MultisigAccountGraphInfo(io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

MultisigAccountGraphInfo (io.nem.symbol.sdk.model.account.MultisigAccountGraphInfo)4 MultisigAccountInfo (io.nem.symbol.sdk.model.account.MultisigAccountInfo)3 Test (org.junit.jupiter.api.Test)3 ArrayList (java.util.ArrayList)2 Account (io.nem.symbol.sdk.model.account.Account)1 MultisigAccountGraphInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.MultisigAccountGraphInfoDTO)1 MultisigAccountGraphInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.MultisigAccountGraphInfoDTO)1 BigInteger (java.math.BigInteger)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 EnumSource (org.junit.jupiter.params.provider.EnumSource)1