//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotAppendToFileWhenRetryingWithNewFile() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotAppendToFileWhenRetryingWithNewFile() { // given string fileName = "foo"; string copyFileName = "bar"; string unfinishedContent = "abcd"; string finishedContent = "abcdefgh"; IEnumerator <string> contents = Iterators.iterator(unfinishedContent, finishedContent); // and TestCatchupServerHandler halfWayFailingServerhandler = new TestCatchupServerHandlerAnonymousInnerClass(this, _logProvider, TestDirectory, _fsa, fileName, copyFileName, contents); Server halfWayFailingServer = null; try { // when ListenSocketAddress listenAddress = new ListenSocketAddress("localhost", PortAuthority.allocatePort()); halfWayFailingServer = (new CatchupServerBuilder(halfWayFailingServerhandler)).listenAddress(listenAddress).build(); halfWayFailingServer.Start(); CatchupAddressProvider addressProvider = CatchupAddressProvider.fromSingleAddress(new AdvertisedSocketAddress(listenAddress.Hostname, listenAddress.Port)); StoreId storeId = halfWayFailingServerhandler.StoreId; File databaseDir = TestDirectory.databaseDir(); StreamToDiskProvider streamToDiskProvider = new StreamToDiskProvider(databaseDir, _fsa, new Monitors()); // and _subject.copyStoreFiles(addressProvider, storeId, streamToDiskProvider, () => _defaultTerminationCondition, _targetLocation); // then assertEquals(FileContent(new File(databaseDir, fileName)), finishedContent); // and File fileCopy = new File(databaseDir, copyFileName); ByteBuffer buffer = ByteBuffer.wrap(new sbyte[finishedContent.Length]); using (StoreChannel storeChannel = _fsa.create(fileCopy)) { storeChannel.read(buffer); } assertEquals(finishedContent, new string( buffer.array(), Charsets.UTF_8 )); } finally { halfWayFailingServer.Stop(); halfWayFailingServer.Shutdown(); } }
public SimpleChannelInboundHandlerAnonymousInnerClass3(TestCatchupServerHandlerAnonymousInnerClass outerInstance) { this.outerInstance = outerInstance; }
public SimpleChannelInboundHandlerAnonymousInnerClass2(TestCatchupServerHandlerAnonymousInnerClass outerInstance, CatchupServerProtocol catchupServerProtocol) { this.outerInstance = outerInstance; this._catchupServerProtocol = catchupServerProtocol; }