예제 #1
0
        public Guid SubmitJob(
            JobParameters jobParameters,
            CancellationToken ct)
        {
            ValidateInputs(jobParameters);

            var jobId = Guid.NewGuid();

            var job = BuildAPSIMJobAndStageFiles(
                jobId,
                jobParameters.ApplicationPackageVersion,
                jobParameters.JobDisplayName,
                jobParameters.ModelPath,
                ct);

            SubmitJob(jobId, job, jobParameters.JobManagerShouldSubmitTasks, jobParameters.AutoScale);

            if (!jobParameters.JobManagerShouldSubmitTasks)
            {
                // Client side submit
                var taskProvider = new TaskProvider(
                    _storageCredentials,
                    jobParameters.ModelPath,
                    jobParameters.CoresPerProcess);

                var tasks = taskProvider.GetTasks(jobId).ToList();
                _batchClient.JobOperations.AddTask(jobId.ToString(), tasks);
            }

            Console.WriteLine("Submitted Job {0}", jobId);

            return(jobId);
        }
        public void RunTest()
        {
            TaskProvider p = new TaskProvider();

            p.Run(3);
            Assert.Fail();
        }
 public ActionResult _EditTaskNotification(Model.EditTaskNoficationModel pModel)
 {
     if (ModelState.IsValid)
     {
         TaskProvider        taskProvider     = new TaskProvider();
         TaskNotificationDTO taskNotification = new TaskNotificationDTO();
         taskNotification.id_notification = pModel.id_notification;
         taskNotification.message         = pModel.message;
         taskNotification.userLog         = Request.Cookies["user_id"].Value;
         taskNotification.isStarting      = "False";
         taskNotification.isTelegram      = pModel.isTelegram == "on" ? "True" : "False";
         taskNotification.isIntern        = pModel.isIntern == "on" ? "True" : "False";
         taskNotification.isEmail         = pModel.isEmail == "on" ? "True" : "False";
         taskNotification.task_id         = pModel.id_task;
         if (taskProvider.putTaskNotification(taskNotification).Result)
         {
             if (taskNotification.isTelegram == "True")
             {
             }
             if (taskNotification.isIntern == "True")
             {
             }
             if (taskNotification.isEmail == "True")
             {
             }
             return(_TaskNotificationList(taskNotification.task_id));
         }
     }
     return(new HttpStatusCodeResult(404, "Error, no se puede agregar la notificación"));
 }
예제 #4
0
        /// <summary>
        /// Constructor.  Inititialize member data.
        /// </summary>
        public NemerleIdeBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy)
        {
            // HACK: We should use VS Automation for retrive root key!
            Regex rx    = new Regex(@"/rootsuffix\s+(.+)");
            Match match = rx.Match(Environment.CommandLine);

            if (match.Success)
            {
                _buildVerbosityRegistryRoot = @"Software\Microsoft\VisualStudio\8.0"
                                              + match.Groups[1].Value.Trim();
            }

            if (taskProvider == null)
            {
                throw new ArgumentNullException("taskProvider");
            }
            if (hierarchy == null)
            {
                throw new ArgumentNullException("hierarchy");
            }

            _taskProvider     = taskProvider;
            _outputWindowPane = output;
            _hierarchy        = hierarchy;
            IOleServiceProvider site;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hierarchy.GetSite(out site));
            _serviceProvider = new ServiceProvider(site);
        }
예제 #5
0
 public async Task <List <ActionResult> > Execute(
     ILog log,
     object subject,
     CancellationToken cancellationToken,
     bool isPreviewOnly = true
     )
 {
     if (TaskProvider != null && TaskConfig != null)
     {
         try
         {
             return(await TaskProvider.Execute(log, subject, TaskConfig, _credentials, isPreviewOnly, null, cancellationToken));
         }
         catch (Exception exp)
         {
             return(new List <ActionResult> {
                 new ActionResult {
                     IsSuccess = false, Message = $"{TaskConfig.TaskName} ({TaskProvider.GetDefinition()?.Title }) :: Task Failed with Exception :: {exp?.ToString()}"
                 }
             });
         }
     }
     else
     {
         return(new List <ActionResult> {
             new ActionResult {
                 IsSuccess = false, Message = "Cannot Execute Deployment Task: TaskProvider or Config not set."
             }
         });
     }
 }
예제 #6
0
 public void SendToSelected(TaskProvider taskProvider)
 {
     foreach (var entity in _selectedEntities)
     {
         entity.Process(taskProvider);
     }
 }
 public ActionResult _ConfirrmTask(string id_task)
 {
     if (ModelState.IsValid)
     {
         var                parameters         = Request.Params;
         TaskProvider       taskProvider       = new TaskProvider();
         TaskResponsableDTO taskResponsableDTO = new TaskResponsableDTO();
         taskResponsableDTO.task_id     = id_task;
         taskResponsableDTO.user_id     = Request.Cookies["user_id"].Value;
         taskResponsableDTO.isConfirmed = "True";
         taskResponsableDTO.userLog     = Request.Cookies["user_id"].Value;
         if (taskProvider.putTaskResponsable(taskResponsableDTO).Result)
         {
             List <TaskResponsableDTO> taskResponsables = taskProvider.getTaskResponsables(id_task).Result;
             bool isTaskCompleted = true;
             foreach (var user in taskResponsables)
             {
                 if (user.isConfirmed == "False")
                 {
                     isTaskCompleted = false;
                 }
             }
             if (isTaskCompleted)
             {
                 completeTask(id_task);
             }
             return(Content(isTaskCompleted ? "True" : id_task));
         }
     }
     return(new HttpStatusCodeResult(404, "Error, no se puede agregar la notificación"));
 }
