//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailIfBothFilesAreEmpty() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFailIfBothFilesAreEmpty() { // given EphemeralFileSystemAbstraction fsa = _fileSystemRule.get(); fsa.Mkdir(_testDir.directory()); File fileA = fileA(); fsa.Create(fileA); File fileB = fileB(); fsa.Create(fileB); StateRecoveryManager <long> manager = new StateRecoveryManager <long>(fsa, new LongMarshal()); try { // when StateRecoveryManager.RecoveryStatus recoveryStatus = manager.Recover(fileA, fileB); fail(); } catch (System.InvalidOperationException) { // then // expected } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnPreviouslyInactiveWhenOneFileFullAndOneEmpty() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReturnPreviouslyInactiveWhenOneFileFullAndOneEmpty() { // given EphemeralFileSystemAbstraction fsa = _fileSystemRule.get(); fsa.Mkdir(_testDir.directory()); File fileA = fileA(); StoreChannel channel = fsa.Create(fileA); FillUpAndForce(channel); File fileB = fileB(); fsa.Create(fileB); 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(fileB, recoveryStatus.activeFile()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnTheFullFileAsPreviouslyInactiveWhenActiveContainsCorruptEntry() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReturnTheFullFileAsPreviouslyInactiveWhenActiveContainsCorruptEntry() { // given EphemeralFileSystemAbstraction fsa = _fileSystemRule.get(); fsa.Mkdir(_testDir.directory()); File fileA = fileA(); StoreChannel channel = fsa.Create(fileA); ByteBuffer buffer = WriteLong(42); channel.WriteAll(buffer); channel.Force(false); buffer.clear(); buffer.putLong(101); // extraneous bytes buffer.flip(); channel.WriteAll(buffer); channel.Force(false); File fileB = fileB(); fsa.Create(fileB); 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(fileB, recoveryStatus.activeFile()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void recover() throws java.io.IOException private void Recover() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.causalclustering.core.state.StateRecoveryManager.RecoveryStatus<STATE> recoveryStatus = recoveryManager.recover(fileA, fileB); StateRecoveryManager.RecoveryStatus <STATE> recoveryStatus = _recoveryManager.recover(_fileA, _fileB); this._currentStoreFile = recoveryStatus.ActiveFile(); this._currentStoreChannel = ResetStoreFile(_currentStoreFile); this._initialState = recoveryStatus.RecoveredState(); _log.info("%s state restored, up to ordinal %d", _name, _marshal.ordinal(_initialState)); }
//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()); }