예제 #1
0
        private static void DependencyInjection()
        {
            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
            .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces()))
            .Add(x => x.AddSingleton <ISurveyedSurfaceFactory>(new SurveyedSurfaceFactory()))
            .Build()

            // The renderer factory that allows tile rendering services access Bitmap etc platform dependent constructs
            .Add(x => x.AddSingleton <IRenderingFactory>(new RenderingFactory()))

            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels(() => DIContext.Obtain <IStorageProxyFactory>().ImmutableGridStorage())))
            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
            .Add(x => x.AddSingleton <ICoordinateConversion>(new CoordinateConversion()))
            .Add(x => x.AddSingleton <IExistenceMaps>(new VSS.TRex.ExistenceMaps.ExistenceMaps()))
            .Add(x => x.AddSingleton <IPipelineProcessorFactory>(new PipelineProcessorFactory()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorPipelineStyle, ISubGridPipelineBase> >(provider => SubGridPipelineFactoryMethod))
            .Add(x => x.AddTransient <IRequestAnalyser>(factory => new RequestAnalyser()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorTaskStyle, ITask> >(provider => SubGridTaskFactoryMethod))
            .Add(x => x.AddSingleton <IClientLeafSubGridFactory>(ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory()))

            .Add(x => x.AddSingleton(new ApplicationServiceServer(new[] {
                ApplicationServiceServer.DEFAULT_ROLE,
                ServerRoles.ASNODE_PROFILER,
                ServerRoles.PATCH_REQUEST_ROLE,
                ServerRoles.TILE_RENDERING_NODE,
                ServerRoles.ANALYTICS_NODE
            })))

            .Complete();
        }
예제 #2
0
 public void GlobalSetup()
 {
     DIBuilder
     .New()
     .AddLogging()
     .Add(x => x.AddSingleton <IClass>(new AClass())).Complete();
 }
예제 #3
0
        private static void DependencyInjection()
        {
            DIBuilder
            .New()
            .AddLogging()

            .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
            .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces()))
            .Add(x => x.AddSingleton <ISurveyedSurfaceFactory>(new SurveyedSurfaceFactory()))
            .Build()
            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels(() => DIContext.Obtain <IStorageProxyFactory>().ImmutableGridStorage())))
            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
            .Add(x => x.AddSingleton <IProfilerBuilderFactory>(new ProfilerBuilderFactory()))
            .Add(x => x.AddTransient <IProfilerBuilder>(factory => new ProfilerBuilder()))
            .Add(x => x.AddSingleton <IExistenceMaps>(new ExistenceMaps()))
            .Add(x => x.AddSingleton <IPipelineProcessorFactory>(new PipelineProcessorFactory()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorPipelineStyle, ISubGridPipelineBase> >(provider => SubGridPipelineFactoryMethod))
            .Add(x => x.AddTransient <IRequestAnalyser>(factory => new RequestAnalyser()))
            .Add(x => x.AddSingleton <Func <PipelineProcessorTaskStyle, ITask> >(provider => SubGridTaskFactoryMethod))
            .Add(x => x.AddSingleton <IProductionEventsFactory>(new ProductionEventsFactory()))
            .Add(x => x.AddSingleton <IClientLeafSubGridFactory>(ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory()))
            .Add(x => x.AddSingleton(new SubGridProcessingServer()))
            .Add(x => x.AddSingleton <IDesignsService>(new DesignsService(StorageMutability.Immutable)))
            .Complete();
        }
예제 #4
0
 private static void DependencyInjection()
 {
     DIBuilder.New()
     .AddLogging()
     .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
     .Complete();
 }
예제 #5
0
        public void FileDeleteFromStorage_HappyPath()
        {
            var mockTransferProxy = new Mock <ITransferProxy>();

            mockTransferProxy.Setup(t => t.RemoveFromBucket(It.IsAny <string>())).Returns(true);

            var mockTransferProxyFactory = new Mock <ITransferProxyFactory>();

            mockTransferProxyFactory.Setup(x => x.NewProxy(It.IsAny <TransferProxyType>())).Returns(mockTransferProxy.Object);

            var mockConfig = new Mock <IConfigurationStore>();

            mockConfig.Setup(x => x.GetValueString("AWS_DESIGNIMPORT_BUCKET_NAME")).Returns("vss-projects-stg");

            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton(mockConfig.Object))
            .Add(x => x.AddSingleton(mockTransferProxyFactory.Object))
            .Complete();

            var projectUid       = Guid.Parse("A11F2458-6666-424F-A995-4426a00771AE");
            var transferFileName = "TransferTestDesign.ttm";

            var s3FileTransfer    = new S3FileTransfer(TransferProxyType.DesignImport);
            var isDeletedFromS3Ok = s3FileTransfer.RemoveFileFromBucket(projectUid, transferFileName);

            Assert.True(isDeletedFromS3Ok);
        }
