use of com.quorum.gauge.common.QuorumNetworkProperty.Node in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method invokeGetMethodOnSimpleContract.
@Step("`<clientName>` invokes get in <contractName> on `<node>` and gets value <expectedValue>")
public void invokeGetMethodOnSimpleContract(String clientName, String contractName, Node node, int expectedValue) {
Contract c = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
BigInteger actualValue = requestAccessToken(clientName).flatMap(t -> contractService.readSimpleContractValue(node, c.getContractAddress())).doOnTerminate(Context::removeAccessToken).onErrorReturn(err -> {
if (StringUtils.equals("Empty value (0x) returned from contract", err.getMessage())) {
return BigInteger.ZERO;
}
throw new RuntimeException(err);
}).blockingFirst();
assertThat(actualValue).isEqualTo(expectedValue);
}
use of com.quorum.gauge.common.QuorumNetworkProperty.Node in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method deployNodeManagedPublicContract.
@Step("`<clientName>` deploys a <contractId> public contract, named <contractName>, by sending a transaction to `<node>` using `<ethAccount>`")
public void deployNodeManagedPublicContract(String clientName, String contractId, String contractName, Node node, String ethAccount) {
Contract contract = requestAccessToken(clientName).flatMap(t -> contractService.createPublicSimpleContract(42, node, ethAccount)).doOnTerminate(Context::removeAccessToken).doOnNext(c -> {
if (c == null || !c.getTransactionReceipt().isPresent()) {
throw new RuntimeException("contract not deployed");
}
}).blockingFirst();
logger.debug("Saving contract address {} with name {}", contract.getContractAddress(), contractName);
DataStoreFactory.getScenarioDataStore().put(contractName, contract);
}
use of com.quorum.gauge.common.QuorumNetworkProperty.Node 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.QuorumNetworkProperty.Node 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.QuorumNetworkProperty.Node in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method setSimpleContractValue.
@Step("`<clientName>` writes a new value <newValue> to <contractName> successfully by sending a transaction to `<node>`")
public void setSimpleContractValue(String clientName, int newValue, String contractName, QuorumNetworkProperty.Node node) {
long chainId = rpcService.call(node, "eth_chainId", Collections.emptyList(), EthChainId.class).blockingFirst().getChainId();
Contract contract = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
assertThat(requestAccessToken(clientName).flatMap(t -> rawContractService.updateRawSimplePublicContract(node, networkProperty.getWallets().get("Wallet1"), contract.getContractAddress(), newValue, chainId)).map(Optional::of).onErrorResumeNext(o -> {
return Observable.just(Optional.empty());
}).doOnTerminate(Context::removeAccessToken).map(r -> r.isPresent() && r.get().isStatusOK()).blockingFirst()).isTrue();
}
Aggregations