diff --git a/Neo4j.Driver/.editorconfig b/Neo4j.Driver/.editorconfig
index 41d5d4871..a5fcf58e7 100644
--- a/Neo4j.Driver/.editorconfig
+++ b/Neo4j.Driver/.editorconfig
@@ -369,11 +369,11 @@ dotnet_naming_symbols.types_and_namespaces_symbols.applicable_kinds = namespace,
dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
-dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_accessibilities = *
-dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_required_modifiers = instance
dotnet_separate_import_directive_groups = false
@@ -663,8 +663,8 @@ resharper_line_break_before_requires_clause = do_not_change
resharper_linkage_specification_braces = end_of_line
resharper_linkage_specification_indentation = none
resharper_local_function_body = block_body
-resharper_macro_block_begin =
-resharper_macro_block_end =
+resharper_macro_block_begin =
+resharper_macro_block_end =
resharper_max_array_initializer_elements_on_line = 10000
resharper_max_attribute_length_for_same_line = 38
resharper_max_enum_members_on_line = 1
@@ -734,7 +734,7 @@ resharper_resx_attribute_indent = single_indent
resharper_resx_blank_line_after_pi = true
resharper_resx_indent_text = OneIndent
resharper_resx_keep_user_linebreaks = true
-resharper_resx_linebreak_before_elements =
+resharper_resx_linebreak_before_elements =
resharper_resx_max_blank_lines_between_tags = 0
resharper_resx_pi_attribute_style = do_not_touch
resharper_resx_space_before_self_closing = false
@@ -963,7 +963,7 @@ resharper_xml_attribute_indent = align_by_first_attribute
resharper_xml_blank_line_after_pi = true
resharper_xml_indent_text = OneIndent
resharper_xml_keep_user_linebreaks = true
-resharper_xml_linebreak_before_elements =
+resharper_xml_linebreak_before_elements =
resharper_xml_max_blank_lines_between_tags = 2
resharper_xml_pi_attribute_style = do_not_touch
resharper_xml_space_before_self_closing = true
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutor.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutor.cs
index 629fd30ff..90a887af5 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutor.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutor.cs
@@ -17,14 +17,10 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Abstractions;
-///
-/// Defines methods for executing a workload.
-///
+/// Defines methods for executing a workload.
public interface IWorkloadExecutor
{
- ///
- /// Execute a workload.
- ///
+ /// Execute a workload.
/// The workload to execute.
/// A task that completes when the workload has been executed.
Task ExecuteWorkloadAsync(Workload workload);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutorSelector.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutorSelector.cs
index 5be58a471..4fad7f104 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutorSelector.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadExecutorSelector.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,14 +17,10 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Abstractions;
-///
-/// Methods for forwarding a workload to the correct executor.
-///
+/// Methods for forwarding a workload to the correct executor.
public interface IWorkloadExecutorSelector
{
- ///
- /// Gets the correct executor for the workload.
- ///
+ /// Gets the correct executor for the workload.
/// The workload to execute.
public IWorkloadExecutor GetExecutor(Workload workload);
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadStore.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadStore.cs
index 75cb10749..479d7c767 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadStore.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Abstractions/IWorkloadStore.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,41 +17,29 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Abstractions;
-///
-/// Represents a store for managing workloads.
-///
+/// Represents a store for managing workloads.
public interface IWorkloadStore
{
- ///
- /// Creates a new workload in the store.
- ///
+ /// Creates a new workload in the store.
/// The workload to create.
/// The ID of the created workload.
string CreateWorkload(Workload workload);
- ///
- /// Retrieves a workload from the store.
- ///
+ /// Retrieves a workload from the store.
/// The ID of the workload to retrieve.
/// The retrieved workload.
Workload GetWorkload(string id);
- ///
- /// Updates a workload in the store.
- ///
+ /// Updates a workload in the store.
/// The ID of the workload to update.
/// The updated workload.
/// The updated workload.
Workload UpdateWorkload(string id, Workload workload);
- ///
- /// Deletes a workload from the store.
- ///
+ /// Deletes a workload from the store.
/// The ID of the workload to delete.
void DeleteWorkload(string id);
- ///
- /// Retrieves the full list of workloads from the store.
- ///
+ /// Retrieves the full list of workloads from the store.
IDictionary GetAllWorkloads();
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/ReadyController.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/ReadyController.cs
index 4521a58ab..ea2298ac4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/ReadyController.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/ReadyController.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,9 +19,7 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.Controllers;
using ILogger = Microsoft.Extensions.Logging.ILogger;
-///
-/// Check if the service is ready.
-///
+/// Check if the service is ready.
[ApiController]
[Route("[controller]")]
public class ReadyController(
@@ -30,12 +28,10 @@ public class ReadyController(
: ControllerBase
{
// GET
- ///
- /// Check if the service is ready.
- ///
+ /// Check if the service is ready.
///
- /// This endpoint can be used to check if the service is ready to receive requests. This obviously includes
- /// the web server, but also whether the backend can successfully connect to the DBMS.
+ /// This endpoint can be used to check if the service is ready to receive requests. This obviously includes the
+ /// web server, but also whether the backend can successfully connect to the DBMS.
///
[HttpGet]
[ProducesResponseType(StatusCodes.Status204NoContent)]
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/WorkloadController.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/WorkloadController.cs
index 2b1c852aa..82b1eef42 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/WorkloadController.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Controllers/WorkloadController.cs
@@ -21,16 +21,14 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.Controllers;
using ILogger = Microsoft.Extensions.Logging.ILogger;
-///
-/// Define and run workloads in the Neo4j driver.
-///
+/// Define and run workloads in the Neo4j driver.
[ApiController]
[Route("[controller]")]
public class WorkloadController(
- IWorkloadStore workloadStore,
- IWorkloadExecutorSelector workloadExecutorSelector,
- ILogger logger,
- LinkGenerator linkGenerator)
+ IWorkloadStore workloadStore,
+ IWorkloadExecutorSelector workloadExecutorSelector,
+ ILogger logger,
+ LinkGenerator linkGenerator)
: ControllerBase
{
// GET
@@ -95,8 +93,7 @@ public async Task ExecuteEphemeral([FromBody] Workload workload)
// DELETE
/// Deletes a driver workload.
- /// This endpoint deletes the workload from memory. Ongoing executions will not be
- /// canceled or stopped.
+ /// This endpoint deletes the workload from memory. Ongoing executions will not be canceled or stopped.
[HttpDelete("{id}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteQueryWorkloadExecutor.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteQueryWorkloadExecutor.cs
index e966e69a9..91ab6b30a 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteQueryWorkloadExecutor.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteQueryWorkloadExecutor.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,9 +21,9 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.Implementations;
using ILogger = Microsoft.Extensions.Logging.ILogger;
internal class ExecuteQueryWorkloadExecutor(
- IDriver driver,
- IRecordConsumer recordConsumer,
- ILogger logger)
+ IDriver driver,
+ IRecordConsumer recordConsumer,
+ ILogger logger)
: IWorkloadExecutor
{
public async Task ExecuteWorkloadAsync(Workload workload)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteReadWriteWorkloadExecutor.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteReadWriteWorkloadExecutor.cs
index b72bf1da9..ce0a2b805 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteReadWriteWorkloadExecutor.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/ExecuteReadWriteWorkloadExecutor.cs
@@ -21,10 +21,10 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.Implementations;
using ILogger = Microsoft.Extensions.Logging.ILogger;
internal class ExecuteReadWriteWorkloadExecutor(
- IDriver driver,
- IRecordConsumer recordConsumer,
- IWorkloadSessionBuilder sessionBuilder,
- ILogger logger)
+ IDriver driver,
+ IRecordConsumer recordConsumer,
+ IWorkloadSessionBuilder sessionBuilder,
+ ILogger logger)
: IWorkloadExecutor
{
public async Task ExecuteWorkloadAsync(Workload workload)
@@ -145,7 +145,7 @@ await execute(
return 0;
},
- _ => { });
+ _ => {});
logger.LogDebug("Workload completed");
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/RecordConsumer.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/RecordConsumer.cs
index 52ffb1cfe..5d9e711b1 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/RecordConsumer.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/RecordConsumer.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,7 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.Implementations;
using ILogger = Microsoft.Extensions.Logging.ILogger;
internal class RecordConsumer(
- ILogger logger)
+ ILogger logger)
: IRecordConsumer
{
public void ConsumeRecords(IEnumerable records)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/SessionRunWorkloadExecutor.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/SessionRunWorkloadExecutor.cs
index 2c80c893c..23698df91 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/SessionRunWorkloadExecutor.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/SessionRunWorkloadExecutor.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,10 +21,10 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.Implementations;
using ILogger = Microsoft.Extensions.Logging.ILogger;
internal class SessionRunWorkloadExecutor(
- IDriver driver,
- IRecordConsumer recordConsumer,
- IWorkloadSessionBuilder sessionBuilder,
- ILogger logger)
+ IDriver driver,
+ IRecordConsumer recordConsumer,
+ IWorkloadSessionBuilder sessionBuilder,
+ ILogger logger)
: IWorkloadExecutor
{
public async Task ExecuteWorkloadAsync(Workload workload)
@@ -47,17 +47,18 @@ private async Task ExecuteInParallelSessionsAsync(Workload workload)
{
var queryToRun = new Query(query.Text, query.Parameters);
logger.LogDebug("Starting query {Query} in parallel session", queryToRun.Text);
- tasks.Add(Task.Run(
- async () =>
- {
- // create a new session in parallel for each query
- await using var session = sessionBuilder.BuildSession(driver, workload);
-
- var resultCursor = await session.RunAsync(queryToRun);
- var records = await resultCursor.ToListAsync();
- logger.LogDebug("Received {RecordCount} records", records.Count);
- recordConsumer.ConsumeRecords(records);
- }));
+ tasks.Add(
+ Task.Run(
+ async () =>
+ {
+ // create a new session in parallel for each query
+ await using var session = sessionBuilder.BuildSession(driver, workload);
+
+ var resultCursor = await session.RunAsync(queryToRun);
+ var records = await resultCursor.ToListAsync();
+ logger.LogDebug("Received {RecordCount} records", records.Count);
+ recordConsumer.ConsumeRecords(records);
+ }));
}
logger.LogDebug("Waiting for {TaskCount} parallel tasks to complete", tasks.Count);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadExecutorSelector.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadExecutorSelector.cs
index 7e09f4326..408dff224 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadExecutorSelector.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadExecutorSelector.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,12 @@
using Neo4j.Driver.Tests.BenchkitBackend.Types;
namespace Neo4j.Driver.Tests.BenchkitBackend.Implementations;
+
using ILogger = Microsoft.Extensions.Logging.ILogger;
internal class WorkloadExecutorSelector(
- IIndex workloadExecutors,
- ILogger logger)
+ IIndex workloadExecutors,
+ ILogger logger)
: IWorkloadExecutorSelector
{
public IWorkloadExecutor GetExecutor(Workload workload)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadSessionBuilder.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadSessionBuilder.cs
index aea2577f3..12a1cc560 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadSessionBuilder.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Implementations/WorkloadSessionBuilder.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,7 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.Implementations;
internal class WorkloadSessionBuilder : IWorkloadSessionBuilder
{
- ///
+ ///
public IAsyncSession BuildSession(IDriver driver, Workload workload)
{
return driver.AsyncSession(
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/JsonConverters/ObjectToPrimitiveConverter.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/JsonConverters/ObjectToPrimitiveConverter.cs
index 4c456ebf1..e50eb94d7 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/JsonConverters/ObjectToPrimitiveConverter.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/JsonConverters/ObjectToPrimitiveConverter.cs
@@ -20,8 +20,8 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.InfrastructureExtensions;
///
/// The purpose of this class is to ensure that when the destination type is "object" that we don't deserialize a
-/// primitive into a JsonElement of some kind, which causes issues when trying to write the value to a PackStream,
-/// but instead deserialize it into a primitive type.
+/// primitive into a JsonElement of some kind, which causes issues when trying to write the value to a PackStream, but
+/// instead deserialize it into a primitive type.
///
internal class ObjectToPrimitiveConverter : JsonConverter
{
@@ -36,9 +36,9 @@ public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS
{
JsonTokenType.True => true,
JsonTokenType.False => false,
- JsonTokenType.Number when reader.TryGetInt64(out long l) => l,
+ JsonTokenType.Number when reader.TryGetInt64(out var l) => l,
JsonTokenType.Number => reader.GetDouble(),
- JsonTokenType.String when reader.TryGetDateTime(out DateTime datetime) => datetime,
+ JsonTokenType.String when reader.TryGetDateTime(out var datetime) => datetime,
JsonTokenType.String => reader.GetString()!,
_ => JsonDocument.ParseValue(ref reader).RootElement.Clone()
};
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/LogEnrichers/ClassNameEnricher.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/LogEnrichers/ClassNameEnricher.cs
index 71eb41277..bad3544e2 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/LogEnrichers/ClassNameEnricher.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/LogEnrichers/ClassNameEnricher.cs
@@ -22,7 +22,7 @@ internal class ClassNameEnricher : ILogEventEnricher
{
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
{
- if (logEvent.Properties.TryGetValue("SourceContext", out LogEventPropertyValue? value) &&
+ if (logEvent.Properties.TryGetValue("SourceContext", out var value) &&
value is ScalarValue { Value: string sourceContext })
{
var className = sourceContext.Split('.').Last();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/WebExtensions/ConfigurationBuilderExtensions.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/WebExtensions/ConfigurationBuilderExtensions.cs
index 127cb22d8..78c0b7650 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/WebExtensions/ConfigurationBuilderExtensions.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/InfrastructureExtensions/WebExtensions/ConfigurationBuilderExtensions.cs
@@ -17,9 +17,7 @@ namespace Neo4j.Driver.Tests.BenchkitBackend.InfrastructureExtensions;
internal static class ConfigurationBuilderExtensions
{
- ///
- /// Override the configuration with values from environment variables.
- ///
+ /// Override the configuration with values from environment variables.
/// The configuration builder.
/// The configuration builder for method chaining.
public static IConfigurationBuilder OverrideFromBenchkitEnvironmentVars(this IConfigurationBuilder builder)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Neo4j.Driver.Tests.BenchkitBackend.csproj b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Neo4j.Driver.Tests.BenchkitBackend.csproj
index 5af42ed5e..13e2b8142 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Neo4j.Driver.Tests.BenchkitBackend.csproj
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Neo4j.Driver.Tests.BenchkitBackend.csproj
@@ -8,14 +8,14 @@
- 1701;1702;1591;CS1591
+ 1701;1702;1591;CS1591
-
-
+
+
-
+
@@ -23,14 +23,13 @@
-
+
-
+
-
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Program.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Program.cs
index 621873784..5df5ce130 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Program.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Program.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,11 +40,12 @@
// wire up autofac
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory())
- .ConfigureContainer(b =>
- {
- b.RegisterInstance(benchkitBackendConfiguration).SingleInstance();
- b.RegisterModule();
- });
+ .ConfigureContainer(
+ b =>
+ {
+ b.RegisterInstance(benchkitBackendConfiguration).SingleInstance();
+ b.RegisterModule();
+ });
builder.Services
.AddNeo4jDriver(benchkitBackendConfiguration)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Properties/launchSettings.json b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Properties/launchSettings.json
index 9096d050a..9c132bb94 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Properties/launchSettings.json
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Properties/launchSettings.json
@@ -1,14 +1,14 @@
{
- "$schema": "http://json.schemastore.org/launchsettings.json",
- "profiles": {
- "kestrel": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "launchBrowser": true,
- "applicationUrl": "http://localhost:9000/swagger/index.html",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "kestrel": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:9000/swagger/index.html",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
}
- }
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Method.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Method.cs
index c3562f1ac..800232aeb 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Method.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Method.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,28 +15,18 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Types;
-///
-/// Different methods in the driver that can be used to execute a query.
-///
+/// Different methods in the driver that can be used to execute a query.
public enum Method
{
- ///
- /// Use the driver-level ExecuteQuery method.
- ///
+ /// Use the driver-level ExecuteQuery method.
ExecuteQuery,
- ///
- /// Use Session.Run to execute the query.
- ///
+ /// Use Session.Run to execute the query.
SessionRun,
- ///
- /// Use Session.ExecuteRead to execute the query.
- ///
+ /// Use Session.ExecuteRead to execute the query.
ExecuteRead,
- ///
- /// Use Session.ExecuteWrite to execute the query.
- ///
+ /// Use Session.ExecuteWrite to execute the query.
ExecuteWrite
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Mode.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Mode.cs
index 9ef2eb005..348d23e03 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Mode.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Mode.cs
@@ -15,28 +15,18 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Types;
-///
-/// Defines the parallel/sequential mode in which the queries should be executed.
-///
+/// Defines the parallel/sequential mode in which the queries should be executed.
public enum Mode
{
- ///
- /// Execute the queries sequentially in a single transaction.
- ///
+ /// Execute the queries sequentially in a single transaction.
SequentialQueries,
- ///
- /// Execute each query in a separate transaction sequentially in the same session.
- ///
+ /// Execute each query in a separate transaction sequentially in the same session.
SequentialTransactions,
- ///
- /// Execute each query in a separate session sequentially.
- ///
+ /// Execute each query in a separate session sequentially.
SequentialSessions,
- ///
- /// Execute the queries in parallel in a session per query.
- ///
+ /// Execute the queries in parallel in a session per query.
ParallelSessions
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Routing.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Routing.cs
index eeb17cefe..0769e4bf4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Routing.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Routing.cs
@@ -1,12 +1,12 @@
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
-//
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,19 +15,13 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Types;
-///
-/// Defines the routing mode in which the queries should be executed.
-///
+/// Defines the routing mode in which the queries should be executed.
public enum Routing
{
- ///
- /// Write routing.
- ///
+ /// Write routing.
Write,
- ///
- /// Read routing.
- ///
+ /// Read routing.
Read
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Workload.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Workload.cs
index c73f0295f..8e75d8ac8 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Workload.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/Workload.cs
@@ -15,33 +15,21 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Types;
-///
-/// Describes a driver workload.
-///
+/// Describes a driver workload.
public class Workload
{
- ///
- /// The method to use for executing the workload.
- ///
+ /// The method to use for executing the workload.
public Method Method { get; set; }
- ///
- /// The database to use for the workload.
- ///
+ /// The database to use for the workload.
public string? Database { get; set; } = "";
- ///
- /// The routing method to use for the workload.
- ///
+ /// The routing method to use for the workload.
public Routing Routing { get; set; } = Routing.Write;
- ///
- /// The series/parallel mode to use for the workload.
- ///
+ /// The series/parallel mode to use for the workload.
public Mode Mode { get; set; } = Mode.SequentialSessions;
- ///
- /// A list of individual queries to execute as part of the workload.
- ///
+ /// A list of individual queries to execute as part of the workload.
public List Queries { get; set; } = new();
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/WorkloadQuery.cs b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/WorkloadQuery.cs
index 7ee776746..63f577157 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/WorkloadQuery.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/Types/WorkloadQuery.cs
@@ -15,18 +15,12 @@
namespace Neo4j.Driver.Tests.BenchkitBackend.Types;
-///
-/// A query that is part of a workload.
-///
+/// A query that is part of a workload.
public class WorkloadQuery
{
- ///
- /// The query text.
- ///
+ /// The query text.
public string Text { get; set; } = "";
- ///
- /// The parameters to use when executing the query.
- ///
+ /// The parameters to use when executing the query.
public Dictionary Parameters { get; set; } = new();
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/appsettings.json b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/appsettings.json
index d7aa689e7..1a1a21bc0 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/appsettings.json
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.BenchkitBackend/appsettings.json
@@ -1,16 +1,16 @@
{
- "Serilog": {
- "MinimumLevel": {
- "Default": "Debug"
+ "Serilog": {
+ "MinimumLevel": {
+ "Default": "Debug"
+ }
+ },
+ "AllowedHosts": "*",
+ "BenchkitBackend": {
+ "BackendPort": 9000,
+ "Neo4jScheme": "neo4j",
+ "Neo4jHost": "localhost",
+ "Neo4jPort": 7687,
+ "Neo4jUser": "neo4j",
+ "Neo4jPassword": "password"
}
- },
- "AllowedHosts": "*",
- "BenchkitBackend": {
- "BackendPort": 9000,
- "Neo4jScheme": "neo4j",
- "Neo4jHost": "localhost",
- "Neo4jPort": 7687,
- "Neo4jUser": "neo4j",
- "Neo4jPassword": "password"
- }
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/CertificateTrustIT.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/CertificateTrustIT.cs
index 414fede8e..456846707 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/CertificateTrustIT.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/CertificateTrustIT.cs
@@ -164,14 +164,16 @@ private async Task TestConnectivity(Uri target, Config config)
private IDriver SetupWithCustomResolver(Uri overridenUri, Config config)
{
- var resolver = new CustomHostResolver(Server.BoltUri,
+ var resolver = new CustomHostResolver(
+ Server.BoltUri,
new SystemNetCoreHostResolver(new SystemHostResolver()));
+
var driverContext = new DriverContext(
overridenUri,
AuthTokenManagers.Static(Server.AuthToken),
config,
resolver);
-
+
var connectionFactory = new PooledConnectionFactory(driverContext);
return GraphDatabase.CreateDriver(connectionFactory, driverContext);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/DirectDriverTestBase.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/DirectDriverTestBase.cs
index a4ef80738..08d16b14d 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/DirectDriverTestBase.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/DirectDriverTestBase.cs
@@ -43,6 +43,7 @@ public void Dispose()
switch (_disposed)
{
case true: return;
+
case false:
{
using var session = Server.Driver.Session();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/EncryptionIT.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/EncryptionIT.cs
index e508f58ff..3e0b3d770 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/EncryptionIT.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Direct/EncryptionIT.cs
@@ -53,9 +53,9 @@ private static async Task VerifyConnectivity(IDriver driver)
{
await using var session = driver.AsyncSession();
- var cursor = await session.RunAsync("RETURN 2 as Number");
- var records = await cursor.ToListAsync(r => r["Number"].As());
+ var cursor = await session.RunAsync("RETURN 2 as Number");
+ var records = await cursor.ToListAsync(r => r["Number"].As());
- records.Should().BeEquivalentTo(2);
+ records.Should().BeEquivalentTo(2);
}
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Examples.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Examples.cs
index 2f7d17536..9f2caa2a8 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Examples.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Examples.cs
@@ -474,6 +474,11 @@ public HelloWorldExample(string uri, string user, string password)
_driver = GraphDatabase.Driver(uri, AuthTokens.Basic(user, password));
}
+ public void Dispose()
+ {
+ _driver?.Dispose();
+ }
+
public void PrintGreeting(string message)
{
using var session = _driver.Session();
@@ -492,11 +497,6 @@ public void PrintGreeting(string message)
Console.WriteLine(greeting);
}
- public void Dispose()
- {
- _driver?.Dispose();
- }
-
public static void Main()
{
using var greeter = new HelloWorldExample("bolt://localhost:7687", "neo4j", "password");
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/ExamplesAsync.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/ExamplesAsync.cs
index 78d74f4b4..b4e244743 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/ExamplesAsync.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/ExamplesAsync.cs
@@ -538,6 +538,7 @@ protected virtual void Dispose(bool disposing)
}
}
}
+
public class HelloWorldExampleTest : BaseAsyncExample
{
public HelloWorldExampleTest(ITestOutputHelper output, StandAloneIntegrationTestFixture fixture)
@@ -553,7 +554,7 @@ public async Task TestHelloWorldExample()
// When & Then
await example.PrintGreetingAsync("Hello, world");
}
-
+
// tag::async-hello-world[]
public class HelloWorldExample : IDisposable
{
@@ -564,6 +565,11 @@ public HelloWorldExample(string uri, string user, string password)
_driver = GraphDatabase.Driver(uri, AuthTokens.Basic(user, password));
}
+ public void Dispose()
+ {
+ _driver?.Dispose();
+ }
+
public async Task PrintGreetingAsync(string message)
{
await using var session = _driver.AsyncSession();
@@ -582,11 +588,6 @@ public async Task PrintGreetingAsync(string message)
Console.WriteLine(greeting);
}
-
- public void Dispose()
- {
- _driver?.Dispose();
- }
}
// end::async-hello-world[]
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CausalClusterIntegrationTestFixture.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CausalClusterIntegrationTestFixture.cs
index 511d057a7..b7896e18b 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CausalClusterIntegrationTestFixture.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CausalClusterIntegrationTestFixture.cs
@@ -54,6 +54,7 @@ public void Dispose()
switch (_disposed)
{
case true: return;
+
case false:
Cluster?.Dispose();
break;
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CertificateUtils.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CertificateUtils.cs
index 9c5b2cf23..5f3dca2d1 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CertificateUtils.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/CertificateUtils.cs
@@ -69,12 +69,10 @@ public static Pkcs12Store CreateCert(
if (altNames.Any() || addressAltNames.Any())
{
var alternativeNames = new List();
-
- alternativeNames.AddRange(
- altNames.Select(name => new GeneralName(GeneralName.DnsName, name)));
- alternativeNames.AddRange(
- addressAltNames.Select(ip => new GeneralName(GeneralName.IPAddress, ip)));
+ alternativeNames.AddRange(altNames.Select(name => new GeneralName(GeneralName.DnsName, name)));
+
+ alternativeNames.AddRange(addressAltNames.Select(ip => new GeneralName(GeneralName.IPAddress, ip)));
certGenerator.AddExtension(
X509Extensions.SubjectAlternativeName,
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/Cluster/SingleInstance.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/Cluster/SingleInstance.cs
index 5173935fb..349fe81a0 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/Cluster/SingleInstance.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/Cluster/SingleInstance.cs
@@ -28,7 +28,7 @@ public SingleInstance(string httpUri, string boltUri, string homePath, string pa
HttpUri = new Uri(httpUri);
BoltUri = new Uri(boltUri);
BoltRoutingUri = new Uri($"{BoltRoutingScheme}{BoltUri.Host}:{BoltUri.Port}");
- HomePath = homePath == null
+ HomePath = homePath == null
? "UNKNOWN"
: new DirectoryInfo(homePath).FullName;
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/IntegrationTestAttribute.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/IntegrationTestAttribute.cs
index f768675a1..907c1040b 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/IntegrationTestAttribute.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/IntegrationTestAttribute.cs
@@ -231,7 +231,9 @@ public RequireServerFactAttribute(
VersionComparison versionComparison)
{
if (versionComparison != VersionComparison.Between)
+ {
throw new ArgumentException(nameof(versionComparison));
+ }
_versionComparison = versionComparison;
var skipText = new StringBuilder();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/ProcessBasedCommandRunner.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/ProcessBasedCommandRunner.cs
index 186684645..1e6727f84 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/ProcessBasedCommandRunner.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/ProcessBasedCommandRunner.cs
@@ -30,7 +30,7 @@ public sealed class ProcessBasedCommandRunner : ShellCommandRunner, IDisposable
private List _stdOut;
public void Dispose()
- {
+ {
_process?.Dispose();
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/DefaultInstallation.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/DefaultInstallation.cs
index 503e23e80..2519b5d56 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/DefaultInstallation.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/DefaultInstallation.cs
@@ -21,11 +21,11 @@ namespace Neo4j.Driver.IntegrationTests.Internals;
public static class DefaultInstallation
{
- public static readonly string User = "neo4j";
- public static readonly string Password = "neo4j";
public const string HttpUri = "http://127.0.0.1:7474";
public const string BoltHeader = "bolt://";
+ public static readonly string User = "neo4j";
+ public static readonly string Password = "neo4j";
public static readonly string BoltHost = "127.0.0.1";
public static readonly string BoltPort = "7687";
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/SettingsHelper.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/SettingsHelper.cs
index f1fbdb645..c036757c3 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/SettingsHelper.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Internals/StandAlone/SettingsHelper.cs
@@ -39,7 +39,7 @@ public static void UpdateSettings(string location, IDictionary k
using var writer =
new StreamWriter(new FileStream(configFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite));
- while (reader.ReadLine() is { } line)
+ while (reader.ReadLine() is {} line)
{
if (line.Trim() == string.Empty || line.Trim().StartsWith("#"))
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Neo4j.Driver.Tests.Integration.csproj b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Neo4j.Driver.Tests.Integration.csproj
index 82a41340e..932c262f1 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Neo4j.Driver.Tests.Integration.csproj
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Neo4j.Driver.Tests.Integration.csproj
@@ -1,5 +1,5 @@
-
+
net6.0
false
@@ -18,38 +18,38 @@
Neo4j.Driver.IntegrationTests
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -151,7 +151,7 @@
Always
-
+
Always
@@ -172,9 +172,9 @@
-
+
-
+
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/AbstractRxIT.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/AbstractRxIT.cs
index c9ff35978..1de00b774 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/AbstractRxIT.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/AbstractRxIT.cs
@@ -28,7 +28,6 @@ namespace Neo4j.Driver.IntegrationTests.Reactive;
public abstract class AbstractRxIT : AbstractRxTest, IDisposable
{
private readonly List _sessions = new();
- protected bool IsDispose { get; private set; }
protected AbstractRxIT(ITestOutputHelper output, StandAloneIntegrationTestFixture fixture)
: base(output)
@@ -36,6 +35,8 @@ protected AbstractRxIT(ITestOutputHelper output, StandAloneIntegrationTestFixtur
Server = fixture.StandAloneSharedInstance;
}
+ protected bool IsDispose { get; private set; }
+
protected IStandAlone Server { get; }
public virtual void Dispose()
@@ -43,6 +44,7 @@ public virtual void Dispose()
switch (IsDispose)
{
case true: return;
+
case false:
_sessions.ForEach(x => x.Close().WaitForCompletion());
_sessions.Clear();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/NavigationIT.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/NavigationIT.cs
index a2d5cfccb..c24aa5992 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/NavigationIT.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/NavigationIT.cs
@@ -431,6 +431,7 @@ public override void Dispose()
_rxTransaction.Commit().WaitForCompletion();
_rxSession.Close().WaitForCompletion();
}
+
base.Dispose();
}
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/SummaryIT.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/SummaryIT.cs
index 0b3a0f28f..6e2300c62 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/SummaryIT.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Reactive/SummaryIT.cs
@@ -221,7 +221,7 @@ public void ShouldNotReturnPlanAndProfile()
HasPlan = false, Plan = default(IPlan), HasProfile = false, Profile = default(IProfiledPlan)
}));
}
-
+
[RequireServerFact("4.0.0", GreaterThanOrEqualTo, Skip = "Broken with servers 5.6+")]
public void ShouldReturnPlanButNoProfile()
{
@@ -276,7 +276,6 @@ public void ShouldReturnNotifications()
.Excluding(x => x.SelectedMemberPath == "Notifications[0].Description")));
}
-
[RequireServerFact("5.7.0", GreaterThanOrEqualTo)]
public void ShouldReturnNotificationsWithCategory()
{
@@ -286,7 +285,7 @@ public void ShouldReturnNotificationsWithCategory()
MatchesSummary(
new
{
- Notifications = new []
+ Notifications = new[]
{
new Notification(
"Neo.ClientNotification.Statement.UnknownLabelWarning",
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingReadCommandTxFunc.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingReadCommandTxFunc.cs
index b8a838feb..38ebd9ad7 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingReadCommandTxFunc.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingReadCommandTxFunc.cs
@@ -18,7 +18,7 @@
namespace Neo4j.Driver.IntegrationTests.Stress;
-public sealed class BlockingReadCommandTxFunc: BlockingCommand
+public sealed class BlockingReadCommandTxFunc : BlockingCommand
{
public BlockingReadCommandTxFunc(IDriver driver, bool useBookmark)
: base(driver, useBookmark)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingWriteCommandUsingReadSessionTxFunc.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingWriteCommandUsingReadSessionTxFunc.cs
index 26adf20fb..a39279538 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingWriteCommandUsingReadSessionTxFunc.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Blocking/BlockingWriteCommandUsingReadSessionTxFunc.cs
@@ -28,7 +28,7 @@ public BlockingWriteCommandUsingReadSessionTxFunc(IDriver driver, bool useBookma
public override void Execute(StressTestContext context)
{
using var session = NewSession(AccessMode.Read, context);
-
+
try
{
var succeeded = session.ExecuteRead(
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/CausalClusterStressTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/CausalClusterStressTests.cs
index 899818273..564292b87 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/CausalClusterStressTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/CausalClusterStressTests.cs
@@ -86,6 +86,7 @@ protected override void VerifyReadQueryDistribution(StressTestContext context)
{
throw new Exception("Context of wrong type");
}
+
VerifyServedReadQueries(clusterContext, clusterAddresses);
VerifyServedSimilarAmountOfReadQueries(clusterContext, clusterAddresses);
}
@@ -103,6 +104,7 @@ public override bool HandleWriteFailure(Exception error, StressTestContext conte
{
throw new Exception("Context of wrong type");
}
+
clusterContext.LeaderSwitched();
return true;
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/IRxCommand.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/IRxCommand.cs
index cc0a82e4c..2a82285b1 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/IRxCommand.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/IRxCommand.cs
@@ -15,6 +15,6 @@
namespace Neo4j.Driver.IntegrationTests.Stress;
-public interface IRxCommand: IAsyncCommand
+public interface IRxCommand : IAsyncCommand
{
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Reactive/RxFailingCommandInTx.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Reactive/RxFailingCommandInTx.cs
index 7b5befa41..0f5871ecd 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Reactive/RxFailingCommandInTx.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/Reactive/RxFailingCommandInTx.cs
@@ -22,7 +22,7 @@
namespace Neo4j.Driver.IntegrationTests.Stress;
-public sealed class RxFailingCommandInTx: RxCommand
+public sealed class RxFailingCommandInTx : RxCommand
{
public RxFailingCommandInTx(IDriver driver)
: base(driver, false)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/StressTest.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/StressTest.cs
index 8856f110e..996170fdb 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/StressTest.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stress/StressTest.cs
@@ -29,18 +29,8 @@
namespace Neo4j.Driver.IntegrationTests.Stress;
-public abstract class StressTest: IDisposable
+public abstract class StressTest : IDisposable
{
- private enum StressTestMinLogLevel
- {
- Trace,
- Debug,
- Info,
- Warn,
- Error,
- None
- }
-
private const int DefaultExecutionTime = 30;
private const int StressTestThreadCount = 8;
@@ -109,6 +99,16 @@ protected StressTest(
Dispose(false);
}
+ private enum StressTestMinLogLevel
+ {
+ Trace,
+ Debug,
+ Info,
+ Warn,
+ Error,
+ None
+ }
+
private class StressTestLogger : ILogger
{
private readonly StressTestMinLogLevel _minLevel;
@@ -272,7 +272,7 @@ public async Task Async()
private IList CreateAsyncCommands()
{
- /*
+ /*
Optional tests that can be run. Currenlty only want to run the transaction functions as these are what are used with Aura
AsyncReadCommand
AsyncReadCommandInTx
@@ -407,7 +407,7 @@ await session.ExecuteWriteAsync(
async tx =>
{
// 1-500, 501-1000
- var batches = Enumerable.Range(batchIndex * batchSize + 1, batchSize).Batch(queryBatchSize);
+ var batches = Enumerable.Range(batchIndex * batchSize + 1, batchSize).Batch(queryBatchSize);
foreach (var batch in batches)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/RoutingDriverTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/RoutingDriverTests.cs
index e3c52c3c8..ecd9223ed 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/RoutingDriverTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/RoutingDriverTests.cs
@@ -40,12 +40,12 @@ public async Task SendRoutingContextToServer(string boltVersion)
var uri = new Uri("neo4j://127.0.0.1:9001/?policy=my_policy®ion=china");
await using var driver = GraphDatabase.Driver(uri, SetupConfig);
await using var session = driver.AsyncSession();
- var cursor = await session.RunAsync("MATCH (n) RETURN n.name AS name");
- var records = await cursor.ToListAsync();
+ var cursor = await session.RunAsync("MATCH (n) RETURN n.name AS name");
+ var records = await cursor.ToListAsync();
- records.Count.Should().Be(2);
- records[0]["name"].As().Should().Be("Alice");
- records[1]["name"].As().Should().Be("Bob");
+ records.Count.Should().Be(2);
+ records[0]["name"].As().Should().Be("Alice");
+ records[1]["name"].As().Should().Be("Bob");
}
[RequireBoltStubServerTheory]
@@ -57,13 +57,13 @@ public async Task InvokeProcedureGetRoutingTableWhenServerVersionPermits(string
var uri = new Uri("neo4j://127.0.0.1:9001");
await using var driver = GraphDatabase.Driver(uri, SetupConfig);
await using var session = driver.AsyncSession();
- var cursor = await session.RunAsync("MATCH (n) RETURN n.name AS name");
- var records = await cursor.ToListAsync();
+ var cursor = await session.RunAsync("MATCH (n) RETURN n.name AS name");
+ var records = await cursor.ToListAsync();
- records.Count.Should().Be(3);
- records[0]["name"].As().Should().Be("Alice");
- records[1]["name"].As().Should().Be("Bob");
- records[2]["name"].As().Should().Be("Eve");
+ records.Count.Should().Be(3);
+ records[0]["name"].As().Should().Be("Alice");
+ records[1]["name"].As().Should().Be("Bob");
+ records[2]["name"].As().Should().Be("Eve");
}
[RequireBoltStubServerTheory]
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/TransactionTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/TransactionTests.cs
index c7c64a7c7..f51d80ba8 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/TransactionTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Stub/TransactionTests.cs
@@ -31,7 +31,7 @@ public static bool HasCause(this Exception exception)
{
T => true,
AggregateException aggregate => aggregate.InnerExceptions.Any(x => x.HasCause()),
- var _ => exception.InnerException?.HasCause() ?? false
+ _ => exception.InnerException?.HasCause() ?? false
};
}
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Types/PointsIT.cs b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Types/PointsIT.cs
index f2c049ab0..1b5bd53c5 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Types/PointsIT.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.Integration/Types/PointsIT.cs
@@ -169,7 +169,7 @@ private Point GenerateRandomPoint(int sequence)
1 => new Point(Wgs843DSrId, GenerateRandomX(), GenerateRandomY(), GenerateRandomZ()),
2 => new Point(CartesianSrId, GenerateRandomX(), GenerateRandomY()),
3 => new Point(Cartesian3DSrId, GenerateRandomX(), GenerateRandomY(), GenerateRandomZ()),
- var _ => throw new ArgumentOutOfRangeException()
+ _ => throw new ArgumentOutOfRangeException()
};
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Exceptions/ExceptionManager.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Exceptions/ExceptionManager.cs
index 3a66d3b57..1f33fa97a 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Exceptions/ExceptionManager.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Exceptions/ExceptionManager.cs
@@ -14,9 +14,9 @@
// limitations under the License.
using System;
-using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Linq;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Connector;
using Neo4j.Driver.Preview.GqlErrors;
@@ -130,7 +130,9 @@ private static Dictionary CreateExceptionDictionary(
{
var ne = ex as Neo4jException;
var gqlError = ne?.GetGqlErrorPreview();
- var diagnosticRecord = gqlError?.GqlDiagnosticRecord?.ToDictionary(y => y.Key, y => NativeToCypher.Convert(y.Value));
+ var diagnosticRecord =
+ gqlError?.GqlDiagnosticRecord?.ToDictionary(y => y.Key, y => NativeToCypher.Convert(y.Value));
+
var data = new Dictionary();
if (!isCause)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/IO/RequestReader.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/IO/RequestReader.cs
index 3e82f19f7..b6a0326a9 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/IO/RequestReader.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/IO/RequestReader.cs
@@ -46,7 +46,7 @@ public async Task ParseNextRequest()
{
}
- Trace.WriteLine($"\nRequest received: {CurrentObjectData}");
+ Trace.WriteLine($"Request received: {CurrentObjectData}");
return !string.IsNullOrEmpty(CurrentObjectData);
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Neo4j.Driver.Tests.TestBackend.csproj b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Neo4j.Driver.Tests.TestBackend.csproj
index b1364bb0f..b1a9af383 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Neo4j.Driver.Tests.TestBackend.csproj
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Neo4j.Driver.Tests.TestBackend.csproj
@@ -1,5 +1,5 @@
-
+
false
Exe
@@ -10,12 +10,12 @@
-
-
+
+
-
+
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Program.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Program.cs
index 70480423e..6fc665be6 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Program.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Program.cs
@@ -18,6 +18,7 @@
using System.IO;
using System.Net;
using Neo4j.Driver.Tests.TestBackend.IO;
+using Neo4j.Driver.Tests.TestBackend.Protocol.UI;
namespace Neo4j.Driver.Tests.TestBackend;
@@ -28,7 +29,7 @@ public class Program
private static void Main(string[] args)
{
- var consoleTraceListener = new TextWriterTraceListener(Console.Out);
+ var consoleTraceListener = new TextWriterTraceListener(new ConsoleTextWriter());
Trace.Listeners.Add(consoleTraceListener);
try
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerGetAuthCompleted.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerGetAuthCompleted.cs
index d65b84fca..4441eb710 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerGetAuthCompleted.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerGetAuthCompleted.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerHandleSecurityExceptionCompleted.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerHandleSecurityExceptionCompleted.cs
index 1f6fdcd58..d6b26b4fa 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerHandleSecurityExceptionCompleted.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthTokenManagerHandleSecurityExceptionCompleted.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthorizationToken.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthorizationToken.cs
index dbe9a6f03..eb5cacbcf 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthorizationToken.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/AuthorizationToken.cs
@@ -21,15 +21,6 @@ internal class AuthorizationToken : ProtocolObject
{
public AuthorizationTokenType data { get; set; } = new();
- public class AuthorizationTokenType
- {
- public string scheme { get; set; }
- public string principal { get; set; }
- public string credentials { get; set; }
- public string realm { get; set; }
- public Dictionary parameters { get; set; }
- }
-
public IAuthToken AsToken()
{
var authTokenData = data;
@@ -45,4 +36,13 @@ public IAuthToken AsToken()
authTokenData.parameters)
};
}
+
+ public class AuthorizationTokenType
+ {
+ public string scheme { get; set; }
+ public string principal { get; set; }
+ public string credentials { get; set; }
+ public string realm { get; set; }
+ public Dictionary parameters { get; set; }
+ }
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BasicAuthTokenProviderCompleted.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BasicAuthTokenProviderCompleted.cs
index 6ee139904..f774d7dd3 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BasicAuthTokenProviderCompleted.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BasicAuthTokenProviderCompleted.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BearerAuthTokenProviderCompleted.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BearerAuthTokenProviderCompleted.cs
index f9b778c5f..3690778ee 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BearerAuthTokenProviderCompleted.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/BearerAuthTokenProviderCompleted.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/CheckSessionAuthSupport.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/CheckSessionAuthSupport.cs
index b8bb9b52e..58c1e702d 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/CheckSessionAuthSupport.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/CheckSessionAuthSupport.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/ClientCertificate.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/ClientCertificate.cs
index 092d1ee6a..2966845ae 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/ClientCertificate.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/ClientCertificate.cs
@@ -18,26 +18,26 @@
using System.Security.Cryptography.X509Certificates;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.OpenSsl;
-using Org.BouncyCastle.Security;
using Org.BouncyCastle.Pkcs;
+using Org.BouncyCastle.Security;
using X509Certificate = Org.BouncyCastle.X509.X509Certificate;
namespace Neo4j.Driver.Tests.TestBackend.Protocol.Auth;
internal class ClientCertificate : ProtocolObject
{
- public ClientCertificateType data { get; set; } = new();
-
- private Lazy _certificate;
- public X509Certificate2 Certificate => _certificate.Value;
+ private readonly Lazy _certificate;
- ///
+ ///
public ClientCertificate()
{
_certificate = new Lazy(
() => ClientCertificateLoader.GetCertificate(data.certfile, data.keyfile, data.password));
}
+ public ClientCertificateType data { get; set; } = new();
+ public X509Certificate2 Certificate => _certificate.Value;
+
public class ClientCertificateType
{
public string certfile { get; set; } = "";
@@ -79,6 +79,9 @@ public PasswordProvider(string password)
_password = password;
}
- public char[] GetPassword() => _password.ToCharArray();
+ public char[] GetPassword()
+ {
+ return _password.ToCharArray();
+ }
}
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewAuthTokenManager.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewAuthTokenManager.cs
index a999e3f4c..099328ee0 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewAuthTokenManager.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewAuthTokenManager.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBasicAuthTokenManager.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBasicAuthTokenManager.cs
index 2b363ed47..f414db873 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBasicAuthTokenManager.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBasicAuthTokenManager.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +41,7 @@ internal class NewNeo4jAuthTokenManager : ProtocolObject
internal class NewBasicAuthTokenManager : NewNeo4jAuthTokenManager
{
public object data { get; set; }
-
+
public override Task Process(Controller controller)
{
_controller = controller;
@@ -71,7 +69,7 @@ public override string Respond()
{
return new ProtocolResponse("BasicAuthTokenManager", uniqueId).Encode();
}
-
+
protected string GetAuthRequest(string requestId)
{
return new ProtocolResponse(
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBearerAuthTokenManager.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBearerAuthTokenManager.cs
index 5c460c8b7..e9ff373b4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBearerAuthTokenManager.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewBearerAuthTokenManager.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +24,7 @@ namespace Neo4j.Driver.Tests.TestBackend.Protocol.Auth;
internal class NewBearerAuthTokenManager : NewNeo4jAuthTokenManager
{
public object data { get; set; }
-
+
public override Task Process(Controller controller)
{
_controller = controller;
@@ -59,7 +57,7 @@ public override string Respond()
{
return new ProtocolResponse("BearerAuthTokenManager", uniqueId).Encode();
}
-
+
protected string GetAuthRequest(string requestId)
{
return new ProtocolResponse(
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewClientCertificateProvider.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewClientCertificateProvider.cs
index bd949eee6..b2cd0c3c2 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewClientCertificateProvider.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/NewClientCertificateProvider.cs
@@ -23,14 +23,8 @@ internal class NewClientCertificateProvider : ProtocolObject, IClientCertificate
{
private Controller _controller;
public object data { get; set; } = new();
-
- public override Task Process(Controller controller)
- {
- _controller = controller;
- return Task.CompletedTask;
- }
- ///
+ ///
public async ValueTask GetCertificateAsync()
{
var requestId = Guid.NewGuid().ToString();
@@ -38,6 +32,7 @@ public async ValueTask GetCertificateAsync()
"ClientCertificateProviderRequest",
new { clientCertificateProviderId = uniqueId, id = requestId })
.Encode();
+
await _controller.SendResponse(request).ConfigureAwait(false);
var result = await _controller.TryConsumeStreamObjectOfType()
.ConfigureAwait(false);
@@ -53,6 +48,12 @@ public async ValueTask GetCertificateAsync()
throw new Exception("GetCertificateAsync: request IDs did not match");
}
+ public override Task Process(Controller controller)
+ {
+ _controller = controller;
+ return Task.CompletedTask;
+ }
+
public override string Respond()
{
return new ProtocolResponse("ClientCertificateProvider", uniqueId).Encode();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/TemporalAuthTokenProviderCompleted.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/TemporalAuthTokenProviderCompleted.cs
index dc8daabc0..e5c9eb063 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/TemporalAuthTokenProviderCompleted.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/TemporalAuthTokenProviderCompleted.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/VerifyAuthentication.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/VerifyAuthentication.cs
index 9b5319291..60063e4a7 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/VerifyAuthentication.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Auth/VerifyAuthentication.cs
@@ -22,6 +22,7 @@ namespace Neo4j.Driver.Tests.TestBackend.Protocol.Auth;
internal class VerifyAuthentication : ProtocolObject
{
public VerifyAuthenticationDTO data { get; set; } = null!;
+
[JsonIgnore]
public bool Authenticated { get; set; }
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/BookmarkManager/NewBookmarkManager.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/BookmarkManager/NewBookmarkManager.cs
index b284eed13..96f7877fe 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/BookmarkManager/NewBookmarkManager.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/BookmarkManager/NewBookmarkManager.cs
@@ -24,7 +24,8 @@ internal class NewBookmarkManager : ProtocolObject
{
public NewBookmarkManagerDto data { get; set; } = new();
- [JsonIgnore] public IBookmarkManager BookmarkManager { get; set; }
+ [JsonIgnore]
+ public IBookmarkManager BookmarkManager { get; set; }
public override Task Process(Controller controller)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/GetConnectionPoolMetrics.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/GetConnectionPoolMetrics.cs
index 0c7002182..511e190e2 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/GetConnectionPoolMetrics.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/GetConnectionPoolMetrics.cs
@@ -28,7 +28,7 @@ public override string Respond()
{
throw new Exception("The driver is not an internal driver");
}
-
+
var metrics = driver.Context.Metrics.ConnectionPoolMetrics;
var address = metrics.Where(x => x.Value.Id.Contains(data.address, StringComparison.OrdinalIgnoreCase))
.Select(x => x.Value)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriver.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriver.cs
index 0fee2eef0..8a3daff8b 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriver.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriver.cs
@@ -170,7 +170,7 @@ List GetPaths()
ClientCertificateProviders.Static(data.clientCertificate.Certificate));
}
- if(data.clientCertificateProviderId != null)
+ if (data.clientCertificateProviderId != null)
{
var provider = (NewClientCertificateProvider)ObjManager.GetObject(data.clientCertificateProviderId);
configBuilder.WithClientCertificateProvider(provider);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriverConverter.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriverConverter.cs
index 2617c99cf..50d81b6c4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriverConverter.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/NewDriverConverter.cs
@@ -65,7 +65,9 @@ public override NewDriver.NewDriverType ReadJson(
}
if (jsonObj.TryGetValue("notificationsDisabledCategories", out token))
+ {
newDriverRequest.notificationsDisabledCategories = token.ToObject();
+ }
return newDriverRequest;
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/SimpleLogger.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/SimpleLogger.cs
index 635e63bb7..20311ea92 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/SimpleLogger.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Driver/SimpleLogger.cs
@@ -19,21 +19,31 @@ namespace Neo4j.Driver.Tests.TestBackend.Protocol.Driver;
internal class SimpleLogger : ILogger
{
- private string Now => DateTime.UtcNow.ToString("O");
+ private string Now => DateTime.UtcNow.ToString("HH:mm:ss");
public void Debug(string message, params object[] args)
{
- Console.WriteLine($"[DRIVER-DEBUG][{Now}]{message}", args);
+
+ Console.ForegroundColor = message[0] == '['
+ ? ConsoleColor.DarkMagenta
+ : ConsoleColor.DarkGreen;
+
+ Console.WriteLine($"{Now} DBG: {message}", args);
+ Console.ResetColor();
}
public void Error(Exception error, string message, params object[] args)
{
- Console.WriteLine($"[DRIVER-ERROR][{Now}]{message}", args);
+ Console.ForegroundColor = ConsoleColor.DarkRed;
+ Console.WriteLine($"{Now} ERR: {message}", args);
+ Console.ResetColor();
}
public void Info(string message, params object[] args)
{
- Console.WriteLine($"[DRIVER-INFO] [{Now}]{message}", args);
+ Console.ForegroundColor = ConsoleColor.Gray;
+ Console.WriteLine($"{Now} INF: {message}", args);
+ Console.ResetColor();
}
public bool IsDebugEnabled()
@@ -48,11 +58,15 @@ public bool IsTraceEnabled()
public void Trace(string message, params object[] args)
{
- Console.WriteLine($"[DRIVER-TRACE][{Now}]{message}", args);
+ Console.ForegroundColor = ConsoleColor.DarkGray;
+ Console.WriteLine($"{Now} TRC: {message}", args);
+ Console.ResetColor();
}
public void Warn(Exception error, string message, params object[] args)
{
- Console.WriteLine($"[DRIVER-WARN] [{Now}]{message}", args);
+ Console.ForegroundColor = ConsoleColor.Yellow;
+ Console.WriteLine($"{Now} WRN: {message}", args);
+ Console.ResetColor();
}
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/DriverQuery/ExecuteQuery.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/DriverQuery/ExecuteQuery.cs
index ca98fdf51..0d3b3c856 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/DriverQuery/ExecuteQuery.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/DriverQuery/ExecuteQuery.cs
@@ -78,7 +78,9 @@ private QueryConfig BuildConfig()
var transactionConfig = new TransactionConfig
{
Timeout = data.config.timeout.HasValue ? TimeSpan.FromMilliseconds(data.config.timeout.Value) : null,
- Metadata = data.config.txMeta != null ? CypherToNativeObject.ConvertDictionaryToNative(data.config.txMeta) : new Dictionary()
+ Metadata = data.config.txMeta != null
+ ? CypherToNativeObject.ConvertDictionaryToNative(data.config.txMeta)
+ : new Dictionary()
};
var authToken = data.config.authorizationToken switch
@@ -138,8 +140,10 @@ public class ExecuteQueryConfigDto
public string impersonatedUser { get; set; }
public string bookmarkManagerId { get; set; }
public int? timeout { get; set; }
+
[JsonConverter(typeof(QueryParameterConverter))]
public Dictionary txMeta { get; set; }
+
public AuthorizationToken authorizationToken { get; set; }
}
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Protocol.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Protocol.cs
index b1da138c2..6be035ccc 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Protocol.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Protocol.cs
@@ -77,7 +77,8 @@ public string
internal set;
} //Only exposes the get option so that the serializer will output it. Don't want to read in on deserialization.
- [JsonIgnore] protected ProtocolObjectManager ObjManager { get; set; }
+ [JsonIgnore]
+ protected ProtocolObjectManager ObjManager { get; set; }
public event EventHandler ProtocolEvent;
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolException.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolException.cs
index 6e9aac16d..ee395f75e 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolException.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolException.cs
@@ -23,7 +23,8 @@ internal class ProtocolException : ProtocolObject
{
public ProtocolExceptionType data { get; set; } = new();
- [JsonIgnore] public Exception ExceptionObj { get; set; }
+ [JsonIgnore]
+ public Exception ExceptionObj { get; set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolResponse.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolResponse.cs
index 12ebcdfa8..81dddb8b4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolResponse.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ProtocolResponse.cs
@@ -19,9 +19,6 @@ namespace Neo4j.Driver.Tests.TestBackend.Protocol;
internal class ProtocolResponse
{
- public string name { get; }
- public object data { get; set; }
-
public ProtocolResponse(string newName, string newId)
{
data = new ResponseType();
@@ -41,6 +38,9 @@ public ProtocolResponse(string newName)
data = null;
}
+ public string name { get; }
+ public object data { get; set; }
+
public string Encode()
{
return JsonConvert.SerializeObject(this);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/CypherTypeField.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/CypherTypeField.cs
index a5aaf52ab..bbe267d2b 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/CypherTypeField.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/CypherTypeField.cs
@@ -26,9 +26,11 @@ namespace Neo4j.Driver.Tests.TestBackend.Protocol.Result;
internal class CypherTypeField : ProtocolObject
{
- [JsonProperty("data")] public CypherTypeFieldRequest RequestData { get; set; } = new();
+ [JsonProperty("data")]
+ public CypherTypeFieldRequest RequestData { get; set; } = new();
- [JsonIgnore] public object Field { get; set; }
+ [JsonIgnore]
+ public object Field { get; set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/Result.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/Result.cs
index af3d01701..67888ce30 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/Result.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/Result.cs
@@ -21,7 +21,8 @@ namespace Neo4j.Driver.Tests.TestBackend.Protocol.Result;
internal class Result : ProtocolObject
{
- [JsonIgnore] public IResultCursor ResultCursor { get; set; }
+ [JsonIgnore]
+ public IResultCursor ResultCursor { get; set; }
public ResultType data { get; set; } = new();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultConsume.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultConsume.cs
index c1585605d..6e796fba5 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultConsume.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultConsume.cs
@@ -22,9 +22,11 @@ internal class ResultConsume : ProtocolObject
{
public ResultConsumeType data { get; set; } = new();
- [JsonIgnore] public IRecord Records { get; set; }
+ [JsonIgnore]
+ public IRecord Records { get; set; }
- [JsonIgnore] public IResultSummary Summary { get; set; }
+ [JsonIgnore]
+ public IResultSummary Summary { get; set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultList.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultList.cs
index 55a95ae9a..1d9df2a78 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultList.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultList.cs
@@ -25,7 +25,8 @@ internal class ResultList : ProtocolObject
{
public ResultListType data { get; set; } = new();
- [JsonIgnore] public List Records { get; set; }
+ [JsonIgnore]
+ public List Records { get; set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultNext.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultNext.cs
index 8c03d0550..d248a1feb 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultNext.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/ResultNext.cs
@@ -26,7 +26,8 @@ internal class ResultNext : ProtocolObject
{
public ResultNextType data { get; set; } = new();
- [JsonIgnore] public IRecord Records { get; set; }
+ [JsonIgnore]
+ public IRecord Records { get; set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/SummaryJsonSerializer.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/SummaryJsonSerializer.cs
index 6700fe3c6..eb17026c0 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/SummaryJsonSerializer.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Result/SummaryJsonSerializer.cs
@@ -43,8 +43,7 @@ public static JRaw SerializeToRaw(IResultSummary summary)
profile = MapToProfilePlan(summary.Profile),
resultAvailableAfter = GetTotalMilliseconds(summary.ResultAvailableAfter),
resultConsumedAfter = GetTotalMilliseconds(summary.ResultConsumedAfter),
- gqlStatusObjects = MapGqlStatusObjects(
- summary.GqlStatusObjects)
+ gqlStatusObjects = MapGqlStatusObjects(summary.GqlStatusObjects)
}));
}
@@ -225,7 +224,9 @@ private static object MapGqlStatusObjects(IList statusObjects)
{
["gqlStatus"] = x.GqlStatus,
["statusDescription"] = x.StatusDescription,
- ["diagnosticRecord"] = x.DiagnosticRecord.ToDictionary(y => y.Key, y => NativeToCypher.Convert(y.Value)),
+ ["diagnosticRecord"] = x.DiagnosticRecord.ToDictionary(
+ y => y.Key,
+ y => NativeToCypher.Convert(y.Value)),
["classification"] = x.Classification.ToString().ToUpper(),
["rawClassification"] = x.RawClassification,
["rawSeverity"] = x.RawSeverity,
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/BaseSessionType.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/BaseSessionType.cs
index 279df65a6..aba54c98b 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/BaseSessionType.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/BaseSessionType.cs
@@ -33,7 +33,8 @@ internal abstract class BaseSessionType
[JsonProperty(Required = Required.AllowNull)]
public int? timeout { get; set; }
- [JsonIgnore] public bool TimeoutSet { get; set; }
+ [JsonIgnore]
+ public bool TimeoutSet { get; set; }
public TransactionConfigBuilder ConfigureTxTimeout(TransactionConfigBuilder configBuilder)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/NewSession.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/NewSession.cs
index d833b4316..6b0b9c061 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/NewSession.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/NewSession.cs
@@ -35,11 +35,16 @@ public enum SessionState
RetryAbleNegative
}
- [JsonIgnore] public SessionState RetryState { get; private set; } = SessionState.RetryAbleNothing;
- [JsonIgnore] public string RetryableErrorId { get; private set; }
+ [JsonIgnore]
+ public SessionState RetryState { get; private set; } = SessionState.RetryAbleNothing;
+
+ [JsonIgnore]
+ public string RetryableErrorId { get; private set; }
public NewSessionType data { get; set; } = new();
- [JsonIgnore] public IAsyncSession Session { get; set; }
+
+ [JsonIgnore]
+ public IAsyncSession Session { get; set; }
[JsonIgnore]
public AccessMode GetAccessMode
@@ -55,7 +60,8 @@ public AccessMode GetAccessMode
}
}
- [JsonIgnore] public List SessionTransactions { get; } = new();
+ [JsonIgnore]
+ public List SessionTransactions { get; } = new();
private void SessionConfig(SessionConfigBuilder configBuilder)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionBeginTransaction.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionBeginTransaction.cs
index 553f679d8..60adaa17f 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionBeginTransaction.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionBeginTransaction.cs
@@ -24,7 +24,8 @@ internal class SessionBeginTransaction : ProtocolObject
{
public SessionBeginTransactionType data { get; set; } = new();
- [JsonIgnore] public string TransactionId { get; set; }
+ [JsonIgnore]
+ public string TransactionId { get; set; }
public override async Task Process(Controller controller)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionReadTransaction.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionReadTransaction.cs
index b828efc33..2c0f05620 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionReadTransaction.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionReadTransaction.cs
@@ -26,7 +26,8 @@ internal class SessionReadTransaction : ProtocolObject
{
public SessionReadTransactionType data { get; set; } = new();
- [JsonIgnore] private string TransactionId { get; set; }
+ [JsonIgnore]
+ private string TransactionId { get; set; }
public override async Task Process(Controller controller)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionRun.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionRun.cs
index 1cd7d2339..058800f3f 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionRun.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionRun.cs
@@ -25,7 +25,8 @@ internal class SessionRun : ProtocolObject
{
public SessionRunType data { get; set; } = new();
- [JsonIgnore] private string ResultId { get; set; }
+ [JsonIgnore]
+ private string ResultId { get; set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionWriteTransaction.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionWriteTransaction.cs
index 258f363d5..a75e3058a 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionWriteTransaction.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Session/SessionWriteTransaction.cs
@@ -26,7 +26,8 @@ internal class SessionWriteTransaction : ProtocolObject
{
public SessionWriteTransactionType data { get; set; } = new();
- [JsonIgnore] public string TransactionId { get; set; }
+ [JsonIgnore]
+ public string TransactionId { get; set; }
public override async Task Process(Controller controller)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckDriverIsEncrypted.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckDriverIsEncrypted.cs
index c39507f82..4e5ee6008 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckDriverIsEncrypted.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckDriverIsEncrypted.cs
@@ -23,7 +23,8 @@ internal class CheckDriverIsEncrypted : ProtocolObject
{
public DriverIsEncryptedType data { get; set; } = new();
- [JsonIgnore] private bool Encrypted { get; set; }
+ [JsonIgnore]
+ private bool Encrypted { get; set; }
public override Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckMultiDBSupport.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckMultiDBSupport.cs
index 944cb07b0..52d58fc17 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckMultiDBSupport.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/CheckMultiDBSupport.cs
@@ -23,7 +23,8 @@ internal class CheckMultiDBSupport : ProtocolObject
{
public CheckMultiDBSupportType data { get; set; } = new();
- [JsonIgnore] private bool MutlitDBSupportAvailable { get; set; }
+ [JsonIgnore]
+ private bool MutlitDBSupportAvailable { get; set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/GetRoutingTable.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/GetRoutingTable.cs
index d77686ec3..f1746578b 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/GetRoutingTable.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/GetRoutingTable.cs
@@ -25,7 +25,8 @@ internal class GetRoutingTable : ProtocolObject
{
public GetRoutingTableDataType data { get; set; } = new();
- [JsonIgnore] public IRoutingTable RoutingTable { get; set; }
+ [JsonIgnore]
+ public IRoutingTable RoutingTable { get; set; }
public override async Task Process(Controller controller)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/ResolverResolutionCompleted.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/ResolverResolutionCompleted.cs
index 78b05f696..55bcc942f 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/ResolverResolutionCompleted.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/SupportFunctions/ResolverResolutionCompleted.cs
@@ -24,7 +24,8 @@ internal class ResolverResolutionCompleted : ProtocolObject
{
public ResolverResolutionCompletedType data { get; set; } = new();
- [JsonIgnore] public ListAddressResolver Resolver { get; private set; }
+ [JsonIgnore]
+ public ListAddressResolver Resolver { get; private set; }
public override async Task Process()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Time/FakeTime.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Time/FakeTime.cs
index 1ce75ee1d..a5774eee4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Time/FakeTime.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Time/FakeTime.cs
@@ -82,9 +82,9 @@ public override string Respond()
internal class FakeTime : IDateTimeProvider
{
public static readonly FakeTime Instance = new();
+ private readonly List _timers = new();
private DateTime? _frozenTime;
- private readonly List _timers = new();
public DateTime Now()
{
@@ -121,21 +121,19 @@ public void Uninstall()
internal class FakeTimer : ITimer
{
- private long _advanced;
-
- public void Advance(int milliseconds)
- {
- _advanced += milliseconds;
- }
+ public long ElapsedMilliseconds { get; private set; }
- public long ElapsedMilliseconds => _advanced;
-
public void Reset()
{
- _advanced = 0;
+ ElapsedMilliseconds = 0;
}
public void Start()
{
}
+
+ public void Advance(int milliseconds)
+ {
+ ElapsedMilliseconds += milliseconds;
+ }
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Transaction/TransactionRun.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Transaction/TransactionRun.cs
index 31ffb7668..f8f575846 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Transaction/TransactionRun.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/Transaction/TransactionRun.cs
@@ -27,7 +27,8 @@ internal class TransactionRun : ProtocolObject
{
public TransactionRunType data { get; set; } = new();
- [JsonIgnore] private string ResultId { get; set; }
+ [JsonIgnore]
+ private string ResultId { get; set; }
public override async Task Process(Controller controller)
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/UI/ConsoleTextWriter.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/UI/ConsoleTextWriter.cs
new file mode 100644
index 000000000..ff29902b8
--- /dev/null
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/UI/ConsoleTextWriter.cs
@@ -0,0 +1,66 @@
+// Copyright (c) "Neo4j"
+// Neo4j Sweden AB [https://neo4j.com]
+//
+// Licensed under the Apache License, Version 2.0 (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System;
+using System.IO;
+using System.Text;
+
+namespace Neo4j.Driver.Tests.TestBackend.Protocol.UI;
+
+public class ConsoleTextWriter : TextWriter
+{
+ public override Encoding Encoding => Console.Out.Encoding;
+ private string Now => DateTime.UtcNow.ToString("HH:mm:ss");
+ private const ConsoleColor WriteColor = ConsoleColor.DarkCyan;
+
+ private void DoInColor(Action action)
+ {
+ var oldColor = Console.ForegroundColor;
+ Console.ForegroundColor = WriteColor;
+ Console.Out.Write($"{Now} TKB: ");
+ action(Console.Out);
+ Console.ForegroundColor = oldColor;
+ }
+
+ public override void Write(char value)
+ {
+ DoInColor(writer => writer.Write(value));
+ }
+
+ public override void Write(string value)
+ {
+ DoInColor(writer => writer.Write(value));
+ }
+
+ public override void WriteLine(string value)
+ {
+ DoInColor(writer => writer.WriteLine(value));
+ }
+
+ public override void Write(char[] buffer, int index, int count)
+ {
+ DoInColor(writer => writer.Write(buffer, index, count));
+ }
+
+ public override void WriteLine(char[] buffer, int index, int count)
+ {
+ DoInColor(writer => writer.WriteLine(buffer, index, count));
+ }
+
+ public override void Flush()
+ {
+ Console.Out.Flush();
+ }
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/SupportedFeatures.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/SupportedFeatures.cs
index 766906eb9..30ac2c27e 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/SupportedFeatures.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/SupportedFeatures.cs
@@ -67,6 +67,7 @@ static SupportedFeatures()
"Feature:Bolt:5.5",
"Feature:Bolt:5.6",
"Feature:Bolt:5.7",
+ "Feature:Bolt:5.8",
"Feature:Bolt:Patch:UTC",
"Feature:Bolt:HandshakeManifestV1",
"Feature:Impersonation",
@@ -80,6 +81,8 @@ static SupportedFeatures()
//"Optimization:MinimalResets",
"Optimization:AuthPipelining",
"Optimization:PullPipelining",
+ //"Optimization:HomeDbCacheBasicPrincipalIsImpersonatedUser",
+ "Optimization:HomeDatabaseCache"
//"Optimization:ResultListFetchAll",
};
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/TestBlackList.cs b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/TestBlackList.cs
index 0953563a2..a9c56553d 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/TestBlackList.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/TestBlackList.cs
@@ -120,7 +120,11 @@ private static readonly (string Name, string Reason)[] BlackListNames =
("test_temporal_types.TestDataTypes.test_date_time_cypher_created_tz_id",
"No Antarctica/Troll mapping available."),
("test_temporal_types.TestDataTypes.test_should_echo_all_timezone_ids",
- "EST/HST/MST not supported.")
+ "EST/HST/MST not supported."),
+
+ ("test_connection_acquisition_timeout_during_fallback",
+ "Driver currently uses separate acquisition timeouts for the separate connections. Future behavioural " +
+ "fix (6.0) needed to pass test and unify with other drivers.")
};
public static bool FindTest(string testName, out string reason)
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/.editorconfig b/Neo4j.Driver/Neo4j.Driver.Tests/.editorconfig
index fe783240e..53941ecd1 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/.editorconfig
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/.editorconfig
@@ -369,11 +369,11 @@ dotnet_naming_symbols.types_and_namespaces_symbols.applicable_kinds = namespace,
dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
-dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_accessibilities = *
-dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_required_modifiers = instance
dotnet_separate_import_directive_groups = false
@@ -663,8 +663,8 @@ resharper_line_break_before_requires_clause = do_not_change
resharper_linkage_specification_braces = end_of_line
resharper_linkage_specification_indentation = none
resharper_local_function_body = block_body
-resharper_macro_block_begin =
-resharper_macro_block_end =
+resharper_macro_block_begin =
+resharper_macro_block_end =
resharper_max_array_initializer_elements_on_line = 10000
resharper_max_attribute_length_for_same_line = 38
resharper_max_enum_members_on_line = 1
@@ -734,7 +734,7 @@ resharper_resx_attribute_indent = single_indent
resharper_resx_blank_line_after_pi = true
resharper_resx_indent_text = OneIndent
resharper_resx_keep_user_linebreaks = true
-resharper_resx_linebreak_before_elements =
+resharper_resx_linebreak_before_elements =
resharper_resx_max_blank_lines_between_tags = 0
resharper_resx_pi_attribute_style = do_not_touch
resharper_resx_space_before_self_closing = false
@@ -963,7 +963,7 @@ resharper_xml_attribute_indent = align_by_first_attribute
resharper_xml_blank_line_after_pi = true
resharper_xml_indent_text = OneIndent
resharper_xml_keep_user_linebreaks = true
-resharper_xml_linebreak_before_elements =
+resharper_xml_linebreak_before_elements =
resharper_xml_max_blank_lines_between_tags = 2
resharper_xml_pi_attribute_style = do_not_touch
resharper_xml_space_before_self_closing = true
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/AsyncSessionTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/AsyncSessionTests.cs
index 2e7f00ac1..761bcbbfc 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/AsyncSessionTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/AsyncSessionTests.cs
@@ -23,6 +23,7 @@
using Moq;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Connector;
+using Neo4j.Driver.Internal.HomeDbCaching;
using Neo4j.Driver.Internal.Logging;
using Neo4j.Driver.Internal.MessageHandling;
using Neo4j.Driver.Internal.Messaging;
@@ -72,8 +73,7 @@ internal static Mock MockedConnectionWithSuccessResponse(IBoltProto
It.IsAny(),
It.IsAny()))
.Returns(Task.CompletedTask)
- .Callback(
- (IRequestMessage _, IResponseHandler h1) => { h1.OnSuccess(new Dictionary()); });
+ .Callback((IRequestMessage _, IResponseHandler h1) => { h1.OnSuccess(new Dictionary()); });
if (protocol == null)
{
@@ -100,7 +100,8 @@ public async Task ShouldDelegateToProtocolRunAutoCommitTxAsync(bool reactive)
mockConn.Verify(
x => x.RunInAutoCommitTransactionAsync(
It.IsAny(),
- It.IsAny()),
+ It.IsAny(),
+ It.IsAny()),
Times.Once);
}
}
@@ -178,7 +179,10 @@ public async void ShouldDefaultToBlockingTransactionStart()
x =>
x.BeginTransactionAsync(
It.IsAny(),
- It.Is(y => y.TransactionInfo.AwaitBegin == true)),
+ It.Is(y => y.TransactionInfo.AwaitBegin == true),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()),
Times.Once);
}
@@ -227,7 +231,10 @@ public async void ShouldCloseConnectionOnRunIfBeginTxFailed()
x =>
x.BeginTransactionAsync(
It.IsAny(),
- It.IsAny()))
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()))
.Throws(new IOException("Triggered an error when beginTx"));
var session = NewSession(mockConn.Object);
@@ -252,7 +259,10 @@ public async void ShouldCloseConnectionOnNewBeginTxIfBeginTxFailed()
x =>
x.BeginTransactionAsync(
It.IsAny(),
- It.IsAny()))
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()))
.Returns(Task.CompletedTask)
.Callback(
() =>
@@ -292,20 +302,25 @@ public async void PipelinedShouldBeginWithoutBlocking()
var session = new AsyncSession(
new TestConnectionProvider(mockConn.Object),
- null,
+ NullLogger.Instance,
new AsyncRetryLogic(TimeSpan.Zero, null),
0,
new Driver.SessionConfig(),
false,
false);
- await session.PipelinedExecuteReadAsync(_ => Task.FromResult(null as EagerResult), new TransactionConfig());
+ await session.PipelinedExecuteReadAsync(
+ _ => Task.FromResult(null as EagerResult),
+ new TransactionConfig());
mockProtocol.Verify(
x =>
x.BeginTransactionAsync(
It.IsAny(),
- It.Is(y => y.TransactionInfo.AwaitBegin == false)),
+ It.Is(y => y.TransactionInfo.AwaitBegin == false),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()),
Times.Once);
}
}
@@ -321,7 +336,10 @@ public async void ShouldCloseConnectionIfBeginTxFailed()
x =>
x.BeginTransactionAsync(
It.IsAny(),
- It.IsAny()))
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()))
.Throws(new IOException("Triggered an error when beginTx"));
var session = NewSession(mockConn.Object);
@@ -428,6 +446,9 @@ public Task VerifyConnectivityAndGetInfoAsync()
throw new NotSupportedException();
}
+ ///
+ public bool IsDirectDriver => false;
+
public DriverContext DriverContext => new(
new Uri("neo4j://myTest.org"),
AuthTokenManagers.Static(AuthTokens.None),
@@ -481,7 +502,14 @@ public void ShouldSyncBookmarksOnUpdateBookmarks()
.WithBookmarkManager(bookmarkManager.Object)
.Build();
- using (var session = new AsyncSession(null, null, null, 0, cfg, false, false))
+ using (var session = new AsyncSession(
+ null,
+ null,
+ null,
+ 0,
+ cfg,
+ false,
+ false))
{
session.UpdateBookmarks(new InternalBookmarks("a"));
bookmarkManager.Verify(
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Auth/Neo4jAuthTokenManagerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Auth/Neo4jAuthTokenManagerTests.cs
index eea931c15..dc4ad0db7 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Auth/Neo4jAuthTokenManagerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Auth/Neo4jAuthTokenManagerTests.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,7 +42,8 @@ public async Task ShouldCacheToken()
{
var (authData, _) = GetTwoAuthTokens();
- int callCount = 0;
+ var callCount = 0;
+
ValueTask TokenProvider()
{
callCount++;
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/BookmarkTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/BookmarkTests.cs
index 95c3d0b8a..cf672adb2 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/BookmarkTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/BookmarkTests.cs
@@ -98,4 +98,4 @@ public void ShouldUnionValues(string[] values1, string[] values2, string[] value
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/ConfigTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/ConfigTests.cs
index 8e3a36da0..bf8cc40df 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/ConfigTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/ConfigTests.cs
@@ -265,7 +265,7 @@ public void WithNotifications_ShouldSetCategoryWithClassification(
config
.Which
.DisabledCategories.Should()
- .BeEquivalentTo([category]);
+ .BeEquivalentTo(category);
config
.Which
@@ -320,7 +320,7 @@ public void WithNotifications_ShouldSetMultipleCategories()
config
.Which
.DisabledCategories.Should()
- .BeEquivalentTo([Category.Deprecation, Category.Hint]);
+ .BeEquivalentTo(Category.Deprecation, Category.Hint);
config
.Which
@@ -344,7 +344,7 @@ public void WithNotifications_ShouldSetMultipleClassifications()
config
.Which
.DisabledCategories.Should()
- .BeEquivalentTo([Category.Deprecation, Category.Hint]);
+ .BeEquivalentTo(Category.Deprecation, Category.Hint);
config
.Which
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionPoolTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionPoolTests.cs
index 4543ed91a..2a3e7f68a 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionPoolTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionPoolTests.cs
@@ -24,8 +24,8 @@
using Moq;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Connector;
-using Neo4j.Driver.Internal.Util;
using Neo4j.Driver.Internal.Protocol;
+using Neo4j.Driver.Internal.Util;
using Neo4j.Driver.Tests.TestUtil;
using Xunit;
using Xunit.Abstractions;
@@ -291,6 +291,7 @@ private Mock MockValidator(Action x.GetConnectionLifetimeStatus(It.IsAny()))
.Returns(AcquireStatus.Healthy);
}
+
return validator;
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionValidatorTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionValidatorTests.cs
index b15dc0323..2f2ff44d7 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionValidatorTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/ConnectionValidatorTests.cs
@@ -30,8 +30,23 @@ private static ConnectionValidator NewConnectionValidator(
TimeSpan? maxConnLifetime = null,
TimeSpan? livelinessCheckTimeout = null)
{
- return new ConnectionValidator(connIdleTimeout ?? Config.InfiniteInterval,
- maxConnLifetime ?? Config.InfiniteInterval, livelinessCheckTimeout);
+ return new ConnectionValidator(
+ connIdleTimeout ?? Config.InfiniteInterval,
+ maxConnLifetime ?? Config.InfiniteInterval,
+ livelinessCheckTimeout);
+ }
+
+ private static (Mock conn, Mock idle, Mock life) Mock()
+ {
+ var conn = new Mock();
+ conn.Setup(x => x.Version).Returns(BoltProtocolVersion.V5_1);
+
+ var idleTimer = new Mock();
+ var lifeTimer = new Mock();
+
+ conn.Setup(x => x.IdleTimer).Returns(idleTimer.Object);
+ conn.Setup(x => x.LifetimeTimer).Returns(lifeTimer.Object);
+ return (conn, idleTimer, lifeTimer);
}
public class IsConnectionReusableTests
@@ -131,17 +146,4 @@ public void ShouldRequireLiveness()
idleTimer.Verify(x => x.Reset(), Times.Once);
}
}
-
- private static (Mock conn, Mock idle, Mock life) Mock()
- {
- var conn = new Mock();
- conn.Setup(x => x.Version).Returns(BoltProtocolVersion.V5_1);
-
- var idleTimer = new Mock();
- var lifeTimer = new Mock();
-
- conn.Setup(x => x.IdleTimer).Returns(idleTimer.Object);
- conn.Setup(x => x.LifetimeTimer).Returns(lifeTimer.Object);
- return (conn, idleTimer, lifeTimer);
- }
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Connector/MockedMessagingClient.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Connector/MockedMessagingClient.cs
index d76eeebb4..d9d3874ec 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Connector/MockedMessagingClient.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Connector/MockedMessagingClient.cs
@@ -171,4 +171,4 @@ internal static SuccessMessage SuccessMessage(IDictionary fields
? new SuccessMessage(new Dictionary())
: new SuccessMessage(fields);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketClientTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketClientTests.cs
index a0a35a84e..65d47ae90 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketClientTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketClientTests.cs
@@ -75,7 +75,7 @@ private static (Mock, Mock) CreateMockIo
mockIoFactory
.Setup(x => x.TcpSocketClient(It.IsAny(), It.IsAny()))
.Returns(connMock.Object);
-
+
configureFactory?.Invoke(mockIoFactory);
return (connMock, mockIoFactory);
@@ -127,8 +127,7 @@ public async void ShouldNotCatchHandshakeFailuresOrConstructIoTypes()
var client = NewClient(io, null, mockHandshaker);
- var ex = await Record.ExceptionAsync(
- () => client.ConnectAsync(CancellationToken.None));
+ var ex = await Record.ExceptionAsync(() => client.ConnectAsync(CancellationToken.None));
mockHandshaker.Verify(
x => x.DoHandshakeAsync(
@@ -337,4 +336,4 @@ public async Task ShouldCallDisconnectAsyncOnTheTcpSocketClientWhenStoppedAsync(
client.IsOpen.Should().BeFalse();
}
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketConnectionTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketConnectionTests.cs
index 4766c3cf8..fb7f11999 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketConnectionTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Connector/SocketConnectionTests.cs
@@ -74,11 +74,13 @@ public async Task ShouldConnectClient()
var bpFactory = new Mock();
bpFactory.Setup(x => x.ForVersion(BoltProtocolVersion.V3_0)).Returns(protocolMock.Object);
- var conn = NewSocketConnection(mockClient.Object, boltProtocolFactory: bpFactory.Object,
+ var conn = NewSocketConnection(
+ mockClient.Object,
+ boltProtocolFactory: bpFactory.Object,
context: new DriverContext(new Uri("bolt://localhost:7687"), AuthTokenManagers.None, new Config()));
// When
- await conn.InitAsync(null);
+ await conn.InitAsync();
// Then
mockClient.Verify(c => c.ConnectAsync(CancellationToken.None), Times.Once);
@@ -102,7 +104,7 @@ public async Task ShouldThrowClientErrorIfFailedToConnectToServerWithinTimeout()
// ReSharper disable once ObjectCreationAsStatement
var conn = new SocketConnection(mockClient.Object, AuthToken, Logger, Server);
// When
- var error = await Record.ExceptionAsync(() => conn.InitAsync(null));
+ var error = await Record.ExceptionAsync(() => conn.InitAsync());
// Then
error.Should().BeOfType();
error.Message.Should().Be("I will stop socket conn from initialization");
@@ -227,7 +229,7 @@ public async Task ShouldEnqueueBoth()
var h1 = new Mock();
var m2 = new Mock();
var h2 = new Mock();
-
+
await con.EnqueueAsync(m1.Object, h1.Object, m2.Object, h2.Object);
con.Messages[0].Should().Be(m1.Object);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/DriverTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/DriverTests.cs
index b1fc3a30f..adc4c9b91 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/DriverTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/DriverTests.cs
@@ -19,7 +19,6 @@
using Moq;
using Neo4j.Driver.Internal;
using Xunit;
-
using InternalDriver = Neo4j.Driver.Internal.Driver;
#pragma warning disable CS0618
@@ -71,8 +70,7 @@ public void ShouldErrorIfUriWrongFormat()
[Fact]
public void ShouldErrorIfBoltSchemeWithRoutingContext()
{
- var exception = Record.Exception(
- () => GraphDatabase.Driver("bolt://localhost/?name=molly&age=1&color=white"));
+ var exception = Record.Exception(() => GraphDatabase.Driver("bolt://localhost/?name=molly&age=1&color=white"));
exception.Should().BeOfType();
exception.Message.Should().Contain("Routing context are not supported with scheme 'bolt'");
@@ -156,10 +154,12 @@ public async void ShouldTryVerifyConnection()
mock.Setup(x => x.VerifyConnectivityAndGetInfoAsync())
.Returns(Task.FromResult(new Mock().Object));
- var driver = (IDriver)new InternalDriver(new Uri("bolt://localhost"),
+ var driver = (IDriver)new InternalDriver(
+ new Uri("bolt://localhost"),
mock.Object,
null,
TestDriverContext.MockContext);
+
var connects = await driver.TryVerifyConnectivityAsync();
connects.Should().BeTrue();
@@ -172,10 +172,12 @@ public async void ShouldCatchInTryVerifyConnection()
mock.Setup(x => x.VerifyConnectivityAndGetInfoAsync())
.ThrowsAsync(new Exception("broken"));
- var driver = (IDriver)new InternalDriver(new Uri("bolt://localhost"),
+ var driver = (IDriver)new InternalDriver(
+ new Uri("bolt://localhost"),
mock.Object,
null,
TestDriverContext.MockContext);
+
var connects = await driver.TryVerifyConnectivityAsync();
connects.Should().BeFalse();
@@ -189,7 +191,8 @@ public async void ShouldGetInfoConnection()
mock.Setup(x => x.VerifyConnectivityAndGetInfoAsync())
.Returns(Task.FromResult(mockServerInfo));
- var driver = new InternalDriver(new Uri("bolt://localhost"),
+ var driver = new InternalDriver(
+ new Uri("bolt://localhost"),
mock.Object,
null,
TestDriverContext.MockContext);
@@ -205,10 +208,12 @@ public async void ShouldTestSupportMultiDb()
{
var mock = new Mock();
mock.Setup(x => x.SupportsMultiDbAsync()).Returns(Task.FromResult(true));
- var driver = new InternalDriver(new Uri("bolt://localhost"),
+ var driver = new InternalDriver(
+ new Uri("bolt://localhost"),
mock.Object,
null,
TestDriverContext.MockContext);
+
await driver.SupportsMultiDbAsync();
mock.Verify(x => x.SupportsMultiDbAsync(), Times.Once);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Exceptions/Neo4jExceptionFactoryTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Exceptions/Neo4jExceptionFactoryTests.cs
index ddbd8c08c..cc13cda3d 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Exceptions/Neo4jExceptionFactoryTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Exceptions/Neo4jExceptionFactoryTests.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"):
-// you may not use this file except in compliance with the License.
+// Neo4j Sweden AB [https://neo4j.com]
+//
+// Licensed under the Apache License, Version 2.0 (the "License").
+// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +14,6 @@
// limitations under the License.
using System;
-using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Neo4j.Driver.Internal.ExceptionHandling;
@@ -46,7 +43,8 @@ public class Neo4jExceptionFactoryTests
["Neo.TransientError.TemporaryDisabled", typeof(TransientException)]
];
- [Theory, MemberData(nameof(CodeToTypeMapping))]
+ [Theory]
+ [MemberData(nameof(CodeToTypeMapping))]
public void ShouldCreateCorrectExceptionType(string code, Type exceptionType)
{
var subject = new Neo4jExceptionFactory();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/ExecutableQuery/ExecutableQueryTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/ExecutableQuery/ExecutableQueryTests.cs
index 4ab4fc271..c7977789e 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/ExecutableQuery/ExecutableQueryTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/ExecutableQuery/ExecutableQueryTests.cs
@@ -1,14 +1,12 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
-//
+// Neo4j Sweden AB [https://neo4j.com]
+//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -275,7 +273,7 @@ public async Task ShouldReturnMappedTransformedReducedValue()
var result = await subject
.WithMap(i => i * 10)
- .WithReduce(() => 0, (x, y) => x + y, i => $"<{(i * 2)}>")
+ .WithReduce(() => 0, (x, y) => x + y, i => $"<{i * 2}>")
.ExecuteAsync();
result.Result.Should().Be("<900>");
@@ -352,7 +350,7 @@ public async Task ShouldUseStreamProcessor()
async IAsyncEnumerable GetInts(int start, int count)
{
- foreach(var i in Enumerable.Range(start, count))
+ foreach (var i in Enumerable.Range(start, count))
{
await Task.Yield();
yield return i;
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Extensions/StreamExtensionTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Extensions/StreamExtensionTests.cs
index 864f50538..500f190c3 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Extensions/StreamExtensionTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Extensions/StreamExtensionTests.cs
@@ -44,8 +44,7 @@ void Callback(Memory _, CancellationToken token)
const int timeout = 100;
- var ex = await Record.ExceptionAsync(
- () => streamMock.Object.ReadWithTimeoutAsync(new byte[1], 0, 1, timeout));
+ var ex = await Record.ExceptionAsync(() => streamMock.Object.ReadWithTimeoutAsync(new byte[1], 0, 1, timeout));
ex.Should()
.BeOfType()
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Filters/OSFilters.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Filters/OSFilters.cs
index 0b929829a..d36612f4a 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Filters/OSFilters.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Filters/OSFilters.cs
@@ -100,4 +100,4 @@ public class UnixTheoryAttribute : OSTheoryAttribute
public UnixTheoryAttribute() : base(OSPlatform.Linux, OSPlatform.OSX)
{
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Filters/RuntimeFilters.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Filters/RuntimeFilters.cs
index 825fe90da..c16372b6e 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Filters/RuntimeFilters.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Filters/RuntimeFilters.cs
@@ -73,4 +73,4 @@ public DotnetCoreTheoryAttribute()
Skip = "Test is supposed to be run only on .net core runtimes";
}
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/GqlCompliance/GqlErrorTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/GqlCompliance/GqlErrorTests.cs
index b61835885..fbe15a7dd 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/GqlCompliance/GqlErrorTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/GqlCompliance/GqlErrorTests.cs
@@ -45,7 +45,7 @@ public void BuildFailureMessage_ShouldDeserializeCorrectly()
}
};
- int majorVersion = 4;
+ var majorVersion = 4;
// Act
var result = FailureMessageSerializer.BuildFailureMessage(values, majorVersion);
@@ -73,7 +73,7 @@ public void BuildFailureMessage_ShouldDeserializeCorrectly()
result.GqlClassification.Should().Be("UNKNOWN");
}
- [Fact]
+ [Fact]
public void GetException_ShouldHandleNestedFailureMessages()
{
// Arrange
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkReaderTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkReaderTests.cs
index 381874a26..0e96d8889 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkReaderTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkReaderTests.cs
@@ -280,7 +280,11 @@ private static byte[] GenerateMessageChunk(int messageSize)
{
var buffer = Enumerable.Range(0, messageSize).Select(i => i % byte.MaxValue).Select(i => (byte)i).ToArray();
var stream = new MemoryStream();
- var cs = new DriverContext(new Uri("bolt://localhost:7687"), new StaticAuthTokenManager(AuthTokens.None), new Config());
+ var cs = new DriverContext(
+ new Uri("bolt://localhost:7687"),
+ new StaticAuthTokenManager(AuthTokens.None),
+ new Config());
+
var writer = new ChunkWriter(stream, cs, new Mock().Object);
writer.OpenChunk();
@@ -314,4 +318,4 @@ private static byte[] GenerateMessages(int messageSizePerChunk, int maxBytes)
return stream.ToArray();
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkWriterTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkWriterTests.cs
index eda98c059..07f3db5a9 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkWriterTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ChunkWriterTests.cs
@@ -29,6 +29,7 @@ namespace Neo4j.Driver.Tests.Internal.IO;
public class ChunkWriterTests
{
private readonly Mock _logger = new();
+
private static DriverContext TestContext(int defaultRead, int defaultWrite, int maxRead, int maxWrite)
{
return TestDriverContext.With(
@@ -354,4 +355,4 @@ private static async Task ConstructMessage(byte[] buffer)
return stream.ToArray();
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/IgnoredMessageSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/IgnoredMessageSerializerTests.cs
index 8c9ec7967..1da56ed38 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/IgnoredMessageSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/IgnoredMessageSerializerTests.cs
@@ -35,4 +35,4 @@ public void ShouldReturnIgnoredMessage()
var message = IgnoredMessageSerializer.Instance.Deserialize(null);
message.Should().Be(IgnoredMessage.Instance);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/PullAllMessageSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/PullAllMessageSerializerTests.cs
index 5d74786bc..9f16ad4d6 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/PullAllMessageSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/PullAllMessageSerializerTests.cs
@@ -68,4 +68,4 @@ public void ShouldSerialize(int major, int minor)
bytes[0].Should().Be(0xB0);
bytes[1].Should().Be(0x3F);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RecordMessageSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RecordMessageSerializerTests.cs
index f5ee5ae1f..283c2dfc7 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RecordMessageSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RecordMessageSerializerTests.cs
@@ -59,4 +59,4 @@ public void ShouldDeserialize(int major, int minor)
message.Should().BeOfType().Which.Fields.Should().BeEquivalentTo(0L, "a");
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/ResetMessageSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/ResetMessageSerializerTests.cs
index b5e1c4d7b..65faf7579 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/ResetMessageSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/ResetMessageSerializerTests.cs
@@ -71,4 +71,4 @@ public void ShouldSerialize(int major, int minor)
// message tag
headerBytes[1].Should().Be(0x0F);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RunWithMetadataMessageSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RunWithMetadataMessageSerializerTests.cs
index 76684f369..ec16ba136 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RunWithMetadataMessageSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/RunWithMetadataMessageSerializerTests.cs
@@ -84,4 +84,4 @@ public void ShouldSerialize(int major, int minor)
var metadata = reader.ReadMap();
metadata.Should().ContainKey("db").WhichValue.Should().Be("neo4j");
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/SuccessMessageSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/SuccessMessageSerializerTests.cs
index 2bde578ad..e3e725dac 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/SuccessMessageSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/MessageSerializers/SuccessMessageSerializerTests.cs
@@ -67,4 +67,4 @@ public void ShouldDeserialize(int major, int minor)
.WhichValue.Should()
.Be(1L);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/PackStreamTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/PackStreamTests.cs
index 036748eaa..fff6125a4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/PackStreamTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/PackStreamTests.cs
@@ -45,8 +45,10 @@ internal virtual PackStreamReaderMachine CreateReaderMachine(
internal override PackStreamWriterMachine CreateWriterMachine(BoltProtocolVersion version = null)
{
- return CreateWriterMachine(new MessageFormat(version ?? BoltProtocolVersion.V3_0,
- TestDriverContext.MockContext).WriteStructHandlers);
+ return CreateWriterMachine(
+ new MessageFormat(
+ version ?? BoltProtocolVersion.V3_0,
+ TestDriverContext.MockContext).WriteStructHandlers);
}
internal override PackStreamReaderMachine CreateReaderMachine(byte[] data, BoltProtocolVersion version = null)
@@ -154,9 +156,13 @@ public void Serialize(BoltProtocolVersion _, PackStreamWriter writer, object val
}
}
- public (object, int) DeserializeSpan(BoltProtocolVersion version, SpanPackStreamReader reader, byte signature, int size)
+ public (object, int) DeserializeSpan(
+ BoltProtocolVersion version,
+ SpanPackStreamReader reader,
+ byte signature,
+ int size)
{
throw new NotImplementedException();
}
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/Utils/Machines.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/Utils/Machines.cs
index 500844e59..5266f410f 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/Utils/Machines.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/Utils/Machines.cs
@@ -57,4 +57,4 @@ internal PackStreamReader Reader()
{
return _reader;
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementNodeSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementNodeSerializerTests.cs
index 474443884..b1bf11fba 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementNodeSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementNodeSerializerTests.cs
@@ -89,6 +89,7 @@ public void ShouldDeserializeSpan()
{ "prop2", 15 },
{ "prop3", true }
});
+
writer.Write("1");
var readerMachine = CreateSpanReader(writerMachine.GetOutput());
@@ -96,4 +97,4 @@ public void ShouldDeserializeSpan()
Validate(value);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementPathSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementPathSerializerTests.cs
index 89241af1e..8d7a08f7d 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementPathSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementPathSerializerTests.cs
@@ -171,7 +171,6 @@ private static void ValidateAdding(object value)
relationships[0].EndNodeElementId.Should().Be("2");
}
-
private static void ValidatePath(AndWhichConstraint path)
{
path.Which.Nodes.Should().AllBeOfType();
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementRelationshipSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementRelationshipSerializerTests.cs
index 71dd92598..62f31d370 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementRelationshipSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementRelationshipSerializerTests.cs
@@ -103,4 +103,4 @@ private static void Validate(object value)
value.Should().BeOfType().Which.StartNodeElementId.Should().Be("n1");
value.Should().BeOfType().Which.EndNodeElementId.Should().Be("n2");
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementUnboundRelationshipSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementUnboundRelationshipSerializerTests.cs
index 527d3dd79..cbdf59367 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementUnboundRelationshipSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/ElementUnboundRelationshipSerializerTests.cs
@@ -42,6 +42,7 @@ public void ShouldDeserialize()
{
{ "prop3", true }
});
+
writer.Write("r1");
var readerMachine = CreateReaderMachine(writerMachine.GetOutput());
@@ -64,6 +65,7 @@ public void ShouldDeserializeSpan()
{
{ "prop3", true }
});
+
writer.Write("r1");
var readerMachine = CreateSpanReader(writerMachine.GetOutput());
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/NodeSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/NodeSerializerTests.cs
index ab3c2741d..936c29a1d 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/NodeSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/NodeSerializerTests.cs
@@ -116,7 +116,7 @@ private static void VerifySerializedNode(object value)
new KeyValuePair("prop3", true)
});
}
-
+
[Fact]
public void ShouldDeserializeSpan()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PathSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PathSerializerTests.cs
index 947775e7e..beac23db8 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PathSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PathSerializerTests.cs
@@ -59,7 +59,7 @@ public void ShouldDeserializeSpan()
VerifySerializedPath(value);
}
-
+
[Fact]
public void ShouldDeserializeReverse()
{
@@ -84,7 +84,7 @@ public void ShouldDeserializeSpanReverse()
var reader = CreateSpanReader(writerMachine.GetOutput());
var value = reader.Read();
-
+
VerifySerializedPathReverse(value);
}
@@ -123,7 +123,7 @@ public void ShouldDeserializeSpanWhenInList()
VerifySerializedPath(value.Should().BeAssignableTo().Which[0]);
}
-
+
[Fact]
public void ShouldDeserializeWhenInMap()
{
@@ -171,7 +171,7 @@ public void ShouldDeserializeSpanWhenInMap()
VerifySerializedPath(value.Should().BeAssignableTo().Which["x"]);
}
-
+
private static void SerializePath(PackStreamWriter writer, bool reverse = false)
{
writer.WriteStructHeader(3, PathSerializer.Path);
@@ -282,4 +282,4 @@ private static void VerifySerializedUnboundedRelationship(
.And
.Contain(new KeyValuePair("rProp1", $"something{expectedId}"));
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PointSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PointSerializerTests.cs
index 683ab1b18..0f5afb53e 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PointSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/PointSerializerTests.cs
@@ -117,7 +117,6 @@ public void ShouldDeserializeSpanPoint2D()
ValidatePoint2D(value);
}
-
[Fact]
public void ShouldDeserializeSpanPoint3D()
{
@@ -144,7 +143,7 @@ private static void ValidatePoint2D(object value)
value.Should().BeOfType().Which.Y.Should().Be(-0.105658);
value.Should().BeOfType().Which.Z.Should().Be(double.NaN);
}
-
+
private static void ValidatePoint3D(object value)
{
value.Should().NotBeNull();
@@ -153,4 +152,4 @@ private static void ValidatePoint3D(object value)
value.Should().BeOfType().Which.Y.Should().Be(-0.105658);
value.Should().BeOfType().Which.Z.Should().Be(35.25);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/RelationshipSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/RelationshipSerializerTests.cs
index ad372b821..9f7c7ac74 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/RelationshipSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/RelationshipSerializerTests.cs
@@ -140,7 +140,7 @@ public void ShouldDeserializeSpanWhenInMap()
VerifySerializedRelationship(value.Should().BeAssignableTo().Which["x"]);
}
-
+
private static void SerializeRelationship(PackStreamWriter writer)
{
writer.WriteStructHeader(5, RelationshipSerializer.Relationship);
@@ -176,4 +176,4 @@ private static void VerifySerializedRelationship(object value)
new KeyValuePair("prop3", false)
});
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/DurationSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/DurationSerializerTests.cs
index 41e0f3f0a..0227c9d95 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/DurationSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/DurationSerializerTests.cs
@@ -89,4 +89,4 @@ private static void Validate(object value)
value.Should().BeOfType().Which.Seconds.Should().Be(564L);
value.Should().BeOfType().Which.Nanos.Should().Be(865);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/LocalDateTimeSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/LocalDateTimeSerializerTests.cs
index 5c8d72e2f..c99060fd5 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/LocalDateTimeSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/LocalDateTimeSerializerTests.cs
@@ -89,4 +89,4 @@ public void ShouldDeserializeSpanDateTime()
value.Should().BeOfType().Which.Second.Should().Be(59);
value.Should().BeOfType().Which.Nanosecond.Should().Be(128000987);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/OffsetTimeSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/OffsetTimeSerializerTests.cs
index ae01e4017..0f0fa8f4c 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/OffsetTimeSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/OffsetTimeSerializerTests.cs
@@ -89,5 +89,4 @@ private static void Validate(object value)
.Which.OffsetSeconds.Should()
.Be((int)TimeSpan.FromMinutes(150).TotalSeconds);
}
-
}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/SystemDateTimeSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/SystemDateTimeSerializerTests.cs
index 1888bed53..2eb3948d4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/SystemDateTimeSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/SystemDateTimeSerializerTests.cs
@@ -88,4 +88,4 @@ public void ShouldSerializeDateTimeUtc()
reader.Read().Should().Be(999000000L);
reader.Read().Should().Be(0L);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/UtcZonedDateTimeSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/UtcZonedDateTimeSerializerTests.cs
index 899780eb9..8c90b62b4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/UtcZonedDateTimeSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/Temporal/UtcZonedDateTimeSerializerTests.cs
@@ -377,4 +377,4 @@ public void ShouldSerializeUtcAndNonUtcSecondsToSameValue()
bstSecs.Should().Equals(utcSecs);
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/UnboundRelationshipSerializerTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/UnboundRelationshipSerializerTests.cs
index 422ce94f0..1bb04ad95 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/UnboundRelationshipSerializerTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/IO/ValueSerializers/UnboundRelationshipSerializerTests.cs
@@ -147,7 +147,7 @@ public void ShouldDeserializeSpanWhenInMap()
VerifySerializedUnboundRelationship(value.Should().BeAssignableTo().Which["x"]);
}
-
+
private static void SerializeUnboundRelationship(PackStreamWriter writer)
{
writer.WriteStructHeader(3, UnboundRelationshipSerializer.UnboundRelationship);
@@ -181,4 +181,4 @@ private static void VerifySerializedUnboundRelationship(object value)
new KeyValuePair("prop3", false)
});
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/InMemoryPipelinedMessageReaderTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/InMemoryPipelinedMessageReaderTests.cs
index e1e9025f5..9a916b298 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/InMemoryPipelinedMessageReaderTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/InMemoryPipelinedMessageReaderTests.cs
@@ -1,7 +1,5 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
+// Neo4j Sweden AB [https://neo4j.com]
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
@@ -62,8 +60,11 @@ public async Task ShouldReadMessage()
var pipereader = new PipelinedMessageReader(memoryStream, TestDriverContext.MockContext, -1);
var pipeline = MockPipeline();
- await pipereader.ReadAsync(pipeline.Object, new MessageFormat(BoltProtocolVersion.V5_0,
- TestDriverContext.MockContext));
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(
+ BoltProtocolVersion.V5_0,
+ TestDriverContext.MockContext));
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Once);
}
@@ -86,8 +87,11 @@ public async Task ShouldReadMultiChunkMessage()
memoryStream.Position = 0L;
var pipereader = new PipelinedMessageReader(memoryStream, TestDriverContext.MockContext, -1);
var pipeline = MockPipeline();
- await pipereader.ReadAsync(pipeline.Object, new MessageFormat(BoltProtocolVersion.V5_0,
- TestDriverContext.MockContext));
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(
+ BoltProtocolVersion.V5_0,
+ TestDriverContext.MockContext));
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Once);
}
@@ -111,8 +115,11 @@ public async Task ShouldIgnoreNoOpChunk()
memoryStream.Position = 0L;
var pipereader = new PipelinedMessageReader(memoryStream, TestDriverContext.MockContext, -1);
var pipeline = MockPipeline();
- await pipereader.ReadAsync(pipeline.Object, new MessageFormat(BoltProtocolVersion.V5_0,
- TestDriverContext.MockContext));
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(
+ BoltProtocolVersion.V5_0,
+ TestDriverContext.MockContext));
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Once);
}
@@ -144,8 +151,11 @@ public async Task ShouldIgnoreAllNoOpChunks()
memoryStream.Position = 0L;
var pipereader = new PipelinedMessageReader(memoryStream, TestDriverContext.MockContext, -1);
var pipeline = MockPipeline();
- await pipereader.ReadAsync(pipeline.Object, new MessageFormat(BoltProtocolVersion.V5_0,
- TestDriverContext.MockContext));
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(
+ BoltProtocolVersion.V5_0,
+ TestDriverContext.MockContext));
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Once);
}
@@ -163,7 +173,7 @@ public async Task ShouldStopReadAllMessagesAfterAFailure()
// 5 bytes
0x00, 0x00, 0x00, 0x00,
// 9 bytes
- PackStream.String8, 1, Encoding.UTF8.GetBytes("a")[0], PackStream.String8, 7,
+ PackStream.String8, 1, Encoding.UTF8.GetBytes("a")[0], PackStream.String8, 7,
// 14 bytes
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 21 bytes
@@ -175,14 +185,19 @@ public async Task ShouldStopReadAllMessagesAfterAFailure()
PackStream.TinyStruct, MessageFormat.MsgIgnored,
0x00, 0x00
};
+
Encoding.UTF8.GetBytes("code").CopyTo(message.AsSpan().Slice(2 + 5));
Encoding.UTF8.GetBytes("message").CopyTo(message.AsSpan().Slice(2 + 14));
-
+
var memoryStream = new MemoryStream(message);
var pipereader = new PipelinedMessageReader(memoryStream, TestDriverContext.MockContext, -1);
var pipeline = MockPipeline();
- await pipereader.ReadAsync(pipeline.Object, new MessageFormat(BoltProtocolVersion.V5_0,
- TestDriverContext.MockContext));
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(
+ BoltProtocolVersion.V5_0,
+ TestDriverContext.MockContext));
+
pipeline.Verify(x => x.OnFailure(It.IsAny()), Times.Once);
pipeline.Verify(x => x.OnIgnored(), Times.Never);
}
@@ -195,8 +210,11 @@ public async Task ShouldReadLargeMessages()
var pipereader = new PipelinedMessageReader(memoryStream, TestDriverContext.MockContext, -1);
var pipeline = MockPipeline();
- await pipereader.ReadAsync(pipeline.Object, new MessageFormat(BoltProtocolVersion.V5_0,
- TestDriverContext.MockContext));
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(
+ BoltProtocolVersion.V5_0,
+ TestDriverContext.MockContext));
pipeline.Verify(
x => x.OnSuccess(It.Is>(y => y["a"].As().Length == 500_000)),
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BeginMessageTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BeginMessageTests.cs
index 67e059879..91e4c0e91 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BeginMessageTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BeginMessageTests.cs
@@ -136,7 +136,11 @@ public void ShouldHandleSetValuesWithNotifications(int major, int minor)
message.Metadata.Should().ContainKey("tx_metadata").WhichValue.Should().BeEquivalentTo(txMeta);
message.Metadata.Should().ContainKey("mode").WhichValue.Should().BeEquivalentTo("r");
message.Metadata.Should().ContainKey("db").WhichValue.Should().BeEquivalentTo("neo4j");
- message.Metadata.Should().ContainKey("notifications_minimum_severity").WhichValue.Should().BeEquivalentTo("WARNING");
+ message.Metadata.Should()
+ .ContainKey("notifications_minimum_severity")
+ .WhichValue.Should()
+ .BeEquivalentTo("WARNING");
+
message.Metadata.Should()
.ContainKey("notifications_disabled_categories")
.WhichValue.Should()
@@ -189,7 +193,7 @@ public void ShouldHandleSetValuesWithNotificationsClassifications(int major, int
.Be(
"BEGIN [{bookmarks, [bm:a]}, {tx_timeout, 1000}, {tx_metadata, [{a, b}]}, {mode, r}, {db, neo4j}, {imp_user, Douglas Fir}, {notifications_minimum_severity, WARNING}, {notifications_disabled_classifications, [GENERIC]}]");
}
-
+
[Fact]
public void ShouldThrowIfBoltVersionLessThan44()
{
@@ -213,7 +217,6 @@ public void ShouldThrowIfBoltVersionLessThan44()
.BeOfType();
}
-
[Theory]
[InlineData(5, 2)]
[InlineData(5, 3)]
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BoltAgentBuilderTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BoltAgentBuilderTests.cs
index e8c6efacf..952bafd2e 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BoltAgentBuilderTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/BoltAgentBuilderTests.cs
@@ -33,4 +33,4 @@ public void ShouldReturnBoltAgent()
.WhichValue.Should()
.MatchRegex(@"^neo4j-dotnet/\d\.\d+\.\d+$");
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/DiscardMessageTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/DiscardMessageTests.cs
index c3f4dcae3..4126f113d 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/DiscardMessageTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/DiscardMessageTests.cs
@@ -42,4 +42,4 @@ public void ShouldHandleValues()
var message = new DiscardMessage(42, 10);
message.ToString().Should().Be("DISCARD [{n, 10}, {qid, 42}]");
}
-}
\ No newline at end of file
+}
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/RunWithMetaDataMessageTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/RunWithMetaDataMessageTests.cs
index a2463ba78..e9c0ccd3c 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/RunWithMetaDataMessageTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Messages/RunWithMetaDataMessageTests.cs
@@ -53,6 +53,7 @@ public void ShouldIncludeImpersonatedUserKeyWithBoltVersionGreaterThan44(int maj
new BoltProtocolVersion(major, minor),
null,
sessionConfig: new SessionConfig("jeff"));
+
rm.Query.Should().BeNull();
rm.Metadata.Should().ContainKey("imp_user").WhichValue.Should().Be("jeff");
@@ -95,7 +96,6 @@ public void ShouldIncludeValues()
"RUN `...`, [] [{bookmarks, [bm:a]}, {tx_timeout, 1000}, {tx_metadata, [{a, b}]}, {mode, r}, {db, neo4j}, {imp_user, jeff}]");
}
-
[Theory]
[InlineData(5, 2)]
[InlineData(5, 3)]
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsCollectorTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsCollectorTests.cs
index faeb3c7c6..00b1bc4d4 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsCollectorTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsCollectorTests.cs
@@ -1,4 +1,19 @@
-#pragma warning disable CS0618 // Type or member is obsolete
+// Copyright (c) "Neo4j"
+// Neo4j Sweden AB [https://neo4j.com]
+//
+// Licensed under the Apache License, Version 2.0 (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#pragma warning disable CS0618 // Type or member is obsolete
// Copyright (c) "Neo4j"
// Neo4j Sweden AB [https://neo4j.com]
//
@@ -123,6 +138,7 @@ public void ShouldCollectGqlStatuses()
["column"] = 3L
}
};
+
first.GqlStatus.Should().Be("000000");
first.StatusDescription.Should().Be("it is a status");
first.Position.Should().Be(new InputPosition(1, 2, 3));
@@ -136,7 +152,7 @@ public void ShouldCollectGqlStatuses()
first.Title.Should().Be("blah");
});
}
-
+
[Fact]
public void ShouldCollectMinimalGqlStatuses()
{
@@ -165,8 +181,9 @@ public void ShouldCollectMinimalGqlStatuses()
{
["CURRENT_SCHEMA"] = "/",
["OPERATION"] = "",
- ["OPERATION_CODE"] = "0",
+ ["OPERATION_CODE"] = "0"
};
+
first.GqlStatus.Should().Be("030000");
first.StatusDescription.Should().Be("it is a status");
first.Position.Should().BeNull();
@@ -196,8 +213,8 @@ public void ShouldMergeDiagnosticRecord()
["diagnostic_record"] = new Dictionary
{
["Example"] = "blah-de-blah",
- ["OPERATION"] = "OP!",
- },
+ ["OPERATION"] = "OP!"
+ }
}
}
});
@@ -214,13 +231,13 @@ public void ShouldMergeDiagnosticRecord()
["Example"] = "blah-de-blah",
["CURRENT_SCHEMA"] = "/",
["OPERATION"] = "OP!",
- ["OPERATION_CODE"] = "0",
+ ["OPERATION_CODE"] = "0"
};
first.DiagnosticRecord.Should().BeEquivalentTo(dict);
});
}
-
+
[Fact]
public void ShouldPolyfilGqlStatusesIntoNotifications()
{
@@ -366,9 +383,7 @@ public void ShouldCollectMinimalNotification()
{
["notifications"] = new List
{
- new Dictionary
- {
- }
+ new Dictionary()
}
});
@@ -413,8 +428,9 @@ public void ShouldUpgradeMinimalNotificationToGqlStatus()
{
["CURRENT_SCHEMA"] = "/",
["OPERATION"] = "",
- ["OPERATION_CODE"] = "0",
+ ["OPERATION_CODE"] = "0"
};
+
var first = x.Should().BeOfType().Which;
first.GqlStatus.Should().Be("03N42");
first.Title.Should().BeNull();
@@ -462,16 +478,17 @@ public void ShouldUpgradeNotificationToGqlStatus()
var dict = new Dictionary
{
["_severity"] = "WARNING",
- ["_position"] = new Dictionary
- {
- ["offset"] = 1L,
- ["line"] = 2L,
- ["column"] = 3L
- },
+ ["_position"] = new Dictionary
+ {
+ ["offset"] = 1L,
+ ["line"] = 2L,
+ ["column"] = 3L
+ },
["CURRENT_SCHEMA"] = "/",
["OPERATION"] = "",
- ["OPERATION_CODE"] = "0",
+ ["OPERATION_CODE"] = "0"
};
+
var first = x.Should().BeOfType().Which;
first.GqlStatus.Should().Be("01N42");
first.Title.Should().Be("blah");
@@ -484,7 +501,7 @@ public void ShouldUpgradeNotificationToGqlStatus()
first.DiagnosticRecord.Should().BeEquivalentTo(dict);
});
}
-
+
[Fact]
public void ShouldNotPolyfilWhenProvidedGqlStatus()
{
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsTests.cs
index 6ed69f0e5..536386325 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/Metadata/GqlStatusObjectsAndNotificationsTests.cs
@@ -57,7 +57,7 @@ public void FinalizeStatusObjectsShouldPolyfil(bool hadRecords, bool hadKeys, IG
{
["CURRENT_SCHEMA"] = "/",
["OPERATION"] = "",
- ["OPERATION_CODE"] = "0",
+ ["OPERATION_CODE"] = "0"
};
first.GqlStatus.Should().Be(exp.GqlStatus);
@@ -87,16 +87,16 @@ public void ShouldOrderByCodeWhenPolyfilling()
{
["CURRENT_SCHEMA"] = "/",
["OPERATION"] = "",
- ["OPERATION_CODE"] = "0",
+ ["OPERATION_CODE"] = "0"
};
- var statuses = new List()
+ var statuses = new List
{
new GqlStatusObject("04-", "", null, null, null, dict, null, false),
new GqlStatusObject("01-", "", null, null, null, dict, null, false),
new GqlStatusObject("03-", "", null, null, null, dict, null, false),
new GqlStatusObject("02-", "", null, null, null, dict, null, false),
- new GqlStatusObject("1", "", null, null, null, dict, null, false),
+ new GqlStatusObject("1", "", null, null, null, dict, null, false)
};
var objs = new GqlStatusObjectsAndNotifications(null, statuses, false);
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/NetworkedPipelinedMessageReaderTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/NetworkedPipelinedMessageReaderTests.cs
index 8657f1c8c..59a38ee12 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/NetworkedPipelinedMessageReaderTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/MessageHandling/NetworkedPipelinedMessageReaderTests.cs
@@ -1,7 +1,5 @@
// Copyright (c) "Neo4j"
-// Neo4j Sweden AB [http://neo4j.com]
-//
-// This file is part of Neo4j.
+// Neo4j Sweden AB [https://neo4j.com]
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
@@ -32,70 +30,71 @@ namespace Neo4j.Driver.Tests.Internal.MessageHandling;
///
/// These are close to integration tests as they used tcp, but they are not integration tests as they do not
-/// integrate against another process.
+/// integrate against another process.
///
public class NetworkedPipelinedMessageReaderTests
{
- const int Port = 9111;
-
+ private const int Port = 9111;
+
[Fact]
public async Task ShouldReadSimpleMessage()
{
var pipeline = MockPipeline();
using var cts = new CancellationTokenSource(5000);
-
+
await Task.WhenAll(
- Task.Run(async () =>
- {
- var tcp = new TcpListener(IPAddress.Loopback, Port);
- TcpClient stream = null;
- try
+ Task.Run(
+ async () =>
{
- tcp.Start();
- stream = await tcp.AcceptTcpClientAsync(cts.Token);
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x00, 0x03,
- PackStream.TinyStruct, MessageFormat.MsgSuccess, PackStream.TinyMap,
- 0x00, 0x00
- }.AsSpan());
-
+ var tcp = new TcpListener(IPAddress.Loopback, Port);
+ TcpClient stream = null;
try
{
- await Task.Delay(1000, cts.Token);
+ tcp.Start();
+ stream = await tcp.AcceptTcpClientAsync(cts.Token);
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x00, 0x03,
+ PackStream.TinyStruct, MessageFormat.MsgSuccess, PackStream.TinyMap,
+ 0x00, 0x00
+ }.AsSpan());
+
+ try
+ {
+ await Task.Delay(1000, cts.Token);
+ }
+ catch (OperationCanceledException)
+ {
+ }
}
- catch (OperationCanceledException)
+ finally
{
+ stream?.Close();
+ tcp.Stop();
}
- }
- finally
- {
- stream?.Close();
- tcp.Stop();
- }
- }),
- Task.Run(async () =>
- {
- await Task.Delay(100);
- var client = new TcpClient();
- try
+ }),
+ Task.Run(
+ async () =>
{
- await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
- var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
- await pipereader.ReadAsync(
- pipeline.Object,
- new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
- }
- finally
- {
- client.Close();
- cts.Cancel();
+ await Task.Delay(100);
+ var client = new TcpClient();
+ try
+ {
+ await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
+ var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
+ }
+ finally
+ {
+ client.Close();
+ cts.Cancel();
+ }
+ }));
- }
- }));
-
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Once);
}
@@ -104,286 +103,289 @@ public async Task ShouldTimeoutWaitingForSize()
{
var pipeline = MockPipeline();
using var cts = new CancellationTokenSource(5000);
-
+
await Task.WhenAll(
- Task.Run(async () =>
- {
- var tcp = new TcpListener(IPAddress.Loopback, Port);
- TcpClient stream = null;
- try
+ Task.Run(
+ async () =>
{
- tcp.Start();
- stream = await tcp.AcceptTcpClientAsync(cts.Token);
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x00
- }.AsSpan());
+ var tcp = new TcpListener(IPAddress.Loopback, Port);
+ TcpClient stream = null;
try
{
- await Task.Delay(-1, cts.Token);
+ tcp.Start();
+ stream = await tcp.AcceptTcpClientAsync(cts.Token);
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x00
+ }.AsSpan());
+
+ try
+ {
+ await Task.Delay(-1, cts.Token);
+ }
+ catch (OperationCanceledException)
+ {
+ }
}
- catch (OperationCanceledException)
+ finally
{
+ stream?.Close();
+ tcp.Stop();
}
- }
- finally
+ }),
+ Task.Run(
+ async () =>
{
- stream?.Close();
- tcp.Stop();
- }
- }),
- Task.Run(async () =>
- {
-
- await Task.Delay(100);
- var client = new TcpClient();
- try
- {
- await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
- var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
- pipereader.SetReadTimeoutInMs(250);
- var exc = await Record.ExceptionAsync(
- async () =>
- {
- await pipereader.ReadAsync(
- pipeline.Object,
- new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
- });
-
- exc.Should().BeOfType();
- }
- finally
- {
- client.Close();
- cts.Cancel();
+ await Task.Delay(100);
+ var client = new TcpClient();
+ try
+ {
+ await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
+ var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
+ pipereader.SetReadTimeoutInMs(250);
+ var exc = await Record.ExceptionAsync(
+ async () =>
+ {
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
+ });
+
+ exc.Should().BeOfType();
+ }
+ finally
+ {
+ client.Close();
+ cts.Cancel();
+ }
+ }));
- }
- }));
-
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Never);
}
-
+
[Fact]
public async Task ShouldReadSimpleMessageWithDelays()
{
var pipeline = MockPipeline();
using var cts = new CancellationTokenSource(5000);
-
+
await Task.WhenAll(
- Task.Run(async () =>
- {
- var tcp = new TcpListener(IPAddress.Loopback, Port);
- TcpClient stream = null;
- try
+ Task.Run(
+ async () =>
{
- tcp.Start();
- stream = await tcp.AcceptTcpClientAsync(cts.Token);
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x00
- }.AsSpan());
+ var tcp = new TcpListener(IPAddress.Loopback, Port);
+ TcpClient stream = null;
+ try
+ {
+ tcp.Start();
+ stream = await tcp.AcceptTcpClientAsync(cts.Token);
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x00
+ }.AsSpan());
- await Task.Delay(500);
-
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x03,
- PackStream.TinyStruct, MessageFormat.MsgSuccess, PackStream.TinyMap,
- }.AsSpan());
+ await Task.Delay(500);
- await Task.Delay(500);
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x00, 0x00
- }.AsSpan());
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x03,
+ PackStream.TinyStruct, MessageFormat.MsgSuccess, PackStream.TinyMap
+ }.AsSpan());
+
+ await Task.Delay(500);
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x00, 0x00
+ }.AsSpan());
+
+ try
+ {
+ await Task.Delay(1000, cts.Token);
+ }
+ catch (OperationCanceledException)
+ {
+ }
+ }
+ finally
+ {
+ stream?.Close();
+ tcp.Stop();
+ }
+ }),
+ Task.Run(
+ async () =>
+ {
+ await Task.Delay(100);
+ var client = new TcpClient();
try
{
- await Task.Delay(1000, cts.Token);
+ await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
+ var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
+ pipereader.SetReadTimeoutInMs(1000);
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
}
- catch (OperationCanceledException)
+ finally
{
+ client.Close();
+ cts.Cancel();
}
- }
- finally
- {
- stream?.Close();
- tcp.Stop();
- }
- }),
- Task.Run(async () =>
- {
- await Task.Delay(100);
- var client = new TcpClient();
- try
- {
- await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
- var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
- pipereader.SetReadTimeoutInMs(1000);
- await pipereader.ReadAsync(
- pipeline.Object,
- new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
- }
- finally
- {
- client.Close();
- cts.Cancel();
+ }));
- }
- }));
-
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Once);
}
-
+
[Fact]
public async Task ShouldTimeoutWaitingAfterSize()
{
var pipeline = MockPipeline();
using var cts = new CancellationTokenSource(5000);
-
+
await Task.WhenAll(
- Task.Run(async () =>
- {
- var tcp = new TcpListener(IPAddress.Loopback, Port);
- TcpClient stream = null;
- try
+ Task.Run(
+ async () =>
{
- tcp.Start();
- stream = await tcp.AcceptTcpClientAsync(cts.Token);
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x00,0x03
- }.AsSpan());
-
+ var tcp = new TcpListener(IPAddress.Loopback, Port);
+ TcpClient stream = null;
try
{
- await Task.Delay(-1, cts.Token);
+ tcp.Start();
+ stream = await tcp.AcceptTcpClientAsync(cts.Token);
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x00, 0x03
+ }.AsSpan());
+
+ try
+ {
+ await Task.Delay(-1, cts.Token);
+ }
+ catch (OperationCanceledException)
+ {
+ }
}
- catch (OperationCanceledException)
+ finally
{
+ stream?.Close();
+ tcp.Stop();
}
- }
- finally
- {
- stream?.Close();
- tcp.Stop();
- }
- }),
- Task.Run(async () =>
- {
-
- await Task.Delay(100);
- var client = new TcpClient();
- try
+ }),
+ Task.Run(
+ async () =>
{
- await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
- var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
- pipereader.SetReadTimeoutInMs(2000);
- var exc = await Record.ExceptionAsync(
- async () =>
- {
- await pipereader.ReadAsync(
- pipeline.Object,
- new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
- });
-
- exc.Should().BeOfType();
- }
- finally
- {
- client.Close();
- cts.Cancel();
+ await Task.Delay(100);
+ var client = new TcpClient();
+ try
+ {
+ await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
+ var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
+ pipereader.SetReadTimeoutInMs(2000);
+ var exc = await Record.ExceptionAsync(
+ async () =>
+ {
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
+ });
+
+ exc.Should().BeOfType();
+ }
+ finally
+ {
+ client.Close();
+ cts.Cancel();
+ }
+ }));
- }
- }));
-
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Never);
}
-
+
[Fact]
public async Task ShouldTimeoutWaitingForData()
{
var pipeline = MockPipeline();
using var cts = new CancellationTokenSource(5000);
-
+
await Task.WhenAll(
- Task.Run(async () =>
- {
- var tcp = new TcpListener(IPAddress.Loopback, Port);
- TcpClient stream = null;
- try
+ Task.Run(
+ async () =>
{
- tcp.Start();
- stream = await tcp.AcceptTcpClientAsync(cts.Token);
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x00,0x03
- }.AsSpan());
-
- await Task.Delay(1000);
- stream.GetStream()
- .Write(
- new byte[]
- {
- 0x00
- }.AsSpan());
-
+ var tcp = new TcpListener(IPAddress.Loopback, Port);
+ TcpClient stream = null;
try
{
- await Task.Delay(-1, cts.Token);
+ tcp.Start();
+ stream = await tcp.AcceptTcpClientAsync(cts.Token);
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x00, 0x03
+ }.AsSpan());
+
+ await Task.Delay(1000);
+ stream.GetStream()
+ .Write(
+ new byte[]
+ {
+ 0x00
+ }.AsSpan());
+
+ try
+ {
+ await Task.Delay(-1, cts.Token);
+ }
+ catch (OperationCanceledException)
+ {
+ }
}
- catch (OperationCanceledException)
+ finally
{
+ stream?.Close();
+ tcp.Stop();
}
- }
- finally
- {
- stream?.Close();
- tcp.Stop();
- }
- }),
- Task.Run(async () =>
- {
-
- await Task.Delay(100);
- var client = new TcpClient();
- try
+ }),
+ Task.Run(
+ async () =>
{
- await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
- var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
- pipereader.SetReadTimeoutInMs(2000);
- var exc = await Record.ExceptionAsync(
- async () =>
- {
- await pipereader.ReadAsync(
- pipeline.Object,
- new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
- });
-
- exc.Should().BeOfType();
- }
- finally
- {
- client.Close();
- cts.Cancel();
+ await Task.Delay(100);
+ var client = new TcpClient();
+ try
+ {
+ await client.ConnectAsync(IPAddress.Loopback, Port, cts.Token);
+ var pipereader = new PipelinedMessageReader(client.GetStream(), TestDriverContext.MockContext);
+ pipereader.SetReadTimeoutInMs(2000);
+ var exc = await Record.ExceptionAsync(
+ async () =>
+ {
+ await pipereader.ReadAsync(
+ pipeline.Object,
+ new MessageFormat(BoltProtocolVersion.V5_0, TestDriverContext.MockContext));
+ });
+
+ exc.Should().BeOfType();
+ }
+ finally
+ {
+ client.Close();
+ cts.Cancel();
+ }
+ }));
- }
- }));
-
pipeline.Verify(x => x.OnSuccess(It.IsAny>()), Times.Never);
}
-
+
private static Mock MockPipeline()
{
var done = (object)false;
diff --git a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/Protocol/BoltProtocolTests.cs b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/Protocol/BoltProtocolTests.cs
index bf50c245d..0a580b509 100644
--- a/Neo4j.Driver/Neo4j.Driver.Tests/Internal/Protocol/BoltProtocolTests.cs
+++ b/Neo4j.Driver/Neo4j.Driver.Tests/Internal/Protocol/BoltProtocolTests.cs
@@ -21,6 +21,7 @@
using Moq;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Connector;
+using Neo4j.Driver.Internal.HomeDbCaching;
using Neo4j.Driver.Internal.MessageHandling;
using Neo4j.Driver.Internal.MessageHandling.V4;
using Neo4j.Driver.Internal.Messaging;
@@ -159,7 +160,12 @@ public class GetRoutingTableAsyncTests
public async Task ShouldThrowAnExceptionWhenNullConnection()
{
var exception = await Record.ExceptionAsync(
- () => BoltProtocol.Instance.GetRoutingTableAsync(null, null, new SessionConfig("douglas fir"), null));
+ () => BoltProtocol.Instance.GetRoutingTableAsync(
+ null,
+ null,
+ new SessionConfig("douglas fir"),
+ null,
+ new Mock().Object));
exception.Should().BeOfType();
}
@@ -179,7 +185,8 @@ public async Task ShouldThrowWhenUsingImpersonatedUserWithBoltVersionLessThan44(
mockConn.Object,
null,
new SessionConfig("douglas fir"),
- null));
+ null,
+ new Mock().Object));
exception.Should().BeOfType();
}
@@ -199,7 +206,8 @@ public async Task ShouldNotThrowWhenImpersonatingUserWithBoltVersionGreaterThan4
mockConn.Object,
null,
new SessionConfig("douglas fir"),
- null));
+ null,
+ new Mock().Object));
exception.Should().BeNull();
}
@@ -223,8 +231,10 @@ public async Task ShouldSyncRouteMessageWhenUsingBoltVersionGreaterThan43(int ma
.Returns(new RouteMessage(null, null, null, null));
var handlerFactory = new Mock();
- handlerFactory.Setup(x => x.NewRouteResponseHandler())
- .Returns(new RouteResponseHandler());
+ handlerFactory.Setup(
+ x => x.NewRouteResponseHandler(It.IsAny(), It.IsAny(),
+ It.IsAny(), It.IsAny()))
+ .Returns(new RouteResponseHandler(HomeDbCacheKey.Default, null, null, false));
var mockV3 = new Mock();
var protocol = new BoltProtocol(mockV3.Object, msgFactory.Object, handlerFactory.Object);
@@ -233,7 +243,8 @@ await protocol.GetRoutingTableAsync(
mockConn.Object,
"db",
new SessionConfig("dougy"),
- new InternalBookmarks());
+ new InternalBookmarks(),
+ new Mock().Object);
msgFactory.Verify(
x => x.NewRouteMessage(
@@ -243,7 +254,13 @@ await protocol.GetRoutingTableAsync(
"dougy"),
Times.Once);
- handlerFactory.Verify(x => x.NewRouteResponseHandler(), Times.Once);
+ handlerFactory.Verify(
+ x => x.NewRouteResponseHandler(
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()),
+ Times.Once);
mockConn.Verify(
x => x.EnqueueAsync(It.IsNotNull(), It.IsNotNull()),
@@ -268,16 +285,21 @@ public async Task ShouldSyncRouteMessageV43WhenUsingBoltVersion43()
.Setup(x => x.NewRouteMessageV43(mockConn.Object, It.IsNotNull(), "db"))
.Returns(new RouteMessageV43(null, null, null));
- var rrHandler = new RouteResponseHandler();
+ var rrHandler = new RouteResponseHandler(HomeDbCacheKey.Default, new HomeDbCache(), SessionConfig.Default, false);
rrHandler.RoutingInformation = new Dictionary();
var handlerFactory = new Mock();
- handlerFactory.Setup(x => x.NewRouteResponseHandler())
+ handlerFactory.Setup(x => x.NewRouteResponseHandler(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()))
.Returns(rrHandler);
var mockV3 = new Mock();
var protocol = new BoltProtocol(mockV3.Object, msgFactory.Object, handlerFactory.Object);
- await protocol.GetRoutingTableAsync(mockConn.Object, "db", null, new InternalBookmarks());
+ await protocol.GetRoutingTableAsync(
+ mockConn.Object,
+ "db",
+ SessionConfig.Default,
+ new InternalBookmarks(),
+ new HomeDbCache());
msgFactory.Verify(
x => x.NewRouteMessageV43(
@@ -286,7 +308,13 @@ public async Task ShouldSyncRouteMessageV43WhenUsingBoltVersion43()
"db"),
Times.Once);
- handlerFactory.Verify(x => x.NewRouteResponseHandler(), Times.Once);
+ handlerFactory.Verify(
+ x => x.NewRouteResponseHandler(
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()),
+ Times.Once);
mockConn.Verify(
x => x.EnqueueAsync(It.IsNotNull(), It.IsNotNull()),
@@ -313,16 +341,31 @@ public async Task ShouldUpdate43RoutingTableResultWithDbKey()
var mockRt = new Mock>();
mockRt.As>();
- var rrHandler = new RouteResponseHandler();
+ var rrHandler = new RouteResponseHandler(
+ HomeDbCacheKey.Default,
+ new HomeDbCache(),
+ SessionConfig.Default,
+ false);
+
rrHandler.RoutingInformation = mockRt.Object;
var handlerFactory = new Mock();
- handlerFactory.Setup(x => x.NewRouteResponseHandler())
+ handlerFactory.Setup(
+ x => x.NewRouteResponseHandler(
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()))
.Returns(rrHandler);
var mockV3 = new Mock();
var protocol = new BoltProtocol(mockV3.Object, msgFactory.Object, handlerFactory.Object);
- await protocol.GetRoutingTableAsync(mockConn.Object, "test", null, new InternalBookmarks());
+ await protocol.GetRoutingTableAsync(
+ mockConn.Object,
+ "test",
+ null,
+ new InternalBookmarks(),
+ new Mock().Object);
mockRt.Verify(x => x.Add("db", "test"), Times.Once);
@@ -333,9 +376,18 @@ public async Task ShouldUpdate43RoutingTableResultWithDbKey()
"test"),
Times.Once);
- handlerFactory.Verify(x => x.NewRouteResponseHandler(), Times.Once);
handlerFactory.Verify(
- x => x.NewRunResponseHandler(It.IsAny(), It.IsAny()),
+ x => x.NewRouteResponseHandler(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()),
+ Times.Once);
+
+ handlerFactory.Verify(
+ x => x.NewRunResponseHandler(
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny(),
+ It.IsAny()),
Times.Never);
mockConn.Verify(
@@ -417,11 +469,14 @@ public async Task ShouldUseQueryToFetchRoutingTableForBoltVersionLessThan43(int
mockConn.Object,
"test",
null,
- bm);
+ bm,
+ It.IsAny());
routingTable.Should().Contain(new KeyValuePair("db", "test"));
- handlerFactory.Verify(x => x.NewRouteResponseHandler(), Times.Never);
+ handlerFactory.Verify(
+ x => x.NewRouteResponseHandler(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()),
+ Times.Never);
msgFactory.Verify(
x =>
@@ -510,7 +565,8 @@ await protocol.GetRoutingTableAsync(
mockConn.Object,
dbName,
null,
- null);
+ null,
+ It.IsAny());
queryParams.Should().NotBeNull();
queryParams.Query.Parameters.Should().HaveCount(2).And.ContainKeys("context", "database");
@@ -526,19 +582,24 @@ public async Task ShouldProtectAgainstEmptyDatabaseStringWhenUsingRouteMessageV4
mockConn.SetupGet(x => x.Version).Returns(new BoltProtocolVersion(4, 3));
var msgFactory = new Mock();
- var rrHandler = new RouteResponseHandler
+ var rrHandler = new RouteResponseHandler(HomeDbCacheKey.Default, new HomeDbCache(), SessionConfig.Default, false)
{
RoutingInformation = new Dictionary()
};
var handlerFactory = new Mock