예제 #6
0
 public TestBinarizable_ReflectionBasedTests_Fixture()
 {
     DIBuilder.New()
     .AddLogging()
     .Add(x => x.AddSingleton <IFilterSet>(factory => new FilterSet()))
     .Complete();
 }
예제 #7
0
 private static void DependencyInjection()
 {
     DIBuilder.New()
     .AddLogging()
     .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
     .Add(TRexGridFactory.AddGridFactoriesToDI)
     .Complete();
 }
예제 #8
0
 public AnalyticsTestsDIFixture()
 {
     DIBuilder
     .New()
     .AddLogging()
     .Add(x => x.AddTransient <IFilterSet>(factory => new FilterSet()))
     .Complete();
 }
예제 #9
0
 private static void DependencyInjection()
 {
     DIBuilder.New()
     .AddLogging()
     .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
     .Build()
     .Add(x => x.AddSingleton(new TAGFileProcessingClientServer()))
     .Complete();
 }
예제 #10
0
 private static void DependencyInjection()
 {
     DIBuilder.New()
     .AddLogging()
     .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
     .Add(TRexGridFactory.AddGridFactoriesToDI)
     .Build()
     .Add(x => x.AddSingleton(new TAGFileProcessingClientServer()))
     .Complete();
 }
예제 #11
0
 private static void DependencyInjection()
 {
     EnsureAssemblyDependenciesAreLoaded();
     DIBuilder.New()
     .AddLogging()
     .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
     .Add(TRexGridFactory.AddGridFactoriesToDI)
     .Build()
     .Add(x => x.AddSingleton(new MutableClientServer("ServiceDeployer")))
     .Add(x => x.AddSingleton(new ImmutableClientServer("ServiceDeployer")))
     .Complete();
 }
예제 #12
0
            public void GlobalSetup()
            {
                _arrayPool = ArrayPool <byte> .Shared;

                DIBuilder.New().AddLogging()
                .Add(x => x.AddSingleton <IGenericArrayPoolCaches <byte> >(new GenericArrayPoolCaches <byte>())).Build()
                .Complete();

                _genericArrayPoolIntf = GenericArrayPoolCacheHelper <byte> .Caches();

                _genericArrayPoolObj = GenericArrayPoolCacheHelper <byte> .Caches() as GenericArrayPoolCaches <byte>;
            }
예제 #13
0
 private static void DependencyInjection()
 {
     DIBuilder
     .New()
     .AddLogging()
     .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
     .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
     .Build()
     .Add(x => x.AddSingleton <ISiteModels>(new SiteModels(() => DIContext.Obtain <IStorageProxyFactory>().ImmutableGridStorage())))
     .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
     .Add(x => x.AddSingleton <IExistenceMaps>(new ExistenceMaps()))
     .Add(x => x.AddSingleton(new CalculateDesignElevationsServer()))
     .Add(x => x.AddSingleton <IDesignsService>(new DesignsService(StorageMutability.Immutable)))
     .Complete();
 }
예제 #14
0
        static void Main(string[] args)
        {
            DIBuilder.New()
            .AddLogging()
            .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
            .Add(x => x.AddSingleton <IOptimisedTTMProfilerFactory>(new OptimisedTTMProfilerFactory()))
            .Complete();

            //LoadTheGiantDesignALotOfTimes();
            //ScanAllElevationsOverGiantDesign();
            ProfileAcrossTheGiantDesign();

            Console.WriteLine("Completed operations - press a key");
            Console.ReadKey();
        }
예제 #15
0
 private static void DependencyInjection()
 {
     DIBuilder
     .New()
     .AddLogging()
     .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
     .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
     .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces()))
     .Build()
     .Add(x => x.AddSingleton <ISiteModels>(new SiteModels(() => DIContext.Obtain <IStorageProxyFactory>().ImmutableGridStorage())))
     .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
     .Add(x => x.AddSingleton(new ImmutableClientServer("TRexIgniteClient-Framework")))
     .Add(x => x.AddSingleton(new MutableClientServer("TRexIgniteClient-Framework")))
     .Add(x => x.AddSingleton <IDesignManager>(factory => new DesignManager()))
     .Add(x => x.AddSingleton <ISurveyedSurfaceManager>(factory => new SurveyedSurfaceManager()))
     .Complete();
 }
