SqlEntityListener implements EntityListener, RecordStreamFileListener { @Override public void onTokenTransfer(TokenTransfer tokenTransfer) throws ImporterException { tokenTransfers.add(tokenTransfer); } SqlEntityListener(SqlProperties sqlProperties, DataSource dataSource,
                             RecordFileRepository recordFileRepository, MeterRegistry meterRegistry,
                             @Qualifier(CacheConfiguration.NEVER_EXPIRE_LARGE) CacheManager cacheManager,
                             ApplicationStatusRepository applicationStatusRepository,
                             EntityRepository entityRepository, ApplicationEventPublisher eventPublisher,
                             TokenRepository tokenRepository, TokenAccountRepository tokenAccountRepository); @Override boolean isEnabled(); @Override RecordFile onStart(StreamFileData streamFileData); @Override void onEnd(RecordFile recordFile); @Override void onError(); @Override void onTransaction(Transaction transaction); @Override void onEntityId(EntityId entityId); @Override void onCryptoTransfer(CryptoTransfer cryptoTransfer); @Override void onNonFeeTransfer(NonFeeTransfer nonFeeTransfer); @Override void onTopicMessage(TopicMessage topicMessage); @Override void onContractResult(ContractResult contractResult); @Override void onFileData(FileData fd); @Override void onLiveHash(LiveHash liveHash); @Override void onToken(Token token); @Override void onTokenAccount(TokenAccount tokenAccount); @Override void onTokenTransfer(TokenTransfer tokenTransfer);  }
@Test void onTokenTransfer() throws Exception { TokenTransfer tokenTransfer1 = getTokenTransfer(1000, 2L, "0.0.3", "0.0.5"); TokenTransfer tokenTransfer2 = getTokenTransfer(50, 2L, "0.0.7", "0.0.9"); TokenTransfer tokenTransfer3 = getTokenTransfer(-444, 4L, "0.0.3", "0.0.5"); sqlEntityListener.onTokenTransfer(tokenTransfer1); sqlEntityListener.onTokenTransfer(tokenTransfer2); sqlEntityListener.onTokenTransfer(tokenTransfer3); completeFileAndCommit(); assertEquals(3, tokenTransferRepository.count()); EntityId tokenId1 = EntityId.of("0.0.3", EntityTypeEnum.TOKEN); EntityId tokenId2 = EntityId.of("0.0.7", EntityTypeEnum.TOKEN); EntityId accountId1 = EntityId.of("0.0.5", ACCOUNT); EntityId accountId2 = EntityId.of("0.0.9", ACCOUNT); assertExistsAndEquals(tokenTransferRepository, tokenTransfer1, new TokenTransfer.Id(2L, tokenId1, accountId1)); assertExistsAndEquals(tokenTransferRepository, tokenTransfer2, new TokenTransfer.Id(2L, tokenId2, accountId2)); assertExistsAndEquals(tokenTransferRepository, tokenTransfer3, new TokenTransfer.Id(4L, tokenId1, accountId1)); }