예제 #8
0
        public void Run(Func <ITestResult, ITestResult> resultInspector = null)
        {
            var taskProvider = TaskProvider.Create(new RemoteTaskServer(taskServer, null), CreateTaskNodes());
            var run          = new XunitTestRun(new RemoteTaskServer(taskServer, null), new FakeExecutorWrapper(this, resultInspector), taskProvider);

            run.RunTests();
        }
예제 #9
0
        private IAccessControlEditorDialogProvider ProviderFromResourceType(System.Security.AccessControl.ResourceType resType)
        {
            IAccessControlEditorDialogProvider prov = null;

            switch (resType)
            {
            case System.Security.AccessControl.ResourceType.FileObject:
                prov = new FileProvider();
                break;

            case System.Security.AccessControl.ResourceType.KernelObject:
                prov = new KernelProvider();
                break;

            case System.Security.AccessControl.ResourceType.RegistryKey:
                prov = new RegistryProvider();
                break;

            case TaskResourceType:
                prov = new TaskProvider();
                break;

            default:
                prov = new GenericProvider();
                break;
            }
            return(prov);
        }
예제 #10
0
 public async Task <List <ActionResult> > Execute(
     ILog log,
     ManagedCertificate managedCert,
     bool isPreviewOnly = true
     )
 {
     if (TaskProvider != null && TaskConfig != null)
     {
         try
         {
             return(await TaskProvider.Execute(log, managedCert, TaskConfig, _credentials, isPreviewOnly, null));
         }
         catch (Exception exp)
         {
             return(new List <ActionResult> {
                 new ActionResult {
                     IsSuccess = false, Message = $"Task Failed: {TaskProvider.GetDefinition()?.Title } :: {exp?.ToString()}"
                 }
             });
         }
     }
     else
     {
         return(new List <ActionResult> {
             new ActionResult {
                 IsSuccess = false, Message = "Cannot Execute Deployment Task: TaskProvider or Config not set."
             }
         });
     }
 }
예제 #11
0
        public void AggregateExceptionWithTwoInnerExceptionsThrown_When_AggregateExceptionWithTwoInnerExceptionsThrownInsideAction_AndShouldRethrowExceptionIsTrue()
        {
            // Arrange
            var    expectedInternalException1        = new Exception(_fixture.Create <string>());
            var    expectedInternalException2        = new ArgumentException(_fixture.Create <string>());
            string expectedAggregateExceptionMessage = _fixture.Create <string>();
            var    aggregateException = new AggregateException(expectedAggregateExceptionMessage, expectedInternalException1, expectedInternalException2);

            List <string>    messages         = new List <string>();
            List <Exception> actualExceptions = new List <Exception>();

            _exceptionLoggerMock.Setup(x => x.LogErrorAsync(It.IsAny <string>(), It.IsAny <Exception>())).Callback((string exMessage, Exception ex) =>
            {
                messages.Add(exMessage);
                actualExceptions.Add(ex);
            });
            var taskProvider            = new TaskProvider(_exceptionLoggerMock.Object);
            var cancellationTokenSource = new CancellationTokenSource();

            // Act
            // Assert
            Assert.Throws <AggregateException>(() => taskProvider.StartNewLongRunningRepeating(cancellationTokenSource, () => throw aggregateException, 200).Wait(), expectedAggregateExceptionMessage);

            Assert.That(messages.First(), Is.EqualTo(typeof(Exception).Name));
            Assert.That(messages.Last(), Is.EqualTo(typeof(ArgumentException).Name));
            Assert.That(actualExceptions.First(), Is.EqualTo(expectedInternalException1));
            Assert.That(actualExceptions.Last(), Is.EqualTo(expectedInternalException2));

            // Clean up
            cancellationTokenSource.Cancel();
        }
예제 #12
0
        public void ExceptionLogged_When_ExceptionThrownInsideAction()
        {
            // Arrange
            string expectedInnerExceptionMessage = _fixture.Create <string>();
            var    expectedInternalException     = new Exception(expectedInnerExceptionMessage);

            string actualExceptionMessage = string.Empty;
            var    actualException        = default(Exception);

            _exceptionLoggerMock.Setup(x => x.LogErrorAsync(It.IsAny <string>(), It.IsAny <Exception>())).Callback((string exMessage, Exception ex) =>
            {
                actualExceptionMessage = exMessage;
                actualException        = ex;
            });
            var taskProvider            = new TaskProvider(_exceptionLoggerMock.Object);
            var cancellationTokenSource = new CancellationTokenSource();

            // Act
            // Assert
            taskProvider.StartNewLongRunningRepeating(cancellationTokenSource, () => throw expectedInternalException, 200);
            Thread.Sleep(1000);

            Assert.That(actualExceptionMessage, Is.EqualTo(expectedInnerExceptionMessage));
            Assert.That(actualException, Is.EqualTo(expectedInternalException));

            // Clean up
            cancellationTokenSource.Cancel();
        }