예제 #16
0
        public void GatewayHelper_NoSiteModel_Fail(Guid projectUid)
        {
            var mockSiteModels = new Mock <ISiteModels>();

            mockSiteModels.Setup(x => x.GetSiteModel(It.IsAny <Guid>(), It.IsAny <bool>())).Returns((ISiteModel)null);

            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <ISiteModels>(mockSiteModels.Object))
            .Complete();

            var ex = Assert.Throws <ServiceException>(() => GatewayHelper.ValidateAndGetSiteModel("ValidateReportData_GriddedNoSiteModel_Fail", projectUid));

            ex.Code.Should().Be(HttpStatusCode.BadRequest);
            ex.GetResult.Code.Should().Be(ContractExecutionStatesEnum.ValidationError);
            ex.GetResult.Message.Should().Be($"ValidateReportData_GriddedNoSiteModel_Fail: SiteModel: {projectUid} not found ");
        }
예제 #17
0
        public void GlobalSetup()
        {
            DIBuilder.New()
            .AddLogging()
            .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
            .Add(x => x.AddSingleton <IOptimisedTTMProfilerFactory>(new OptimisedTTMProfilerFactory()))
            .Complete();

            design       = new TTMDesign(SubGridTreeConsts.DefaultCellSize);
            readonly_tin = new TrimbleTINModel();

            readonly_tin.LoadFromFile(@"C:\Users\rwilson\Downloads\5644616_oba9c0bd14_FRL.ttm");

            //design.LoadFromFile(@"C:\Temp\141020 Finish Surface.ttm"); // 0.5 Mb
            //design.LoadFromFile(@"C:\Users\rwilson\Downloads\5644616_oba9c0bd14_FRL.ttm"); // 165Mb

            design.LoadFromFile(@"C:\Users\rwilson\Downloads\5644616_oba9c0bd14_FRL.ttm");
        }
예제 #18
0
 private static void DependencyInjection()
 {
     DIBuilder.New()
     .AddLogging()
     .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
     .Build()
     .Add(TRexGridFactory.AddGridFactoriesToDI)
     .Add(VSS.TRex.Storage.Utilities.DIUtilities.AddProxyCacheFactoriesToDI)
     .Add(x => x.AddSingleton <ISubGridCellLatestPassesDataWrapperFactory>(new SubGridCellLatestPassesDataWrapperFactory()))
     .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
     .Build()
     .Add(x => x.AddSingleton <ISiteModels>(new SiteModels.SiteModels(StorageMutability.Mutable)))
     .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
     .Build()
     .Add(x => x.AddSingleton(new ImmutableClientServer("ProjectExtractor-Immutable")))
     .Add(x => x.AddSingleton(new MutableClientServer("ProjectExtractor-Mutable")))
     .Complete();
 }
예제 #19
0
        /// <summary>
        /// This method gets called by the runtime. Use this method to add services to the container.
        /// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        /// </summary>

        protected override void ConfigureAdditionalServices(IServiceCollection services)
        {
            DIBuilder.New(services)
            .Build()
            .Add(x => x.AddSingleton <ICoreXWrapper, CoreXWrapper>())
            .Add(VSS.TRex.IO.DIUtilities.AddPoolCachesToDI)
            .Add(TRexGridFactory.AddGridFactoriesToDI)
            .Build()
            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels.SiteModels(StorageMutability.Mutable)))

            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
            .Add(x => x.AddSingleton <ISiteModelMetadataManager>(factory => new SiteModelMetadataManager(StorageMutability.Mutable)))

            .Add(x => x.AddSingleton <ISurveyedSurfaceManager>(factory => new SurveyedSurfaceManager(StorageMutability.Mutable)))
            .Add(x => x.AddTransient <IDesigns>(factory => new Designs.Storage.Designs()))
            .Add(x => x.AddSingleton <IDesignManager>(factory => new DesignManager(StorageMutability.Mutable)))
            .Add(x => x.AddSingleton <IDesignChangedEventSender>(new DesignChangedEventSender()))
            .Add(x => x.AddSingleton <IMutabilityConverter>(new MutabilityConverter()))
            .Add(x => x.AddSingleton <ISiteModelAttributesChangedEventSender>(new SiteModelAttributesChangedEventSender()))
            //.Add(x => x.AddSingleton<ISiteModelAttributesChangedEventListener>(new SiteModelAttributesChangedEventListener(TRexGrids.MutableGridName())))
            .Add(ExistenceMaps.ExistenceMaps.AddExistenceMapFactoriesToDI)
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces.SurveyedSurfaces()))
            .Add(x => x.AddTransient <IAlignments>(factory => new Alignments.Alignments()))
            .Add(x => x.AddSingleton <IAlignmentManager>(factory => new AlignmentManager(StorageMutability.Mutable)))
            .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
            .Add(VSS.TRex.Storage.Utilities.DIUtilities.AddProxyCacheFactoriesToDI)
            .Build();

            services.AddServiceDiscovery();
            services.AddSingleton <ITransferProxyFactory, TransferProxyFactory>();

            services.AddOpenTracing(builder =>
            {
                builder.ConfigureAspNetCore(options =>
                {
                    options.Hosting.IgnorePatterns.Add(request => request.Request.Path.ToString() == "/ping");
                });
            });

            DIBuilder
            .Continue()
            .Add(x => x.AddSingleton <IMutableClientServer>(new MutableClientServer(new [] { ServerRoles.TAG_PROCESSING_NODE_CLIENT, ServerRoles.RECEIVES_SITEMODEL_CHANGE_EVENTS })))
            .Complete();
        }
