use of com.quorum.tessera.test.rest.RestUtils in project tessera by ConsenSys.
the class PrivacyIT method updateExistingContractByParticipant.
@Test
public void updateExistingContractByParticipant() {
final String originalHash = sendContractCreationTransaction(PrivacyMode.PARTY_PROTECTION);
Party sender = partyHelper.findByAlias(NodeAlias.B);
SendRequest sendRequest = new SendRequest();
sendRequest.setPayload(new RestUtils().createTransactionData());
sendRequest.setFrom(sender.getPublicKey());
List<String> recipientList = List.of(partyHelper.findByAlias(NodeAlias.A).getPublicKey());
sendRequest.setTo(recipientList.toArray(new String[recipientList.size()]));
sendRequest.setPrivacyFlag(PrivacyMode.PARTY_PROTECTION.getPrivacyFlag());
sendRequest.setAffectedContractTransactions(originalHash);
Response response = sender.getRestClientWebTarget().path("send").request().post(Entity.entity(sendRequest, MIME_TYPE_JSON_2_1));
assertThat(response.getStatus()).isEqualTo(201);
}
use of com.quorum.tessera.test.rest.RestUtils in project tessera by ConsenSys.
the class PrivacyIT method sendPSVTransactionWithoutExecHashWillBeRejected.
@Test
public void sendPSVTransactionWithoutExecHashWillBeRejected() {
Party sender = partyHelper.findByAlias(NodeAlias.A);
SendRequest sendRequest = new SendRequest();
sendRequest.setPayload(new RestUtils().createTransactionData());
sendRequest.setFrom(sender.getPublicKey());
List<String> recipientList = List.of(partyHelper.findByAlias(NodeAlias.B).getPublicKey());
sendRequest.setTo(recipientList.toArray(new String[recipientList.size()]));
sendRequest.setPrivacyFlag(PrivacyMode.PRIVATE_STATE_VALIDATION.getPrivacyFlag());
sendRequest.setAffectedContractTransactions(new String[0]);
Response response = sender.getRestClientWebTarget().path("send").request().post(Entity.entity(sendRequest, MIME_TYPE_JSON_2_1));
assertThat(response.getStatus()).isEqualTo(400);
}
use of com.quorum.tessera.test.rest.RestUtils in project tessera by ConsenSys.
the class PrivacyIT method updateExistingContractByNonParticipant.
@Test
public void updateExistingContractByNonParticipant() {
final String originalHash = sendContractCreationTransaction(PrivacyMode.PARTY_PROTECTION);
Party sender = partyHelper.findByAlias(NodeAlias.C);
SendRequest sendRequest = new SendRequest();
sendRequest.setPayload(new RestUtils().createTransactionData());
sendRequest.setFrom(sender.getPublicKey());
List<String> recipientList = List.of(partyHelper.findByAlias(NodeAlias.B).getPublicKey());
sendRequest.setTo(recipientList.toArray(new String[recipientList.size()]));
sendRequest.setPrivacyFlag(PrivacyMode.PARTY_PROTECTION.getPrivacyFlag());
sendRequest.setAffectedContractTransactions(originalHash);
Response response = sender.getRestClientWebTarget().path("send").request().post(Entity.entity(sendRequest, MIME_TYPE_JSON_2_1));
assertThat(response.getStatus()).isEqualTo(403);
}
use of com.quorum.tessera.test.rest.RestUtils in project tessera by ConsenSys.
the class PrivacyIT method sendContractCreationTransaction.
private String sendContractCreationTransaction(PrivacyMode privacyMode) {
Party sender = partyHelper.findByAlias(NodeAlias.A);
SendRequest sendRequest = new SendRequest();
sendRequest.setPayload(new RestUtils().createTransactionData());
sendRequest.setFrom(sender.getPublicKey());
List<String> recipientList = List.of(partyHelper.findByAlias(NodeAlias.B).getPublicKey());
sendRequest.setTo(recipientList.toArray(new String[recipientList.size()]));
sendRequest.setPrivacyFlag(privacyMode.getPrivacyFlag());
sendRequest.setAffectedContractTransactions(new String[0]);
if (privacyMode == PrivacyMode.PRIVATE_STATE_VALIDATION) {
sendRequest.setExecHash("execHash");
}
Response response = sender.getRestClientWebTarget().path("send").request().post(Entity.entity(sendRequest, MIME_TYPE_JSON_2_1));
assertThat(response.getStatus()).isEqualTo(201);
final SendResponse result = response.readEntity(SendResponse.class);
return result.getKey();
}
Aggregations