Search in sources :

Example 6 with DomainSerdes

use of com.hedera.services.state.serdes.DomainSerdes in project hedera-services by hashgraph.

the class HFileMetaSerdeTest method undoStaticMocking.

private void undoStaticMocking() {
    HFileMetaSerde.serdes = new DomainSerdes();
    HFileMetaSerde.setSerInFactory(SerializableDataInputStream::new);
    HFileMetaSerde.setSerOutFactory(SerializableDataOutputStream::new);
    HFileMetaSerde.setStreamContentDiscovery(JKeySerializer::byteStream);
}
Also used : SerializableDataInputStream(com.swirlds.common.io.SerializableDataInputStream) SerializableDataOutputStream(com.swirlds.common.io.SerializableDataOutputStream) DomainSerdes(com.hedera.services.state.serdes.DomainSerdes) JKeySerializer(com.hedera.services.legacy.core.jproto.JKeySerializer)

Example 7 with DomainSerdes

use of com.hedera.services.state.serdes.DomainSerdes in project hedera-services by hashgraph.

the class TxnIdTest method serializeWorksForUserNonce.

@Test
void serializeWorksForUserNonce() throws IOException {
    // setup:
    subject = scheduledSubjectUserNonce();
    // and:
    dout = mock(SerializableDataOutputStream.class);
    serdes = mock(DomainSerdes.class);
    TxnId.serdes = serdes;
    // given:
    InOrder inOrder = Mockito.inOrder(serdes, dout);
    // when:
    subject.serialize(dout);
    // then:
    inOrder.verify(dout).writeSerializable(fcPayer, Boolean.TRUE);
    inOrder.verify(serdes).serializeTimestamp(fcValidStart, dout);
    inOrder.verify(dout).writeBoolean(true);
    inOrder.verify(dout).writeBoolean(false);
    verifyNoMoreInteractions(dout);
    // cleanup:
    TxnId.serdes = new DomainSerdes();
}
Also used : InOrder(org.mockito.InOrder) SerializableDataOutputStream(com.swirlds.common.io.SerializableDataOutputStream) DomainSerdes(com.hedera.services.state.serdes.DomainSerdes) Test(org.junit.jupiter.api.Test)

Aggregations

DomainSerdes (com.hedera.services.state.serdes.DomainSerdes)7 Test (org.junit.jupiter.api.Test)6 SerializableDataInputStream (com.swirlds.common.io.SerializableDataInputStream)5 SerializableDataOutputStream (com.swirlds.common.io.SerializableDataOutputStream)4 Supplier (java.util.function.Supplier)3 InOrder (org.mockito.InOrder)2 JKeySerializer (com.hedera.services.legacy.core.jproto.JKeySerializer)1 EntityId (com.hedera.services.state.submerkle.EntityId)1 FcCustomFee (com.hedera.services.state.submerkle.FcCustomFee)1 ClassConstructorPair (com.swirlds.common.constructable.ClassConstructorPair)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1