Search in sources :

Example 16 with Id

use of com.hedera.services.store.models.Id in project hedera-services by hashgraph.

the class BalanceChangeTest method tokenAdjust.

@Test
void tokenAdjust() {
    final var tokenAdjust = BalanceChange.tokenAdjust(IdUtils.asModelId("1.2.3"), IdUtils.asModelId("3.2.1"), 10, null, true);
    assertEquals(10, tokenAdjust.getAggregatedUnits());
    assertEquals(0, tokenAdjust.getAllowanceUnits());
    assertEquals(new Id(1, 2, 3), tokenAdjust.getAccount());
    assertEquals(new Id(3, 2, 1), tokenAdjust.getToken());
}
Also used : Id(com.hedera.services.store.models.Id) NftId(com.hedera.services.store.models.NftId) Test(org.junit.jupiter.api.Test)

Example 17 with Id

use of com.hedera.services.store.models.Id in project hedera-services by hashgraph.

the class EntityNumPairTest method factoryFromModelRelWorks.

@Test
void factoryFromModelRelWorks() {
    final var expected = fromLongs(1, 2);
    final var modelRel = new TokenRelationship(new Token(new Id(0, 0, 2)), new Account(new Id(0, 0, 1)));
    final var actual = EntityNumPair.fromModelRel(modelRel);
    assertEquals(expected, actual);
}
Also used : Account(com.hedera.services.store.models.Account) Token(com.hedera.services.store.models.Token) Id(com.hedera.services.store.models.Id) EntityNumPair.fromNftId(com.hedera.services.utils.EntityNumPair.fromNftId) NftId(com.hedera.services.store.models.NftId) TokenRelationship(com.hedera.services.store.models.TokenRelationship) Test(org.junit.jupiter.api.Test)

Aggregations

Id (com.hedera.services.store.models.Id)17 Test (org.junit.jupiter.api.Test)13 NftId (com.hedera.services.store.models.NftId)3 FcTokenAllowanceId (com.hedera.services.state.submerkle.FcTokenAllowanceId)2 Account (com.hedera.services.store.models.Account)2 Token (com.hedera.services.store.models.Token)2 AccountID (com.hederahashgraph.api.proto.java.AccountID)2 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)2 Code (org.hyperledger.besu.evm.Code)2 ByteString (com.google.protobuf.ByteString)1 MerkleToken (com.hedera.services.state.merkle.MerkleToken)1 MerkleUniqueToken (com.hedera.services.state.merkle.MerkleUniqueToken)1 EntityId (com.hedera.services.state.submerkle.EntityId)1 RichInstant (com.hedera.services.state.submerkle.RichInstant)1 TokenRelationship (com.hedera.services.store.models.TokenRelationship)1 UniqueToken (com.hedera.services.store.models.UniqueToken)1 EntityNumPair.fromNftId (com.hedera.services.utils.EntityNumPair.fromNftId)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Bytes (org.apache.tuweni.bytes.Bytes)1