Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static class Protocol
typeof(SessionBeginTransaction),
typeof(Result),
typeof(ResultNext),
typeof(ResultPeek),
typeof(ResultConsume),
typeof(RetryablePositive),
typeof(RetryableNegative),
Expand Down Expand Up @@ -69,7 +70,7 @@ public static void ValidateType(string typeName)
catch
{
throw new TestKitProtocolException($"Attempting to use an unrecognized protocol type: {typeName}");
}
}
}

public static void ValidateType(Type objectType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public async Task<IRecord> GetNextRecord()
return await Task.FromResult<IRecord>(null);
}

public Task<IRecord> PeekRecord()
{
return ResultCursor.PeekAsync();
}

public async Task<IResultSummary> ConsumeResults()
{
return await ResultCursor.ConsumeAsync().ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Newtonsoft.Json;
using System.Threading.Tasks;
using System.Linq;

namespace Neo4j.Driver.Tests.TestBackend
{
internal class ResultPeek : IProtocolObject
{
public ResultPeekType data { get; set; } = new ResultPeekType();

public IRecord Records { get; set; }

public class ResultPeekType
{
public string resultId { get; set; }
}

public override async Task Process()
{
var result = (Result)ObjManager.GetObject(data.resultId);
Records = await result.PeekRecord();
}

public override string Respond()
{
if (Records is null)
return new ProtocolResponse("NullRecord", (object)null).Encode();

//Generate list of ordered records
var valuesList = Records.Keys.Select(v => NativeToCypher.Convert(Records[v]));
return new ProtocolResponse("Record", new { values = valuesList }).Encode();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ internal static class SupportedFeatures
static SupportedFeatures()
{
FeaturesList.Add("AuthorizationExpiredTreatment");

FeaturesList.Add("ConfHint:connection.recv_timeout_seconds");

FeaturesList.Add("Optimization:EagerTransactionBegin");

FeaturesList.Add("Feature:Auth:Bearer");
Expand All @@ -34,7 +34,7 @@ static SupportedFeatures()

//FeaturesList.Add("Feature:API:SSLSchemes");
//FeaturesList.Add("Feature:API:Result.Single");
//FeaturesList.Add("Feature:API:Result.Peek");
FeaturesList.Add("Feature:API:Result.Peek");
//FeaturesList.Add("Feature:API:Result.List");


Expand Down