Exemplo n.º 1
0
        public void ProjectStatisticsExecutor_Raptor_Success()
        {
            var excludedSurveyedSurfaceUids = new[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
            var excludedSurveyedSurfaceIds  = new long[] { 444, 777, 888 };
            var request = new ProjectStatisticsMultiRequest(Guid.NewGuid(), 123, excludedSurveyedSurfaceUids, excludedSurveyedSurfaceIds);

            var statistics = new TICDataModelStatistics
            {
                StartTime         = DateTime.UtcNow.AddDays(-5),
                EndTime           = DateTime.UtcNow.AddDays(-1),
                CellSize          = 32.5,
                IndexOriginOffset = 10,
                Extents           = new T3DBoundingWorldExtent(10, 500, 0, 20, 510, 0)
            };

            var raptorClient = new Mock <IASNodeClient>();

            raptorClient
            .Setup(x => x.GetDataModelStatistics(request.ProjectId, It.IsAny <TSurveyedSurfaceID[]>(), out statistics))
            .Returns(true);

            var configStore = new Mock <IConfigurationStore>();

            configStore.Setup(x => x.GetValueBool("ENABLE_TREX_GATEWAY_PROJECTSTATISTICS")).Returns(false);

            var executor = RequestExecutorContainerFactory
                           .Build <ProjectStatisticsExecutor>(logger, raptorClient.Object, configStore: configStore.Object);
            var result = executor.ProcessAsync(request).Result as ProjectStatisticsResult;

            Assert.IsNotNull(result, "Result should not be null");
            Assert.AreEqual(statistics.CellSize, result.cellSize, "Wrong CellSize");
            Assert.AreEqual(statistics.Extents.MaxX, result.extents.MaxX, "Wrong MaxX extent");
        }
Exemplo n.º 2
0
        public void ProjectStatisticsExecutor_TRex_Success()
        {
            var excludedSurveyedSurfaceUids = new[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
            var excludedSurveyedSurfaceIds  = new long[] { 444, 777, 888 };
            var request = new ProjectStatisticsMultiRequest(Guid.NewGuid(), 123, excludedSurveyedSurfaceUids, excludedSurveyedSurfaceIds);

            var expectedResult = new ProjectStatisticsResult(ContractExecutionStatesEnum.ExecutedSuccessfully)
            {
                startTime         = DateTime.UtcNow.AddDays(-5),
                endTime           = DateTime.UtcNow.AddDays(-1),
                cellSize          = 32.5,
                indexOriginOffset = 10,
                extents           = new BoundingBox3DGrid(10, 500, 0, 20, 510, 0)
            };
            var tRexProxy = new Mock <ITRexCompactionDataProxy>();

            tRexProxy.Setup(x => x.SendDataPostRequest <ProjectStatisticsResult, ProjectStatisticsTRexRequest>(It.IsAny <ProjectStatisticsTRexRequest>(), It.IsAny <string>(), It.IsAny <IHeaderDictionary>(), false))
            .ReturnsAsync((expectedResult));


            var configStore = new Mock <IConfigurationStore>();

            configStore.Setup(x => x.GetValueBool("ENABLE_TREX_GATEWAY_PROJECTSTATISTICS")).Returns(true);

            var executor = RequestExecutorContainerFactory
                           .Build <ProjectStatisticsExecutor>(logger, configStore: configStore.Object,
                                                              trexCompactionDataProxy: tRexProxy.Object, customHeaders: _customHeaders);

            var result = executor.ProcessAsync(request).Result as ProjectStatisticsResult;

            Assert.IsNotNull(result, "Result should not be null");
            Assert.AreEqual(expectedResult.startTime, result.startTime, "Wrong startTime");
            Assert.AreEqual(expectedResult.extents.MaxX, result.extents.MaxX, "Wrong MaxX extent");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get project statistics using excluded surveyed surfaces.
        /// </summary>
        private async Task <ProjectStatisticsResult> GetProjectStatisticsWithSsExclusions(Guid projectUid, long projectId, IEnumerable <long> excludedIds, IEnumerable <Guid> excludedUids, string userId)
        {
            var request = new ProjectStatisticsMultiRequest(projectUid, projectId, excludedUids?.ToArray(), excludedIds?.ToArray());

            return(await
                   RequestExecutorContainerFactory.Build <ProjectStatisticsExecutor>(_loggerFactory,
#if RAPTOR
                                                                                     _raptorClient,
#endif
                                                                                     configStore : _configStore, trexCompactionDataProxy : _tRexCompactionDataProxy,
                                                                                     userId : userId, fileImportProxy : _fileImportProxy)
                   .ProcessAsync(request) as ProjectStatisticsResult);
        }