@Test public void test001WriteTransaction_Without_DltData_ShouldFail() { Assertions .assertThatThrownBy(() -> this.overledgerSDK.writeTransaction(this.overledgerTransactionRequest)) .isInstanceOf(EmptyDltException.class) .hasMessage("No DLT found"); }
@Override public OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction) throws Exception { this.verifyOverledgerTransaction(ovlTransaction); OverledgerTransaction overledgerTransaction = null; try { ovlTransaction.getDltData().stream() .map(dltTransaction -> (DltTransactionRequest)dltTransaction) .map(dltTransactionRequest -> { if (dltTransactionRequest instanceof DltStreamTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltStreamTransactionRequest) dltTransactionRequest).getInputStream(), dltTransactionRequest ); } else if (dltTransactionRequest instanceof DltBytesTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltBytesTransactionRequest) dltTransactionRequest).getBytes(), dltTransactionRequest ); } else { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), dltTransactionRequest.getMessage(), dltTransactionRequest ); } return dltTransactionRequest; }).collect(Collectors.toList()); overledgerTransaction = (OverledgerTransactionResponse)this.client.postTransaction(ovlTransaction, OverledgerTransactionRequest.class, OverledgerTransactionResponse.class); ObjectMapper objectMapper = new ObjectMapper(); System.out.println(objectMapper.writeValueAsString(overledgerTransaction)); } catch (Exception e) { this.throwCauseException(e); } return overledgerTransaction; }
DefaultOverledgerSDK implements OverledgerSDK { @Override public OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction) throws Exception { this.verifyOverledgerTransaction(ovlTransaction); OverledgerTransaction overledgerTransaction = null; try { ovlTransaction.getDltData().stream() .map(dltTransaction -> (DltTransactionRequest)dltTransaction) .map(dltTransactionRequest -> { if (dltTransactionRequest instanceof DltStreamTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltStreamTransactionRequest) dltTransactionRequest).getInputStream(), dltTransactionRequest ); } else if (dltTransactionRequest instanceof DltBytesTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltBytesTransactionRequest) dltTransactionRequest).getBytes(), dltTransactionRequest ); } else { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), dltTransactionRequest.getMessage(), dltTransactionRequest ); } return dltTransactionRequest; }).collect(Collectors.toList()); overledgerTransaction = (OverledgerTransactionResponse)this.client.postTransaction(ovlTransaction, OverledgerTransactionRequest.class, OverledgerTransactionResponse.class); ObjectMapper objectMapper = new ObjectMapper(); System.out.println(objectMapper.writeValueAsString(overledgerTransaction)); } catch (Exception e) { this.throwCauseException(e); } return overledgerTransaction; } }
DefaultOverledgerSDK implements OverledgerSDK { @Override public OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction) throws Exception { this.verifyOverledgerTransaction(ovlTransaction); OverledgerTransaction overledgerTransaction = null; try { ovlTransaction.getDltData().stream() .map(dltTransaction -> (DltTransactionRequest)dltTransaction) .map(dltTransactionRequest -> { if (dltTransactionRequest instanceof DltStreamTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltStreamTransactionRequest) dltTransactionRequest).getInputStream(), dltTransactionRequest ); } else if (dltTransactionRequest instanceof DltBytesTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltBytesTransactionRequest) dltTransactionRequest).getBytes(), dltTransactionRequest ); } else { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), dltTransactionRequest.getMessage(), dltTransactionRequest ); } return dltTransactionRequest; }).collect(Collectors.toList()); overledgerTransaction = (OverledgerTransactionResponse)this.client.postTransaction(ovlTransaction, OverledgerTransactionRequest.class, OverledgerTransactionResponse.class); ObjectMapper objectMapper = new ObjectMapper(); System.out.println(objectMapper.writeValueAsString(overledgerTransaction)); } catch (Exception e) { this.throwCauseException(e); } return overledgerTransaction; } private  DefaultOverledgerSDK(NETWORK network); private  DefaultOverledgerSDK(NETWORK network, AccountManager accountManager, Client client); }
DefaultOverledgerSDK implements OverledgerSDK { @Override public OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction) throws Exception { this.verifyOverledgerTransaction(ovlTransaction); OverledgerTransaction overledgerTransaction = null; try { ovlTransaction.getDltData().stream() .map(dltTransaction -> (DltTransactionRequest)dltTransaction) .map(dltTransactionRequest -> { if (dltTransactionRequest instanceof DltStreamTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltStreamTransactionRequest) dltTransactionRequest).getInputStream(), dltTransactionRequest ); } else if (dltTransactionRequest instanceof DltBytesTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltBytesTransactionRequest) dltTransactionRequest).getBytes(), dltTransactionRequest ); } else { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), dltTransactionRequest.getMessage(), dltTransactionRequest ); } return dltTransactionRequest; }).collect(Collectors.toList()); overledgerTransaction = (OverledgerTransactionResponse)this.client.postTransaction(ovlTransaction, OverledgerTransactionRequest.class, OverledgerTransactionResponse.class); ObjectMapper objectMapper = new ObjectMapper(); System.out.println(objectMapper.writeValueAsString(overledgerTransaction)); } catch (Exception e) { this.throwCauseException(e); } return overledgerTransaction; } private  DefaultOverledgerSDK(NETWORK network); private  DefaultOverledgerSDK(NETWORK network, AccountManager accountManager, Client client); NETWORK getNetwork(); @Override void initial(NETWORK network); @Override void addAccount(String dlt, Account account); @Override OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction); @Override OverledgerTransaction readTransaction(UUID overledgerTransactionID); @Override OverledgerTransactions readTransactions(String mappId); @Override OverledgerTransactions readTransactions(String mappId, PageParams pageParams); @Override @Deprecated OverledgerTransaction readTransaction(String dlt, String transactionHash); @Override Transaction searchTransaction(String transactionHash, Class<Transaction> responseClass); @Override @Deprecated Address searchAddress(String address, Class<Address> responseClass); @Override Address searchAddress(String address); @Deprecated Block searchBlock(String dlt, String blockhash, Class<Block> responseClass); @Override Block searchBlock(String dlt, String blockhash); @Override Block searchBlock(String dlt, BigDecimal blocknumber); @Override List<BalanceResponse> getBalance(List<BalanceRequest> balanceRequests); @Override SequenceResponse getSequence(SequenceRequest sequenceRequest); OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction, byte[] data); OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction, InputStream inputStream); static DefaultOverledgerSDK newInstance(NETWORK network); static DefaultOverledgerSDK newInstance(NETWORK network, AccountManager accountManager, Client client); static DefaultOverledgerSDK newInstance(); static DefaultOverledgerSDK newInstance(AccountManager accountManager, Client client); }
DefaultOverledgerSDK implements OverledgerSDK { @Override public OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction) throws Exception { this.verifyOverledgerTransaction(ovlTransaction); OverledgerTransaction overledgerTransaction = null; try { ovlTransaction.getDltData().stream() .map(dltTransaction -> (DltTransactionRequest)dltTransaction) .map(dltTransactionRequest -> { if (dltTransactionRequest instanceof DltStreamTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltStreamTransactionRequest) dltTransactionRequest).getInputStream(), dltTransactionRequest ); } else if (dltTransactionRequest instanceof DltBytesTransactionRequest) { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), ((DltBytesTransactionRequest) dltTransactionRequest).getBytes(), dltTransactionRequest ); } else { this.accountManager.getAccount(dltTransactionRequest.getDlt()).sign( dltTransactionRequest.getFromAddress(), dltTransactionRequest.getToAddress(), dltTransactionRequest.getMessage(), dltTransactionRequest ); } return dltTransactionRequest; }).collect(Collectors.toList()); overledgerTransaction = (OverledgerTransactionResponse)this.client.postTransaction(ovlTransaction, OverledgerTransactionRequest.class, OverledgerTransactionResponse.class); ObjectMapper objectMapper = new ObjectMapper(); System.out.println(objectMapper.writeValueAsString(overledgerTransaction)); } catch (Exception e) { this.throwCauseException(e); } return overledgerTransaction; } private  DefaultOverledgerSDK(NETWORK network); private  DefaultOverledgerSDK(NETWORK network, AccountManager accountManager, Client client); NETWORK getNetwork(); @Override void initial(NETWORK network); @Override void addAccount(String dlt, Account account); @Override OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction); @Override OverledgerTransaction readTransaction(UUID overledgerTransactionID); @Override OverledgerTransactions readTransactions(String mappId); @Override OverledgerTransactions readTransactions(String mappId, PageParams pageParams); @Override @Deprecated OverledgerTransaction readTransaction(String dlt, String transactionHash); @Override Transaction searchTransaction(String transactionHash, Class<Transaction> responseClass); @Override @Deprecated Address searchAddress(String address, Class<Address> responseClass); @Override Address searchAddress(String address); @Deprecated Block searchBlock(String dlt, String blockhash, Class<Block> responseClass); @Override Block searchBlock(String dlt, String blockhash); @Override Block searchBlock(String dlt, BigDecimal blocknumber); @Override List<BalanceResponse> getBalance(List<BalanceRequest> balanceRequests); @Override SequenceResponse getSequence(SequenceRequest sequenceRequest); OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction, byte[] data); OverledgerTransaction writeTransaction(OverledgerTransaction ovlTransaction, InputStream inputStream); static DefaultOverledgerSDK newInstance(NETWORK network); static DefaultOverledgerSDK newInstance(NETWORK network, AccountManager accountManager, Client client); static DefaultOverledgerSDK newInstance(); static DefaultOverledgerSDK newInstance(AccountManager accountManager, Client client);  }