예제 #20
0
        public void ExecuteTestAsSimpleLoop()
        {
            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <IClass>(new AClass())).Complete();

            var count = 1_000_000_000;
            var sw    = Stopwatch.StartNew();

            for (int i = 0; i < count; i++)
            {
                var di = DIContext.Obtain <IClass>();
            }

            var elapsed = sw.Elapsed;

            Console.WriteLine($"Time to obtain {count} instances from DI: {elapsed}, {elapsed.Ticks / (1.0 * count)} ticks per invocation");
        }
예제 #21
0
 private static void DependencyInjection()
 {
     DIBuilder
     .New()
     .AddLogging()
     .Add(x => x.AddSingleton <ITRexGridFactory>(new TRexGridFactory()))
     .Add(x => x.AddSingleton <IStorageProxyFactory>(new StorageProxyFactory()))
     .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces()))
     .Add(x => x.AddSingleton <ISurveyedSurfaceFactory>(new SurveyedSurfaceFactory()))
     .Build()
     .Add(x => x.AddSingleton <ISiteModels>(new SiteModels(() => DIContext.Obtain <IStorageProxyFactory>().MutableGridStorage())))
     .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
     .Add(x => x.AddSingleton <ICoordinateConversion>(new CoordinateConversion()))
     .Add(x => x.AddSingleton(Configuration))
     .Add(x => x.AddSingleton <IExistenceMaps>(new ExistenceMaps()))
     .Add(x => x.AddSingleton <IProductionEventsFactory>(new ProductionEventsFactory()))
     .Add(x => x.AddSingleton(new TagProcComputeServer()))
     .Complete();
 }
예제 #22
0
        /// <summary>
        /// This method gets called by the runtime. Use this method to add services to the container.
        /// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        /// </summary>

        protected override void ConfigureAdditionalServices(IServiceCollection services)
        {
            DIBuilder.New(services)
            .Build()
            .Add(x => x.AddSingleton <ICoreXWrapper, CoreXWrapper>())
            .Add(IO.DIUtilities.AddPoolCachesToDI)
            .Add(TRexGridFactory.AddGridFactoriesToDI)
            .Add(Storage.Utilities.DIUtilities.AddProxyCacheFactoriesToDI)
            .Build()
            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels.SiteModels(StorageMutability.Immutable)))
            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))

            .Add(x => x.AddSingleton <ISurveyedSurfaceManager>(factory => new SurveyedSurfaceManager(StorageMutability.Immutable)))
            .Add(x => x.AddTransient <IDesigns>(factory => new Designs.Storage.Designs()))
            .Add(x => x.AddSingleton <IDesignManager>(factory => new DesignManager(StorageMutability.Immutable)))
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces.SurveyedSurfaces()))
            .Add(x => x.AddTransient <IAlignments>(factory => new Alignments.Alignments()))
            .Add(x => x.AddSingleton <IAlignmentManager>(factory => new AlignmentManager(StorageMutability.Immutable)))
            //Monitor number of notifications from this. If too many, go through ignite to get data rather than directly from the site model.
            //.Add(x => x.AddSingleton<ISiteModelAttributesChangedEventListener>(new SiteModelAttributesChangedEventListener(TRexGrids.ImmutableGridName())))
            .Add(x => x.AddSingleton <IClientLeafSubGridFactory>(ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory()))
            .Build();

            services.AddTransient <IErrorCodesProvider, ContractExecutionStatesEnum>();//Replace with custom error codes provider if required
            services.AddTransient <IServiceExceptionHandler, ServiceExceptionHandler>();
            services.AddTransient <IReportDataValidationUtility, ReportDataValidationUtility>();
            services.AddTransient <ICoordinateServiceUtility, CoordinateServiceUtility>();
            services.AddSingleton <IProductionEventsFactory>(new ProductionEventsFactory());
            services.AddSingleton <ITransferProxyFactory, TransferProxyFactory>();

            services.AddOpenTracing(builder =>
            {
                builder.ConfigureAspNetCore(options =>
                {
                    options.Hosting.IgnorePatterns.Add(request => request.Request.Path.ToString() == "/ping");
                });
            });

            DIBuilder.Continue()
            .Add(x => x.AddSingleton <IImmutableClientServer>(new ImmutableClientServer(new [] { "TRexIgniteClient-DotNetStandard", ServerRoles.RECEIVES_SITEMODEL_CHANGE_EVENTS })))
            .Complete();
        }
