Beispiel #1
0
        public async Task <ContractExecutionResult> GetDesignBoundaries([FromQuery] Guid projectUid, [FromQuery] double?tolerance)
        {
            Log.LogInformation($"{nameof(GetDesignBoundaries)}: " + Request.QueryString);

            var projectId = await((RaptorPrincipal)User).GetLegacyProjectId(projectUid);

            tolerance ??= DesignBoundariesRequest.BOUNDARY_POINTS_INTERVAL;

            var request = new DesignBoundariesRequest(projectId, projectUid, tolerance.Value);

            request.Validate();

            var fileList = await FileImportProxy.GetFiles(projectUid.ToString(), GetUserId(), Request.Headers.GetCustomHeaders());

            fileList = fileList?.Where(f => f.ImportedFileType == ImportedFileType.DesignSurface && f.IsActivated).ToList();

            return(await RequestExecutorContainerFactory.Build <DesignExecutor>(
                       LoggerFactory,
                       configStore : ConfigStore,
                       fileList : fileList,
                       trexCompactionDataProxy : TRexCompactionDataProxy,
                       userId : GetUserId(),
                       fileImportProxy : FileImportProxy)
                   .ProcessAsync(request));
        }
Beispiel #2
0
        public void DesignExecutor_DesignBoundariesRequest_ProjectIDFailure()
        {
            var request = new DesignBoundariesRequest(0, Guid.NewGuid(), TOLERANCE);
            var ex      = Assert.ThrowsException <ServiceException>(() => request.Validate());

            ex.Should().NotBeNull();
            ex.Code.Should().Be(HttpStatusCode.BadRequest);
            ex.GetResult.Code.Should().Be(ContractExecutionStatesEnum.ValidationError);
            ex.GetResult.Message.Should().Be("Invalid project ID");
        }
Beispiel #3
0
        public Task <ContractExecutionResult> GetDesignBoundaries(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid designUid,
            [FromQuery] string fileName,
            [FromQuery] double?tolerance)
        {
            Log.LogInformation($"{nameof(GetDesignsForProject)}: projectUid:{projectUid}, designUid:{designUid}, fileName:{fileName}, tolerance: {tolerance}");

            const double BOUNDARY_POINTS_INTERVAL = 0.0;

            var designBoundariesRequest = new DesignBoundariesRequest(projectUid, designUid, fileName, tolerance ?? BOUNDARY_POINTS_INTERVAL);

            designBoundariesRequest.Validate();

            return(WithServiceExceptionTryExecuteAsync(() =>
                                                       RequestExecutorContainer
                                                       .Build <DesignBoundariesExecutor>(ConfigStore, LoggerFactory, ServiceExceptionHandler)
                                                       .ProcessAsync(designBoundariesRequest)));
        }
Beispiel #4
0
        public async Task DesignBoundariesExecutor_SiteModelNotFound()
        {
            const double TOLERANCE = 1.2;
            const string FILE_NAME = "Test.ttm";

            var projectUid = Guid.NewGuid();

            var request = new DesignBoundariesRequest(projectUid, Guid.NewGuid(), FILE_NAME, TOLERANCE);

            request.Validate();

            var executor = RequestExecutorContainer
                           .Build <DesignBoundariesExecutor>(
                DIContext.Obtain <IConfigurationStore>(),
                DIContext.Obtain <ILoggerFactory>(),
                DIContext.Obtain <IServiceExceptionHandler>());

            var result = await Assert.ThrowsAsync <ServiceException>(() => executor.ProcessAsync(request));

            Assert.Equal(HttpStatusCode.BadRequest, result.Code);
            Assert.Equal(ContractExecutionStatesEnum.InternalProcessingError, result.GetResult.Code);
            Assert.Equal($"Site model {projectUid} is unavailable", result.GetResult.Message);
        }
Beispiel #5
0
        public void DesignExecutor_DesignBoundariesRequest_Success()
        {
            var request = new DesignBoundariesRequest(PROJECT_ID, Guid.NewGuid(), TOLERANCE);

            request.Validate();
        }