use of com.hedera.mirror.common.domain.token.TokenAccount in project hedera-mirror-node by hashgraph.
the class SqlEntityListenerTest method onTokenAccountMissingToken.
@Test
void onTokenAccountMissingToken() {
EntityId tokenId1 = EntityId.of("0.0.3", TOKEN);
EntityId accountId1 = EntityId.of("0.0.7", ACCOUNT);
// given no token row in db
// when
TokenAccount associate = getTokenAccount(tokenId1, accountId1, 10L, 10L, true, false, null, null);
sqlEntityListener.onTokenAccount(associate);
TokenAccount kycGrant = getTokenAccount(tokenId1, accountId1, null, 15L, null, null, null, TokenKycStatusEnum.GRANTED);
sqlEntityListener.onTokenAccount(kycGrant);
completeFileAndCommit();
// then
assertThat(tokenAccountRepository.count()).isZero();
}
use of com.hedera.mirror.common.domain.token.TokenAccount in project hedera-mirror-node by hashgraph.
the class SqlEntityListenerTest method onTokenAccount.
@Test
void onTokenAccount() {
EntityId tokenId1 = EntityId.of("0.0.3", TOKEN);
EntityId tokenId2 = EntityId.of("0.0.5", TOKEN);
// save token entities first
Token token1 = getToken(tokenId1, EntityId.of("0.0.500", ACCOUNT), 1L, 1L);
Token token2 = getToken(tokenId2, EntityId.of("0.0.110", ACCOUNT), 2L, 2L);
sqlEntityListener.onToken(token1);
sqlEntityListener.onToken(token2);
completeFileAndCommit();
EntityId accountId1 = EntityId.of("0.0.7", ACCOUNT);
EntityId accountId2 = EntityId.of("0.0.11", ACCOUNT);
TokenAccount tokenAccount1 = getTokenAccount(tokenId1, accountId1, 5L, 5L, true, false, TokenFreezeStatusEnum.NOT_APPLICABLE, TokenKycStatusEnum.NOT_APPLICABLE);
TokenAccount tokenAccount2 = getTokenAccount(tokenId2, accountId2, 6L, 6L, true, false, TokenFreezeStatusEnum.NOT_APPLICABLE, TokenKycStatusEnum.NOT_APPLICABLE);
// when
sqlEntityListener.onTokenAccount(tokenAccount1);
sqlEntityListener.onTokenAccount(tokenAccount1);
sqlEntityListener.onTokenAccount(tokenAccount2);
completeFileAndCommit();
// then
assertThat(tokenAccountRepository.findAll()).containsExactlyInAnyOrder(tokenAccount1, tokenAccount2);
}
Aggregations