Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnTheEmptyFileAsPreviouslyInactiveWhenActiveContainsCorruptEntry() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnTheEmptyFileAsPreviouslyInactiveWhenActiveContainsCorruptEntry()
        {
            // given
            EphemeralFileSystemAbstraction fsa = _fileSystemRule.get();

            fsa.Mkdir(_testDir.directory());

            File         fileA   = fileA();
            StoreChannel channel = fsa.Create(fileA);

            ByteBuffer buffer = WriteLong(999);

            channel.WriteAll(buffer);
            channel.Force(false);

            File fileB = fileB();

            channel = fsa.Create(fileB);
            channel.close();

            StateRecoveryManager <long> manager = new StateRecoveryManager <long>(fsa, new LongMarshal());

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.causalclustering.core.state.StateRecoveryManager.RecoveryStatus recoveryStatus = manager.recover(fileA, fileB);
            StateRecoveryManager.RecoveryStatus recoveryStatus = manager.Recover(fileA, fileB);

            // then
            assertEquals(999L, recoveryStatus.recoveredState());
            assertEquals(fileB, recoveryStatus.activeFile());
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRecoverFromPartiallyWrittenEntriesInBothFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRecoverFromPartiallyWrittenEntriesInBothFiles()
        {
            // given
            EphemeralFileSystemAbstraction fsa = _fileSystemRule.get();

            fsa.Mkdir(_testDir.directory());

            StateRecoveryManager <long> manager = new StateRecoveryManager <long>(fsa, new LongMarshal());

            WriteSomeLongsIn(fsa, FileA(), 3, 4);
            WriteSomeLongsIn(fsa, FileB(), 5, 6);
            WriteSomeGarbage(fsa, FileA());
            WriteSomeGarbage(fsa, FileB());

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.causalclustering.core.state.StateRecoveryManager.RecoveryStatus recovered = manager.recover(fileA(), fileB());
            StateRecoveryManager.RecoveryStatus recovered = manager.Recover(FileA(), FileB());

            // then
            assertEquals(FileA(), recovered.activeFile());
            assertEquals(6L, recovered.recoveredState());
        }