//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expected = org.neo4j.kernel.impl.store.MismatchingStoreIdException.class) public void makeSureServerStoreIdsMustMatch() public virtual void MakeSureServerStoreIdsMustMatch() { MadeUpServer server = _builder.storeId(newStoreIdForCurrentVersion(10, 10, 10, 10)).server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); client.Multiply(1, 2); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void communicateBetweenJvms() public virtual void CommunicateBetweenJvms() { ServerInterface server = _builder.serverInOtherJvm(_port); server.AwaitStarted(); MadeUpClient client = _builder.port(_port).client(); _life.add(client); _life.start(); assertEquals(( int? )(9 * 5), client.Multiply(9, 5).response()); client.FetchDataStream(new ToAssertionWriter(), 1024 * 1024 * 3); server.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void internalProtocolVersionsMustMatch() public virtual void InternalProtocolVersionsMustMatch() { MadeUpServer server = _builder.internalProtocolVersion(( sbyte )1).server(); MadeUpClient client = _builder.internalProtocolVersion(( sbyte )2).client(); AddToLifeAndStart(server, client); try { client.Multiply(10, 20); fail("Shouldn't be able to communicate with different application protocol versions"); } catch (IllegalProtocolVersionException) { } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void applicationProtocolVersionsMustMatch() public virtual void ApplicationProtocolVersionsMustMatch() { MadeUpServer server = _builder.applicationProtocolVersion(( sbyte )(APPLICATION_PROTOCOL_VERSION + 1)).server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); try { client.Multiply(10, 20); fail("Shouldn't be able to communicate with different application protocol versions"); } catch (IllegalProtocolVersionException) { } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void clientGetResponseFromServerViaComLayer() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ClientGetResponseFromServerViaComLayer() { MadeUpServerImplementation serverImplementation = new MadeUpServerImplementation(_storeIdToUse); MadeUpServer server = _builder.server(serverImplementation); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); int value1 = 10; int value2 = 5; Response <int> response = client.Multiply(10, 5); WaitUntilResponseHasBeenWritten(server, 1000); assertEquals(( int? )(value1 * value2), response.ResponseConflict()); assertTrue(serverImplementation.GotCalled()); assertTrue(server.ResponseHasBeenWritten()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test @SuppressWarnings("rawtypes") public void masterResponseShouldBeUnpackedIfRequestTypeRequires() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MasterResponseShouldBeUnpackedIfRequestTypeRequires() { // Given ResponseUnpacker responseUnpacker = mock(typeof(ResponseUnpacker)); MadeUpClient client = _builder.clientWith(responseUnpacker); AddToLifeAndStart(_builder.server(), client); // When client.Multiply(42, 42); // Then ArgumentCaptor <Response> captor = ArgumentCaptor.forClass(typeof(Response)); verify(responseUnpacker).unpackResponse(captor.capture(), eq(NO_OP_TX_HANDLER)); assertEquals(_storeIdToUse, captor.Value.StoreId); assertEquals(42 * 42, captor.Value.response()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void clientShouldUseHandlersToHandleComExceptions() public virtual void ClientShouldUseHandlersToHandleComExceptions() { // Given const string comExceptionMessage = "The ComException"; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: MadeUpCommunicationInterface communication = mock(MadeUpCommunicationInterface.class, (org.mockito.stubbing.Answer<Response<?>>) ignored -> MadeUpCommunicationInterface communication = mock(typeof(MadeUpCommunicationInterface), (Answer <Response <object> >)ignored => { throw new ComException(comExceptionMessage); }); ComExceptionHandler handler = mock(typeof(ComExceptionHandler)); _life.add(_builder.server(communication)); MadeUpClient client = _life.add(_builder.client()); client.ComExceptionHandler = handler; _life.start(); // When ComException exceptionThrownOnRequest = null; try { client.Multiply(1, 10); } catch (ComException e) { exceptionThrownOnRequest = e; } // Then assertNotNull(exceptionThrownOnRequest); assertEquals(comExceptionMessage, exceptionThrownOnRequest.Message); ArgumentCaptor <ComException> exceptionCaptor = ArgumentCaptor.forClass(typeof(ComException)); verify(handler).handle(exceptionCaptor.capture()); assertEquals(comExceptionMessage, exceptionCaptor.Value.Message); verifyNoMoreInteractions(handler); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void internalProtocolVersionsMustMatchMultiJvm() public virtual void InternalProtocolVersionsMustMatchMultiJvm() { ServerInterface server = _builder.internalProtocolVersion(( sbyte )1).serverInOtherJvm(_port); server.AwaitStarted(); MadeUpClient client = _builder.port(_port).internalProtocolVersion(( sbyte )2).client(); _life.add(client); _life.start(); try { client.Multiply(10, 20); fail("Shouldn't be able to communicate with different application protocol versions"); } catch (IllegalProtocolVersionException) { } server.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void serverContextVerificationCanThrowException() public virtual void ServerContextVerificationCanThrowException() { const string failureMessage = "I'm failing"; TxChecksumVerifier failingVerifier = (txId, checksum) => { throw new FailingException(failureMessage); }; MadeUpServer server = _builder.verifier(failingVerifier).server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); try { client.Multiply(10, 5); fail("Should have failed"); } catch (Exception) { // Good // TODO catch FailingException instead of Exception and make Server throw the proper // one instead of getting a "channel closed". } }