Search in sources :

Example 1 with ReceiptSource

use of io.nem.symbol.sdk.model.receipt.ReceiptSource in project nem2-sdk-java by nemtech.

the class TransactionServiceTest method simulateStatement.

private void simulateStatement(BigInteger height, int primaryId, int secondaryId) {
    Map<NamespaceId, Address> addressMap = new HashMap<>();
    addressMap.put(addressNamespace1, address1);
    addressMap.put(addressNamespace2, address2);
    addressMap.put(addressNamespace3, address3);
    Map<NamespaceId, MosaicId> mosaicMap = new HashMap<>();
    mosaicMap.put(mosaicNamespace1, mosaicId1);
    mosaicMap.put(mosaicNamespace2, mosaicId2);
    mosaicMap.put(mosaicNamespace3, mosaicId3);
    List<AddressResolutionStatement> addressResolutionStatements = addressMap.entrySet().stream().map(e -> new AddressResolutionStatement("abc", height, e.getKey(), Collections.singletonList(ResolutionEntry.forAddress(e.getValue(), new ReceiptSource(primaryId, secondaryId))))).collect(Collectors.toList());
    List<MosaicResolutionStatement> mosaicResolutionStatements = mosaicMap.entrySet().stream().map(e -> new MosaicResolutionStatement("abc", height, e.getKey(), Collections.singletonList(ResolutionEntry.forMosaicId(e.getValue(), new ReceiptSource(primaryId, secondaryId))))).collect(Collectors.toList());
    Mockito.when(receiptRepositoryMock.searchAddressResolutionStatements(Mockito.eq(new ResolutionStatementSearchCriteria().height(height)))).thenReturn(Observable.just(new Page<>(addressResolutionStatements)));
    Mockito.when(receiptRepositoryMock.searchMosaicResolutionStatements(Mockito.eq(new ResolutionStatementSearchCriteria().height(height)))).thenReturn(Observable.just(new Page<>(mosaicResolutionStatements)));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) ResolutionEntry(io.nem.symbol.sdk.model.receipt.ResolutionEntry) SecretProofTransaction(io.nem.symbol.sdk.model.transaction.SecretProofTransaction) HashLockTransaction(io.nem.symbol.sdk.model.transaction.HashLockTransaction) Account(io.nem.symbol.sdk.model.account.Account) MosaicAddressRestrictionTransaction(io.nem.symbol.sdk.model.transaction.MosaicAddressRestrictionTransaction) AccountAddressRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) Map(java.util.Map) TransactionType(io.nem.symbol.sdk.model.transaction.TransactionType) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) BigInteger(java.math.BigInteger) Listener(io.nem.symbol.sdk.api.Listener) MosaicDefinitionTransaction(io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction) AccountMosaicRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction) MosaicDefinitionTransactionFactory(io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransactionFactory) NamespaceId(io.nem.symbol.sdk.model.namespace.NamespaceId) AccountAddressRestrictionFlags(io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionFlags) BlockDuration(io.nem.symbol.sdk.model.blockchain.BlockDuration) MosaicMetadataTransactionFactory(io.nem.symbol.sdk.model.transaction.MosaicMetadataTransactionFactory) PlainMessage(io.nem.symbol.sdk.model.message.PlainMessage) MosaicMetadataTransaction(io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction) Transaction(io.nem.symbol.sdk.model.transaction.Transaction) AccountAddressRestrictionTransactionFactory(io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransactionFactory) Collectors(java.util.stream.Collectors) StringEncoder(io.nem.symbol.core.utils.StringEncoder) Currency(io.nem.symbol.sdk.model.mosaic.Currency) ReceiptRepository(io.nem.symbol.sdk.api.ReceiptRepository) Test(org.junit.jupiter.api.Test) List(java.util.List) TransferTransactionFactory(io.nem.symbol.sdk.model.transaction.TransferTransactionFactory) MosaicAddressRestrictionTransactionFactory(io.nem.symbol.sdk.model.transaction.MosaicAddressRestrictionTransactionFactory) ExceptionUtils(io.nem.symbol.core.utils.ExceptionUtils) AggregateTransactionFactory(io.nem.symbol.sdk.model.transaction.AggregateTransactionFactory) TransactionFactory(io.nem.symbol.sdk.model.transaction.TransactionFactory) Address(io.nem.symbol.sdk.model.account.Address) Page(io.nem.symbol.sdk.api.Page) SecretLockTransactionFactory(io.nem.symbol.sdk.model.transaction.SecretLockTransactionFactory) MosaicSupplyChangeTransactionFactory(io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransactionFactory) HashLockTransactionFactory(io.nem.symbol.sdk.model.transaction.HashLockTransactionFactory) Mosaic(io.nem.symbol.sdk.model.mosaic.Mosaic) AccountMosaicRestrictionTransactionFactory(io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransactionFactory) HashMap(java.util.HashMap) MosaicGlobalRestrictionTransaction(io.nem.symbol.sdk.model.transaction.MosaicGlobalRestrictionTransaction) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory) ArrayList(java.util.ArrayList) AccountMosaicRestrictionFlags(io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionFlags) MosaicRestrictionType(io.nem.symbol.sdk.model.transaction.MosaicRestrictionType) ResolutionStatementSearchCriteria(io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria) TransactionService(io.nem.symbol.sdk.api.TransactionService) AddressResolutionStatement(io.nem.symbol.sdk.model.receipt.AddressResolutionStatement) MosaicResolutionStatement(io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement) MosaicNonce(io.nem.symbol.sdk.model.mosaic.MosaicNonce) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) MosaicSupplyChangeActionType(io.nem.symbol.sdk.model.mosaic.MosaicSupplyChangeActionType) Observable(io.reactivex.Observable) SecretProofTransactionFactory(io.nem.symbol.sdk.model.transaction.SecretProofTransactionFactory) UnresolvedAddress(io.nem.symbol.sdk.model.account.UnresolvedAddress) LockHashAlgorithm(io.nem.symbol.sdk.model.transaction.LockHashAlgorithm) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) ReceiptSource(io.nem.symbol.sdk.model.receipt.ReceiptSource) ExecutionException(java.util.concurrent.ExecutionException) TransactionGroup(io.nem.symbol.sdk.model.transaction.TransactionGroup) TransactionInfo(io.nem.symbol.sdk.model.transaction.TransactionInfo) Mockito(org.mockito.Mockito) Deadline(io.nem.symbol.sdk.model.transaction.Deadline) AfterEach(org.junit.jupiter.api.AfterEach) Assertions(org.junit.jupiter.api.Assertions) NetworkType(io.nem.symbol.sdk.model.network.NetworkType) TransactionAnnounceResponse(io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse) MosaicFlags(io.nem.symbol.sdk.model.mosaic.MosaicFlags) MosaicSupplyChangeTransaction(io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction) Collections(java.util.Collections) TransactionRepository(io.nem.symbol.sdk.api.TransactionRepository) MosaicGlobalRestrictionTransactionFactory(io.nem.symbol.sdk.model.transaction.MosaicGlobalRestrictionTransactionFactory) SecretLockTransaction(io.nem.symbol.sdk.model.transaction.SecretLockTransaction) Address(io.nem.symbol.sdk.model.account.Address) UnresolvedAddress(io.nem.symbol.sdk.model.account.UnresolvedAddress) HashMap(java.util.HashMap) ReceiptSource(io.nem.symbol.sdk.model.receipt.ReceiptSource) AddressResolutionStatement(io.nem.symbol.sdk.model.receipt.AddressResolutionStatement) ResolutionStatementSearchCriteria(io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria) Page(io.nem.symbol.sdk.api.Page) MosaicResolutionStatement(io.nem.symbol.sdk.model.receipt.MosaicResolutionStatement) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) NamespaceId(io.nem.symbol.sdk.model.namespace.NamespaceId)