예제 #13
0
 protected override void Awake()
 {
     base.Awake();
     _actorTaskProvider = TaskProvider.Create <ActorTaskProviderControl>();
     _selectedEntities  = new List <Entity>();
     RegisterEvents();
 }
예제 #14
0
        public void AggregateExceptionThrown_When_AggregateExceptionThrownInsideAction_AndShouldRethrowExceptionIsTrue()
        {
            // Arrange
            var    expectedException = new Exception(_fixture.Create <string>());
            string expectedAggregateExceptionMessage = _fixture.Create <string>();
            var    aggregateException = new AggregateException(expectedAggregateExceptionMessage, expectedException);
            string message            = string.Empty;
            var    actualException    = default(Exception);

            _exceptionLoggerMock.Setup(x => x.LogErrorAsync(It.IsAny <string>(), It.IsAny <Exception>())).Callback((string exMessage, Exception ex) =>
            {
                message         = exMessage;
                actualException = ex;
            });
            var taskProvider            = new TaskProvider(_exceptionLoggerMock.Object);
            var cancellationTokenSource = new CancellationTokenSource();

            // Act
            // Assert
            Assert.Throws <AggregateException>(() => taskProvider.StartNewLongRunningRepeating(cancellationTokenSource, () => throw aggregateException, 200).Wait(), expectedAggregateExceptionMessage);

            Assert.That(message, Is.EqualTo(typeof(Exception).Name));
            Assert.That(actualException, Is.EqualTo(expectedException));

            // Clean up
            cancellationTokenSource.Cancel();
        }
        public ActionResult _AddTaskNotificationUser(string id_notification, List <string> selected_userParticipants_id)
        {
            if (ModelState.IsValid)
            {
                TaskProvider taskProvider = new TaskProvider();
                List <TaskNotificationUserDTO> taskNotificationUsers = new List <TaskNotificationUserDTO>();
                foreach (var user_id in selected_userParticipants_id)
                {
                    TaskNotificationUserDTO taskNotificationUser = new TaskNotificationUserDTO();
                    taskNotificationUser.user_id         = user_id;
                    taskNotificationUser.userLog         = Request.Cookies["user_id"].Value;
                    taskNotificationUser.notification_id = id_notification;
                    taskNotificationUsers.Add(taskNotificationUser);
                }

                List <TaskNotificationUserDTO> adddedUsers = taskProvider.postTaskNotificationUser(taskNotificationUsers).Result;
                int addedCount = adddedUsers.Count;
                int errorCount = taskNotificationUsers.Count - addedCount;
                TaskNotificationDTO taskNotification = new TaskNotificationDTO();
                taskNotification.id_notification = id_notification;
                var result = new { id_notification = id_notification, usersAdded = addedCount, usersError = errorCount,
                                   viewHtml        = PartialView("/Views/Tasks/_Tasks/_TaskDetails/_TaskNotificationsUsers.cshtml", new Model.TaskNotificationsUserModel(taskNotification)).RenderToString() };

                return(Json(result));
            }
            return(new HttpStatusCodeResult(404, "Error, no se puede agregar la notificación"));
        }
