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));
}
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));
}
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);
}
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());
}
Aggregations