Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMarshalTransactionReferenceWithMissingHeader() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMarshalTransactionReferenceWithMissingHeader()
        {
            ByteBuf buffer = Unpooled.buffer();
            PhysicalTransactionRepresentation representation = new PhysicalTransactionRepresentation(Collections.emptyList());

            TransactionRepresentationReplicatedTransaction replicatedTx = ReplicatedTransaction.from(representation);

            AssertMarshalingEquality(buffer, replicatedTx);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertMarshalingEquality(io.netty.buffer.ByteBuf buffer, org.neo4j.causalclustering.core.state.machines.tx.TransactionRepresentationReplicatedTransaction replicatedTx) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        private void AssertMarshalingEquality(ByteBuf buffer, TransactionRepresentationReplicatedTransaction replicatedTx)
        {
            _marshal.marshal(replicatedTx, new NetworkWritableChannel(buffer));

            ReplicatedContent unmarshal = _marshal.unmarshal(new NetworkReadableClosableChannelNetty4(buffer));

            TransactionRepresentation tx = replicatedTx.Tx();

            sbyte[] extraHeader = tx.AdditionalHeader();
            if (extraHeader == null)
            {
                // hackishly set additional header to empty array...
                (( PhysicalTransactionRepresentation )tx).setHeader(new sbyte[0], tx.MasterId, tx.AuthorId, tx.TimeStarted, tx.LatestCommittedTxWhenStarted, tx.TimeCommitted, tx.LockSessionId);
                extraHeader = tx.AdditionalHeader();
            }
            TransactionRepresentation representation = ReplicatedTransactionFactory.extractTransactionRepresentation(( ReplicatedTransaction )unmarshal, extraHeader);

            assertThat(representation, equalTo(tx));
        }