예제 #16
0
        private void CreateOkButton_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }

            TaskExtModel task = new TaskExtModel();

            task.Title       = titleTextBox.Text;
            task.Description = descriptionTextBox.Text;
            task.Begin       = DateTime.Now;
            task.Deadline    = dateTimePicker.Value.Date;

            try
            {
                task.Id = TaskProvider.CreateTask(
                    task, SubjectId, GroupId);

                if (picturePath.Text != "")
                {
                    TaskProvider.UploadImage(task.Id, picturePath.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            TaskCreated?.Invoke(task, EventArgs.Empty);

            this.Close();
        }
예제 #17
0
        private void EditOkButton_Click(object sender, EventArgs e)
        {
            if (!ValidateFields())
            {
                return;
            }

            string prevPath = Model.Photo;

            Model.Title       = titleTextBox.Text;
            Model.Description = descriptionTextBox.Text;
            Model.Deadline    = dateTimePicker.Value.Date;

            try
            {
                TaskProvider.Update(Model);

                if (picturePath.Text.Length != 0)
                {
                    Model = TaskProvider.UploadImage(Model.Id, picturePath.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            TaskEdited?.Invoke(Model, EventArgs.Empty);

            this.Close();
        }
예제 #18
0
 public void TestUncontrolledMethodReturnsGenericTask()
 {
     this.Test(async() =>
     {
         var task = TaskProvider.GetGenericTask <int>();
         await task;
     });
 }
예제 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlanningPokerController" /> class.
 /// </summary>
 /// <param name="dateTimeProvider">The date time provider to provide current date-time.</param>
 /// <param name="configuration">The configuration of the planning poker.</param>
 /// <param name="repository">The Scrum teams repository.</param>
 /// <param name="taskProvider">The system tasks provider.</param>
 /// <param name="logger">Logger instance to log events.</param>
 public PlanningPokerController(DateTimeProvider dateTimeProvider, IPlanningPokerConfiguration configuration, IScrumTeamRepository repository, TaskProvider taskProvider, ILogger <PlanningPokerController> logger)
 {
     DateTimeProvider = dateTimeProvider ?? Duracellko.PlanningPoker.Domain.DateTimeProvider.Default;
     Configuration    = configuration ?? new PlanningPokerConfiguration();
     Repository       = repository ?? new EmptyScrumTeamRepository();
     _taskProvider    = taskProvider ?? TaskProvider.Default;
     _logger          = logger;
 }
 public UnresolvedImportSquiggleProvider(IServiceProvider serviceProvider, TaskProvider taskProvider) {
     _serviceProvider = serviceProvider;
     _taskProvider = taskProvider;
     var options = _serviceProvider.GetPythonToolsService()?.GeneralOptions;
     if (options != null) {
         _enabled = options.UnresolvedImportWarning;
         options.Changed += GeneralOptions_Changed;
     }
 }
예제 #21
0
 private static PlanningPokerController CreatePlanningPokerController(
     DateTimeProvider dateTimeProvider = null,
     Configuration.IPlanningPokerConfiguration configuration = null,
     PlanningPoker.Data.IScrumTeamRepository repository      = null,
     TaskProvider taskProvider = null,
     ILogger <PlanningPokerController> logger = null)
 {
     return(new PlanningPokerController(dateTimeProvider, configuration, repository, taskProvider, logger));
 }
예제 #22
0
        /// <summary>
        /// Удалить модель
        /// </summary>
        /// <param name="model"></param>
        public void DeleteTask(TaskExtModel model)
        {
            Tasks.Remove(model);

            /// Ленивая реализация - по-хорошему нужен отдельный event
            TasksUpdated?.Invoke(this, EventArgs.Empty);

            TaskProvider.Delete(model.Id);
        }
        public async Task <IHttpActionResult> NotRegisteredUserTask(TaskViewModel taskViewModel)
        {
            taskViewModel.Region = Denmark_addressess.GetMunicipalityCode(taskViewModel.ClientStreetName, taskViewModel.ClientPostCode.ToString(), taskViewModel.ClientHouseNumber, taskViewModel.ClientCity);


            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var            randomPass     = GenerateRandomPassword.GenerateRandomPass();
            RegisterClient registerClient = new RegisterClient();

            registerClient.Email           = taskViewModel.ClientEmail;
            registerClient.Password        = randomPass;
            registerClient.ConfirmPassword = randomPass;

            var user = new ApplicationUser()
            {
                UserName = taskViewModel.ClientEmail, Email = taskViewModel.ClientEmail
            };

            IdentityResult result = await UserManager.CreateAsync(user, randomPass);

            if (result.Succeeded)
            {
                var UserId = UserManager.FindByEmail(taskViewModel.ClientEmail);

                ClientProvider.SaveClientInfo(taskViewModel.ClientName, taskViewModel.ClientEmail, UserId.Id);

                TaskProvider.SaveTaskRegisteredUser(taskViewModel, UserId.Id);
                UserManager.AddToRole(UserId.Id, "Client");
            }


            if (!result.Succeeded)
            {
                return(GetErrorResult(result));
            }
            var httpStatusCode = HttpStatusCode.Accepted;
            var responseMsg    = new HttpResponseMessage(httpStatusCode)
            {
                Content = new StringContent("", Encoding.UTF8, "application/json")
            };

            MitBudDBEntities mitBudDB = new MitBudDBEntities();


            var UserEmail = mitBudDB.AspNetUsers.Where(x => x.Email == taskViewModel.ClientEmail).SingleOrDefault();

            string token = await UserManager.GeneratePasswordResetTokenAsync(UserEmail.Id);

            Email.sendCreatePasswordByEmail(taskViewModel.ClientEmail, taskViewModel.ClientName, token);

            return(Ok());
        }
예제 #24
0
        /// <summary>
        /// This is the common function that executes the verification that the build
        /// messages are correctly written or omitted from the output according with
        /// the verbosity level.
        /// It takes as argument a function that set the verbosity for the logger. This
        /// delegate is needed because there are at least two different ways to set the
        /// verbosity: one reading it from the registry, the other setting it directly
        /// on the logger.
        /// </summary>
        private static void VerifyLoggingByVerbosity(LoggerVerbositySetter verbositySetter)
        {
            using (OleServiceProvider provider = new OleServiceProvider())
            {
                using (TaskProvider task = new TaskProvider(new ServiceProvider(provider)))
                {
                    IVsHierarchy hierarchy  = MockFactories.HierarchyForLogger(provider);
                    BaseMock     mockOutput = MockFactories.OutputWindowPaneFactory.GetInstance();

                    // Create the logger and make sure that it points to the verbosity
                    // registry key that we have deleted at the beginning of the test.
                    IDELoggerProxy logger = new IDELoggerProxy(mockOutput as IVsOutputWindowPane, task, hierarchy);
                    logger.SetBuildVerbosityRegistryRoot(TestVerbosityRoot);

                    // Create the IEventSource that will be used to send messages to the logger
                    BaseMock mockSource = MockFactories.CreateMSBuildEventSource();

                    // Now initialize the logger.
                    logger.Initialize(mockSource as IEventSource);
                    // Verify that the logger has installed an event handler for messages.
                    Assert.IsNotNull(mockSource["MessageRaised"]);
                    BuildMessageEventHandler messageHandler = (BuildMessageEventHandler)mockSource["MessageRaised"];

                    foreach (VerbosityImportancePair expected in expectedVerbosityImportancePair)
                    {
                        // Because the IDEBuildLogger caches its Verbosity setting after reading it
                        // from the registry, we need to clear the cached value before calling the
                        // verbositySetter, which may set verbosity by changing the registry value.
                        logger.ClearVerbosityCache();

                        // Set the verbosity of the logger.
                        verbositySetter(logger, expected.Verbosity);
                        // Create a message of the expected importance.
                        BuildMessageEventArgs message = new BuildMessageEventArgs("message", "help", "sender", expected.Importance);

                        // Reset the counter of the calls to the output window pane.
                        mockOutput.ResetAllFunctionCalls();

                        // Execute the message event handler
                        messageHandler.Invoke(mockSource, message);
                        System.Windows.Forms.Application.DoEvents();

                        // Verify that the output pane was used only if the expected result is that
                        // something should be printed on the output.
                        if (expected.ShouldPrint)
                        {
                            Assert.IsTrue(mockOutput.TotalCallsAllFunctions() > 0);
                        }
                        else
                        {
                            Assert.AreEqual <int>(mockOutput.TotalCallsAllFunctions(), 0);
                        }
                    }
                }
            }
        }
예제 #25
0
        public void ConstructorTest()
        {
            // Execute metod under test first time
            TaskProvider target = new TaskProvider(this.serviceProvider);

            Assert.IsNotNull(target, "Unable to instantiate TaskProvider.");
            Assert.IsNotNull(typeof(TaskProvider)
                             .GetField("serviceProvider", BindingFlags.Instance | BindingFlags.NonPublic)
                             .GetValue(target), "TaskProvider.provider returned null");
        }
예제 #26
0
        public void Test005DeleteTask()
        {
            TaskProvider.CreateTask(dashboardPage);

            var myTasksPage = dashboardPage.NavigationPanel.NavigateToMyTasksPage();

            myTasksPage.DeleteNewTask();

            myTasksPage.Validate().IsTaskDeleted();
        }
예제 #27
0
        public static void AddEncodingTask(EncodingAction action, string param,
                                           Preset currentPreset, List <FileSelector.FileInfo> selectPaths,
                                           string input, string output, string extra)
        {
            if (!TaskArgBuilders.ContainsKey(action))
            {
                AppContext.Status.MainStatus = $"Error: 没有找到可用的处理流程模板:{action}";
                return;
            }
            var taskArgBuilder = TaskArgBuilders[action];

            var useHdr = false;

            if (param == "HDR" || AppContext.Config.ForceHDR)
            {
                useHdr = true;
            }

            var(ext, _) = FileSelector.FileName.GetOutputExt(currentPreset.OutputFormat);

            //为每个选中的项目生成任务并推入任务队列
            foreach (var filePath in selectPaths)
            {
                var name    = filePath.Filename;
                var newTask = new EncodingTask(name, action);

                AppContext.Status.MainStatus = $"生成任务 {name}";

                var thisInput  = filePath.Path;
                var thisOutput = FileSelector.FileName.RecalcOutputPath(thisInput, output, "_neenc", ext);
                if (thisInput == input)
                {
                    thisOutput = output;
                }

                var(exeFile, exeArgs) = taskArgBuilder.Invoke(param, thisInput, thisOutput, currentPreset, useHdr, input, extra);

                newTask.RegTask(exeFile, exeArgs);
                newTask.RegInputOutput(thisInput, thisOutput);
                newTask.RunLog      += $"{exeFile} {exeArgs}\n";
                newTask.ProcessStop += async sender =>
                {
                    AppContext.Status.MainStatus = $"{name} 任务完成";
                    await Task.Delay(500);

                    TaskProvider.Schedule();
                };

                AppContext.EncodingContext.TaskQueue.Add(newTask);
            }

            //调度任务
            AppContext.Status.MainStatus = "开始任务调度";
            TaskProvider.Schedule();
        }
예제 #28
0
        public void ConstructorTest()
        {
            // Execute metod under test first time
            TaskProvider target = new TaskProvider(this.serviceProvider);

            Assert.IsNotNull(target, "Unable to instantiate TaskProvider.");

            PrivateObject taskProvider = new PrivateObject(target, new PrivateType(typeof(TaskProvider)));

            Assert.IsNotNull(taskProvider.GetFieldOrProperty("serviceProvider"), "TaskProvider.provider returned null");
        }
예제 #29
0
        public void TestInputZipFile()
        {
            var taskProvider = new TaskProvider(
                new StorageCredentials {
                Account = _storageAccount, Key = _storageKey
            },
                Path.Combine(Directory.GetCurrentDirectory(), "Input.zip"),
                1);

            Assert.AreEqual(2, taskProvider.GetTasks(Guid.NewGuid()).Count());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AzurePlanningPokerController"/> class.
 /// </summary>
 /// <param name="dateTimeProvider">The date time provider to provide current date-time.</param>
 /// <param name="guidProvider">The GUID provider to provide new GUID objects.</param>
 /// <param name="deckProvider">The provider to get estimation cards deck.</param>
 /// <param name="configuration">The configuration of the planning poker.</param>
 /// <param name="repository">The Scrum teams repository.</param>
 /// <param name="taskProvider">The system tasks provider.</param>
 /// <param name="logger">Logger instance to log events.</param>
 public AzurePlanningPokerController(
     DateTimeProvider dateTimeProvider,
     GuidProvider guidProvider,
     DeckProvider deckProvider,
     IAzurePlanningPokerConfiguration configuration,
     IScrumTeamRepository repository,
     TaskProvider taskProvider,
     ILogger <PlanningPokerController> logger)
     : base(dateTimeProvider, guidProvider, deckProvider, configuration, repository, taskProvider, logger)
 {
 }
예제 #31
0
    public override void Process(TaskProvider taskProvider)
    {
        base.Process(taskProvider);

        ActorTaskProvider actorTaskProvider = taskProvider as ActorTaskProvider;

        if (actorTaskProvider != null)
        {
            SetTaskProvider(actorTaskProvider);
        }
    }
예제 #32
0
        /// <summary>
        /// Constructor.  Inititialize member data.
        /// </summary>
        public IDEBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy)
        {
            if (taskProvider == null)
                throw new ArgumentNullException("taskProvider");
            if (hierarchy == null)
                throw new ArgumentNullException("hierarchy");

            this.taskProvider = taskProvider;
            this.outputWindowPane = output;
            this.hierarchy = hierarchy;
            IOleServiceProvider site;
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hierarchy.GetSite(out site));
            this.serviceProvider = new ServiceProvider(site);
        }
예제 #33
0
        /// <summary>
        /// Constructor.  Inititialize member data.
        /// </summary>
        public IDEBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy)
        {
            if (taskProvider == null)
                throw new ArgumentNullException("taskProvider");
            if (hierarchy == null)
                throw new ArgumentNullException("hierarchy");

            Trace.WriteLineIf(Thread.CurrentThread.GetApartmentState() != ApartmentState.STA, "WARNING: IDEBuildLogger constructor running on the wrong thread.");

            IOleServiceProvider site;
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hierarchy.GetSite(out site));

            this.taskProvider = taskProvider;
            this.outputWindowPane = output;
            this.hierarchy = hierarchy;
            this.serviceProvider = new ServiceProvider(site);
            this.dispatcher = Dispatcher.CurrentDispatcher;
        }
예제 #34
0
        /// <summary>
        /// Constructor.  Inititialize member data.
        /// </summary>
        public IDEBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy)
        {
            UIThread.MustBeCalledFromUIThread();

            Utilities.ArgumentNotNull("taskProvider", taskProvider);
            Utilities.ArgumentNotNull("hierarchy", hierarchy);

            Trace.WriteLineIf(Thread.CurrentThread.GetApartmentState() != ApartmentState.STA, "WARNING: IDEBuildLogger constructor running on the wrong thread.");

            IOleServiceProvider site;
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hierarchy.GetSite(out site));

            this.taskProvider = taskProvider;
            this.outputWindowPane = output;
            this.hierarchy = hierarchy;
            this.serviceProvider = new ServiceProvider(site);
            this.dispatcher = Dispatcher.CurrentDispatcher;
        }
