Esempio n. 1
0
 internal void InitializeStatement()
 {
     if (this._statement == null)                 // this is the first statement in the transaction, use the transaction time
     {
         this._statement = this._transaction;
     }
     else               // this is not the first statement in the transaction, initialize with a new time
     {
         this._statement = Clock.@fixed(_system.instant(), Timezone());
     }
 }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeHeartbeats() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSerializeHeartbeats()
        {
            // Given
            Instant            now     = Instant.now();
            Clock              clock   = Clock.@fixed(now, ZoneOffset.UTC);
            RaftMessageEncoder encoder = new RaftMessageEncoder(marshal);
            RaftMessageDecoder decoder = new RaftMessageDecoder(marshal, clock);

            // Deserialization adds read objects in this list
            List <object> thingsRead = new List <object>(1);

            // When
            MemberId sender = new MemberId(System.Guid.randomUUID());

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage<?> message = org.neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage.of(now, clusterId, new org.neo4j.causalclustering.core.consensus.RaftMessages_Heartbeat(sender, 1, 2, 3));
            Org.Neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage <object> message = Org.Neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage.of(now, _clusterId, new Org.Neo4j.causalclustering.core.consensus.RaftMessages_Heartbeat(sender, 1, 2, 3));
            ChannelHandlerContext ctx = SetupContext();
            ByteBuf buffer            = null;

            try
            {
                buffer = ctx.alloc().buffer();
                encoder.Encode(ctx, message, buffer);

                // When
                decoder.Decode(null, buffer, thingsRead);

                // Then
                assertEquals(1, thingsRead.Count);
                assertEquals(message, thingsRead[0]);
            }
            finally
            {
                if (buffer != null)
                {
                    buffer.release();
                }
            }
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void serializeReadBackAndVerifyMessage(org.neo4j.causalclustering.core.consensus.RaftMessages_RaftMessage message) throws Exception
        private void SerializeReadBackAndVerifyMessage(Org.Neo4j.causalclustering.core.consensus.RaftMessages_RaftMessage message)
        {
            // Given
            Instant            now     = Instant.now();
            Clock              clock   = Clock.@fixed(now, ZoneOffset.UTC);
            RaftMessageEncoder encoder = new RaftMessageEncoder(marshal);
            RaftMessageDecoder decoder = new RaftMessageDecoder(marshal, clock);

            // Deserialization adds read objects in this list
            List <object> thingsRead = new List <object>(1);

            // When
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage<?> decoratedMessage = org.neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage.of(now, clusterId, message);
            Org.Neo4j.causalclustering.core.consensus.RaftMessages_ClusterIdAwareMessage <object> decoratedMessage = Org.Neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage.of(now, _clusterId, message);
            ChannelHandlerContext ctx = SetupContext();
            ByteBuf buffer            = null;

            try
            {
                buffer = ctx.alloc().buffer();
                encoder.Encode(ctx, decoratedMessage, buffer);

                // When
                decoder.Decode(null, buffer, thingsRead);

                // Then
                assertEquals(1, thingsRead.Count);
                assertEquals(decoratedMessage, thingsRead[0]);
            }
            finally
            {
                if (buffer != null)
                {
                    buffer.release();
                }
            }
        }
Esempio n. 4
0
 internal void InitializeTransaction()
 {
     this._transaction = Clock.@fixed(_system.instant(), Timezone());
     this._statement   = null;
 }