Example #1
0
        public SessionService(IUserSessionFactory sessionFactory,
                              IPlatformInformationService service)
        {
            _sessionFactory = sessionFactory;

            SetSession(service.PlatformInformation.Type);
        }
Example #2
0
        public CalculatorViewModel(
            IAlertsService alertsService,
            IClipboardService clipboardService,
            ICommandFactoryService commandFactoryService,
            INavigationService navigationService,
            IPlatformInformationService platformInformationService)
        {
            _alertsService              = alertsService;
            _clipboardService           = clipboardService;
            _commandFactoryService      = commandFactoryService;
            _navigationService          = navigationService;
            _platformInformationService = platformInformationService;

            AllClearCommand             = _commandFactoryService.Create(AllClear);
            ClearCommand                = _commandFactoryService.Create(Clear);
            DeleteCommand               = _commandFactoryService.Create(async() => await Delete());
            BinaryOperatorCommand       = _commandFactoryService.Create <string>(async(symbol) => await BinaryOperator(symbol));
            UnaryOperatorCommand        = _commandFactoryService.Create <string>(async(symbol) => await UnaryOperator(symbol));
            ParenthesisCommand          = _commandFactoryService.Create <string>(async(parenthesis) => await Parenthesis(parenthesis));
            VariableStorageCommand      = _commandFactoryService.Create <string>(async(symbol) => await VariableStorage(symbol));
            NumberCommand               = _commandFactoryService.Create <string>(async(number) => await Number(number));
            DecimalCommand              = _commandFactoryService.Create(async() => await Decimal());
            CalculateCommand            = _commandFactoryService.Create(async() => await Calculate());
            CopyCommand                 = _commandFactoryService.Create(async() => await Copy());
            PasteCommand                = _commandFactoryService.Create(async() => await Paste());
            SelectInputSectionCommand   = _commandFactoryService.Create <InputSectionViewModel>(async(inputSectionViewModel) => await SelectInputSection(inputSectionViewModel));
            ManageInputCharacterCommand = _commandFactoryService.Create <string>(async(character) => await ManageInputCharacter(character));
            ShowHistoryCommand          = _commandFactoryService.Create(async() => await ShowHistory());
            NavigateToSettingsCommand   = _commandFactoryService.Create(async() => await NavigateToSettings());
            NavigateToAboutCommand      = _commandFactoryService.Create(async() => await NavigateToAbout());

            Input.CollectionChanged += Input_CollectionChanged;
        }
Example #3
0
 public PsAuxProcessCollector(ILoggerWrapper logger,
                              IPlatformInformationService info,
                              ISessionService session,
                              IDateTime time)
     : base(logger, session, info, time)
 {
 }
Example #4
0
 public LinuxRootProcessCollector(ILoggerWrapper logger,
                                  ISessionService session,
                                  IPlatformInformationService info,
                                  IDateTime time) : base(logger, session, time)
 {
     _info = info;
 }
Example #5
0
        public AzureStorageShortenedTimerDurabilityProviderFactory(
            IOptions <DurableTaskOptions> options,
            IConnectionStringResolver connectionStringResolver,
            INameResolver nameResolver,
            ILoggerFactory loggerFactory,
#pragma warning disable CS0612 // Type or member is obsolete
            IPlatformInformationService platformInformationService)
#pragma warning restore CS0612 // Type or member is obsolete
            : base(options, connectionStringResolver, nameResolver, loggerFactory, platformInformationService)
        {
        }
Example #6
0
 public ApplicationCollectorFactory(ILoggerWrapper logger,
                                    IPlatformInformationService platform,
                                    IOptions <ApplicationCollectorUsageOptions> options,
                                    IDateTime time,
                                    ISessionService sessionService)
 {
     _logger         = logger;
     _platform       = platform;
     _options        = options.Value;
     _time           = time;
     _sessionService = sessionService;
 }
Example #7
0
 public ProcessCollectorFactory(IPlatformInformationService platform,
                                ILoggerWrapper logger,
                                IOptions <ProcessCollectorUsageOptions> usageOptions,
                                ISessionService session,
                                IDateTime time)
 {
     _platform     = platform;
     _logger       = logger;
     _usageOptions = usageOptions.Value;
     _session      = session;
     _time         = time;
 }
Example #8
0
        public AzureStorageDurabilityProviderFactory(
            IOptions <DurableTaskOptions> options,
            IConnectionStringResolver connectionStringResolver,
            INameResolver nameResolver,
            ILoggerFactory loggerFactory,
#pragma warning disable CS0612 // Type or member is obsolete
            IPlatformInformationService platformInfo)
