use of com.quorum.gauge.common.PrivacyFlag 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.PrivacyFlag in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method notAuthorizedToExtendContract.
@Step("`<sourceClientName>` <expectedErr> to extend <contractName> on `<sourceNode>` private from `<sourceParty>` using `<sourceEthAccount>` to `<targetClientName>`'s `<targetParty>` on `<targetNode>` with acceptance by `<targetEthAccount>`")
public void notAuthorizedToExtendContract(String sourceClientName, String expectedErr, String contractName, Node sourceNode, String sourceParty, String sourceEthAccount, String targetClientName, String targetParty, Node targetNode, String targetEthAccount) {
Contract existingContract = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
PrivacyFlag privacyFlag = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName + "_privacyFlag", PrivacyFlag.class);
Optional<String> accessToken = haveValue(DataStoreFactory.getScenarioDataStore(), "access_token", String.class);
accessToken.ifPresent(Context::storeAccessToken);
extensionService.initiateContractExtension(sourceNode, sourceEthAccount, sourceParty, existingContract.getContractAddress(), targetNode, targetEthAccount, targetParty, privacyFlag).doOnNext(res -> {
assertThat(res.getError()).as("expected error to return").isNotNull();
assertThat(res.getError().getMessage()).contains(expectedErr);
}).doOnTerminate(Context::removeAccessToken).blockingSubscribe();
}
use of com.quorum.gauge.common.PrivacyFlag in project quorum-acceptance-tests by ConsenSys.
the class ContractExtension method createInavlidContractExtension.
@Step("Initiating extension of <contractName> to <newNode> with its default account as recipient from <creator> should fail with error <expErrMsg>")
public void createInavlidContractExtension(final String contractName, final QuorumNetworkProperty.Node newNode, final QuorumNetworkProperty.Node creator, final String expErrMsg) {
PrivacyFlag privacyFlag = PrivacyFlag.StandardPrivate;
DataStoreFactory.getScenarioDataStore().put("privacyFlag", privacyFlag);
final Set<QuorumNetworkProperty.Node> allNodes = Stream.of(newNode, creator).collect(Collectors.toSet());
DataStoreFactory.getScenarioDataStore().put("extensionAllNodes", allNodes);
final Contract existingContract = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
final QuorumExtendContract result = extensionService.initiateContractExtension(creator, existingContract.getContractAddress(), newNode, privacyFlag).blockingFirst();
assertThat(result.getError().getMessage()).isEqualTo(expErrMsg);
}
use of com.quorum.gauge.common.PrivacyFlag in project quorum-acceptance-tests by ConsenSys.
the class ContractExtension method createInvalidExtensionProposition.
@Step("Initiate <contractName> extension from non creating node <fromNode> to <newNode> should fail with error message <errMsg>")
public void createInvalidExtensionProposition(final String contractName, final QuorumNetworkProperty.Node fromNode, final QuorumNetworkProperty.Node newNode, final String errMsg) throws InterruptedException {
PrivacyFlag privacyFlag = PrivacyFlag.StandardPrivate;
DataStoreFactory.getScenarioDataStore().put("privacyFlag", privacyFlag);
final Set<QuorumNetworkProperty.Node> allNodes = Stream.of(fromNode, newNode).collect(Collectors.toSet());
DataStoreFactory.getScenarioDataStore().put("extensionAllNodes", allNodes);
final Contract existingContract = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
final QuorumExtendContract result = extensionService.initiateContractExtension(fromNode, existingContract.getContractAddress(), newNode, privacyFlag).blockingFirst();
assertThat(result.getError().getMessage()).isEqualTo(errMsg);
}
use of com.quorum.gauge.common.PrivacyFlag in project quorum-acceptance-tests by ConsenSys.
the class ContractExtension method acceptExtension.
@Step("<newNode> accepts the offer to extend the contract <contractName>")
public void acceptExtension(final QuorumNetworkProperty.Node newNode, final String contractName) {
final DataStore store = DataStoreFactory.getScenarioDataStore();
final PrivacyFlag privacyFlag = mustHaveValue(store, "privacyFlag", PrivacyFlag.class);
final String contractAddress = mustHaveValue(store, contractName + "extensionAddress", String.class);
final Set<QuorumNetworkProperty.Node> allNodes = mustHaveValue(store, "extensionAllNodes", Set.class);
final QuorumVoteOnContract result = this.extensionService.acceptExtension(newNode, true, contractAddress, allNodes, privacyFlag).blockingFirst();
if (result.getError() != null) {
logger.error(result.getError().toString());
}
assertThat(result.getError()).isNull();
final Optional<TransactionReceipt> transactionReceipt = transactionService.pollTransactionReceipt(newNode, result.getResult());
assertThat(transactionReceipt.isPresent()).isTrue();
assertThat(transactionReceipt.get().getStatus()).isEqualTo("0x1");
}
Aggregations