public AutomaticUninstallerService(IChocolateyPackageInformationService packageInfoService, IFileSystem fileSystem, IRegistryService registryService, ICommandExecutor commandExecutor) { _packageInfoService = packageInfoService; _fileSystem = fileSystem; _registryService = registryService; _commandExecutor = commandExecutor; WaitForCleanup = true; }
public CygwinService(ICommandExecutor commandExecutor, INugetService nugetService, IFileSystem fileSystem, IRegistryService registryService) { _commandExecutor = commandExecutor; _nugetService = nugetService; _fileSystem = fileSystem; _registryService = registryService; set_cmd_args_dictionaries(); }
void Awake() { radius = GetComponent<SphereCollider>().radius; pointers = new List<EnemyPointerWidget>(); registry = IOC.Resolve<IRegistryService>(); enemyFactory = IOC.Resolve<IEnemyFactory>(); enemyFactory.onEnemyCreated += OnEnemyCreated; }
/// <summary> /// Set up planet. /// </summary> void Awake () { // get components sphereCollider = GetComponent<SphereCollider>(); // resolve services registry = IOC.Resolve<IRegistryService>(); // register object registry.Register<IPlanet>("Planet", this); }
//For test purposes public CachedFileSystemParser(IFileSystemParser fileSystemParser, ICacheSerializer cacheSerializer, IFileSystemListener fileSystemListener, IRegistryService registryService, IAsyncFileSystemParser asyncFileSystemParser, bool appRunOnStartup, int updatesCountToWrite) : this(fileSystemParser, cacheSerializer, fileSystemListener, registryService, asyncFileSystemParser, appRunOnStartup) { _updatesCountToWrite = updatesCountToWrite; }
public void Setup() { mr = new MockRepository(); regSvc = mr.StrictMock<IRegistryService>(); hkcu = mr.StrictMock<IRegistryKey>(); sc = new ServiceContainer(); sc.AddService(typeof(IRegistryService), regSvc); regSvc.Stub(r => r.CurrentUser).Return(hkcu); settingsSvc = new WindowsFormsSettingsService(sc); }
////////////////////////////////////////////////////////////////////////////////// // Monobehaviour Events // void Awake() { registry = IOC.Resolve<IRegistryService>(); collectables = IOC.Resolve<ICollectableFactory>(); score = IOC.Resolve<IScoreService>(); rigid = GetComponent<Rigidbody>(); rigid.useGravity = false; rigid.constraints = RigidbodyConstraints.FreezeRotation; }
public CachedFileSystemParser(IFileSystemParser fileSystemParser, ICacheSerializer cacheSerializer, IFileSystemListener fileSystemListener, IRegistryService registryService, IAsyncFileSystemParser asyncFileSystemParser, bool appRunOnStartup) { _cacheSerializer = cacheSerializer; _fileSystemListener = fileSystemListener; _registryService = registryService; _fileSystemParser = fileSystemParser; _asyncFileSystemParser = asyncFileSystemParser; _fileSystemFilter = new FileSystemFilter(); Initialize(appRunOnStartup); }
////////////////////////////////////////////////////////////////////////////////// // MonoBehaviour // /// <summary> /// get references to services and internal components. /// </summary> void Awake() { // get services controller = IOC.Resolve<IShipController>(); bullets = IOC.Resolve<IShootableFactory>(); registry = IOC.Resolve<IRegistryService>(); // get and initialize components rigid = GetComponent<Rigidbody>(); rigid.constraints = RigidbodyConstraints.FreezeRotation; rigid.useGravity = false; // register with services and controllers controller.Register(this); registry.Register<IShip>("Ship", this); }
// MonoBehaviour // void Awake() { // time service time = IOC.Resolve<ITimeService>(); time.TimeUpdated += UpdateTimeText; // score service score = IOC.Resolve<IScoreService>(); score.ScoreUpdated += UpdateScoreText; // registry service registry = IOC.Resolve<IRegistryService>(); registry.Register<IGameUI>("GameUI", this); // animator component animator = GetComponent<Animator>(); // game ready behaviour gameReadyBehaviour = animator.GetBehaviour<GameReadyBehaviour>(); gameReadyBehaviour.gameUI = this; }
// Monobehaviour // /// <summary> /// Set up internal data objects. Resolve references to services. /// </summary> void Awake() { // create new list to hold enemy references enemyList = new List<IEnemy>(); // resolve services enemies = IOC.Resolve<IEnemyFactory>(); time = IOC.Resolve<ITimeService>(); registry = IOC.Resolve<IRegistryService>(); shipController = IOC.Resolve<IShipController>(); endGameController = IOC.Resolve<IEndGameController>(); // initialize wave info currentWaveIndex = 0; // get pointer to current wave currentWave = waveData.waves[0]; // set start time on countdown time.SetCountdown(waveData.startTime); }
public BrokerController(IRegistryService registryService, ITaxService taxService, BrokerContext context) { _registryService = registryService; _taxService = taxService; _context = context; }
public ClientRegistrationViewModel(ISettings settings, IRegistryService registryService) { _settings = settings; _registryService = registryService; ClearCache(); }
public ChocolateyPackageInformationService(IFileSystem fileSystem, IRegistryService registryService, IFilesService filesService) { _fileSystem = fileSystem; _registryService = registryService; _filesService = filesService; }
public PinCodeStorageService(IRegistryService registryService) { this.registryService = registryService; }
public Bootstrapper(ILogger logger, IScheduler scheduler, IHealthService health, IRegistryService application) : base() { Logger = logger ?? throw new ArgumentNullException(nameof(logger)); Scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler)); Health = health ?? throw new ArgumentNullException(nameof(health)); Application = application ?? throw new ArgumentNullException(nameof(application)); ApplicationPipelines.OnError += OnError; }
internal static async Task <int> ExecuteAsync(CheckIisSettings settings, string applicationHostConfigurationPath, int?pid, IRegistryService registryService = null) { var values = settings.SiteName.Split('/'); var siteName = values[0]; var applicationName = values.Length > 1 ? $"/{values[1]}" : "/"; AnsiConsole.WriteLine(FetchingApplication(siteName, applicationName)); var serverManager = new ServerManager(readOnly: true, applicationHostConfigurationPath); var site = serverManager.Sites[siteName]; if (site == null) { Utils.WriteError(CouldNotFindSite(siteName, serverManager.Sites.Select(s => s.Name))); return(1); } var application = site.Applications[applicationName]; if (application == null) { Utils.WriteError(CouldNotFindApplication(siteName, applicationName, site.Applications.Select(a => a.Path))); return(1); } var pool = serverManager.ApplicationPools[application.ApplicationPoolName]; // The WorkerProcess part of ServerManager doesn't seem to be compatible with IISExpress // so we skip this bit when launched from the tests if (pid == null) { var workerProcesses = pool.WorkerProcesses; if (workerProcesses.Count > 0) { // If there are multiple worker processes, we just take the first one // In theory, all worker processes have the same configuration pid = workerProcesses[0].ProcessId; } } if (pid == null) { Utils.WriteWarning(NoWorkerProcess); } else { AnsiConsole.WriteLine(InspectingWorkerProcess(pid.Value)); var rootDirectory = application.VirtualDirectories.FirstOrDefault(d => d.Path == "/")?.PhysicalPath; IConfigurationSource appSettingsConfigurationSource = null; try { var config = application.GetWebConfiguration(); var appSettings = config.GetSection("appSettings"); var collection = appSettings.GetCollection(); appSettingsConfigurationSource = new DictionaryConfigurationSource( collection.ToDictionary(c => (string)c.Attributes["key"].Value, c => (string)c.Attributes["value"].Value)); } catch (Exception ex) { Utils.WriteWarning(ErrorExtractingConfiguration(ex.Message)); } var process = ProcessInfo.GetProcessInfo(pid.Value, rootDirectory, appSettingsConfigurationSource); if (process == null) { Utils.WriteError(GetProcessError); return(1); } if (process.DotnetRuntime.HasFlag(ProcessInfo.Runtime.NetCore) && !string.IsNullOrEmpty(pool.ManagedRuntimeVersion)) { Utils.WriteWarning(IisMixedRuntimes); } if (process.Modules.Any(m => Path.GetFileName(m).Equals("aspnetcorev2_outofprocess.dll", StringComparison.OrdinalIgnoreCase))) { // IIS site is hosting aspnetcore in out-of-process mode // Trying to locate the actual application process AnsiConsole.WriteLine(OutOfProcess); var childProcesses = process.GetChildProcesses(); // Get either the first process that is dotnet, or the first that is not conhost int?dotnetPid = null; int?fallbackPid = null; foreach (var childPid in childProcesses) { using var childProcess = Process.GetProcessById(childPid); if (childProcess.ProcessName.Equals("dotnet", StringComparison.OrdinalIgnoreCase)) { dotnetPid = childPid; break; } if (!childProcess.ProcessName.Equals("conhost", StringComparison.OrdinalIgnoreCase)) { fallbackPid = childPid; } } var aspnetCorePid = dotnetPid ?? fallbackPid; if (aspnetCorePid == null) { Utils.WriteError(AspNetCoreProcessNotFound); return(1); } AnsiConsole.WriteLine(AspNetCoreProcessFound(aspnetCorePid.Value)); process = ProcessInfo.GetProcessInfo(aspnetCorePid.Value); if (process == null) { Utils.WriteError(GetProcessError); return(1); } } if (!ProcessBasicCheck.Run(process, registryService)) { return(1); } if (!await AgentConnectivityCheck.RunAsync(process).ConfigureAwait(false)) { return(1); } } if (!GacCheck.Run()) { return(1); } Utils.WriteSuccess(IisNoIssue); return(0); }
public PendingRebootService(IRegistryService registryService) { _registryService = registryService; }
public TransferService(ICacheDataService cacheDataService, IRegistryService registryService) { _cacheDataService = cacheDataService; _registryService = registryService; }
public MovePathCommandTest() { _cryptoServiceMock = new CryptoServiceMock(); _registryServiceMock = new RegistryServiceMock(); _loggerServiceMock = new LoggerServiceMock(); }
public ChocolateyPackageService(INugetService nugetService, IPowershellService powershellService, IShimGenerationService shimgenService, IFileSystem fileSystem, IRegistryService registryService, IChocolateyPackageInformationService packageInfoService, IAutomaticUninstallerService autoUninstallerService, IXmlService xmlService) { _nugetService = nugetService; _powershellService = powershellService; _shimgenService = shimgenService; _fileSystem = fileSystem; _registryService = registryService; _packageInfoService = packageInfoService; _autoUninstallerService = autoUninstallerService; _xmlService = xmlService; }
public CryptoService(IRegistryService registryService) { CreateSaltIfFirstTime(registryService); this._entropy = registryService.GetValue(EntropyKey); }
public TemplateAddCommand(IProjectService projectService, IRegistryService registryService) { _projectService = projectService; _registryService = registryService; }
public HttpServer(IWebHost server, IRegistryService registryService) : base(registryService) { _server = server; }
public AutomaticUninstallerService(IChocolateyPackageInformationService packageInfoService, IFileSystem fileSystem, IRegistryService registryService, ICommandExecutor commandExecutor) { _packageInfoService = packageInfoService; _fileSystem = fileSystem; _registryService = registryService; _commandExecutor = commandExecutor; }
public void SetUp() { _registryService = new RegistryService("temp assembly path"); _registryService.DeleteRunOnStartup(); }
public DeleteTemplateCommandTest() { _cryptoServiceMock = new CryptoServiceMock(); _registryServiceMock = new RegistryServiceMock(); _loggerServiceMock = new LoggerServiceMock(); }
public PluginCompileCommand(IRegistryService registryService) { _registryService = registryService; }
/// <summary> /// DB のテナント・レジストリ・ノード情報を Cluster(k8s) へ同期させるメソッドです。 /// </summary> protected override void DoWork(object state, int doWorkCount) { LogInfo($"DB のテナント・レジストリ・ノード情報を Cluster(k8s) へ同期させます。"); try { // DB のテナント情報に対応する名前空間、ロール、クォータを Cluster(k8s) へ同期 var tenants = tenantRepository.GetAllTenants(); foreach (Tenant tenant in tenants) { // 名前空間とロールを同期 bool ret = clusterManagementService.RegistTenantAsync(tenant.Name).Result; if (ret) { LogDebug($"DB のテナント \"{tenant.Name}\" に対応する名前空間とロールを Cluster(k8s) へ同期させました。"); } else { LogError($"DB のテナント \"{tenant.Name}\" に対応する名前空間とロールを Cluster(k8s) へ同期させる処理に失敗しました。"); } // クォータを同期 int cpu = tenant.LimitCpu == null ? 0 : tenant.LimitCpu.Value; int memory = tenant.LimitMemory == null ? 0 : tenant.LimitMemory.Value; int gpu = tenant.LimitGpu == null ? 0 : tenant.LimitGpu.Value; ret = clusterManagementService.SetQuotaAsync(tenant.Name, cpu, memory, gpu).Result; string quotaInfo = $"cpu={cpu} memory={memory} gpu={gpu}"; if (ret) { LogDebug($"DB のテナント \"{tenant.Name}\" に対応するクォータ [{quotaInfo}] を Cluster(k8s) へ同期させました。"); } if (!ret) { LogError($"DB のテナント \"{tenant.Name}\" に対応するクォータ [{quotaInfo}] を Cluster(k8s) へ同期させる処理に失敗しました。"); } // テナントの古い ClusterToken を削除 tenantRepository.DeleteClusterToken(tenant.Id); } // テナントの古い ClusterToken 削除を確定する unitOfWork.Commit(); // DB のレジストリ情報(UserTenantRegistryMap)に対応するシークレットを Cluster(k8s) へ同期 var userTenantRegistryMaps = registryRepository.GetUserTenantRegistryMapAll(); foreach (UserTenantRegistryMap userTenantRegistryMap in userTenantRegistryMaps) { // ログ情報 string registryPasswd = string.IsNullOrEmpty(userTenantRegistryMap.RegistryPassword) ? "無し" : "有り"; string mapInfo = $"UserTenantRegistryMapId={userTenantRegistryMap.Id}, UserId={userTenantRegistryMap.UserId}, " + $"RegistryPassword={registryPasswd}, TenantRegistryMapId={userTenantRegistryMap.TenantRegistryMapId}, " + $"TernantId={userTenantRegistryMap.TenantRegistryMap.TenantId}, " + $"RegistryId={userTenantRegistryMap.TenantRegistryMap.RegistryId}"; Registry registry = userTenantRegistryMap.Registry; if (registry == null) { // Registry が null というのはあり得ないが、取り敢えずはチェック LogDebug($"DB のレジストリ情報 [{mapInfo}] に対応する Registry が存在しません。"); continue; } mapInfo += $", RegistryServiceType={registry.ServiceType}"; // テナントの取得 Tenant tenant = tenantRepository.Get(userTenantRegistryMap.TenantRegistryMap.TenantId); if (tenant == null) { // テナントが null というのはあり得ないが、取り敢えずはチェック LogError($"DB のレジストリ情報 [{ mapInfo}] に対応するテナントが存在しません。"); continue; } // RegistryService の取得 IRegistryService registryService = getRegistryService(registry); if (registryService == null) { LogError($"DB のレジストリ情報 [{mapInfo}] に対応する RegistryService を取得できませんでした。"); continue; } // パスワードが空なら同期させない if (string.IsNullOrEmpty(userTenantRegistryMap.RegistryPassword)) { LogDebug($"DB のレジストリ情報 [{mapInfo}] のレジストリ・パスワードが空なので Cluster(k8s) への同期は行いません。"); continue; } // Docker コンフィグの取得 string dockerCfg = registryService.GetDockerCfgAuthString(userTenantRegistryMap); if (dockerCfg == null) { LogError($"DB のレジストリ情報 [{ mapInfo}] に同期させる Docker コンフィグを取得できませんでした。"); continue; } // シークレット情報の生成 var inModel = new RegistRegistryTokenInputModel() { TenantName = tenant.Name, RegistryTokenKey = userTenantRegistryMap.RegistryTokenKey, DockerCfgAuthString = dockerCfg, Url = userTenantRegistryMap.Registry.RegistryUrl }; // Cluster(k8s) にシークレットを同期 bool ret = clusterManagementService.RegistRegistryTokenyAsync(inModel).Result; if (ret) { LogDebug($"DB のレジストリ情報 [{mapInfo}] に対応するシークレットを Cluster(k8s) へ同期させました。"); } else { LogError($"DB のレジストリ情報 [{mapInfo}] に対応するシークレットを Cluster(k8s) へ同期させる処理に失敗しました。"); } } // DB のノード情報に対応するパーティションを Cluster(k8s) へ同期 var nodes = nodeRepository.GetAll(); foreach (Node node in nodes) { bool ret = clusterManagementService.SetNodeLabelAsync(node.Name, containerManageOptions.ContainerLabelPartition, node.Partition).Result; if (!ret) { LogError($"DB のノード情報 [{node.Name}] に対応するパーティションを Cluster(k8s) へ同期させる処理に失敗しました。"); continue; } string tensorBoardEnabledStr = node.TensorBoardEnabled ? "true" : ""; ret = clusterManagementService.SetNodeLabelAsync(node.Name, containerManageOptions.ContainerLabelTensorBoardEnabled, tensorBoardEnabledStr).Result; if (ret) { LogDebug($"DB のノード情報 [{node.Name}] に対応するパーティションと TensorBoard 可否設定を Cluster(k8s) へ同期させました。"); } else { LogError($"DB のノード情報 [{node.Name}] に対応する TensorBoard 可否設定を Cluster(k8s) へ同期させる処理に失敗しました。"); } } LogInfo("DB のテナント・レジストリ・ノード情報を Cluster(k8s) へ同期させる処理は終了しました。"); } catch (Exception e) { //例外をキャッチしたが ERROR ログを出力して処理を継続 LogError($"DB のテナント・レジストリ・ノード情報を Cluster(k8s) へ同期させる時に例外をキャッチしましたが web-api は継続処理します。 例外メッセージ=\"{e.Message}\""); } }
public RegistryController(IRegistryService registryService, IFileService FileService) { _registryService = registryService; _fileService = FileService; }
public ConfirmCommandTest() { _cryptoServiceMock = new CryptoServiceMock(); _registryServiceMock = new RegistryServiceMock(); _loggerServiceMock = new LoggerServiceMock(); }
/// <summary> /// Unregisters an entity as observable for a given topic. /// This method is called by a management service or actor. /// </summary> /// <param name="topic">The topic.</param> /// <param name="useObserverAsProxy">Observable uses one observer for each cluster node as a proxy when true, /// it directly sends the message to all observers otherwise.</param> /// <returns>The asynchronous result of the operation.</returns> public async Task UnregisterObservableActorAsync(string topic, bool useObserverAsProxy) { EntityId id = await this.GetEntityIdAsync(); if (id == null) { return; } if (string.IsNullOrWhiteSpace(topic)) { throw new ArgumentException($"The {nameof(topic)} parameter cannot be null.", nameof(topic)); } ConditionalValue <Dictionary <Uri, ObserverInfo> > topicState = await this.StateManager.TryGetStateAsync <Dictionary <Uri, ObserverInfo> >(topic); if (!topicState.HasValue) { throw new ArgumentException($"{id} is not an observable for Topic=[{topic}]"); } Dictionary <Uri, ObserverInfo> observerDictionary = topicState.Value; try { for (int k = 1; k <= ConfigurationHelper.MaxQueryRetryCount; k++) { try { IRegistryService registryService = ServiceProxy.Create <IRegistryService>(ConfigurationHelper.RegistryServiceUri, new ServicePartitionKey(PartitionResolver.Resolve(topic, ConfigurationHelper.RegistryServicePartitionCount))); await registryService.UnregisterObservableAsync(topic, id); break; } catch (FabricTransientException ex) { ActorEventSource.Current.Error(ex); if (k == ConfigurationHelper.MaxQueryRetryCount) { throw; } } catch (AggregateException ex) { foreach (Exception innerException in ex.InnerExceptions) { ActorEventSource.Current.Error(innerException); } if (k == ConfigurationHelper.MaxQueryRetryCount) { throw; } } catch (Exception ex) { ActorEventSource.Current.Error(ex); if (k == ConfigurationHelper.MaxQueryRetryCount) { throw; } } await Task.Delay(ConfigurationHelper.BackoffQueryDelay); } List <Task> taskList = new List <Task>(); try { if (useObserverAsProxy) { // observers are grouped by NodeName taskList.AddRange( observerDictionary. Select(kvp => kvp.Value.EntityId). GroupBy(e => e.NodeName). Select(groupingByNodeName => ProcessingHelper.GetObserverProxyAndList(groupingByNodeName, true)). Select(tuple => ProcessingHelper.UnregisterObservableAsync(topic, tuple.Item1, id, tuple.Item2))); } else { taskList.AddRange( observerDictionary.Select( observer => ProcessingHelper.UnregisterObservableAsync(topic, observer.Value.EntityId, id, null))); } await Task.WhenAll(taskList.ToArray()); } catch (AggregateException ex) { foreach (Exception e in ex.InnerExceptions) { ActorEventSource.Current.Error(e); } } catch (Exception ex) { ActorEventSource.Current.Error(ex); } await this.StateManager.TryRemoveStateAsync(topic); ActorEventSource.Current.Message($"Observable successfully unregistered.\r\n[Observable]: {id}\r\n[Publication]: Topic=[{topic}]."); } catch (FabricTransientException ex) { ActorEventSource.Current.Error(ex); } catch (AggregateException ex) { foreach (Exception e in ex.InnerExceptions) { ActorEventSource.Current.Error(e); } throw; } catch (Exception ex) { ActorEventSource.Current.Error(ex); throw; } }
public WindowCmdCommandTest() { _cryptoServiceMock = new CryptoServiceMock(); _registryServiceMock = new RegistryServiceMock(); _loggerServiceMock = new LoggerServiceMock(); }
public AkkaServer(string actorName, string actorConfig, IDictionary <string, ZooyardActor> actors, IRegistryService registryService, ILoggerFactory loggerFactory) : this(ActorSystem.Create(actorName.Replace(".", "-"), ConfigurationFactory.ParseString(actorConfig)), actors, registryService, loggerFactory) { }
public CompilerFactory(IRegistryService registryService) { _languagePlugins = registryService.SearchForType <ILanguagePlugin>(registryService.LoadAllPlugins()); }
public RegistryApplicationService(IRegistryService service, IUnitOfWork uow) : base(uow) { _service = service; }
public UpdateParameterCommandTest() { _cryptoServiceMock = new CryptoServiceMock(); _registryServiceMock = new RegistryServiceMock(); _loggerServiceMock = new LoggerServiceMock(); }
public Controller(IRegistryService registryService) { _registryService = registryService; }
public HandInFileMetadataStorageService(IRegistryService registryService) { this._registryService = registryService; }
/// <summary> /// Get reference to the registry. /// </summary> void Awake() { registry = IOC.Resolve<IRegistryService>(); }
public RegistryController(IRegistryService registry_service) { this._registry_service = registry_service; }