#pragma warning restore CS0612 // Type or member is obsolete
        {
            this.options             = options.Value;
            this.nameResolver        = nameResolver;
            this.loggerFactory       = loggerFactory;
            this.azureStorageOptions = new AzureStorageOptions();
            this.inConsumption       = platformInfo.InConsumption();

            // The consumption plan has different performance characteristics so we provide
            // different defaults for key configuration values.
            int maxConcurrentOrchestratorsDefault = this.inConsumption ? 5 : 10 * Environment.ProcessorCount;
            int maxConcurrentActivitiesDefault    = this.inConsumption ? 10 : 10 * Environment.ProcessorCount;

            if (this.inConsumption)
            {
                if (platformInfo.IsPython())
                {
                    this.azureStorageOptions.ControlQueueBufferThreshold = 32;
                }
                else
                {
                    this.azureStorageOptions.ControlQueueBufferThreshold = 128;
                }
            }

            // The following defaults are only applied if the customer did not explicitely set them on `host.json`
            this.options.MaxConcurrentOrchestratorFunctions = this.options.MaxConcurrentOrchestratorFunctions ?? maxConcurrentOrchestratorsDefault;
            this.options.MaxConcurrentActivityFunctions     = this.options.MaxConcurrentActivityFunctions ?? maxConcurrentActivitiesDefault;

            // Override the configuration defaults with user-provided values in host.json, if any.
            JsonConvert.PopulateObject(JsonConvert.SerializeObject(this.options.StorageProvider), this.azureStorageOptions);

            var logger = loggerFactory.CreateLogger(nameof(this.azureStorageOptions));

            this.azureStorageOptions.Validate(logger);

            this.connectionStringResolver = connectionStringResolver ?? throw new ArgumentNullException(nameof(connectionStringResolver));
            this.defaultConnectionName    = this.azureStorageOptions.ConnectionStringName ?? ConnectionStringNames.Storage;
        }
        public static ITestHost CreateJobHost(
            IOptions <DurableTaskOptions> options,
            string storageProvider,
            ILoggerProvider loggerProvider,
            INameResolver nameResolver,
            IDurableHttpMessageHandlerFactory durableHttpMessageHandler,
            ILifeCycleNotificationHelper lifeCycleNotificationHelper,
            IMessageSerializerSettingsFactory serializerSettingsFactory,
            IApplicationLifetimeWrapper shutdownNotificationService = null,
            Action <ITelemetry> onSend = null,
#pragma warning disable CS0612 // Type or member is obsolete
            IPlatformInformationService platformInformationService = null)
#pragma warning restore CS0612 // Type or member is obsolete
        {
            var config = new JobHostConfiguration {
                HostId = "durable-task-host"
            };

            config.TypeLocator = TestHelpers.GetTypeLocator();

            var connectionResolver = new WebJobsConnectionStringProvider();

            var loggerFactory = new LoggerFactory();

            loggerFactory.AddProvider(loggerProvider);

            // Unless otherwise specified, use legacy partition management for tests as it makes the task hubs start up faster.
            // These tests run on a single task hub workers, so they don't test partition management anyways, and that is tested
            // in the DTFx repo.
            if (!options.Value.StorageProvider.ContainsKey(nameof(AzureStorageOptions.UseLegacyPartitionManagement)))
            {
                options.Value.StorageProvider.Add(nameof(AzureStorageOptions.UseLegacyPartitionManagement), true);
            }

            platformInformationService = platformInformationService ?? TestHelpers.GetMockPlatformInformationService();

            IDurabilityProviderFactory orchestrationServiceFactory = new AzureStorageDurabilityProviderFactory(
                options,
                connectionResolver,
                nameResolver,
                loggerFactory,
                platformInformationService);

            var extension = new DurableTaskExtension(
                options,
                loggerFactory,
                nameResolver,
                new[] { orchestrationServiceFactory },
                shutdownNotificationService ?? new TestHostShutdownNotificationService(),
                durableHttpMessageHandler,
                lifeCycleNotificationHelper,
                serializerSettingsFactory,
                platformInformationService);

            config.UseDurableTask(extension);

            // Mock INameResolver for not setting EnvironmentVariables.
            if (nameResolver != null)
            {
                config.AddService(nameResolver);
            }

            // Performance is *significantly* worse when dashboard logging is enabled, at least
            // when running in the storage emulator. Disabling to keep tests running quickly.
            config.DashboardConnectionString = null;

            // Add test logger
            config.LoggerFactory = loggerFactory;

            var host = new JobHost(config);

            return(new FunctionsV1HostWrapper(host, options, connectionResolver));
        }
Example #10
0
 public WindowsSession(ILoggerWrapper logger, IPlatformInformationService platformInformation)
 {
     _logger = logger;
     _platformInformation = platformInformation;
 }
Example #11
0
 public UserSessionFactory(ILoggerWrapper logger, IPlatformInformationService platformInformation)
 {
     _logger = logger;
     _platformInformation = platformInformation;
 }