예제 #23
0
        static void Main(string[] args)
        {
            Log = Logger.CreateLogger <Program>();
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
            DIBuilder.New().AddLogging().Complete();
            string[] dataList = null;
            try
            {
                if (0 < args.Length)
                {
                    if (args[0].Equals("-a", StringComparison.InvariantCultureIgnoreCase))
                    {
                        PrintAttributes();
                    }
                    else if (Directory.Exists(args[0]))
                    {
                        var directoryToProcess = args[0];
                        if (1 < args.Length)
                        {
                            dataList = new ArraySegment <string>(args, 1, args.Length - 1).ToArray();
                        }

                        ProcessTagFiles(directoryToProcess, dataList);
                    }
                    else
                    {
                        PrintHelp();
                    }
                }
                else
                {
                    PrintHelp();
                }
            }
            catch (Exception e)
            {
                Log.LogCritical(e.ToString());
                Console.WriteLine("An error occured processing input please refer to log file for more details");
                PrintHelp();
            }
        }
예제 #24
0
        public ProfileBuilderTests_Fixture()
        {
            var factory               = new Mock <IProfilerBuilderFactory <ProfileCell> >();
            var newCellLiftBuilder    = new Mock <ICellLiftBuilder>();
            var newCellProfileBuilder = new Mock <ICellProfileBuilder <ProfileCell> >();
            var newProfileLiftBuilder = new Mock <ICellProfileAnalyzer <ProfileCell> >();

            factory.Setup(mk => mk.NewCellLiftBuilder(null, GridDataType.All, null, null, null))
            .Returns(newCellLiftBuilder.Object);
            factory.Setup(mk => mk.NewCellProfileBuilder(null, null, null, true)).Returns(newCellProfileBuilder.Object);
            factory.Setup(mk => mk.NewCellProfileAnalyzer(ProfileStyle.CellPasses, null, null, null, null, It.IsAny <ICellLiftBuilder>(), It.IsAny <VolumeComputationType>(), null, null))
            .Returns(newProfileLiftBuilder.Object);

            DIBuilder
            .New()
            .Add(x => x.AddSingleton <ICellLiftBuilder>(newCellLiftBuilder.Object))
            .Add(x => x.AddSingleton <ICellProfileBuilder <ProfileCell> >(newCellProfileBuilder.Object))
            .Add(x => x.AddSingleton <ICellProfileAnalyzer <ProfileCell> >(newProfileLiftBuilder.Object))
            .Add(x => x.AddSingleton <IProfilerBuilderFactory <ProfileCell> >(factory.Object)).Complete();
        }
예제 #25
0
        public void ValidateReportData_GriddedNoDesign_Fail(Guid projectUid, Guid cutFillDesignUid, double?cutFillDesignOffset, Guid?alignmentDesignUid)
        {
            var mockSiteModel  = new Mock <ISiteModel>();
            var mockSiteModels = new Mock <ISiteModels>();

            mockSiteModels.Setup(x => x.GetSiteModel(It.IsAny <Guid>(), It.IsAny <bool>())).Returns(mockSiteModel.Object);

            var mockDesigns       = new Mock <IDesigns>();
            var mockDesignManager = new Mock <IDesignManager>();

            mockDesignManager.Setup(x => x.List(It.IsAny <Guid>())).Returns(mockDesigns.Object);
            mockDesigns.Setup(x => x.Locate(It.IsAny <Guid>())).Returns((IDesign)null);

            var mockAlignments       = new Mock <IAlignments>();
            var mockAlignmentManager = new Mock <IAlignmentManager>();

            mockAlignmentManager.Setup(x => x.List(It.IsAny <Guid>())).Returns(mockAlignments.Object);
            mockAlignments.Setup(x => x.Locate(It.IsAny <Guid>())).Returns((IAlignment)null);

            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <ISiteModels>(mockSiteModels.Object))
            .Add(x => x.AddSingleton <IDesignManager>(mockDesignManager.Object))
            .Add(x => x.AddSingleton <IAlignmentManager>(mockAlignmentManager.Object))
            .Add(x => x.AddTransient <IReportDataValidationUtility, ReportDataValidationUtility>())
            .Complete();

            var request = new CompactionReportGridTRexRequest(
                projectUid, null,
                true, true, true, true, true, true,
                cutFillDesignUid, cutFillDesignOffset,
                null, GridReportOption.Automatic,
                800000, 400000, 800001, 400001, 2, null, null);

            var ex = Assert.Throws <ServiceException>(() => DIContext.Obtain <IReportDataValidationUtility>().ValidateData(nameof(ValidateReportData_GriddedNoDesign_Fail), request.ProjectUid, request));

            Assert.Equal(System.Net.HttpStatusCode.BadRequest, ex.Code);
            Assert.Equal(ContractExecutionStatesEnum.ValidationError, ex.GetResult.Code);
            Assert.Equal($"CutFill design {cutFillDesignUid} is not found.", ex.GetResult.Message);
        }
