use of com.quorum.gauge.common.QuorumNode in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method setRawSimpleContractValue.
@Step("`<clientName>` writes a new arbitrary value to <contractName> successfully by sending a transaction to `<node>` with its TM key `<privateFrom>`, signed by `<wallet>` and private for `<privateFor>`")
public void setRawSimpleContractValue(String clientName, String contractName, QuorumNode node, String privateFrom, String wallet, String privateFor) {
Contract c = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
List<String> privateForList = Arrays.stream(privateFor.split(",")).map(String::trim).collect(Collectors.toList());
assertThat(requestAccessToken(clientName).flatMap(t -> rawContractService.updateRawSimplePrivateContract(100, c.getContractAddress(), networkProperty.getWallets().get(wallet), node, privateFrom, privateForList)).map(Optional::of).onErrorResumeNext(o -> {
return Observable.just(Optional.empty());
}).doOnTerminate(Context::removeAccessToken).map(r -> r.isPresent() && r.get().isStatusOK()).blockingFirst()).isTrue();
}
use of com.quorum.gauge.common.QuorumNode in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method invokeSetDelegate.
@Step("`<clientName>` invokes setDelegate to <value> in <contractName> by sending a transaction to `<node>` with its TM key `<privateFrom>`, signed by `<wallet>` and private for `<privateFor>`")
public void invokeSetDelegate(String clientName, boolean value, String contractName, QuorumNode node, String privateFrom, String wallet, String privateFor) {
Contract c = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
List<String> privateForList = Arrays.stream(privateFor.split(",")).map(String::trim).collect(Collectors.toList());
assertThat(requestAccessToken(clientName).flatMap(t -> rawContractService.updateDelegateInSneakyWrapperContract(value, c.getContractAddress(), networkProperty.getWallets().get(wallet), node, privateFrom, privateForList)).map(Optional::of).onErrorResumeNext(o -> {
return Observable.just(Optional.empty());
}).doOnTerminate(Context::removeAccessToken).map(r -> r.isPresent() && r.get().isStatusOK()).blockingFirst()).isTrue();
}
use of com.quorum.gauge.common.QuorumNode in project quorum-acceptance-tests by ConsenSys.
the class NestedPrivateContract method callNewContractC2.
@Step("Execute <privacyFlags> <contractName>'s `newContractC2()` function with new value <newValue> in <source> and it's private for <target>")
public void callNewContractC2(String privacyFlags, String contractName, int newValue, QuorumNode source, String target) {
Contract c1 = mustHaveValue(contractName, Contract.class);
TransactionReceipt receipt = nestedContractService.newContractC2(source, Arrays.stream(target.split(",")).map(s -> QuorumNode.valueOf(s)).collect(Collectors.toList()), c1.getContractAddress(), BigInteger.valueOf(newValue), Arrays.stream(privacyFlags.split(",")).map(PrivacyFlag::valueOf).collect(Collectors.toList())).blockingFirst();
Gauge.writeMessage("Transaction Hash %s", receipt.getTransactionHash());
DataStoreFactory.getScenarioDataStore().put("transactionHash", receipt.getTransactionHash());
}
use of com.quorum.gauge.common.QuorumNode in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method depositClientReceipt.
@Step("`<clientName>` executes <contractName>'s `deposit()` function <times> times with arbitrary id and value between original parties")
public void depositClientReceipt(String clientName, String contractName, int times) {
Contract c = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
Object[] data = mustHaveValue(DataStoreFactory.getScenarioDataStore(), clientName + "ClientReceipt" + contractName, Object[].class);
QuorumNode node = (QuorumNode) data[0];
String privateFrom = (String) data[1];
String privateFor = (String) data[2];
List<String> privateForList = Arrays.stream(privateFor.split(",")).map(String::trim).collect(Collectors.toList());
requestAccessToken(clientName).blockingSubscribe();
try {
List<String> txHashes = new ArrayList<>();
for (int i = 0; i < times; i++) {
assertThat(rawContractService.updateRawClientReceiptPrivateContract(c.getContractAddress(), networkProperty.getWallets().get("Wallet1"), node, privateFrom, privateForList).map(Optional::of).onErrorResumeNext(o -> {
return Observable.just(Optional.empty());
}).doOnNext(r -> {
if (r.isPresent()) {
txHashes.add(r.get().getTransactionHash());
}
}).map(r -> r.isPresent() && r.get().isStatusOK()).blockingFirst()).isTrue();
}
DataStoreFactory.getScenarioDataStore().put("hashes", txHashes.toArray(new String[0]));
} finally {
Context.removeAccessToken();
}
}
use of com.quorum.gauge.common.QuorumNode in project quorum-acceptance-tests by ConsenSys.
the class PrivateStateValidation method updateNewValue.
@Step("Execute contract `C2`(<contractName>)'s `set()` function with new value <newValue> in <source> and it's private for <privateFor>")
public void updateNewValue(String contractName, int newValue, QuorumNode source, String privateFor) {
Contract c = mustHaveValue(DataStoreFactory.getSpecDataStore(), contractName, Contract.class);
TransactionReceipt receipt = nestedContractService.updateC2Contract(source, Arrays.stream(privateFor.split(",")).map(s -> QuorumNode.valueOf(s)).collect(Collectors.toList()), c.getContractAddress(), newValue, Arrays.asList(PrivacyFlag.StandardPrivate)).blockingFirst();
assertThat(receipt.getTransactionHash()).isNotBlank();
assertThat(receipt.getBlockNumber()).isNotEqualTo(currentBlockNumber());
TransactionReceipt receiptPrivateFor = transactionService.waitForTransactionReceipt(QuorumNode.valueOf(privateFor), receipt.getTransactionHash());
assertThat(receiptPrivateFor.getBlockNumber()).isNotEqualTo(currentBlockNumber());
}
Aggregations