Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void membershipManagerShouldUseLatestAppendedMembershipSetEntries() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MembershipManagerShouldUseLatestAppendedMembershipSetEntries()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.causalclustering.core.consensus.log.InMemoryRaftLog log = new org.neo4j.causalclustering.core.consensus.log.InMemoryRaftLog();
            InMemoryRaftLog log = new InMemoryRaftLog();

            RaftMembershipManager membershipManager = LifeRule.add(RaftMembershipManager(log));

            // when
            membershipManager.processLog(0, asList(new AppendLogEntry(0, new RaftLogEntry(0, new RaftTestGroup(1, 2, 3, 4))), new AppendLogEntry(1, new RaftLogEntry(0, new RaftTestGroup(1, 2, 3, 5)))
                                                   ));

            // then
            assertEquals((new RaftTestGroup(1, 2, 3, 5)).Members, membershipManager.VotingMembers());
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void membershipManagerShouldRevertToEarlierAppendedMembershipSetAfterTruncationCausesLossOfLastAppended() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MembershipManagerShouldRevertToEarlierAppendedMembershipSetAfterTruncationCausesLossOfLastAppended()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.causalclustering.core.consensus.log.InMemoryRaftLog raftLog = new org.neo4j.causalclustering.core.consensus.log.InMemoryRaftLog();
            InMemoryRaftLog raftLog = new InMemoryRaftLog();

            RaftMembershipManager membershipManager = LifeRule.add(RaftMembershipManager(raftLog));

            // when
            IList <RaftLogCommand> logCommands = asList(new AppendLogEntry(0, new RaftLogEntry(0, new RaftTestGroup(1, 2, 3, 4))), new AppendLogEntry(1, new RaftLogEntry(0, new RaftTestGroup(1, 2, 3, 5))), new AppendLogEntry(2, new RaftLogEntry(0, new RaftTestGroup(1, 2, 3, 6))), new TruncateLogCommand(2)
                                                        );

            foreach (RaftLogCommand logCommand in logCommands)
            {
                logCommand.ApplyTo(raftLog, _log);
            }
            membershipManager.ProcessLog(0, logCommands);

            // then
            assertEquals((new RaftTestGroup(1, 2, 3, 5)).Members, membershipManager.VotingMembers());
        }