use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class DomainSerdesTest method setupAll.
@BeforeAll
public static void setupAll() throws ConstructableRegistryException {
/* Per Cody, this will be unnecessary at some point. */
ConstructableRegistry.registerConstructable(new ClassConstructorPair(ExpirableTxnRecord.class, ExpirableTxnRecord::new));
ConstructableRegistry.registerConstructable(new ClassConstructorPair(EntityId.class, EntityId::new));
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class DomainSerdesTest method readsExpectedForNonNullReadable.
@Test
void readsExpectedForNonNullReadable() throws IOException {
// setup:
var in = mock(SerializableDataInputStream.class);
// and:
var reader = (IoReadingFunction<EntityId>) mock(IoReadingFunction.class);
var data = new EntityId(1L, 2L, 3L);
given(in.readBoolean()).willReturn(true);
given(reader.read(in)).willReturn(data);
// when:
EntityId dataIn = subject.readNullable(in, reader);
// then:
verify(in).readBoolean();
assertEquals(data, dataIn);
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class UpdateMerkleTopicResourceUsageTest method getFeeThrowsExceptionForBadKeys.
@Test
void getFeeThrowsExceptionForBadKeys() throws DecoderException, IllegalArgumentException {
final var txnBody = makeTransactionBody(topicId, defaultMemo, JKey.mapJKey(adminKey), JKey.mapJKey(submitKey), IdUtils.asAccount("0.1.2"), null, null);
final var merkleTopic = new MerkleTopic(defaultMemo, adminKey, submitKey, 0, new EntityId(0, 1, 2), new RichInstant(36_000, 0));
given(topics.get(EntityNum.fromTopicId(topicId))).willReturn(merkleTopic);
final var mockedJkey = mockStatic(JKey.class);
mockedJkey.when(() -> JKey.mapJKey(any())).thenThrow(new DecoderException());
assertThrows(InvalidTxBodyException.class, () -> subject.usageGiven(txnBody, sigValueObj, view));
assertThat(logCaptor.warnLogs(), Matchers.contains(Matchers.startsWith("Usage estimation unexpectedly failed for")));
mockedJkey.close();
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class EntityExpiryMapFactoryTest method toKeyConversionWorks.
@Test
void toKeyConversionWorks() {
// given:
var expected = "/2/e3";
// when:
var actual = EntityExpiryMapFactory.toKeyString(new EntityId(0, 2, 3));
// then:
assertEquals(expected, actual);
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class TypedTokenStoreTest method setupToken.
private void setupToken() {
merkleToken = new MerkleToken(expiry, tokenSupply, 0, symbol, name, freezeDefault, true, new EntityId(0, 0, treasuryAccountNum));
merkleToken.setAutoRenewAccount(new EntityId(0, 0, autoRenewAccountNum));
merkleToken.setSupplyKey(supplyKey);
merkleToken.setKycKey(kycKey);
merkleToken.setFreezeKey(freezeKey);
merkleToken.setPauseKey(pauseKey);
merkleToken.setPaused(false);
token.setTreasury(treasuryAccount);
token.setAutoRenewAccount(autoRenewAccount);
token.setTotalSupply(tokenSupply);
token.setKycKey(kycKey);
token.setSupplyKey(supplyKey);
token.setFreezeKey(freezeKey);
token.setPauseKey(pauseKey);
token.setFrozenByDefault(freezeDefault);
token.setIsDeleted(false);
token.setPaused(false);
token.setExpiry(expiry);
}
Aggregations