Пример #1
0
        private ReplicatedString String(int numberOfCharacters)
        {
            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < numberOfCharacters; i++)
            {
                builder.Append(i.ToString());
            }
            return(ReplicatedString.valueOf(builder.ToString()));
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogDifferentContentTypes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogDifferentContentTypes()
        {
            RaftLog log = CreateRaftLog();

            RaftLogEntry logEntryA = new RaftLogEntry(1, valueOf(1));
            RaftLogEntry logEntryB = new RaftLogEntry(1, ReplicatedString.valueOf("hejzxcjkzhxcjkxz"));

            log.Append(logEntryA, logEntryB);

            assertThat(log.AppendIndex(), @is(1L));

            assertThat(readLogEntry(log, 0), equalTo(logEntryA));
            assertThat(readLogEntry(log, 1), equalTo(logEntryB));
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected org.neo4j.causalclustering.core.replication.ReplicatedContent unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        protected internal override ReplicatedContent Unmarshal0(ReadableChannel channel)
        {
            sbyte type = channel.Get();

            switch (type)
            {
            case REPLICATED_INTEGER_TYPE:
                return(ReplicatedInteger.valueOf(channel.Int));

            case REPLICATED_STRING_TYPE:
                int     length = channel.Int;
                sbyte[] bytes  = new sbyte[length];
                channel.Get(bytes, length);
                return(ReplicatedString.valueOf(StringHelper.NewString(bytes)));

            default:
                throw new System.ArgumentException("Unknown content type: " + type);
            }
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogDifferentContentTypes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogDifferentContentTypes()
        {
            RaftLog log = _logFactory.createBasedOn(FsRule.get());

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final RaftLogEntry logEntryA = new RaftLogEntry(1, org.neo4j.causalclustering.core.consensus.ReplicatedInteger.valueOf(1));
            RaftLogEntry logEntryA = new RaftLogEntry(1, ReplicatedInteger.valueOf(1));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final RaftLogEntry logEntryB = new RaftLogEntry(1, org.neo4j.causalclustering.core.consensus.ReplicatedString.valueOf("hejzxcjkzhxcjkxz"));
            RaftLogEntry logEntryB = new RaftLogEntry(1, ReplicatedString.valueOf("hejzxcjkzhxcjkxz"));

            log.Append(logEntryA);
            log.Append(logEntryB);

            VerifyCurrentLogAndNewLogLoadedFromFileSystem(log, FsRule.get(), myLog =>
            {
                assertThat(myLog.appendIndex(), @is(1L));
                assertThat(readLogEntry(myLog, 0), equalTo(logEntryA));
                assertThat(readLogEntry(myLog, 1), equalTo(logEntryB));
            });
        }