//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private <T extends org.neo4j.values.AnyValue> void testSendingOfBoltV2Value(T value) throws Exception private void TestSendingOfBoltV2Value <T>(T value) where T : Org.Neo4j.Values.AnyValue { NegotiateBoltV2(); _connection.send(_util.chunk(new RunMessage("CREATE (n:Node {value: $value}) RETURN 42", map(new string[] { "value" }, new AnyValue[] { value })), PullAllMessage.INSTANCE)); assertThat(_connection, _util.eventuallyReceives(msgSuccess(), msgRecord(eqRecord(equalTo(longValue(42)))), msgSuccess())); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void testFailureWithUnpackableValue(org.neo4j.function.ThrowingConsumer<org.neo4j.bolt.messaging.Neo4jPack_Packer, java.io.IOException> valuePacker, String expectedMessage) throws Exception private void TestFailureWithUnpackableValue(ThrowingConsumer <Org.Neo4j.Bolt.messaging.Neo4jPack_Packer, IOException> valuePacker, string expectedMessage) { _connection.connect(_address).send(_util.defaultAcceptedVersions()); assertThat(_connection, _util.eventuallyReceivesSelectedProtocolVersion()); _connection.send(_util.chunk(new InitMessage(USER_AGENT, Collections.emptyMap()))); assertThat(_connection, _util.eventuallyReceives(msgSuccess())); _connection.send(_util.chunk(64, CreateRunWith(valuePacker))); assertThat(_connection, _util.eventuallyReceives(msgFailure(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.TypeError, expectedMessage))); assertThat(_connection, eventuallyDisconnects()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void testFailureWithV2Value(org.neo4j.values.AnyValue value, String description) throws Exception private void TestFailureWithV2Value(AnyValue value, string description) { _connection.connect(_address).send(_util.defaultAcceptedVersions()); assertThat(_connection, _util.eventuallyReceivesSelectedProtocolVersion()); _connection.send(_util.chunk(new InitMessage(USER_AGENT, Collections.emptyMap()))); assertThat(_connection, _util.eventuallyReceives(msgSuccess())); _connection.send(_util.chunk(64, CreateRunWithV2Value(value))); assertThat(_connection, _util.eventuallyReceives(msgFailure(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.TypeError, description + " values cannot be unpacked with this version of bolt."))); assertThat(_connection, eventuallyDisconnects()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void sendingButNotReceivingClientShouldBeKilledWhenWriteThrottleMaxDurationIsReached() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SendingButNotReceivingClientShouldBeKilledWhenWriteThrottleMaxDurationIsReached() { int numberOfRunDiscardPairs = 10_000; string largeString = StringUtils.repeat(" ", 8 * 1024); _client.connect(_address).send(_util.acceptedVersions(1, 0, 0, 0)).send(_util.chunk(new InitMessage("TestClient/1.1", emptyMap()))); assertThat(_client, eventuallyReceives(new sbyte[] { 0, 0, 0, 1 })); assertThat(_client, _util.eventuallyReceives(msgSuccess())); Future sender = OtherThread.execute(state => { for (int i = 0; i < numberOfRunDiscardPairs; i++) { _client.send(_util.chunk(new RunMessage("RETURN $data as data", ValueUtils.asMapValue(singletonMap("data", largeString))), PullAllMessage.INSTANCE)); } return(null); }); try { OtherThread.get().awaitFuture(sender); fail("should throw ExecutionException instead"); } catch (ExecutionException e) { assertThat(Exceptions.rootCause(e), instanceOf(typeof(SocketException))); } _logProvider.assertAtLeastOnce(inLog(Matchers.containsString(typeof(BoltConnection).Assembly.GetName().Name)).error(startsWith("Unexpected error detected in bolt session"), hasProperty("cause", matchesExceptionMessage(containsString("will be closed because the client did not consume outgoing buffers for "))))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseConnectionOnInvalidHandshake() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseConnectionOnInvalidHandshake() { // GIVEN Connection.connect(_address); // WHEN Connection.send(new sbyte[] { unchecked (( sbyte )0xDE), unchecked (( sbyte )0xAD), unchecked (( sbyte )0xB0), ( sbyte )0x17, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); // THEN Exception.expect(typeof(IOException)); Connection.recv(4); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReportFailureWhenAllThreadsInThreadPoolAreBusy() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReportFailureWhenAllThreadsInThreadPoolAreBusy() { // it's enough to get the bolt state machine into streaming mode to have // the thread sticked to the connection, causing all the available threads // to be busy (logically) _connection1 = EnterStreaming(); _connection2 = EnterStreaming(); try { _connection3 = ConnectAndPerformBoltHandshake(NewConnection()); _connection3.send(Util.chunk(new InitMessage("TestClient/1.1", emptyMap()))); assertThat(_connection3, Util.eventuallyReceives(msgFailure(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.NoThreadsAvailable, "There are no available threads to serve this request at the moment"))); _userLogProvider.rawMessageMatcher().assertContains("since there are no available threads to serve it at the moment. You can retry at a later time"); _internalLogProvider.assertAtLeastOnce(AssertableLogProvider.inLog(startsWith(typeof(BoltConnection).Assembly.GetName().Name)).error(containsString("since there are no available threads to serve it at the moment. You can retry at a later time"), isA(typeof(RejectedExecutionException)))); } finally { ExitStreaming(_connection1); ExitStreaming(_connection2); } }