public virtual IGameletClientFactory GetGameletClientFactory() { if (_gameletClientFactory == null) { _gameletClientFactory = new GameletClient.Factory(); } return(_gameletClientFactory); }
public void SetUp() { gameletClient = Substitute.For <IGameletClient>(); gameletClientFactory = Substitute.For <GameletClient.Factory>(); gameletClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(gameletClient); cloudRunner = Substitute.For <ICloudRunner>(); sshKeyLoader = Substitute.For <ISshKeyLoader>(); sshKnownHostsWriter = Substitute.For <ISshKnownHostsWriter>(); remoteCommand = Substitute.For <IRemoteCommand>(); sshManager = new SshManager(gameletClientFactory, cloudRunner, sshKeyLoader, sshKnownHostsWriter, remoteCommand); }
// Creates a DebugPortSupplier with specific factories. Used by tests. public DebugPortSupplier(DebugPort.Factory debugPortFactory, GameletClient.Factory gameletClientFactory, IExtensionOptions options, IDialogUtil dialogUtil, CancelableTask.Factory cancelableTaskFactory, IMetrics metrics, ICloudRunner cloudRunner, string developerAccount) { _debugPortFactory = debugPortFactory; _gameletClientFactory = gameletClientFactory; _dialogUtil = dialogUtil; _cancelableTaskFactory = cancelableTaskFactory; _metrics = metrics; _cloudRunner = cloudRunner; _developerAccount = developerAccount; }
public CoreAttachWindow(IServiceProvider serviceProvider) { var serviceManager = new ServiceManager(); _taskContext = serviceManager.GetJoinableTaskContext(); _dialogUtil = new DialogUtil(); IExtensionOptions options = ((YetiVSIService)serviceManager.RequireGlobalService(typeof(YetiVSIService))) .Options; var managedProcessFactory = new ManagedProcess.Factory(); var progressDialogFactory = new ProgressDialog.Factory(); _cancelableTaskFactory = new CancelableTask.Factory(_taskContext, progressDialogFactory); _coreListRequest = new CoreListRequest.Factory().Create(); var jsonUtil = new JsonUtil(); var credentialConfigFactory = new CredentialConfig.Factory(jsonUtil); var accountOptionLoader = new VsiAccountOptionLoader(options); var credentialManager = new CredentialManager(credentialConfigFactory, accountOptionLoader); _developerAccount = credentialManager.LoadAccount(); IRemoteCommand remoteCommand = new RemoteCommand(managedProcessFactory); _remoteFile = new RemoteFile(managedProcessFactory); var cloudConnection = new CloudConnection(); var sdkConfigFactory = new SdkConfig.Factory(jsonUtil); // NOTE: the lifetime of this CloudRunner is limited to the current CoreAttachWindow. _cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager, cloudConnection, new GgpSDKUtil()); _gameletClientFactory = new GameletClient.Factory(); var sshKeyLoader = new SshKeyLoader(managedProcessFactory); var sshKnownHostsWriter = new SshKnownHostsWriter(); _sshManager = new SshManager(_gameletClientFactory, _cloudRunner, sshKeyLoader, sshKnownHostsWriter, remoteCommand); _debugSessionMetrics = new DebugSessionMetrics( serviceProvider.GetService(typeof(SMetrics)) as IMetrics); _debugSessionMetrics.UseNewDebugSessionId(); _actionRecorder = new ActionRecorder(_debugSessionMetrics); InitializeComponent(); _instanceSelectionWindowFactory = new ProjectInstanceSelection.Factory(); _paramsFactory = new DebugEngine.DebugEngine.Params.Factory(jsonUtil); SelectInstanceOnInit(); }
// Creates a DebugPortSupplier. This will be invoked by Visual Studio based on this class // Guid being in the registry. public DebugPortSupplier() { // Factory creation for the PortSupplier entry point. var serviceManager = new ServiceManager(); IExtensionOptions options = ((YetiVSIService)serviceManager.RequireGlobalService(typeof(YetiVSIService))) .Options; var taskContext = serviceManager.GetJoinableTaskContext(); var debugPropertyFactory = new DebugProperty.Factory(); var debugProgramFactory = new DebugProgram.Factory(debugPropertyFactory, options); var debugProcessFactory = new DebugProcess.Factory(debugProgramFactory); var managedProcessFactory = new ManagedProcess.Factory(); var processListRequestFactory = new ProcessListRequest.Factory(managedProcessFactory); var jsonUtil = new JsonUtil(); var sdkConfigFactory = new SdkConfig.Factory(jsonUtil); var credentialConfigFactory = new CredentialConfig.Factory(jsonUtil); var accountOptionLoader = new VsiAccountOptionLoader(options); var credentialManager = new CredentialManager(credentialConfigFactory, accountOptionLoader); _developerAccount = credentialManager.LoadAccount(); _dialogUtil = new DialogUtil(); var progressDialogFactory = new ProgressDialog.Factory(); _cancelableTaskFactory = new CancelableTask.Factory(taskContext, progressDialogFactory); var cloudConnection = new CloudConnection(); // NOTE: this CloudRunner is re-used for all subsequent Attach to Process windows. _cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager, cloudConnection, new GgpSDKUtil()); var sshKeyLoader = new SshKeyLoader(managedProcessFactory); var sshKnownHostsWriter = new SshKnownHostsWriter(); _gameletClientFactory = new GameletClient.Factory(); var sshManager = new SshManager(_gameletClientFactory, _cloudRunner, sshKeyLoader, sshKnownHostsWriter, new RemoteCommand(managedProcessFactory)); _metrics = (IMetrics)serviceManager.RequireGlobalService(typeof(SMetrics)); _debugPortFactory = new DebugPort.Factory( debugProcessFactory, processListRequestFactory, _cancelableTaskFactory, _dialogUtil, sshManager, _metrics, _developerAccount); }