예제 #26
0
        public void ValidateReportData_GriddedSuccess(Guid projectUid, Guid cutFillDesignUid, double?cutFillDesignOffset, Guid?alignmentDesignUid)
        {
            var mockSiteModel  = new Mock <ISiteModel>();
            var mockSiteModels = new Mock <ISiteModels>();

            mockSiteModels.Setup(x => x.GetSiteModel(It.IsAny <Guid>(), It.IsAny <bool>())).Returns(mockSiteModel.Object);

            var mockDesign        = new Mock <IDesign>();
            var mockDesigns       = new Mock <IDesigns>();
            var mockDesignManager = new Mock <IDesignManager>();

            mockDesignManager.Setup(x => x.List(It.IsAny <Guid>())).Returns(mockDesigns.Object);
            mockDesigns.Setup(x => x.Locate(It.IsAny <Guid>())).Returns(mockDesign.Object);

            var mockAlignments       = new Mock <IAlignments>();
            var mockAlignmentManager = new Mock <IAlignmentManager>();

            mockAlignmentManager.Setup(x => x.List(It.IsAny <Guid>())).Returns(mockAlignments.Object);
            mockAlignments.Setup(x => x.Locate(It.IsAny <Guid>())).Returns((IAlignment)null);

            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <ISiteModels>(mockSiteModels.Object))
            .Add(x => x.AddSingleton <IDesignManager>(mockDesignManager.Object))
            .Add(x => x.AddSingleton <IAlignmentManager>(mockAlignmentManager.Object))
            .Add(x => x.AddTransient <IReportDataValidationUtility, ReportDataValidationUtility>())
            .Complete();

            var request = new CompactionReportGridTRexRequest(
                projectUid, null,
                true, true, true, true, true, true,
                cutFillDesignUid, cutFillDesignOffset,
                null, GridReportOption.Automatic,
                800000, 400000, 800001, 400001, 2, null, null);

            var siteModel = GatewayHelper.ValidateAndGetSiteModel(nameof(ValidateReportData_GriddedSuccess), projectUid);
            var isOk      = DIContext.Obtain <IReportDataValidationUtility>().ValidateData(nameof(ValidateReportData_GriddedSuccess), projectUid, request);

            Assert.True(isOk);
        }
예제 #27
0
        public void ValidateReportData_AlignmentIncludingCutFill_Success(Guid projectUid, Guid cutFillDesignUid, double?cutFillDesignOffset, Guid alignmentDesignUid)
        {
            var mockSiteModel  = new Mock <ISiteModel>();
            var mockSiteModels = new Mock <ISiteModels>();

            mockSiteModels.Setup(x => x.GetSiteModel(It.IsAny <Guid>(), It.IsAny <bool>())).Returns(mockSiteModel.Object);

            var mockDesign        = new Mock <IDesign>();
            var mockDesigns       = new Mock <IDesigns>();
            var mockDesignManager = new Mock <IDesignManager>();

            mockDesignManager.Setup(x => x.List(It.IsAny <Guid>())).Returns(mockDesigns.Object);
            mockDesigns.Setup(x => x.Locate(It.IsAny <Guid>())).Returns(mockDesign.Object);

            var mockAlignment        = new Mock <IAlignment>();
            var mockAlignments       = new Mock <IAlignments>();
            var mockAlignmentManager = new Mock <IAlignmentManager>();

            mockAlignmentManager.Setup(x => x.List(It.IsAny <Guid>())).Returns(mockAlignments.Object);
            mockAlignments.Setup(x => x.Locate(It.IsAny <Guid>())).Returns(mockAlignment.Object);

            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <ISiteModels>(mockSiteModels.Object))
            .Add(x => x.AddSingleton <IDesignManager>(mockDesignManager.Object))
            .Add(x => x.AddSingleton <IAlignmentManager>(mockAlignmentManager.Object))
            .Add(x => x.AddTransient <IReportDataValidationUtility, ReportDataValidationUtility>())
            .Complete();

            var request = CompactionReportStationOffsetTRexRequest.CreateRequest(
                projectUid, null,
                true, true, true, true, true, true,
                cutFillDesignUid, cutFillDesignOffset, alignmentDesignUid,
                2.0, 100, 200, new[] { -1.0, 0, 1.3 }, null, null);

            var isOk = DIContext.Obtain <IReportDataValidationUtility>().ValidateData(nameof(ValidateReportData_AlignmentIncludingCutFill_Success), request.ProjectUid, request);

            Assert.True(isOk);
        }