Aggregations

ExceptionUtils (io.nem.symbol.core.utils.ExceptionUtils)1 StringEncoder (io.nem.symbol.core.utils.StringEncoder)1 Listener (io.nem.symbol.sdk.api.Listener)1 Page (io.nem.symbol.sdk.api.Page)1 ReceiptRepository (io.nem.symbol.sdk.api.ReceiptRepository)1 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)1 ResolutionStatementSearchCriteria (io.nem.symbol.sdk.api.ResolutionStatementSearchCriteria)1 TransactionRepository (io.nem.symbol.sdk.api.TransactionRepository)1 TransactionService (io.nem.symbol.sdk.api.TransactionService)1 Account (io.nem.symbol.sdk.model.account.Account)1 Address (io.nem.symbol.sdk.model.account.Address)1 UnresolvedAddress (io.nem.symbol.sdk.model.account.UnresolvedAddress)1 BlockDuration (io.nem.symbol.sdk.model.blockchain.BlockDuration)1 PlainMessage (io.nem.symbol.sdk.model.message.PlainMessage)1 Currency (io.nem.symbol.sdk.model.mosaic.Currency)1 Mosaic (io.nem.symbol.sdk.model.mosaic.Mosaic)1 MosaicFlags (io.nem.symbol.sdk.model.mosaic.MosaicFlags)1 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)1 MosaicNonce (io.nem.symbol.sdk.model.mosaic.MosaicNonce)1 MosaicSupplyChangeActionType (io.nem.symbol.sdk.model.mosaic.MosaicSupplyChangeActionType)1