7860c44f4e
* Dim/quack lets go (#1275) * Add model ingestion to sharp connectors * correct ingestion message * Progress * grasshopper * GH exception messages * fix GH * file names * revit file name * grasshopper file names * etabs file names * delete tests * tekla maybe * ingestion scope * bad boolean logic * Longer TimeSpan * wip upload pipe * 10s * passthrough ingestion id * happy hack time: prevent ingestion completion this is handled server-side in the processing logic. * add packfile send endpoint detection and routing Route to SendViaPackfile when the server supports the upload-signing endpoint (POST probe, 404 = unsupported) and a continuous traversal builder is registered. * Adds Continuous Traversal Builder Introduces a Continuous Traversal Builder to manage the conversion and processing of Revit elements within a Send Pipeline. --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> * feat(api): DI Refactor for Duck DB + Gergo's API endpoint changes (#1282) * Di * undo accidental change * Feat (duck): dui ingestion updates post upload (#1295) * Pass optional ingestion id to DUI * Make ingestion id null for the SendViaIngestion, see the note :) * feat!: Duckdev progress reporitng (#1296) * Di * throwaway from laptop * Progress reporting * Use matching logger * Revit and revert rhino unpacker progress * more revertion * make pr even cleaner * and this one * fix build issues with other connectors * SDK nuget (#1299) * Bump to 3.14.0-alpha.2 * Feat(duck): grasshopper (#1297) * Duck x Grasshopper - who would win? * Fix registration for new builder * missing imports * return version id grasshopper * Align sync resource to sync --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> * Bump SDK * feat(importer): rhino file importer changes for packfile (#1301) * rhino importer changes * correct deps * Bump SDK * Fix build issues * ditto * Fix build issue * Lower standards * Fix build * feat: duck for acad, civil, navis, tekla, etabs (#1300) * duck: acad, civil, etabs, tekla, navis and bump channels to 10.0.0 * notes * fix conflicts * more conflicts * Ready for testing * fix(duck): Fix send caching (#1302) * potential fix * undo-rhino chnages * fix xml comment * amended comment * revit * Fix build * Aligned converting message * fix: reoccurring object references * Bump sdk and resolve merge conflict issues * Merge pull request #1317 from specklesystems/jrm/importer-tracing feat(otel): Tracing and OTEL changes for Rhino importer * Fix revit linked model progress (#1312) * Revert otel packages * bump SDK * Trace unpacking groups * Align trace context nullability with app * Disable send caching in Navisworks * comments * Update FileimportPayload.cs * fix using directive --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> * Fix merge conflicts --------- Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com> Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com> Co-authored-by: Björn Steinhagen <88777268+bjoernsteinhagen@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sebastian Witt <sebastian.witt@rwth-aachen.de>
137 lines
4.6 KiB
C#
137 lines
4.6 KiB
C#
using System.Reflection;
|
|
using FluentAssertions;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Moq;
|
|
using NUnit.Framework;
|
|
using Speckle.Connectors.Common.Analytics;
|
|
using Speckle.Connectors.Common.Builders;
|
|
using Speckle.Connectors.Common.Operations;
|
|
using Speckle.Connectors.Common.Threading;
|
|
using Speckle.Sdk.Api;
|
|
using Speckle.Sdk.Api.GraphQL.Models;
|
|
using Speckle.Sdk.Credentials;
|
|
using Speckle.Sdk.Logging;
|
|
using Speckle.Sdk.Models;
|
|
using Speckle.Sdk.Pipelines.Progress;
|
|
using Speckle.Testing;
|
|
|
|
namespace Speckle.Connectors.Common.Tests.Operations;
|
|
|
|
public class ReceiveOperationTests : MoqTest
|
|
{
|
|
#pragma warning disable CA1034
|
|
[SpeckleType("TestBase")]
|
|
public class TestBase : Base;
|
|
#pragma warning restore CA1034
|
|
[Test]
|
|
public async Task Execute()
|
|
{
|
|
var hostObjectBuilder = Create<IHostObjectBuilder>();
|
|
var receiveProgress = Create<IReceiveProgress>();
|
|
var operations = Create<IOperations>();
|
|
var receiveVersionRetriever = Create<IReceiveVersionRetriever>();
|
|
var activityFactory = Create<ISdkActivityFactory>(MockBehavior.Loose);
|
|
var threadContext = Create<IThreadContext>();
|
|
|
|
var @base = new TestBase();
|
|
var account = new Account
|
|
{
|
|
userInfo = new UserInfo() { email = "test_user@example.com" },
|
|
serverInfo = new ServerInfo() { url = "https://myserver.example.com" },
|
|
};
|
|
var version = new Speckle.Sdk.Api.GraphQL.Models.Version();
|
|
var projectName = "projectName";
|
|
var modelName = "modelName";
|
|
|
|
var ct = new CancellationToken();
|
|
var receiveInfo = new ReceiveInfo(
|
|
account,
|
|
string.Empty,
|
|
projectName,
|
|
string.Empty,
|
|
modelName,
|
|
string.Empty,
|
|
string.Empty
|
|
);
|
|
var progress = Create<IProgress<CardProgress>>();
|
|
|
|
var hostResult = new HostObjectBuilderResult([], []);
|
|
|
|
receiveVersionRetriever.Setup(x => x.GetVersion(account, receiveInfo, ct)).ReturnsAsync(version);
|
|
receiveVersionRetriever
|
|
.Setup(x => x.VersionReceived(account, version, receiveInfo, ct))
|
|
.Returns(Task.CompletedTask);
|
|
hostObjectBuilder.Setup(x => x.Build(@base, projectName, modelName, progress.Object, ct)).ReturnsAsync(hostResult);
|
|
|
|
threadContext.Setup(x => x.RunOnThreadAsync(It.IsAny<Func<Task<Base>>>(), false)).ReturnsAsync(@base);
|
|
|
|
var sp = CreateServices(Assembly.GetExecutingAssembly()).BuildServiceProvider();
|
|
var receiveOperation = ActivatorUtilities.CreateInstance<ReceiveOperation>(
|
|
sp,
|
|
hostObjectBuilder.Object,
|
|
receiveProgress.Object,
|
|
activityFactory.Object,
|
|
operations.Object,
|
|
receiveVersionRetriever.Object,
|
|
threadContext.Object
|
|
);
|
|
var result = await receiveOperation.Execute(receiveInfo, progress.Object, ct);
|
|
result.Should().Be(hostResult);
|
|
}
|
|
|
|
[Test]
|
|
public async Task ReceiveData()
|
|
{
|
|
var hostObjectBuilder = Create<IHostObjectBuilder>();
|
|
var accountService = Create<IAccountService>();
|
|
var receiveProgress = Create<IReceiveProgress>();
|
|
var operations = Create<IOperations>();
|
|
var receiveVersionRetriever = Create<IReceiveVersionRetriever>();
|
|
var activityFactory = Create<ISdkActivityFactory>(MockBehavior.Loose);
|
|
var threadContext = Create<IThreadContext>();
|
|
var mixPanelManager = Create<IMixPanelManager>();
|
|
|
|
var @base = new TestBase();
|
|
var token = "token";
|
|
var serverUrl = new Uri("https://localhost");
|
|
var projectId = "projectId";
|
|
var account = new Account()
|
|
{
|
|
token = token,
|
|
serverInfo = new ServerInfo() { url = serverUrl.ToString() }
|
|
};
|
|
string referencedObject = "referencedObject";
|
|
var version = new Speckle.Sdk.Api.GraphQL.Models.Version() { referencedObject = referencedObject };
|
|
|
|
var ct = new CancellationToken();
|
|
var receiveInfo = new ReceiveInfo(
|
|
account,
|
|
projectId,
|
|
string.Empty,
|
|
string.Empty,
|
|
string.Empty,
|
|
string.Empty,
|
|
string.Empty
|
|
);
|
|
var progress = Create<IProgress<CardProgress>>();
|
|
|
|
receiveProgress.Setup(x => x.Begin());
|
|
operations
|
|
.Setup(x => x.Receive2(serverUrl, projectId, referencedObject, token, It.IsAny<PassthroughProgress>(), ct, null))
|
|
.ReturnsAsync(@base);
|
|
|
|
var sp = CreateServices(Assembly.GetExecutingAssembly()).BuildServiceProvider();
|
|
var receiveOperation = ActivatorUtilities.CreateInstance<ReceiveOperation>(
|
|
sp,
|
|
hostObjectBuilder.Object,
|
|
receiveProgress.Object,
|
|
activityFactory.Object,
|
|
operations.Object,
|
|
receiveVersionRetriever.Object,
|
|
threadContext.Object
|
|
);
|
|
var result = await receiveOperation.ReceiveData(account, version, receiveInfo, progress.Object, ct);
|
|
result.Should().Be(@base);
|
|
}
|
|
}
|