use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class ExpiryManagerTest method expiresSchedulesAsExpected.
@Test
void expiresSchedulesAsExpected() {
subject = new ExpiryManager(mockScheduleStore, nums, sigImpactHistorian, mockTxnHistories, () -> mockAccounts, () -> mockSchedules);
// given:
subject.trackExpirationEvent(Pair.of(aKey.longValue(), entityId -> mockScheduleStore.expire(entityId)), firstThen);
subject.trackExpirationEvent(Pair.of(bKey.longValue(), entityId -> mockScheduleStore.expire(entityId)), secondThen);
subject.purge(now);
// then:
verify(mockScheduleStore).expire(new EntityId(0, 0, aKey.longValue()));
verify(sigImpactHistorian).markEntityChanged(aKey.longValue());
assertEquals(1, subject.getShortLivedEntityExpiries().getAllExpiries().size());
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class MerkleTokenTest method liveFireSerdeWorks.
@Test
void liveFireSerdeWorks() throws IOException, ConstructableRegistryException {
final var baos = new ByteArrayOutputStream();
final var dos = new SerializableDataOutputStream(baos);
ConstructableRegistry.registerConstructable(new ClassConstructorPair(FcCustomFee.class, FcCustomFee::new));
ConstructableRegistry.registerConstructable(new ClassConstructorPair(EntityId.class, EntityId::new));
MerkleToken.serdes = new DomainSerdes();
subject.serialize(dos);
dos.flush();
final var bytes = baos.toByteArray();
final var bais = new ByteArrayInputStream(bytes);
final var din = new SerializableDataInputStream(bais);
final var newSubject = new MerkleToken();
newSubject.deserialize(din, MerkleToken.CURRENT_VERSION);
assertEquals(subject, newSubject);
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class MerkleTopicTest method topicFrom.
private MerkleTopic topicFrom(int s) throws IOException {
long v = 1_234_567L + s * 1_000_000L;
long t = s + 1;
AccountID payer = AccountID.newBuilder().setAccountNum(123).build();
TopicID id = TopicID.newBuilder().setTopicNum(s).build();
var topic = new MerkleTopic(memos[s], adminKeys[s], submitKeys[s], v, new EntityId(t, t * 2, t * 3), new RichInstant(v, s));
for (int i = 0; i < s; i++) {
topic.updateRunningHashAndSequenceNumber(payer, "Hello world!".getBytes(), id, Instant.ofEpochSecond(v, i));
}
topic.setKey(EntityNum.fromInt(s));
return topic;
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class MerkleUniqueTokenTest method setup.
@BeforeEach
void setup() {
owner = new EntityId(0, 0, 3);
otherOwner = new EntityId(0, 0, 4);
metadata = "Test NFT".getBytes();
otherMetadata = "Test NFT2".getBytes();
timestamp = RichInstant.fromJava(Instant.ofEpochSecond(timestampL));
otherTimestamp = RichInstant.fromJava(Instant.ofEpochSecond(1_234_568L));
subject = new MerkleUniqueToken(owner, metadata, timestamp);
subject.setKey(new EntityNumPair(numbers));
}
use of com.hedera.services.state.submerkle.EntityId in project hedera-services by hashgraph.
the class DomainSerdesTest method readsNullForNullableSerializable.
@Test
void readsNullForNullableSerializable() throws IOException {
// setup:
var in = mock(SerializableDataInputStream.class);
// and:
EntityId data;
given(in.readBoolean()).willReturn(false);
// when:
data = subject.readNullableSerializable(in);
// then:
verify(in).readBoolean();
verifyNoMoreInteractions(in);
// and:
assertNull(data);
}
Aggregations