use of com.quorum.gauge.ext.filltx.PrivateFillTransaction in project quorum-acceptance-tests by ConsenSys.
the class FillTransaction method sendFillTransaction.
@Step("Deploy Simple Storage contract using fillTransaction api with an initial value of <initValue> called from <from> private for <to>. Name this contract as <contractName>")
public void sendFillTransaction(int initValue, QuorumNode from, QuorumNode to, String contractName) {
com.quorum.gauge.ext.filltx.FillTransaction filledTx = rawContractService.fillTransaction(from, to, initValue).blockingFirst().getResponseObject();
if (filledTx == null) {
// possible that tessera is older version which is leading to test case failure. skip
// further filltx tests.
DataStoreFactory.getSpecDataStore().put("skipFillTXTests", true);
} else {
assertThat(!filledTx.getRaw().isEmpty());
DataStoreFactory.getSpecDataStore().put("skipFillTXTests", false);
PrivateFillTransaction tx = filledTx.getPrivateTransaction(accountService.getDefaultAccountAddress(from).blockingFirst(), Arrays.asList(privacyService.id(to)));
com.quorum.gauge.ext.filltx.FillTransaction fTx = rawContractService.signTransaction(from, tx).blockingFirst().getResponseObject();
assertThat(!fTx.getRaw().isEmpty());
String txHash = rawContractService.sendRawPrivateTransaction(from, fTx.getRaw(), to).blockingFirst().getTransactionHash();
assertThat(!txHash.isEmpty());
// if the transaction is accepted, its receipt must be available in any node
Predicate<? super EthGetTransactionReceipt> isReceiptPresent = ethGetTransactionReceipt -> ethGetTransactionReceipt.getTransactionReceipt().isPresent();
Optional<TransactionReceipt> receipt = transactionService.getTransactionReceipt(QuorumNode.Node1, txHash).repeatWhen(completed -> completed.delay(2, TimeUnit.SECONDS)).takeUntil(isReceiptPresent).timeout(10, TimeUnit.SECONDS).blockingLast().getTransactionReceipt();
assertThat(receipt.isPresent()).isTrue();
assertThat(receipt.get().getBlockNumber()).isNotEqualTo(currentBlockNumber());
assertThat(!receipt.get().getContractAddress().isEmpty());
Contract c = loadSimpleStorageContract(receipt.get().getContractAddress(), receipt.get());
DataStoreFactory.getSpecDataStore().put(contractName, c);
}
}
Aggregations