예제 #28
0
        private static void DependencyInjection()
        {
            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
            .Build()
            .Add(x => x.AddSingleton <ITransferProxyFactory>(factory => new TransferProxyFactory(factory.GetRequiredService <IConfigurationStore>(), factory.GetRequiredService <ILoggerFactory>())))
            .Add(x => x.AddSingleton <ICoreXWrapper, CoreXWrapper>())
            .Add(VSS.TRex.IO.DIUtilities.AddPoolCachesToDI)
            .Add(VSS.TRex.Cells.DIUtilities.AddPoolCachesToDI)
            .Add(TRexGridFactory.AddGridFactoriesToDI)
            .Add(VSS.TRex.Storage.Utilities.DIUtilities.AddProxyCacheFactoriesToDI)
            .Build()
            .Add(x => x.AddTransient <IFilterSet>(factory => new FilterSet()))
            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels.SiteModels(StorageMutability.Immutable)))
            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
            .Add(ExistenceMaps.ExistenceMaps.AddExistenceMapFactoriesToDI)
            .Add(x => x.AddSingleton <IProductionEventsFactory>(new ProductionEventsFactory()))
            .Build()
            .Add(x => x.AddSingleton(new CalculateDesignElevationsServer()))
            .Add(X => X.AddTransient <IDesigns>(factory => new Designs.Storage.Designs()))
            .Add(x => x.AddSingleton <IDesignFiles>(new DesignFiles()))
            .Add(x => x.AddSingleton <IDesignManager>(factory => new DesignManager(StorageMutability.Immutable)))
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces.SurveyedSurfaces()))
            .Add(x => x.AddSingleton <ISurveyedSurfaceManager>(factory => new SurveyedSurfaceManager(StorageMutability.Immutable)))
            .Add(x => x.AddTransient <IAlignments>(factory => new Alignments.Alignments()))
            .Add(x => x.AddSingleton <IAlignmentManager>(factory => new AlignmentManager(StorageMutability.Immutable)))
            //.Add(x => x.AddSingleton<IDesignChangedEventListener>(new DesignChangedEventListener(TRexGrids.ImmutableGridName())))
            .Add(x => x.AddSingleton <ITRexHeartBeatLogger>(new TRexHeartBeatLogger()))
            .Add(x => x.AddSingleton <IOptimisedTTMProfilerFactory>(new OptimisedTTMProfilerFactory()))
            .Add(x => x.AddSingleton <IDesignClassFactory>(new DesignClassFactory()))
            .Add(x => x.AddSingleton <IClientLeafSubGridFactory>(ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory()))

            // Register the listener for site model attribute change notifications
            //.Add(x => x.AddSingleton<ISiteModelAttributesChangedEventListener>(new SiteModelAttributesChangedEventListener(TRexGrids.ImmutableGridName())))

            .Complete();
        }
예제 #29
0
        static void Main(string[] args)
        {
            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
            .Add(TRexGridFactory.AddGridFactoriesToDI)
            .Add(VSS.TRex.Storage.Utilities.DIUtilities.AddProxyCacheFactoriesToDI)
            .Build()
            .Add(x => x.AddSingleton(new ImmutableClientServer("Webtools-Immutable")))
            .Add(x => x.AddSingleton(new MutableClientServer("Webtools-Mutable")))
            .Complete();

            try
            {
                var ks = new KeyScanner();

                Console.WriteLine("Starting to dump mutable grid keys");
                Console.WriteLine("##################################");

                ks.dumpKeysToFile(StorageMutability.Mutable, @"C:\Temp\AllTRexIgniteCacheKeys = mutable.txt");
                Console.WriteLine("----> Mutable grid key dump complete");

                Console.WriteLine("Starting to dump immutable grid keys");
                Console.WriteLine("####################################");
                ks.dumpKeysToFile(StorageMutability.Immutable, @"C:\Temp\AllTRexIgniteCacheKeys = immutable.txt");
                Console.WriteLine("----> Immutable grid key dump complete");

                Console.WriteLine("Completed dump of grid keys");
                Console.WriteLine("###########################");
            }
            finally
            {
                DIContext.Obtain <ITRexGridFactory>()?.StopGrids();
            }
        }
