//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()); }
public DurableStateStorage(FileSystemAbstraction fsa, File baseDir, string name, StateMarshal <STATE> marshal, int numberOfEntriesBeforeRotation, LogProvider logProvider) { this._fsa = fsa; this._name = name; this._marshal = marshal; this._numberOfEntriesBeforeRotation = numberOfEntriesBeforeRotation; this._log = logProvider.getLog(this.GetType()); this._recoveryManager = new StateRecoveryManager <STATE>(fsa, marshal); File parent = StateDir(baseDir, name); this._fileA = new File(parent, name + ".a"); this._fileB = new File(parent, name + ".b"); }
//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()); }