예제 #35
0
        /// <summary>
        /// Disposes the project node object.
        /// </summary>
        /// <param name="disposing">Flag determining ehether it was deterministic or non deterministic clean up.</param>
        protected override void Dispose(bool disposing)
        {
            if (this.isDisposed)
            {
                return;
            }

            try
            {
                try
                {
                    this.UnRegisterProject();
                }
                finally
                {
                    try
                    {
                        this.RegisterClipboardNotifications(false);
                    }
                    finally
                    {
                        try
                        {

                            if (this.projectEventsProvider != null)
                            {
                                this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
                            }
                            if (this.taskProvider != null)
                            {
                                this.taskProvider.Tasks.Clear();
                                this.taskProvider.Refresh();
                                this.taskProvider.Dispose();
                                this.taskProvider = null;
                            }
                            if (buildLogger != null)
                            {
                                buildLogger = null;
                            }
                            this.site = null;
                        }
                        finally
                        {
                            if (this.buildEngine != null)
                            {
                                this.buildEngine.UnregisterAllLoggers();
                                this.buildEngine = null;
                            }
                        }
                    }
                }

                if (this.buildProject != null)
                {
                    //this.projectInstance = null;
                    MSBuildProject.FullyUnloadProject(this.buildProject.ProjectCollection, this.buildProject);
                    SetBuildProject(null);
                }

                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
                this.isDisposed = true;
            }
        }
