715bb7274a
* Can debug dependencies * Different exceptions * Uses root id only after we found it to signal the end * DataChunks are created later and need to be accounted for * format * use app ids in tests and references * check sqlite cache after serialize * use dummy to go through channels to end * fmt * Extend channel lib to batch by size * fmt * build fix * adjust limits * FIx sending * Optimize reference generation * more * remove tolist * rework closures to be constant and serializer only deals with current....references bases are cached * fix chunk creation * another bug fix * clean up with factories * add deserializer factory * Needed to reference interface * move around streamId * some clean up * Use StringBuilder pool on serialization to reduce memory pressure * remove extra * remove extra clears * Fix a flaw in batchsize * use default complete * format * loader should use 1 writer that is batched * remove redundant ref gen * Fix graphql commands by adding project id
52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using System.Collections.Concurrent;
|
|
using Shouldly;
|
|
using Speckle.Newtonsoft.Json.Linq;
|
|
using Speckle.Sdk.Common;
|
|
using Speckle.Sdk.Dependencies.Serialization;
|
|
using Speckle.Sdk.Serialisation.V2;
|
|
using Speckle.Sdk.Transports;
|
|
|
|
namespace Speckle.Sdk.Serialization.Tests;
|
|
|
|
public class DummySendServerObjectManager(ConcurrentDictionary<string, string> savedObjects) : IServerObjectManager
|
|
{
|
|
public IAsyncEnumerable<(string, string)> DownloadObjects(
|
|
IReadOnlyList<string> objectIds,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
) => throw new NotImplementedException();
|
|
|
|
public Task<string?> DownloadSingleObject(
|
|
string objectId,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
) => throw new NotImplementedException();
|
|
|
|
public Task<Dictionary<string, bool>> HasObjects(IReadOnlyList<string> objectIds, CancellationToken cancellationToken)
|
|
{
|
|
return Task.FromResult(objectIds.ToDictionary(x => x, x => false));
|
|
}
|
|
|
|
public Task UploadObjects(
|
|
IReadOnlyList<BaseItem> objects,
|
|
bool compressPayloads,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
)
|
|
{
|
|
foreach (var obj in objects)
|
|
{
|
|
obj.Id.ShouldBe(JObject.Parse(obj.Json)["id"].NotNull().Value<string>());
|
|
if (savedObjects.TryGetValue(obj.Id, out var j))
|
|
{
|
|
j.ShouldBe(obj.Json);
|
|
}
|
|
else
|
|
{
|
|
savedObjects.TryAdd(obj.Id, obj.Json);
|
|
}
|
|
}
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|