Search in sources :

Example 6 with MirrorTransactionsResponse

use of com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse in project hedera-mirror-node by hashgraph.

the class ScheduleFeature method verifyScheduledTransaction.

private void verifyScheduledTransaction(String timestamp) {
    log.info("Verify scheduled transaction {}", timestamp);
    MirrorTransactionsResponse mirrorTransactionsResponse = mirrorClient.getTransactionInfoByTimestamp(timestamp);
    MirrorTransaction mirrorTransaction = verifyMirrorTransactionsResponse(mirrorTransactionsResponse, HttpStatus.OK.value(), false);
    assertThat(mirrorTransaction.getConsensusTimestamp()).isEqualTo(timestamp);
    assertThat(mirrorTransaction.isScheduled()).isTrue();
}
Also used : MirrorTransaction(com.hedera.mirror.test.e2e.acceptance.props.MirrorTransaction) MirrorTransactionsResponse(com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse)

Example 7 with MirrorTransactionsResponse

use of com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse in project hedera-mirror-node by hashgraph.

the class TokenFeature method verifyNftTransfers.

private void verifyNftTransfers(TokenId tokenId, Long serialNumber) {
    String transactionId = networkTransactionResponse.getTransactionIdStringNoCheckSum();
    MirrorTransactionsResponse mirrorTransactionsResponse = mirrorClient.getTransactions(transactionId);
    List<MirrorTransaction> transactions = mirrorTransactionsResponse.getTransactions();
    assertNotNull(transactions);
    assertThat(transactions).isNotEmpty();
    MirrorTransaction mirrorTransaction = transactions.get(0);
    assertThat(mirrorTransaction.getTransactionId()).isEqualTo(transactionId);
    assertThat(mirrorTransaction.getValidStartTimestamp()).isEqualTo(networkTransactionResponse.getValidStartString());
    assertThat(mirrorTransaction.getNftTransfers()).filteredOn(transfer -> tokenId.toString().equals(transfer.getTokenId())).map(MirrorNftTransfer::getSerialNumber).containsExactly(serialNumber);
}
Also used : MirrorTransaction(com.hedera.mirror.test.e2e.acceptance.props.MirrorTransaction) MirrorTransactionsResponse(com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse)

Example 8 with MirrorTransactionsResponse

use of com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse in project hedera-mirror-node by hashgraph.

the class TokenFeature method verifyMirrorRestTransactionIsPresent.

@Then("the mirror node REST API should return status {int} for transaction {string}")
@Retryable(value = { AssertionError.class }, backoff = @Backoff(delayExpression = "#{@restPollingProperties.minBackoff.toMillis()}"), maxAttemptsExpression = "#{@restPollingProperties.maxAttempts}")
public void verifyMirrorRestTransactionIsPresent(int status, String transactionIdString) {
    MirrorTransactionsResponse mirrorTransactionsResponse = mirrorClient.getTransactions(transactionIdString);
    List<MirrorTransaction> transactions = mirrorTransactionsResponse.getTransactions();
    assertNotNull(transactions);
    assertThat(transactions).isNotEmpty();
    MirrorTransaction mirrorTransaction = transactions.get(0);
    assertThat(mirrorTransaction.getTransactionId()).isEqualTo(transactionIdString);
    if (status == HttpStatus.OK.value()) {
        assertThat(mirrorTransaction.getResult()).isEqualTo("SUCCESS");
    }
    // publish background message to network to reduce possibility of stale info in low TPS environment
    topicClient.publishMessageToDefaultTopic();
}
Also used : MirrorTransaction(com.hedera.mirror.test.e2e.acceptance.props.MirrorTransaction) MirrorTransactionsResponse(com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse) Retryable(org.springframework.retry.annotation.Retryable) Then(io.cucumber.java.en.Then)

Example 9 with MirrorTransactionsResponse

use of com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse in project hedera-mirror-node by hashgraph.

the class TokenFeature method verifyTokenTransfers.

private void verifyTokenTransfers(TokenId tokenId) {
    String transactionId = networkTransactionResponse.getTransactionIdStringNoCheckSum();
    MirrorTransactionsResponse mirrorTransactionsResponse = mirrorClient.getTransactions(transactionId);
    List<MirrorTransaction> transactions = mirrorTransactionsResponse.getTransactions();
    assertNotNull(transactions);
    assertThat(transactions).isNotEmpty();
    MirrorTransaction mirrorTransaction = transactions.get(0);
    assertThat(mirrorTransaction.getTransactionId()).isEqualTo(transactionId);
    assertThat(mirrorTransaction.getValidStartTimestamp()).isEqualTo(networkTransactionResponse.getValidStartString());
    assertThat(mirrorTransaction.getName()).isEqualTo("CRYPTOTRANSFER");
    boolean tokenIdFound = false;
    String tokenIdString = tokenId.toString();
    for (MirrorTokenTransfer tokenTransfer : mirrorTransaction.getTokenTransfers()) {
        if (tokenTransfer.getTokenId().equalsIgnoreCase(tokenIdString)) {
            tokenIdFound = true;
            break;
        }
    }
    assertTrue(tokenIdFound);
}
Also used : MirrorTokenTransfer(com.hedera.mirror.test.e2e.acceptance.props.MirrorTokenTransfer) MirrorTransaction(com.hedera.mirror.test.e2e.acceptance.props.MirrorTransaction) MirrorTransactionsResponse(com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse)

Aggregations

MirrorTransaction (com.hedera.mirror.test.e2e.acceptance.props.MirrorTransaction)9 MirrorTransactionsResponse (com.hedera.mirror.test.e2e.acceptance.response.MirrorTransactionsResponse)9 Then (io.cucumber.java.en.Then)4 MirrorTokenTransfer (com.hedera.mirror.test.e2e.acceptance.props.MirrorTokenTransfer)1 MirrorTransfer (com.hedera.mirror.test.e2e.acceptance.props.MirrorTransfer)1 Retryable (org.springframework.retry.annotation.Retryable)1