Search in sources :

Example 1 with TransactionStatus

use of io.nem.symbol.sdk.model.transaction.TransactionStatus in project nem2-sdk-java by nemtech.

the class TransactionStatusRepositoryVertxImplTest method shouldGetTransactionStatuses.

@Test
public void shouldGetTransactionStatuses() throws Exception {
    TransactionStatusDTO transactionStatusDTO = new TransactionStatusDTO();
    transactionStatusDTO.setGroup(TransactionGroupEnum.FAILED);
    transactionStatusDTO.setDeadline(BigInteger.valueOf(5));
    transactionStatusDTO.setHeight(BigInteger.valueOf(6));
    transactionStatusDTO.setCode(TransactionStatusEnum.FAILURE_ACCOUNTLINK_LINK_ALREADY_EXISTS);
    transactionStatusDTO.setHash("someHash");
    mockRemoteCall(Collections.singletonList(transactionStatusDTO));
    TransactionStatus transaction = repository.getTransactionStatuses(Collections.singletonList(transactionStatusDTO.getHash())).toFuture().get().get(0);
    Assertions.assertNotNull(transaction);
    Assertions.assertEquals(transactionStatusDTO.getHash(), transaction.getHash());
    Assertions.assertEquals(5L, transaction.getDeadline().getValue());
    Assertions.assertEquals(BigInteger.valueOf(6L), transaction.getHeight());
    Assertions.assertEquals("Failure_AccountLink_Link_Already_Exists", transaction.getCode());
    Assertions.assertEquals(transaction.getGroup().getValue(), transactionStatusDTO.getGroup().getValue());
}
Also used : TransactionStatusDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionStatusDTO) TransactionStatus(io.nem.symbol.sdk.model.transaction.TransactionStatus) Test(org.junit.jupiter.api.Test)

Example 2 with TransactionStatus

use of io.nem.symbol.sdk.model.transaction.TransactionStatus in project nem2-sdk-java by nemtech.

the class TransactionRepositoryIntegrationTest method getTransactionsStatuses.

@ParameterizedTest
@EnumSource(RepositoryType.class)
public void getTransactionsStatuses(RepositoryType type) {
    TransactionStatusRepository transactionRepository = getTransactionStatusRepository(type);
    List<TransactionStatus> transactionStatuses = get(transactionRepository.getTransactionStatuses(Collections.singletonList(transactionHash)));
    assertEquals(transactionHash, transactionStatuses.get(0).getHash());
}
Also used : TransactionStatusRepository(io.nem.symbol.sdk.api.TransactionStatusRepository) TransactionStatus(io.nem.symbol.sdk.model.transaction.TransactionStatus) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with TransactionStatus

use of io.nem.symbol.sdk.model.transaction.TransactionStatus in project nem2-sdk-java by nemtech.

the class TransactionRepositoryIntegrationTest method getTransactionStatus.

@ParameterizedTest
@EnumSource(RepositoryType.class)
public void getTransactionStatus(RepositoryType type) {
    TransactionStatus transactionStatus = get(getTransactionStatusRepository(type).getTransactionStatus(transactionHash));
    assertEquals(transactionHash, transactionStatus.getHash());
    assertNotNull(transactionStatus.getCode());
}
Also used : TransactionStatus(io.nem.symbol.sdk.model.transaction.TransactionStatus) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with TransactionStatus

use of io.nem.symbol.sdk.model.transaction.TransactionStatus in project nem2-sdk-java by nemtech.

the class TransactionStatusRepositoryOkHttpImplTest method shouldGetTransactionStatus.

@Test
public void shouldGetTransactionStatus() throws Exception {
    TransactionStatusDTO transactionStatusDTO = new TransactionStatusDTO();
    transactionStatusDTO.setGroup(TransactionGroupEnum.FAILED);
    transactionStatusDTO.setDeadline(BigInteger.valueOf(5));
    transactionStatusDTO.setHeight(BigInteger.valueOf(6));
    transactionStatusDTO.setCode(TransactionStatusEnum.FAILURE_ACCOUNTLINK_LINK_ALREADY_EXISTS);
    transactionStatusDTO.setHash("someHash");
    mockRemoteCall(transactionStatusDTO);
    TransactionStatus transaction = repository.getTransactionStatus(transactionStatusDTO.getHash()).toFuture().get();
    Assertions.assertNotNull(transaction);
    Assertions.assertEquals(transactionStatusDTO.getHash(), transaction.getHash());
    Assertions.assertEquals(5L, transaction.getDeadline().getValue());
    Assertions.assertEquals(BigInteger.valueOf(6L), transaction.getHeight());
    Assertions.assertEquals("Failure_AccountLink_Link_Already_Exists", transaction.getCode());
    Assertions.assertEquals(transaction.getGroup().getValue(), transactionStatusDTO.getGroup().getValue());
}
Also used : TransactionStatusDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO) TransactionStatus(io.nem.symbol.sdk.model.transaction.TransactionStatus) Test(org.junit.jupiter.api.Test)

Example 5 with TransactionStatus

use of io.nem.symbol.sdk.model.transaction.TransactionStatus in project nem2-sdk-java by nemtech.

the class TransactionStatusRepositoryOkHttpImplTest method shouldGetTransactionStatuses.

@Test
public void shouldGetTransactionStatuses() throws Exception {
    TransactionStatusDTO transactionStatusDTO = new TransactionStatusDTO();
    transactionStatusDTO.setGroup(TransactionGroupEnum.FAILED);
    transactionStatusDTO.setDeadline(BigInteger.valueOf(5));
    transactionStatusDTO.setHeight(BigInteger.valueOf(6));
    transactionStatusDTO.setCode(TransactionStatusEnum.FAILURE_ACCOUNTLINK_LINK_ALREADY_EXISTS);
    transactionStatusDTO.setHash("someHash");
    mockRemoteCall(Collections.singletonList(transactionStatusDTO));
    TransactionStatus transaction = repository.getTransactionStatuses(Collections.singletonList(transactionStatusDTO.getHash())).toFuture().get().get(0);
    Assertions.assertNotNull(transaction);
    Assertions.assertEquals(transactionStatusDTO.getHash(), transaction.getHash());
    Assertions.assertEquals(5L, transaction.getDeadline().getValue());
    Assertions.assertEquals(BigInteger.valueOf(6L), transaction.getHeight());
    Assertions.assertEquals("Failure_AccountLink_Link_Already_Exists", transaction.getCode());
    Assertions.assertEquals(transaction.getGroup().getValue(), transactionStatusDTO.getGroup().getValue());
}
Also used : TransactionStatusDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO) TransactionStatus(io.nem.symbol.sdk.model.transaction.TransactionStatus) Test(org.junit.jupiter.api.Test)

Aggregations

TransactionStatus (io.nem.symbol.sdk.model.transaction.TransactionStatus)6 Test (org.junit.jupiter.api.Test)4 TransactionStatusDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionStatusDTO)2 TransactionStatusDTO (io.nem.symbol.sdk.openapi.vertx.model.TransactionStatusDTO)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 EnumSource (org.junit.jupiter.params.provider.EnumSource)2 TransactionStatusRepository (io.nem.symbol.sdk.api.TransactionStatusRepository)1