예제 #36
0
 /// <include file='doc\Source.uex' path='docs/doc[@for="Source.GetTaskProvider"]/*' />
 public virtual TaskProvider GetTaskProvider()
 {
     if (this.taskProvider == null) {
         this.taskProvider = new ErrorListProvider(service.Site); // task list
         // <temporary hack>
         // Due to the fact that the ErrorList is not yet working...the
         // following at least results in all tasks from the same language
         // service into one list.
         this.taskProvider.ProviderGuid = service.GetLanguageServiceGuid();
         this.taskProvider.ProviderName = service.Name;
         // </temporary hack>
     }
     return this.taskProvider;
 }
예제 #37
0
    /// <include file='doc\Project.uex' path='docs/doc[@for="Project.Close"]/*' />
    public override int Close(){
      Project.ProjectList.Remove(this.automation);
      automation = null;
      this.ClearLibraryReferences();
      this.ClearStaticReferencesToThis();
      UnregisterSccProject();
#if WHIDBEY
      // release the task manager
      if ((this.taskManager != null || this.taskManagerBuild != null) && Site != null) {
        ITaskManagerFactory taskManagerFactory = (ITaskManagerFactory)Site.GetService(typeof(ITaskManagerFactory));
        if (taskManagerFactory != null) {
          if (this.taskManager != null)      taskManagerFactory.ReleaseSharedTaskManager(this.taskManager);
          if (this.taskManagerBuild != null) taskManagerFactory.ReleaseSharedTaskManager(this.taskManagerBuild);
        }
      }
      this.taskManager = null;
      this.taskManagerBuild = null;
#endif
      
      base.Close();
      if (this.taskProvider != null){
        this.taskProvider.Dispose();
        this.taskProvider = null;
      }
      this.Site = null;
      this.UIShell = null;
      return 0;
    }
