//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void failedFileCopyShouldRetry() throws StoreCopyFailedException, java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void FailedFileCopyShouldRetry() { // given a file will fail twice before succeeding _fileB.RemainingFailed = 2; // and remote node has a store // and local client has a store InMemoryStoreStreamProvider clientStoreFileStream = new InMemoryStoreStreamProvider(); // when catchup is performed for valid transactionId and StoreId CatchupAddressProvider catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(From(_catchupServer.address().Port)); _subject.copyStoreFiles(catchupAddressProvider, _serverHandler.StoreId, clientStoreFileStream, () => _defaultTerminationCondition, _targetLocation); // then the catchup is successful ISet <string> expectedFiles = new HashSet <string>(Arrays.asList(_fileA.Filename, _fileB.Filename, _indexFileA.Filename)); assertEquals(expectedFiles, clientStoreFileStream.FileStreams().Keys); // and assertEquals(FileContent(Relative(_fileA.Filename)), ClientFileContents(clientStoreFileStream, _fileA.Filename)); assertEquals(FileContent(Relative(_fileB.Filename)), ClientFileContents(clientStoreFileStream, _fileB.Filename)); // and verify server had exactly 2 failed calls before having a 3rd succeeding request assertEquals(3, _serverHandler.getRequestCount(_fileB.Filename)); // and verify server had exactly 1 call for all other files assertEquals(1, _serverHandler.getRequestCount(_fileA.Filename)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canPerformCatchup() throws StoreCopyFailedException, java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CanPerformCatchup() { // given local client has a store InMemoryStoreStreamProvider storeFileStream = new InMemoryStoreStreamProvider(); // when catchup is performed for valid transactionId and StoreId CatchupAddressProvider catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(From(_catchupServer.address().Port)); _subject.copyStoreFiles(catchupAddressProvider, _serverHandler.StoreId, storeFileStream, () => _defaultTerminationCondition, _targetLocation); // then the catchup is successful ISet <string> expectedFiles = new HashSet <string>(Arrays.asList(_fileA.Filename, _fileB.Filename, _indexFileA.Filename)); assertEquals(expectedFiles, storeFileStream.FileStreams().Keys); assertEquals(FileContent(Relative(_fileA.Filename)), ClientFileContents(storeFileStream, _fileA.Filename)); assertEquals(FileContent(Relative(_fileB.Filename)), ClientFileContents(storeFileStream, _fileB.Filename)); }
private static string ClientFileContents(InMemoryStoreStreamProvider storeFileStreamsProvider, string filename) { return(storeFileStreamsProvider.FileStreams()[filename].ToString()); }