Search in sources :

Example 1 with PrivateTransactionResult

use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionResult in project besu by hyperledger.

the class PrivGetPrivateTransactionTest method returnsPrivateTransactionLegacy.

@Test
public void returnsPrivateTransactionLegacy() {
    final PrivateTransaction legacyPrivateTransaction = PrivateTransactionDataFixture.privateTransactionLegacy();
    final ExecutedPrivateTransaction executedPrivateTransaction = createExecutedPrivateTransaction(legacyPrivateTransaction);
    when(privacyController.findPrivateTransactionByPmtHash(any(), any())).thenReturn(Optional.of(executedPrivateTransaction));
    final PrivateTransactionLegacyResult expectedResult = new PrivateTransactionLegacyResult(legacyPrivateTransaction);
    final JsonRpcRequestContext request = createRequestContext();
    final PrivateTransactionResult result = makeRequest(request);
    assertThat(result).usingRecursiveComparison().isEqualTo(expectedResult);
}
Also used : PrivateTransaction(org.hyperledger.besu.ethereum.privacy.PrivateTransaction) ExecutedPrivateTransaction(org.hyperledger.besu.ethereum.privacy.ExecutedPrivateTransaction) PrivateTransactionResult(org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionResult) JsonRpcRequestContext(org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext) PrivateTransactionLegacyResult(org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionLegacyResult) ExecutedPrivateTransaction(org.hyperledger.besu.ethereum.privacy.ExecutedPrivateTransaction) Test(org.junit.Test)

Example 2 with PrivateTransactionResult

use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionResult in project besu by hyperledger.

the class PrivGetPrivateTransactionTest method returnsPrivateTransactionGroup.

@Test
public void returnsPrivateTransactionGroup() {
    final PrivateTransaction privateTransaction = PrivateTransactionDataFixture.privateTransactionBesu();
    final ExecutedPrivateTransaction executedPrivateTransaction = createExecutedPrivateTransaction(privateTransaction);
    when(privacyController.findPrivateTransactionByPmtHash(any(), any())).thenReturn(Optional.of(executedPrivateTransaction));
    final PrivateTransactionGroupResult expectedResult = new PrivateTransactionGroupResult(privateTransaction);
    final JsonRpcRequestContext request = createRequestContext();
    final PrivateTransactionResult result = makeRequest(request);
    assertThat(result).usingRecursiveComparison().isEqualTo(expectedResult);
}
Also used : PrivateTransaction(org.hyperledger.besu.ethereum.privacy.PrivateTransaction) ExecutedPrivateTransaction(org.hyperledger.besu.ethereum.privacy.ExecutedPrivateTransaction) PrivateTransactionResult(org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionResult) JsonRpcRequestContext(org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext) ExecutedPrivateTransaction(org.hyperledger.besu.ethereum.privacy.ExecutedPrivateTransaction) PrivateTransactionGroupResult(org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionGroupResult) Test(org.junit.Test)

Example 3 with PrivateTransactionResult

use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionResult in project besu by hyperledger.

the class PrivGetPrivateTransactionTest method makeRequest.

private PrivateTransactionResult makeRequest(final JsonRpcRequestContext request) {
    final PrivGetPrivateTransaction privGetPrivateTransaction = new PrivGetPrivateTransaction(privacyController, privacyIdProvider);
    final JsonRpcSuccessResponse response = (JsonRpcSuccessResponse) privGetPrivateTransaction.response(request);
    return (PrivateTransactionResult) response.getResult();
}
Also used : PrivateTransactionResult(org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionResult) JsonRpcSuccessResponse(org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse)

Aggregations

PrivateTransactionResult (org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionResult)3 JsonRpcRequestContext (org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext)2 ExecutedPrivateTransaction (org.hyperledger.besu.ethereum.privacy.ExecutedPrivateTransaction)2 PrivateTransaction (org.hyperledger.besu.ethereum.privacy.PrivateTransaction)2 Test (org.junit.Test)2 JsonRpcSuccessResponse (org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse)1 PrivateTransactionGroupResult (org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionGroupResult)1 PrivateTransactionLegacyResult (org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.privacy.PrivateTransactionLegacyResult)1