예제 #38
0
        /// <summary>
        /// Closes the project node.
        /// </summary>
        /// <returns>A success or failure value.</returns>
        public override int Close()
        {
            int hr = VSConstants.S_OK;

            try
            {
                this.UnRegisterProject();
            }
            catch (COMException e)
            {
                Trace.WriteLine(e);
                hr = e.ErrorCode;
            }
            finally
            {
                try
                {
                    this.RegisterClipboardNotifications(false);
                    hr = ErrorHandler.ThrowOnFailure(base.Close());
                }
                catch (COMException e)
                {
                    Trace.WriteLine(e);
                    hr = e.ErrorCode;
                }
                finally
                {
                    try
                    {
                        if (this.projectEventsProvider != null)
                        {
                            this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
                        }
                        if (this.taskProvider != null)
                        {
                            taskProvider.Tasks.Clear();
                            this.taskProvider.Dispose();
                            this.taskProvider = null;
                        }
                        if (buildLogger != null)
                        {
                            buildLogger = null;
                        }
                        this.site = null;
                        this.isClosed = true;
                    }
                    finally
                    {
                        if (this.buildEngine != null)
                        {
                            this.buildEngine.UnregisterAllLoggers();
                            this.buildEngine = null;
                        }
                    }
                }
            }
            try
            {
                if (this.buildProject != null)
                {
                    this.buildProject.ParentEngine.UnloadProject(this.buildProject);
                    this.buildProject = null;
                }
                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message);
                Debug.Fail(e.Message);
            }
            return hr;
        }
예제 #39
0
        /// <summary>
        /// Disposes the project node object.
        /// </summary>
        /// <param name="disposing">Flag determining ehether it was deterministic or non deterministic clean up.</param>
        protected override void Dispose(bool disposing)
        {
            if (this.isDisposed)
            {
                return;
            }

            try
            {
                try
                {
                    this.UnRegisterProject();
                }
                finally
                {
                    try
                    {
                        this.RegisterClipboardNotifications(false);
                    }
                    finally
                    {
                        try
                        {
                            if (this.globalPropertyHandler != null)
                            {
                                this.globalPropertyHandler.ActiveConfigurationChanged -= new EventHandler<ActiveConfigurationChangedEventArgs>(this.OnHandleConfigurationRelatedGlobalProperties);

                                this.globalPropertyHandler.Dispose();
                            }

                            if (this.projectEventsProvider != null)
                            {
                                this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
                            }
                            if (this.taskProvider != null)
                            {
                                taskProvider.Tasks.Clear();
                                this.taskProvider.Dispose();
                                this.taskProvider = null;
                            }
                            if (buildLogger != null)
                            {
                                buildLogger = null;
                            }
                            this.site = null;
                        }
                        finally
                        {
                            if (this.buildEngine != null)
                            {
                                this.buildEngine.UnregisterAllLoggers();
                                this.buildEngine = null;
                            }
                        }
                    }
                }

                if (this.buildProject != null)
                {
                    this.buildProject.ParentEngine.UnloadProject(this.buildProject);
                    this.buildProject = null;
                }

                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
                this.isDisposed = true;
            }
        }
예제 #40
0
        /// <summary>
        /// Sets the service provider from which to access the services. 
        /// </summary>
        /// <param name="site">An instance to an Microsoft.VisualStudio.OLE.Interop object</param>
        /// <returns>A success or failure value.</returns>
        public override int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site)
        {
            CCITracing.TraceCall();
            this.site = new ServiceProvider(site);

            if (taskProvider != null)
            {
                taskProvider.Dispose();
            }
            taskProvider = new TaskProvider(this.site);

            return VSConstants.S_OK;
        }
예제 #41
0
        /// <include file='doc\Project.uex' path='docs/doc[@for="Project.SetSite"]/*' />
        public override int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site)
        {
            CCITracing.TraceCall();
            this.Site = new ServiceProvider(site);

            this.UIShell = this.Site.GetService(typeof(SVsUIShell)) as IVsUIShell;
            // if we are a new project open up default file
            if (this.fNewProject)
            {
                HierarchyNode child = this.FirstChild; // that should be the reference folder....
                IVsUIHierarchyWindow uiWindow = this.GetIVsUIHierarchyWindow(HierarchyNode.Guid_SolutionExplorer);

                this.fNewProject = false;
                while (child != null && child.NodeType != HierarchyNodeType.File)
                {
                    child = child.NextSibling;
                }
                /*
        //  BUGBUG: that should work in my opinion..... but throws OLE exceptions in the interops... need to check with next drop
        if (uiWindow != null && child!=null){
          object dummy = null; 
          uiWindow.ExpandItem(this.projectMgr, child.ID, __EXPANDFLAGS.EXPF_ExpandParentsToShowItem); 
          uiWindow.ExpandItem(this.projectMgr, child.ID, __EXPANDFLAGS.EXPF_SelectItem); 
          child.OpenItem(false, false); 
        }
        */
            }

            if (taskProvider != null) taskProvider.Dispose();

            taskProvider = new TaskProvider(this.Site);
            LoadLibrary();
            return NativeMethods.S_OK;
        }
