use of com.hederahashgraph.api.proto.java.CryptoGetInfoResponse.AccountInfo in project hedera-mirror-node by hashgraph.
the class HistoricalAccountInfoMigrationTest method update.
@Test
void update() {
createEntity(ACCOUNT_ID1, EntityType.ACCOUNT, false);
AccountInfo.Builder accountInfo = accountInfo();
String publicKey = DomainUtils.getPublicKey(accountInfo.getKey().toByteArray());
assertThat(historicalAccountInfoMigration.process(accountInfo.build())).isTrue();
assertThat(entityRepository.findById(ACCOUNT_ID1)).get().returns(accountInfo.getAutoRenewPeriod().getSeconds(), from(Entity::getAutoRenewPeriod)).returns(accountInfo.getDeleted(), from(Entity::getDeleted)).returns(publicKey, from(Entity::getPublicKey)).returns(DomainUtils.timeStampInNanos(accountInfo.getExpirationTime()), from(Entity::getExpirationTimestamp)).returns(accountInfo.getKey().toByteArray(), from(Entity::getKey)).returns(accountInfo.getMemo(), from(Entity::getMemo)).returns(EntityId.of(accountInfo.getProxyAccountID()), from(Entity::getProxyAccountId));
}
use of com.hederahashgraph.api.proto.java.CryptoGetInfoResponse.AccountInfo in project hedera-mirror-node by hashgraph.
the class HistoricalAccountInfoMigrationTest method skipExisting.
@Test
void skipExisting() {
AccountInfo.Builder accountInfo = accountInfo();
Entity entity = createEntity(ACCOUNT_ID1, EntityType.ACCOUNT, true);
assertThat(historicalAccountInfoMigration.process(accountInfo.build())).isFalse();
assertThat(entityRepository.findAll()).hasSize(1).containsExactly(entity);
}
use of com.hederahashgraph.api.proto.java.CryptoGetInfoResponse.AccountInfo in project hedera-mirror-node by hashgraph.
the class HistoricalAccountInfoMigrationTest method create.
@Test
void create() {
AccountInfo.Builder accountInfo = accountInfo();
String publicKey = DomainUtils.getPublicKey(accountInfo.getKey().toByteArray());
assertThat(historicalAccountInfoMigration.process(accountInfo.build())).isTrue();
assertThat(entityRepository.findById(ACCOUNT_ID1)).get().returns(accountInfo.getAutoRenewPeriod().getSeconds(), from(Entity::getAutoRenewPeriod)).returns(accountInfo.getDeleted(), from(Entity::getDeleted)).returns(publicKey, from(Entity::getPublicKey)).returns(DomainUtils.timeStampInNanos(accountInfo.getExpirationTime()), from(Entity::getExpirationTimestamp)).returns(accountInfo.getKey().toByteArray(), from(Entity::getKey)).returns(accountInfo.getMemo(), from(Entity::getMemo)).returns(EntityId.of(accountInfo.getProxyAccountID()), from(Entity::getProxyAccountId));
}
use of com.hederahashgraph.api.proto.java.CryptoGetInfoResponse.AccountInfo in project hedera-mirror-node by hashgraph.
the class HistoricalAccountInfoMigrationTest method emptyValues.
@Test
void emptyValues() {
AccountID accountId = AccountID.newBuilder().setAccountNum(ACCOUNT_ID1).build();
AccountInfo.Builder accountInfo = accountInfo().clear().setAccountID(accountId);
assertThat(historicalAccountInfoMigration.process(accountInfo.build())).isTrue();
assertThat(entityRepository.findById(ACCOUNT_ID1)).get().returns(null, from(Entity::getAutoRenewPeriod)).returns(false, from(Entity::getDeleted)).returns(null, from(Entity::getPublicKey)).returns(null, from(Entity::getExpirationTimestamp)).returns(null, from(Entity::getKey)).returns("", from(Entity::getMemo)).returns(null, from(Entity::getProxyAccountId));
}
Aggregations