use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class CryptoCreateTransactionHandlerTest method updateTransactionStakedAccountId.
@Test
void updateTransactionStakedAccountId() {
// given
final AccountID accountId = AccountID.newBuilder().setAccountNum(1L).build();
var recordItem = recordItemBuilder.cryptoCreate().transactionBody(b -> b.setDeclineReward(false).setStakedAccountId(accountId)).build();
// when
transactionHandler.updateTransaction(transaction(recordItem), recordItem);
// then
verify(entityListener).onEntity(entities.capture());
assertThat(entities.getValue()).isNotNull().returns(false, Entity::isDeclineReward).returns(accountId.getAccountNum(), Entity::getStakedAccountId).returns(Utility.getEpochDay(recordItem.getConsensusTimestamp()), Entity::getStakePeriodStart);
}
use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class CryptoUpdateTransactionHandlerTest method updateTransactionStakedAccountId.
@Test
void updateTransactionStakedAccountId() {
AccountID accountId = AccountID.newBuilder().setAccountNum(1L).build();
RecordItem withStakedNodeIdSet = recordItemBuilder.cryptoUpdate().transactionBody(body -> body.clear().setStakedAccountId(accountId)).build();
setupForCrytoUpdateTransactionTest(withStakedNodeIdSet, t -> assertThat(t).returns(1L, Entity::getStakedAccountId).returns(false, Entity::isDeclineReward).returns(-1L, Entity::getStakedNodeId).returns(Utility.getEpochDay(withStakedNodeIdSet.getConsensusTimestamp()), Entity::getStakePeriodStart));
}
use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class UtilityTest method getTransactionID.
@Test
@DisplayName("get TransactionId")
void getTransactionID() {
AccountID payerAccountId = AccountID.newBuilder().setShardNum(0).setRealmNum(0).setAccountNum(2).build();
TransactionID transactionId = Utility.getTransactionId(payerAccountId);
assertThat(transactionId).isNotEqualTo(TransactionID.getDefaultInstance());
AccountID testAccountId = transactionId.getAccountID();
assertAll(// row counts
() -> assertEquals(payerAccountId.getShardNum(), testAccountId.getShardNum()), () -> assertEquals(payerAccountId.getRealmNum(), testAccountId.getRealmNum()), () -> assertEquals(payerAccountId.getAccountNum(), testAccountId.getAccountNum()));
}
use of com.hederahashgraph.api.proto.java.AccountID 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));
}
use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccountsReturnsFirst.
@Test
void lookupAccountsReturnsFirst() {
AccountID accountId1 = AccountID.newBuilder().setAccountNum(100).build();
AccountID accountId2 = AccountID.newBuilder().setAccountNum(101).build();
EntityId entityId = entityIdService.lookup(accountId1, accountId2);
assertThat(entityId).isEqualTo(EntityId.of(accountId1));
}
Aggregations