예제 #42
0
        /// <include file='doc\Project.uex' path='docs/doc[@for="Project.Close"]/*' />
        public override int Close()
        {
            Project.ProjectList.Remove(this.automation);
            this.automation = null;
            this.ClearLibraryReferences();
            NativeMethods.ThrowOnFailure(base.Close());
            if (this.taskProvider != null)
            {
                this.taskProvider.Dispose();
                this.taskProvider = null;
            }

            this.Site = null;
            this.UIShell = null;
            return NativeMethods.S_OK;
        }
예제 #43
0
    /// <include file='doc\Project.uex' path='docs/doc[@for="Project.SetSite"]/*' />
    public override int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site){
      this.Site = new ServiceProvider(site);
      this.UIShell = this.Site.GetService(typeof(SVsUIShell)) as IVsUIShell;
      // if we are a new project open up default file
      if (this.fNewProject){
        HierarchyNode child = this.FirstChild; // that should be the reference folder....
        IVsUIHierarchyWindow uiWindow = this.GetIVsUIHierarchyWindow(VsConstants.Guid_SolutionExplorer);
        this.fNewProject = false;
        while (child != null && child.NodeType != HierarchyNodeType.File){
          child = child.NextSibling;
        }
        /*
        //  BUGBUG: that should work in my opinion..... but throws OLE exceptions in the interops... need to check with next drop
        if (uiWindow != null && child!=null){
          object dummy = null; 
          uiWindow.ExpandItem(this.projectMgr, child.ID, __EXPANDFLAGS.EXPF_ExpandParentsToShowItem); 
          uiWindow.ExpandItem(this.projectMgr, child.ID, __EXPANDFLAGS.EXPF_SelectItem); 
          child.OpenItem(false, false); 
        }
        */

      }
      if (taskProvider != null) taskProvider.Dispose();
      taskProvider = new TaskProvider(this.Site);
      
#if WHIDBEY
      // create a task manager
      if (taskManager == null || taskManagerBuild == null) {
        ITaskManagerFactory taskManagerFactory = (ITaskManagerFactory)this.Site.GetService(typeof(ITaskManagerFactory));
        if (taskManagerFactory != null) {
          if (taskManager==null)        taskManager = taskManagerFactory.QuerySharedTaskManager("SpecSharp", true);
          if (taskManagerBuild == null) taskManagerBuild = taskManagerFactory.QuerySharedTaskManager("SpecSharp Build", true);
        }
      }
#endif
      LoadLibrary();
      return 0;
    }
 public UnresolvedImportSquiggleProvider(IServiceProvider serviceProvider, TaskProvider taskProvider) {
     _serviceProvider = serviceProvider;
     _taskProvider = taskProvider;
 }
예제 #45
0
        /// <include file='doc\LanguageService.uex' path='docs/doc[@for="Source.Dispose"]/*' />
        public virtual void Dispose()
        {
            #if LANGTRACE
            Trace.WriteLine("Source::Cleanup");
            #endif
            try {
                if (this.textLinesEvents != null) {
                    this.textLinesEvents.Dispose();
                    this.textLinesEvents = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.userDataEvents != null) {
                    this.userDataEvents.Dispose();
                    this.userDataEvents = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.hiddenTextSession != null) {
                    // We can't throw or exit here because we need to call Dispose on the
                    // other members that need to be disposed.
                    this.hiddenTextSession.UnadviseClient();
                    this.hiddenTextSession = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.methodData != null) {
                    this.methodData.Dispose();
                    this.methodData = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.completionSet != null) {
                    this.completionSet.Dispose();
                    this.completionSet = null;
                }
            } catch (COMException) {
            }
            try {

                if (this.taskProvider != null) {
                    this.taskProvider.Dispose();
                    this.taskProvider = null;
                }
            } catch (COMException) {
            }
            try {
                this.service = null;
                if (this.colorizer != null) {
                    // The colorizer is owned by the core text editor, so we don't close it, the core text editor
                    // does that for us when it is ready to do so.
                    //colorizer.CloseColorizer();
                    this.colorizer = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.colorState != null) {
                    this.colorState = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.expansionProvider != null) {
                    this.expansionProvider.Dispose();
                    this.expansionProvider = null;
                }

            } catch (COMException) {
            }
            try {

                // Sometimes OnCloseSource is called when language service is changed, (for example
                // when you save the file with a different file extension) in which case we cannot
                // null out the site because that will cause a crash inside msenv.dll.
                //            if (this.textLines != null) {
                //                ((IObjectWithSite)this.textLines).SetSite(null);
                //            }
                if (this.textLines != null) {
                    this.textLines = null; //rely on GC rather control lifetime through ReleaseCOMObject
                    Marshal.Release(pUnkTextLines);
                }
            } catch (COMException) {
            }
        }