use of com.quorum.gauge.common.Context in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method notAuthorizedToAcceptContractExtension.
@Step("From `<targetNode>` `<targetClientName>` <expectedErr> to accept `<contractName>` extension, private from `<targetParty>` using `<targetEthAccount>` and private for `<sourceParty>`")
public void notAuthorizedToAcceptContractExtension(Node targetNode, String targetClientName, String expectedErr, String contractName, String targetParty, String targetEthAccount, String sourceParty) {
DataStore store = DataStoreFactory.getScenarioDataStore();
PrivacyFlag privacyFlag = mustHaveValue(store, contractName + "_privacyFlag", PrivacyFlag.class);
String contractAddress = mustHaveValue(store, contractName + "extensionAddress", String.class);
obtainAccessToken(targetClientName);
Optional<String> accessToken = haveValue(DataStoreFactory.getScenarioDataStore(), "access_token", String.class);
accessToken.ifPresent(Context::storeAccessToken);
extensionService.acceptExtension(targetNode, true, targetEthAccount, privacyService.id(targetParty), contractAddress, List.of(privacyService.id(sourceParty)), 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.Context in project quorum-acceptance-tests by ConsenSys.
the class MultiTenancy method getCodeSizeWithAssertion.
private void getCodeSizeWithAssertion(String clientName, String contractName, String targetContractName, Node source, Consumer<BigInteger> assertFunc) {
Contract reader = mustHaveValue(DataStoreFactory.getScenarioDataStore(), contractName, Contract.class);
Contract target = mustHaveValue(DataStoreFactory.getScenarioDataStore(), targetContractName, Contract.class);
obtainAccessToken(clientName);
Optional<String> accessToken = haveValue(DataStoreFactory.getScenarioDataStore(), "access_token", String.class);
accessToken.ifPresent(Context::storeAccessToken);
BigInteger actual = contractCodeReaderService.getCodeSize(source, reader.getContractAddress(), target.getContractAddress()).doOnTerminate(Context::removeAccessToken).blockingFirst();
assertFunc.accept(actual);
}
use of com.quorum.gauge.common.Context in project quorum-acceptance-tests by ConsenSys.
the class ContractExtension method getListedStatus.
public Optional<Map<Object, Object>> getListedStatus(final QuorumNetworkProperty.Node node, final String contractName) {
final Optional<String> accessToken = haveValue(DataStoreFactory.getScenarioDataStore(), "access_token", String.class);
accessToken.ifPresent(Context::storeAccessToken);
final Contract contract = mustHaveValue(contractName, Contract.class);
final QuorumActiveExtensionContracts result = this.extensionService.getExtensionContracts(node).blockingFirst();
Context.removeAccessToken();
return result.getResult().stream().filter(contractStatus -> contractStatus.containsValue(contract.getContractAddress())).findFirst();
}
Aggregations