Search in sources :

Example 1 with TokenPauseStatusEnum

use of com.hedera.mirror.common.domain.token.TokenPauseStatusEnum in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerTokenTest method tokenCreate.

void tokenCreate(List<CustomFee> customFees, boolean freezeDefault, boolean freezeKey, boolean kycKey, boolean pauseKey, List<TokenAccount> expectedTokenAccounts, List<EntityId> autoAssociatedAccounts) {
    // given
    Entity expected = createEntity(DOMAIN_TOKEN_ID, TOKEN_REF_KEY, PAYER.getAccountNum(), AUTO_RENEW_PERIOD, false, EXPIRY_NS, TOKEN_CREATE_MEMO, null, CREATE_TIMESTAMP, CREATE_TIMESTAMP);
    // when
    createTokenEntity(TOKEN_ID, FUNGIBLE_COMMON, SYMBOL, CREATE_TIMESTAMP, freezeDefault, freezeKey, kycKey, pauseKey, customFees, autoAssociatedAccounts);
    // then
    assertEquals(1L, entityRepository.count());
    assertEntity(expected);
    // verify token
    TokenPauseStatusEnum pauseStatus = pauseKey ? TokenPauseStatusEnum.UNPAUSED : TokenPauseStatusEnum.NOT_APPLICABLE;
    assertTokenInRepository(TOKEN_ID, true, CREATE_TIMESTAMP, CREATE_TIMESTAMP, SYMBOL, INITIAL_SUPPLY, pauseStatus);
    assertThat(tokenAccountRepository.findAll()).containsExactlyInAnyOrderElementsOf(expectedTokenAccounts);
    assertTokenTransferInRepository(TOKEN_ID, PAYER, CREATE_TIMESTAMP, INITIAL_SUPPLY);
    assertCustomFeesInDb(customFees);
    assertThat(tokenTransferRepository.count()).isEqualTo(1L);
}
Also used : Entity(com.hedera.mirror.common.domain.entity.Entity) TokenPauseStatusEnum(com.hedera.mirror.common.domain.token.TokenPauseStatusEnum)

Example 2 with TokenPauseStatusEnum

use of com.hedera.mirror.common.domain.token.TokenPauseStatusEnum in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerTokenTest method tokenCreateWithNfts.

@ParameterizedTest(name = "{0}")
@MethodSource("provideTokenCreateNftArguments")
void tokenCreateWithNfts(String name, List<CustomFee> customFees, boolean freezeDefault, boolean freezeKey, boolean kycKey, boolean pauseKey, List<TokenAccount> expectedTokenAccounts) {
    // given
    Entity expected = createEntity(DOMAIN_TOKEN_ID, TOKEN_REF_KEY, PAYER.getAccountNum(), AUTO_RENEW_PERIOD, false, EXPIRY_NS, TOKEN_CREATE_MEMO, null, CREATE_TIMESTAMP, CREATE_TIMESTAMP);
    List<EntityId> autoAssociatedAccounts = expectedTokenAccounts.stream().map(TokenAccount::getId).map(TokenAccountId::getAccountId).collect(Collectors.toList());
    // when
    createTokenEntity(TOKEN_ID, NON_FUNGIBLE_UNIQUE, SYMBOL, CREATE_TIMESTAMP, freezeDefault, freezeKey, kycKey, pauseKey, customFees, autoAssociatedAccounts);
    // then
    assertEquals(1L, entityRepository.count());
    assertEntity(expected);
    // verify token
    TokenPauseStatusEnum pauseStatus = pauseKey ? TokenPauseStatusEnum.UNPAUSED : TokenPauseStatusEnum.NOT_APPLICABLE;
    assertTokenInRepository(TOKEN_ID, true, CREATE_TIMESTAMP, CREATE_TIMESTAMP, SYMBOL, 0, pauseStatus);
    assertThat(tokenAccountRepository.findAll()).containsExactlyInAnyOrderElementsOf(expectedTokenAccounts);
    assertCustomFeesInDb(customFees);
    assertThat(tokenTransferRepository.count()).isZero();
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) Entity(com.hedera.mirror.common.domain.entity.Entity) TokenAccount(com.hedera.mirror.common.domain.token.TokenAccount) TokenPauseStatusEnum(com.hedera.mirror.common.domain.token.TokenPauseStatusEnum) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

Entity (com.hedera.mirror.common.domain.entity.Entity)2 TokenPauseStatusEnum (com.hedera.mirror.common.domain.token.TokenPauseStatusEnum)2 EntityId (com.hedera.mirror.common.domain.entity.EntityId)1 TokenAccount (com.hedera.mirror.common.domain.token.TokenAccount)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1