Пример #1
0
        public void PD_PostProjectExtents_Raptor_Fail()
        {
            // create the mock RaptorClient with successful result
            var mockRaptorClient = new Mock <IASNodeClient>();
            var mockLogger       = new Mock <ILoggerFactory>();

            var mockConfigStore = new Mock <IConfigurationStore>();

            mockConfigStore.Setup(x => x.GetValueBool("ENABLE_TREX_GATEWAY_TILES")).Returns(false);


            var trexCompactionDataProxy = new Mock <ITRexCompactionDataProxy>();
            var getExtentsResults       = false;
            var excludedSsIds           = new long[1]; // excluded surveyed surfaces

            excludedSsIds[0] = 1;

            // return results
            var extents = new T3DBoundingWorldExtent();

            // mock return result
            // this wont work as we need to mock higher level
            mockRaptorClient.Setup(prj => prj.GetDataModelExtents(544, It.IsAny <TSurveyedSurfaceID[]>(), out extents)).Returns(getExtentsResults);

            // create submitter
            var submitter = RequestExecutorContainerFactory.Build <ProjectExtentsSubmitter>(mockLogger.Object, mockRaptorClient.Object, configStore: mockConfigStore.Object, trexCompactionDataProxy: trexCompactionDataProxy.Object);
            // make request parameters
            var request = new ExtentRequest(544, null, excludedSsIds);

            // Act
            // Call controller
            Assert.ThrowsExceptionAsync <ServiceException>(async() => await submitter.ProcessAsync(request));
        }
Пример #2
0
        public async Task PD_PostProjectExtentsSuccessful()
        {
            // create the mock RaptorClient with successful result
            var mockRaptorClient        = new Mock <IASNodeClient>();
            var mockLogger              = new Mock <ILoggerFactory>();
            var mockConfigStore         = new Mock <IConfigurationStore>();
            var trexCompactionDataProxy = new Mock <ITRexCompactionDataProxy>();
            var getExtentsResults       = true;
            var excludedSsIds           = new long[1]; // excluded surveyed surfaces

            excludedSsIds[0] = 1;

            // return results
            var extents = new T3DBoundingWorldExtent();

            // mock return result
            // this wont work as we need to mock higher level
            mockRaptorClient.Setup(prj => prj.GetDataModelExtents(544, It.IsAny <TSurveyedSurfaceID[]>(), out extents)).Returns(getExtentsResults);

            // create submitter
            var submitter = RequestExecutorContainerFactory.Build <ProjectExtentsSubmitter>(mockLogger.Object, mockRaptorClient.Object, configStore: mockConfigStore.Object, trexCompactionDataProxy: trexCompactionDataProxy.Object);
            // make request parameters
            var request = new ExtentRequest(544, null, excludedSsIds);

            // Act
            // Call controller
            var result = await submitter.ProcessAsync(request);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Message == ContractExecutionResult.DefaultMessage, result.Message);
        }
Пример #3
0
 private static BoundingBox3DGrid ConvertExtents(T3DBoundingWorldExtent extents)
 {
     return(new BoundingBox3DGrid(
                extents.MinX,
                extents.MinY,
                extents.MinZ,
                extents.MaxX,
                extents.MaxY,
                extents.MaxZ));
 }
Пример #4
0
 public bool GetProductionDataExport(long DataModelID, TASNodeRequestDescriptor ExternalRequestDescriptor,
                                     TASNodeUserPreferences UserPreferences, int ExportType, string CallerId, TICFilterSettings Filter,
                                     TICLiftBuildSettings LiftBuildSettings, bool TimeStampRequired, bool CellSizeRequired, bool RawData,
                                     bool RestrictSize, bool ZipFile, double Tolerance, bool IncludeSurveydSurface, bool Precheckonly, string Filename,
                                     TMachine[] MachineList, int CoordType, int OutputType, TDateTime DateFromUTC, TDateTime DateToUTC,
                                     TTranslation[] Translations, T3DBoundingWorldExtent ProjectExtents, out TDataExport DataExport)
 {
     return(client.GetProductionDataExport(DataModelID, ExternalRequestDescriptor, UserPreferences, ExportType,
                                           CallerId, Filter, LiftBuildSettings, TimeStampRequired, CellSizeRequired,
                                           RawData, RestrictSize, ZipFile, Tolerance, IncludeSurveydSurface, Precheckonly, Filename, MachineList,
                                           CoordType, OutputType, DateFromUTC, DateToUTC, Translations, ProjectExtents,
                                           out DataExport));
 }