예제 #30
0
        private static void DependencyInjection()
        {
            DIBuilder
            .New()
            .AddLogging()
            .Add(x => x.AddSingleton <IConfigurationStore, GenericConfiguration>())
            .Build()
            .Add(x => x.AddSingleton <ITransferProxyFactory, TransferProxyFactory>())
            .Add(x => x.AddSingleton <ICoreXWrapper, CoreXWrapper>())
            .Add(x => x.AddSingleton <IACSTranslator, ACSTranslator>())
            .Add(VSS.TRex.IO.DIUtilities.AddPoolCachesToDI)
            .Add(VSS.TRex.Cells.DIUtilities.AddPoolCachesToDI)
            .Add(TRexGridFactory.AddGridFactoriesToDI)
            .Add(VSS.TRex.Storage.Utilities.DIUtilities.AddProxyCacheFactoriesToDI)
            .Build()
            .Add(x => x.AddSingleton <ISubGridCellSegmentPassesDataWrapperFactory>(new SubGridCellSegmentPassesDataWrapperFactory()))
            .Add(x => x.AddSingleton <ISubGridCellLatestPassesDataWrapperFactory>(new SubGridCellLatestPassesDataWrapperFactory()))
            .Add(x => x.AddTransient <ISurveyedSurfaces>(factory => new SurveyedSurfaces.SurveyedSurfaces()))
            .Add(x => x.AddSingleton <ISurveyedSurfaceFactory>(new SurveyedSurfaces.SurveyedSurfaceFactory()))
            .Add(x => x.AddSingleton <ISubGridSpatialAffinityKeyFactory>(new SubGridSpatialAffinityKeyFactory()))
            .Build()
            .Add(x => x.AddServiceDiscovery())

            .Add(x => x.AddSingleton <ITagFileAuthProjectV5Proxy, TagFileAuthProjectV5Proxy>())
            .Add(x => x.AddSingleton <ITPaaSApplicationAuthentication, TPaaSApplicationAuthentication>())
            .Add(x => x.AddTransient <ITPaasProxy, TPaasProxy>())
            .Add(x => x.AddSingleton <ICwsDeviceGatewayClient, CwsDeviceGatewayClient>())

            .Add(x => x.AddSingleton <ISiteModels>(new SiteModels.SiteModels(StorageMutability.Mutable)))
            .Add(x => x.AddSingleton <ISiteModelFactory>(new SiteModelFactory()))
            .Add(x => x.AddSingleton <IMutabilityConverter>(new MutabilityConverter()))
            .Add(TRex.ExistenceMaps.ExistenceMaps.AddExistenceMapFactoriesToDI)
            .Add(x => x.AddSingleton <IProductionEventsFactory>(new ProductionEventsFactory()))
            .Add(x => x.AddSingleton <ISegmentRetirementQueue>(factory => new SegmentRetirementQueue()))
            .Build()
            .Add(x => x.AddSingleton(new TagProcComputeServer()))
            .Add(x => x.AddTransient <IDesigns>(factory => new Designs.Storage.Designs()))
            .Add(x => x.AddSingleton <IDesignFiles>(new DesignFiles()))
            .Add(x => x.AddSingleton <IDesignManager>(factory => new DesignManager(StorageMutability.Mutable)))

            .Add(x => x.AddSingleton <IDesignChangedEventSender, DesignChangedEventSender>())

            .Add(x => x.AddSingleton <ISurveyedSurfaceManager>(factory => new SurveyedSurfaceManager(StorageMutability.Mutable)))

            // Register the sender for the site model attribute change notifications
            .Add(x => x.AddSingleton <ISiteModelAttributesChangedEventSender>(new SiteModelAttributesChangedEventSender()))

            .Add(x => x.AddSingleton <ISiteModelMetadataManager>(factory => new SiteModelMetadataManager(StorageMutability.Mutable)))
            .Add(x => x.AddSingleton <ITRexHeartBeatLogger>(new TRexHeartBeatLogger()))

            .Add(x => x.AddTransient <IAlignments>(factory => new Alignments.Alignments()))
            .Add(x => x.AddSingleton <IAlignmentManager>(factory => new AlignmentManager(StorageMutability.Mutable)))

            .Add(x => x.AddSingleton <Func <ITAGFileBufferQueue> >(factory => () => new TAGFileBufferQueue()))
            .Add(x => x.AddMemoryCache())
            .Add(x => x.AddServiceDiscovery())
            .Add(x => x.AddSingleton <IDataCache>(factory => new InMemoryDataCache(DIContext.Obtain <ILoggerFactory>(), DIContext.Obtain <IMemoryCache>())))
            .Add(x => x.AddHttpClient())
            .Add(x => x.AddSingleton <IWebRequest>(factory =>
                                                   new GracefulWebRequest(
                                                       DIContext.Obtain <ILoggerFactory>(),
                                                       DIContext.Obtain <IConfigurationStore>(),
                                                       DIContext.Obtain <IHttpClientFactory>())))
            .Add(x => x.AddSingleton <IRebuildSiteModelTAGNotifier, RebuildSiteModelTAGNotifier>())
            .Complete();
        }