Пример #5
0
 public bool GetDataModelExtents(long DataModelID, TSurveyedSurfaceID[] SurveyedSurfaceExclusionList,
                                 out T3DBoundingWorldExtent extents)
 {
     return(client.GetDataModelExtents(DataModelID, SurveyedSurfaceExclusionList, out extents) == 1);/*icsrrNoError*/
 }
Пример #6
0
        /// <summary>
        /// Creates an instance of the ProfileProductionDataRequest class and populate it with data needed for a design profile.
        /// </summary>
        public ExportReport CreateExportRequest(
            DateTime?startUtc,
            DateTime?endUtc,
            CoordType coordType,
            ExportTypes exportType,
            string fileName,
            bool restrictSize,
            bool rawData,
            OutputTypes outputType,
            string machineNames,
            double tolerance = 0.0)
        {
            // todo once the requirement for RAPTOR build to be able to call TRex endpoints is removed
            //      this whole tangle can be unraveled
            var liftSettings = SettingsManager.CompactionLiftBuildSettings(ProjectSettings);

#if RAPTOR
            T3DBoundingWorldExtent projectExtents = new T3DBoundingWorldExtent();
            TMachine[]             machineList    = null;
            machineNameList = new string[0];

            if (exportType == ExportTypes.SurfaceExport)
            {
                raptorClient.GetDataModelExtents(ProjectId,
                                                 RaptorConverters.convertSurveyedSurfaceExlusionList(Filter?.SurveyedSurfaceExclusionList), out projectExtents);
            }
            else
            {
                TMachineDetail[] machineDetails = raptorClient.GetMachineIDs(ProjectId);

                if (machineDetails != null)
                {
                    if (!string.IsNullOrEmpty(machineNames) && machineNames != "All")
                    {
                        machineNameList = machineNames.Split(',');
                        machineDetails  = machineDetails.Where(machineDetail => machineNameList.Contains(machineDetail.Name)).ToArray();
                    }

                    machineList = machineDetails.Select(m => new TMachine {
                        AssetID = m.ID, MachineName = m.Name, SerialNo = ""
                    }).ToArray();
                }
            }

            if (!string.IsNullOrEmpty(fileName))
            {
                fileName = StripInvalidCharacters(fileName);
            }

            return(new ExportReport(
                       ProjectId,
                       ProjectUid,
                       liftSettings,
                       Filter,
                       -1,
                       null,
                       false,
                       null,
                       coordType,
                       startUtc ?? DateTime.MinValue,
                       endUtc ?? DateTime.MinValue,
                       tolerance,
                       false,
                       restrictSize,
                       rawData,
                       RaptorConverters.convertProjectExtents(projectExtents),
                       false,
                       outputType,
                       RaptorConverters.convertMachines(machineList),
                       exportType == ExportTypes.SurfaceExport,
                       fileName,
                       exportType,
                       ConvertUserPreferences(userPreferences, projectDescriptor.ProjectTimeZone)));
#else
            if (exportType == ExportTypes.SurfaceExport)
            {
                if (!string.IsNullOrEmpty(machineNames) && machineNames != "All")
                {
                    machineNameList = machineNames.Split(',');
                }
            }
            return(new ExportReport(
                       ProjectId,
                       ProjectUid,
                       liftSettings,
                       Filter,
                       -1,
                       null,
                       false,
                       null,
                       coordType,
                       startUtc ?? DateTime.MinValue,
                       endUtc ?? DateTime.MinValue,
                       tolerance,
                       false,
                       restrictSize,
                       rawData,
                       null,//project extents are retrieved in the TRex gateway as part of this request
                       false,
                       outputType,
                       null,
                       exportType == ExportTypes.SurfaceExport,
                       fileName,
                       exportType,
                       ConvertUserPreferences(userPreferences, projectDescriptor.ProjectTimeZone)));
#endif
        }