public AdminProject( int projectId, string name, ProjectType[] projectType, string info, ProjectStatus projectStatus, Common.Image landingImage, AccessLevel accessLevel, Uri versionControlSystemUri, Uri projectManagementSystemUri, HashSet<Issue> issues, HashSet<ProjectMembership> projectDevelopers, HashSet<Common.Image> screenshots) { Require.Positive(projectId, nameof(projectId)); Require.NotEmpty(name, nameof(name)); Require.NotNull(info, nameof(info)); Require.NotNull(versionControlSystemUri, nameof(versionControlSystemUri)); Require.NotNull(projectManagementSystemUri, nameof(projectManagementSystemUri)); ProjectId = projectId; Name = name; ProjectType = projectType ?? new[] {Common.ProjectType.Other}; AccessLevel = accessLevel; Info = info; ProjectStatus = projectStatus; LandingImage = landingImage; VersionControlSystemUri = versionControlSystemUri; ProjectManagementSystemUri = projectManagementSystemUri; Issues = issues ?? new HashSet<Issue>(); ProjectMemberships = projectDevelopers ?? new HashSet<ProjectMembership>(); Screenshots = screenshots ?? new HashSet<Common.Image>(); }
public Project( int projectId, string name, ProjectType[] projectType, string info, ProjectStatus projectStatus, Common.Image landingImage, Uri versionControlSystemUri, Uri projectManagementSystemUri, HashSet<Issue> issues, HashSet<ProjectMembership> projectMemberships, HashSet<Common.Image> screenshots) { Require.Positive(projectId, nameof(projectId)); Require.NotEmpty(name, nameof(name)); Require.NotNull(info, nameof(info)); Require.NotNull(versionControlSystemUri, nameof(versionControlSystemUri)); Require.NotNull(projectManagementSystemUri, nameof(projectManagementSystemUri)); ProjectId = projectId; Name = name; ProjectType = projectType; Info = info; ProjectStatus = projectStatus; LandingImage = landingImage; VersionControlSystemUri = versionControlSystemUri; ProjectManagementSystemUri = projectManagementSystemUri; Issues = issues; ProjectMemberships = projectMemberships; Screenshots = screenshots; }
protected ProjectPage(string areaName, string projectName, string pageName, PageDocument pageDocument, BuildOwners buildOwners) { if (String.IsNullOrEmpty(areaName)) throw new ArgumentNullException(nameof(areaName)); if (String.IsNullOrEmpty(projectName)) throw new ArgumentNullException(nameof(projectName)); if (String.IsNullOrEmpty(pageName)) throw new ArgumentNullException(nameof(pageName)); if (pageDocument == null) throw new ArgumentNullException(nameof(pageDocument)); if (buildOwners == null) throw new ArgumentNullException(nameof(buildOwners)); AreaName = areaName; ProjectName = projectName; m_page = pageName; m_root = pageDocument.Root; m_owners = buildOwners; m_properties = ParseProperties(m_root); Description = ParseDescription(m_properties); Owner = ParseOwner(m_properties); Status = ParseStatus(m_properties); }
public virtual List<Project> GetLast(ProjectStatus status, int max) { var offset = 0; var lastProjects = new List<Project>(); var projects = projectDao.GetLast(status, offset, max) .Where(CanRead) .ToList(); lastProjects.AddRange(projects); while (lastProjects.Count < max) { offset = offset + max; projects = projectDao.GetLast(status, offset, max); if (projects.Count == 0) return lastProjects; projects = projects .Where(CanRead) .ToList(); lastProjects.AddRange(projects); } return lastProjects.Count == max ? lastProjects : lastProjects.GetRange(0, max); }
public IEnumerable<ProjectWrapperFull> GetProjectsByFilter(int tag, ProjectStatus? status, Guid participant, Guid manager, bool follow, int lastId) { var filter = new TaskFilter { ParticipantId = participant, UserId = manager, SortBy = _context.SortBy, SortOrder = !_context.SortDescending, SearchText = _context.FilterValue, TagId = tag, Follow = follow, LastId = lastId, Offset = _context.StartIndex, Max = _context.Count }; if (status != null) filter.ProjectStatuses.Add((ProjectStatus)status); _context.SetDataFiltered(); _context.SetDataPaginated(); _context.SetDataSorted(); return EngineFactory.GetProjectEngine().GetByFilter(filter).NotFoundIfNull().Select(r => new ProjectWrapperFull(r)).ToSmartList(); }
public Project( string name, ISet<ProjectType> projectTypes, string info, ProjectStatus projectStatus, Image landingImage, AccessLevel accessLevel, VersionControlSystemInfo versionControlSystemInfo, RedmineProjectInfo redmineProjectInfo, ISet<Issue> issues, ISet<ProjectMembership> projectDevelopers, ISet<Image> screenshots) { Require.NotEmpty(name, nameof(name)); Require.NotNull(info, nameof(info)); Require.NotNull(versionControlSystemInfo, nameof(versionControlSystemInfo)); Require.NotNull(redmineProjectInfo, nameof(redmineProjectInfo)); Require.NotEmpty(projectTypes, nameof(projectTypes)); Name = name; ProjectTypes = projectTypes; AccessLevel = accessLevel; Info = info; ProjectStatus = projectStatus; LandingImage = landingImage; VersionControlSystemInfo = versionControlSystemInfo; RedmineProjectInfo = redmineProjectInfo; Issues = issues ?? new HashSet<Issue>(); ProjectMemberships = projectDevelopers ?? new HashSet<ProjectMembership>(); Screenshots = screenshots ?? new HashSet<Image>(); }
/// <summary> /// Change the status of project. /// </summary> /// <param name="status">the status of project.</param> public void ChangeStatus(ProjectStatus status) { if (status == ProjectStatus.Loaded) executeButton.Enabled = true; else executeButton.Enabled = false; }
public static XElement BuildStatus(ProjectStatus status) { PageDocument.StatusColor color; switch (status) { case ProjectStatus.Active: color = PageDocument.StatusColor.Green; break; case ProjectStatus.Normal: color = PageDocument.StatusColor.Blue; break; case ProjectStatus.Legacy: color = PageDocument.StatusColor.Red; break; default: color = PageDocument.StatusColor.Grey; break; } return PageDocument.BuildStatus(status.ToString(), color, false); }
public Project(string code, string name, DateTime deliveryDate) { _id = Guid.NewGuid(); _code = code; _name = name; _status = ProjectStatus.Active; IsValidDeliveryDate(deliveryDate); _deliveryDate = deliveryDate; _tasks = new List<Task>(); ApplyEvent(new ProjectAddedEvent(_id, _code, _name, _deliveryDate)); }
public DeveloperPageProjectPreview( int projectId, Uri photoUri, string name, ProjectStatus projectStatus, string developerRole) { Require.Positive(projectId, nameof(projectId)); Require.NotEmpty(name, nameof(name)); Require.NotNull(developerRole, nameof(developerRole)); ProjectId = projectId; PhotoUri = photoUri; Name = name; ProjectStatus = projectStatus; DeveloperRole = developerRole; }
public ProjectPreview( int projectId, Uri photoUri, string name, ProjectStatus projectStatus, ProjectType[] projectTypes) { Require.Positive(projectId, nameof(projectId)); Require.NotEmpty(name, nameof(name)); Require.NotEmpty(projectTypes, nameof(projectTypes)); ProjectId = projectId; PhotoUri = photoUri; Name = name; ProjectStatus = projectStatus; ProjectTypes = projectTypes; }
public ProjectGridRow[] GenerateProjectGridRows(IFarmService farmService, ProjectStatusOnServer[] statusList, string forceBuildActionName, ProjectGridSortColumn sortColumn, bool sortIsAscending) { ArrayList rows = new ArrayList(); foreach (ProjectStatusOnServer statusOnServer in statusList) { ProjectStatus status = statusOnServer.ProjectStatus; IServerSpecifier serverSpecifier = statusOnServer.ServerSpecifier; string projectName = status.Name; IProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(serverSpecifier, projectName); string baseUrl = Regex.Replace(statusOnServer.ProjectStatus.WebURL, @"default\.aspx\?.*", ""); string projectLink = baseUrl + linkFactory.CreateProjectLink(projectSpecifier, ProjectReportProjectPlugin.ACTION_NAME).Url; IBuildSpecifier[] buildSpecifiers = farmService.GetMostRecentBuildSpecifiers(projectSpecifier, 1); string mostRecentBuildUrl; if (buildSpecifiers.Length == 1) { mostRecentBuildUrl = baseUrl + linkFactory.CreateProjectLink(projectSpecifier, LatestBuildReportProjectPlugin.ACTION_NAME).Url; } else { mostRecentBuildUrl = projectLink; } rows.Add( new ProjectGridRow( projectName, statusOnServer.ServerSpecifier.ServerName, status.BuildStatus.ToString(), CalculateHtmlColor(status.BuildStatus), status.LastBuildDate, (status.LastBuildLabel != null ? status.LastBuildLabel : "no build available"), status.Status.ToString(), status.Activity.ToString(), urlBuilder.BuildFormName(forceBuildActionName), projectLink, mostRecentBuildUrl )); } rows.Sort(GetComparer(sortColumn, sortIsAscending)); return((ProjectGridRow[])rows.ToArray(typeof(ProjectGridRow))); }
public void ShouldReturnProjectsSortedByBuildStatusIfBuildStatusColumnSpecifiedAsSortSeed() { // Setup IProjectSpecifier projectA = new DefaultProjectSpecifier(serverSpecifier, "a"); IProjectSpecifier projectB = new DefaultProjectSpecifier(serverSpecifier, "b"); ProjectStatus projectStatus1 = new ProjectStatus("a", "category", ProjectActivity.Sleeping, IntegrationStatus.Success, ProjectIntegratorState.Running, "url", DateTime.Today, "1", null, DateTime.Today, "", "", 0, new List <ParameterBase>()); ProjectStatus projectStatus2 = new ProjectStatus("b", "category", ProjectActivity.Sleeping, IntegrationStatus.Failure, ProjectIntegratorState.Running, "url", DateTime.Today.AddHours(1), "1", null, DateTime.Today, "", "", 0, new List <ParameterBase>()); ProjectStatusOnServer[] statusses = new ProjectStatusOnServer[] { new ProjectStatusOnServer(projectStatus1, serverSpecifier), new ProjectStatusOnServer(projectStatus2, serverSpecifier) }; SetupProjectLinkExpectation(projectA); SetupProjectLinkExpectation(projectB); // Execute mocks.ReplayAll(); ProjectGridRow[] rows = projectGrid.GenerateProjectGridRows(statusses, "myAction", ProjectGridSortColumn.BuildStatus, true, "", urlBuilderMock, new Translations("en-US")); // Verify Assert.AreEqual(2, rows.Length); Assert.AreEqual("b", rows[0].Name); Assert.AreEqual("a", rows[1].Name); // Setup SetupProjectLinkExpectation(projectA); SetupProjectLinkExpectation(projectB); // Execute rows = projectGrid.GenerateProjectGridRows(statusses, "myAction", ProjectGridSortColumn.BuildStatus, false, "", urlBuilderMock, new Translations("en-US")); // Verify Assert.AreEqual(2, rows.Length); Assert.AreEqual("a", rows[0].Name); Assert.AreEqual("b", rows[1].Name); VerifyAll(); }
public virtual void Update(TodoBase todo) { if (todo == null) { return; } Key = todo.Key; Creator = todo.Creator; Created = todo.Created; Name = todo.Name; Id = todo.Id; Start = todo.Start; End = todo.End; Target = todo.Target; Priority = todo.Priority; Point = todo.Priority; Status = todo.Status; }
public void GetProjectStatusReturnsProjects() { ProjectStatus status = new ProjectStatus("Test project", IntegrationStatus.Success, DateTime.Now); ProjectStatusResponse response = new ProjectStatusResponse(); response.Result = ResponseResult.Success; response.Projects.Add(status); IServerConnection connection = mocks.Create <IServerConnection>().Object; Mock.Get(connection).Setup(_connection => _connection.SendMessage("GetProjectStatus", It.IsAny <ServerRequest>())) .Returns(response); CruiseServerClient client = new CruiseServerClient(connection); ProjectStatus[] results = client.GetProjectStatus(); Assert.AreEqual(1, results.Length); Assert.AreEqual(status, results[0]); }
/// <summary> /// 修改项目状态 /// </summary> /// <param name="objProjectStatus"></param> /// <returns></returns> public int EditProjectStatus(ProjectStatus objProjectStatus) { string sql = "update ProjectStatus set ProjectStatusName='{0}',StatusDesc='{1}' where ProjectStatusId={2}"; sql = string.Format(sql, objProjectStatus.ProjectStatusName, objProjectStatus.StatusDesc, objProjectStatus.ProjectStatusId); try { return(SQLHelper.Update(sql)); } catch (SqlException ex) { throw new Exception("数据库操作出现异常:" + ex.Message); } catch (Exception ex) { throw ex; } }
public ActionResult UpdateStatus(int?id, ProjectStatus status) { if (id == null) { return(this.ajaxFailure()); } if (!this.db.HasProjectRole(id.Value, User.Identity.GetUserId(), Role.Owner)) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } var project = this.db.Projects.Find(id); project.Status = status; this.db.SaveChanges(); return(this.ajaxSuccess()); }
public void UpdateChangesUnderlyingStatus() { var client = mocks.DynamicMock <CruiseServerClientBase>(); var server = InitialiseServer(); var status = new ProjectStatus { BuildStatus = IntegrationStatus.Exception }; var project = new Project(client, server, status); mocks.ReplayAll(); var newStatus = new ProjectStatus { BuildStatus = IntegrationStatus.Failure }; project.Update(newStatus); Assert.AreEqual(newStatus.BuildStatus, project.BuildStatus); }
private string SetTaskActionName(ProjectStatus currStatus) { string actionName; switch (currStatus) { case ProjectStatus.Killed: case ProjectStatus.Pending: actionName = ProjectAction.Pending; break; default: actionName = null; break; } return(actionName); }
/// <summary> /// When change system status, change menu enable/disable. /// </summary> /// <param name="type">System status.</param> public override void ChangeStatus(ProjectStatus type) { if (type == ProjectStatus.Uninitialized) { m_plotWin.Enabled = false; } else if (type == ProjectStatus.Loaded) { } else if (type == ProjectStatus.Running) { m_plotWin.Enabled = true; } else if (type == ProjectStatus.Stepping) { m_plotWin.Enabled = true; } }
public ProjectDetailsViewModel(string id, string name, ProjectStatus status, DateTime startDate, DateTime endDate, UserInfo manager, string department, string description) { Id = id; Name = name; Status = status; StartDate = startDate; EndDate = endDate; Manager = String.Format("{0} {1}", manager.FirstName, manager.LastName); Department = department; Description = description; }
private static void AssertProjectsSerializedCorrectly(CruiseServerSnapshot snapshot) { ProjectStatus projectStatus1 = snapshot.ProjectStatuses[0]; Assert.AreEqual("SvnTest", projectStatus1.Name); Assert.AreEqual(ProjectActivity.Sleeping, projectStatus1.Activity); Assert.AreEqual(IntegrationStatus.Exception, projectStatus1.BuildStatus); Assert.AreEqual("8", projectStatus1.LastBuildLabel); Assert.AreEqual("http://mrtickle/ccnet/", projectStatus1.WebURL); ProjectStatus projectStatus2 = snapshot.ProjectStatuses[1]; Assert.AreEqual("projectName", projectStatus2.Name); Assert.AreEqual(ProjectActivity.Sleeping, projectStatus2.Activity); Assert.AreEqual(IntegrationStatus.Success, projectStatus2.BuildStatus); Assert.AreEqual("13", projectStatus2.LastBuildLabel); Assert.AreEqual("http://mrtickle/ccnet/", projectStatus2.WebURL); }
public static void Collect(ExcelWorksheet rawData, UnitOfWork unit) { for (int row = 2; row <= rawData.Dimension.Rows; row++) { int oldId = rawData.ReadInteger(row, 1); ProjectStatus projectStatus = new ProjectStatus { //Id = rawData.ReadInteger(row, 1), Name = rawData.ReadString(row, 2) }; unit.ProjectStatuses.Insert(projectStatus); unit.Save(); Utility.projectStatusesDictionary.Add(oldId, projectStatus.Id); } }
//[ExpectedException(typeof(ApplicationException), )] public void ProjectStatusThrowsIfProjectNotFound() { ProjectStatus[] result = new ProjectStatus[] { CreateProjectStatus("a name"), CreateProjectStatus("another name"), }; CruiseServerSnapshot snapshot = new CruiseServerSnapshot(result, null); mockServerManager.Setup(_manager => _manager.GetCruiseServerSnapshot()).Returns(snapshot).Verifiable(); monitor.Poll();// Force the snapshot to be loaded Assert.That(delegate { monitor.GetProjectStatus(PROJECT_NAME); }, Throws.TypeOf <ApplicationException>().With.Message.EqualTo( "Project 'projectName' not found on server")); }
public void ShouldGenerateFarmServerProjectAndBuildLinksIfServerProjectAndBuildSpecified() { // Setup cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ServerName).Returns("myServer").Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ServerName).Returns("myServer").Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ProjectName).Returns("myProject").Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ProjectName).Returns("myProject").Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ProjectName).Returns("myProject").Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.BuildName).Returns("myBuild").Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ServerSpecifier).Returns(serverSpecifier).Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ServerSpecifier).Returns(serverSpecifier).Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.ProjectSpecifier).Returns(projectSpecifier).Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.BuildSpecifier).Returns(buildSpecifier).Verifiable(); cruiseRequestMock.SetupGet(_cruiseRequest => _cruiseRequest.Request).Returns(requestMock.Object).Verifiable(); requestMock.Setup(_request => _request.GetText("Category")).Returns("").Verifiable(); ProjectStatus ps = new ProjectStatus("myProject", "", null, 0, 0, null, DateTime.Now, null, null, DateTime.Now, null, "Queue 1", 1, new List <ParameterBase>()); ProjectStatusOnServer[] psosa = new ProjectStatusOnServer[] { new ProjectStatusOnServer(ps, serverSpecifier) }; ProjectStatusListAndExceptions pslae = new ProjectStatusListAndExceptions(psosa, new CruiseServerException[0]); farmServiceMock.Setup(service => service.GetProjectStatusListAndCaptureExceptions(serverSpecifier, null)).Returns(pslae).Verifiable(); expectedVelocityContext["serverName"] = "myServer"; expectedVelocityContext["categoryName"] = ""; expectedVelocityContext["projectName"] = "myProject"; expectedVelocityContext["buildName"] = "myBuild"; linkFactoryMock.Setup(factory => factory.CreateFarmLink("Dashboard", FarmReportFarmPlugin.ACTION_NAME)).Returns(link1).Verifiable(); linkFactoryMock.Setup(factory => factory.CreateServerLink(serverSpecifier, ServerReportServerPlugin.ACTION_NAME)).Returns(link2).Verifiable(); linkFactoryMock.Setup(factory => factory.CreateProjectLink(projectSpecifier, ProjectReportProjectPlugin.ACTION_NAME)).Returns(link3).Verifiable(); linkFactoryMock.Setup(factory => factory.CreateBuildLink(buildSpecifier, BuildReportBuildPlugin.ACTION_NAME)).Returns(link4).Verifiable(); expectedVelocityContext["farmLink"] = link1; expectedVelocityContext["serverLink"] = link2; expectedVelocityContext["projectLink"] = link3; expectedVelocityContext["buildLink"] = link4; velocityViewGeneratorMock.Setup(generator => generator.GenerateView(@"TopMenu.vm", It.IsAny <Hashtable>())). Callback <string, Hashtable>((name, context) => Assert.AreEqual(context, expectedVelocityContext)).Returns(response).Verifiable(); // Execute & Verify Assert.AreEqual(response, viewBuilder.Execute()); VerifyAll(); }
public void TestShouldRunIntegrationAllowedByExclusionFilter() { ProjectForceFilter TestSubject = new ProjectForceFilter(); TestSubject.ProjectFilters = new ProjectFilterList(); ProjectFilter Project = new ProjectFilter(); Project.Project = "TestProject"; Project.ServerUri = "TestUri"; Project.ExclusionFilters.Activities = new ProjectActivity[2] { ProjectActivity.Building, ProjectActivity.CheckingModifications }; Project.ExclusionFilters.Conditions = new IntegrationStatus[1] { IntegrationStatus.Failure }; RecorderIRemotingService RemotingRecorder = new RecorderIRemotingService(); RecorderICruiseManager CruiseRecorder = new RecorderICruiseManager(); ProjectStatus Stati = new ProjectStatus(); Stati.Name = "TestProject"; Stati.Activity = ProjectActivity.Sleeping; Stati.BuildStatus = IntegrationStatus.Success; CruiseRecorder.Recordings.GetProjectStatusRecording.ReturnValue = new ProjectStatus[1] { Stati }; RemotingRecorder.Recordings.ConnectTypeStringRecording.ReturnValue = CruiseRecorder; Project.RemoteService = RemotingRecorder; TestSubject.ProjectFilters.Add(Project); bool Condition = TestSubject.ShouldRunIntegration(null, null); Assert.IsTrue(RemotingRecorder.Recordings.ConnectTypeStringRecording.Called); Assert.AreEqual("TestUri", RemotingRecorder.Recordings.ConnectTypeStringRecording.PassedStringuri); Assert.AreEqual(typeof(ICruiseManager), RemotingRecorder.Recordings.ConnectTypeStringRecording.PassedTypeproxyType); Assert.IsTrue(CruiseRecorder.Recordings.GetProjectStatusRecording.Called); Assert.IsTrue(Condition); }
public void ShouldGenerateFarmServerProjectAndBuildLinksIfServerProjectAndBuildSpecified() { // Setup cruiseRequestMock.ExpectAndReturn("ServerName", "myServer"); cruiseRequestMock.ExpectAndReturn("ServerName", "myServer"); cruiseRequestMock.ExpectAndReturn("ProjectName", "myProject"); cruiseRequestMock.ExpectAndReturn("ProjectName", "myProject"); cruiseRequestMock.ExpectAndReturn("ProjectName", "myProject"); cruiseRequestMock.ExpectAndReturn("BuildName", "myBuild"); cruiseRequestMock.ExpectAndReturn("ServerSpecifier", serverSpecifier); cruiseRequestMock.ExpectAndReturn("ServerSpecifier", serverSpecifier); cruiseRequestMock.ExpectAndReturn("ProjectSpecifier", projectSpecifier); cruiseRequestMock.ExpectAndReturn("BuildSpecifier", buildSpecifier); cruiseRequestMock.ExpectAndReturn("Request", requestMock.MockInstance); requestMock.ExpectAndReturn("GetText", "", new object[] { "Category" }); ProjectStatus ps = new ProjectStatus("myProject", "", null, 0, 0, null, DateTime.Now, null, null, DateTime.Now, null, "Queue 1", 1, new List <ParameterBase>()); ProjectStatusOnServer[] psosa = new ProjectStatusOnServer[] { new ProjectStatusOnServer(ps, serverSpecifier) }; ProjectStatusListAndExceptions pslae = new ProjectStatusListAndExceptions(psosa, new CruiseServerException[0]); farmServiceMock.ExpectAndReturn("GetProjectStatusListAndCaptureExceptions", pslae, serverSpecifier, null); expectedVelocityContext["serverName"] = "myServer"; expectedVelocityContext["categoryName"] = ""; expectedVelocityContext["projectName"] = "myProject"; expectedVelocityContext["buildName"] = "myBuild"; linkFactoryMock.ExpectAndReturn("CreateFarmLink", link1, "Dashboard", FarmReportFarmPlugin.ACTION_NAME); linkFactoryMock.ExpectAndReturn("CreateServerLink", link2, serverSpecifier, ServerReportServerPlugin.ACTION_NAME); linkFactoryMock.ExpectAndReturn("CreateProjectLink", link3, projectSpecifier, ProjectReportProjectPlugin.ACTION_NAME); linkFactoryMock.ExpectAndReturn("CreateBuildLink", link4, buildSpecifier, BuildReportBuildPlugin.ACTION_NAME); expectedVelocityContext["farmLink"] = link1; expectedVelocityContext["serverLink"] = link2; expectedVelocityContext["projectLink"] = link3; expectedVelocityContext["buildLink"] = link4; velocityViewGeneratorMock.ExpectAndReturn("GenerateView", response, "TopMenu.vm", new HashtableConstraint(expectedVelocityContext)); // Execute & Verify Assert.AreEqual(response, viewBuilder.Execute()); VerifyAll(); }
public override bool UpdateStatus(ProjectStatus status) { if (status != null && this.CanUpdate()) { try { NpgsqlCommand cmd = Db.GetCmd(Db.ConnectionString); cmd.CommandText = Db.UpdateStat; Guid id = Guid.NewGuid(); cmd.Parameters.AddWithValue("sid", status.ProjectIdentity.DataStoreIdentity); cmd.Parameters.AddWithValue("id", status.ProjectIdentity.Identity); cmd.Parameters.AddWithValue("eid", status.Identity); if (!string.IsNullOrEmpty(status.Text)) { cmd.Parameters.AddWithValue("name", status.Text); } else { cmd.Parameters.Add(NpgSqlCommandUtils.GetNullInParam("name", NpgsqlTypes.NpgsqlDbType.Varchar)); } cmd.Parameters.AddWithValue("when", status.StatusDate); if (status.StatusTypeIdentity.IsNullOrEmpty()) { cmd.Parameters.Add(NpgSqlCommandUtils.GetNullInParam("stsid", NpgsqlTypes.NpgsqlDbType.Uuid)); cmd.Parameters.Add(NpgSqlCommandUtils.GetNullInParam("stid", NpgsqlTypes.NpgsqlDbType.Uuid)); } else { cmd.Parameters.AddWithValue("stsid", status.StatusTypeIdentity.DataStoreIdentity); cmd.Parameters.AddWithValue("stid", status.StatusTypeIdentity.Identity); } Db.ExecuteNonQuery(cmd); return(true); } catch { } } return(false); }
public void ShouldCopyProjectNameToProjectRow() { // Setup ProjectStatus projectStatus1 = ProjectStatusFixture.New(projectSpecifier.ProjectName); ProjectStatusOnServer[] statusses = new ProjectStatusOnServer[] { new ProjectStatusOnServer(projectStatus1, serverSpecifier) }; // Execute SetupProjectLinkExpectation(); ProjectGridRow[] rows = projectGrid.GenerateProjectGridRows(statusses, "myAction", ProjectGridSortColumn.Name, true, "", urlBuilderMock, new Translations("en-US")); // Verify Assert.AreEqual(1, rows.Length); Assert.AreEqual(projectSpecifier.ProjectName, rows[0].Name); VerifyAll(); }
public void GetProjectStatus_when_current_status_is_null_should_return_new_status() { ApiTestDependencies mocks = new ApiTestDependencies(); var target = CreateTestTarget(mocks); ProjectStatusSampleData projectStatusSampleData = new ProjectStatusSampleData(); projectStatusSampleData.InitializeFromFile(@".\TestData\ProjectStatusSampleData1.xml"); projectStatusSampleData.SetLastBuildNumberTo(101); mocks.EnqueueThisFileAsNextResponse(@".\TestData\BuildInformationSampleData1.xml"); // Act ProjectStatus status = target.GetProjectStatus(projectStatusSampleData.Document, null); // Assert status.Should().NotBeNull(); }
/// <summary> /// Initialise a new project. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="server">The server this project belongs to.</param> /// <param name="project">The actual project details.</param> public Project(CruiseServerClientBase client, Server server, ProjectStatus project) { if (client == null) { throw new ArgumentNullException("client"); } if (server == null) { throw new ArgumentNullException("server"); } if (project == null) { throw new ArgumentNullException("project"); } this.client = client; this.server = server; this.project = project; }
public void ShouldCopyProjectCategoryToProjectRow() { // Setup ProjectStatus projectStatus1 = new ProjectStatus(projectSpecifier.ProjectName, "category", ProjectActivity.Sleeping, IntegrationStatus.Success, ProjectIntegratorState.Running, "url", DateTime.Today, "my label", null, DateTime.Today, "", "", 0); ProjectStatusOnServer[] statusses = new ProjectStatusOnServer[] { new ProjectStatusOnServer(projectStatus1, serverSpecifier) }; SetupProjectLinkExpectation(); // Execute mocks.ReplayAll(); ProjectGridRow[] rows = projectGrid.GenerateProjectGridRows(statusses, "myAction", ProjectGridSortColumn.Name, true, "", urlBuilderMock, new Translations("en-US")); // Verify Assert.AreEqual("category", rows[0].Category); VerifyAll(); // Setup projectStatus1 = new ProjectStatus(projectSpecifier.ProjectName, "category1", ProjectActivity.Sleeping, IntegrationStatus.Success, ProjectIntegratorState.Stopped, "url", DateTime.Today, "my label", null, DateTime.Today, "", "", 0); statusses = new ProjectStatusOnServer[] { new ProjectStatusOnServer(projectStatus1, serverSpecifier) }; SetupProjectLinkExpectation(); // Execute rows = projectGrid.GenerateProjectGridRows(statusses, "myAction", ProjectGridSortColumn.Name, true, "", urlBuilderMock, new Translations("en-US")); // Verify Assert.AreEqual("category1", rows[0].Category); VerifyAll(); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ProjectStatus status = ((int?)value).To <ProjectStatus>(); switch (status) { case ProjectStatus.InWork: return(Brushes.Red); case ProjectStatus.OnCheck: return(Brushes.Orange); case ProjectStatus.Completed: return(Brushes.Green); default: return(Brushes.Black); } }
public async Task <IActionResult> ChangeStatus(int id, ProjectStatus status) { var project = await _context.Projects.FindAsync(id); if (project == null || project.Status.IsDone() || !IsProjectOfUser(project.Id)) { return(NotFound()); } ViewBag.Project = project; switch (status) { case ProjectStatus.Continued: case ProjectStatus.Canceled: case ProjectStatus.Discontinued: { project.Status = status; await _context.SaveChangesAsync(); ViewBag.Message = _localizer["Status has changed to: {0}", status]; } break; case ProjectStatus.Completed: if (_context.ProjectSchedules.Where(ps => ps.ProjectId == id).All(ps => ps.Rating.HasValue)) { project.Status = status; await _context.SaveChangesAsync(); ViewBag.Message = _localizer["Status has changed to: {0}", status]; } else { ViewBag.Message = _localizer["All project schedules have not been rated yet."]; } break; default: ViewBag.Message = _localizer["Something wrong."]; break; } return(View("ChangeStatus")); }
public void DisplayBalloonMessageWhenNewMessageIsReceived() { ProjectStatus initial = ProjectStatusFixture.New(IntegrationStatus.Success, ProjectActivity.Sleeping); mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME); mockServerMonitor.ExpectAndReturn("GetProjectStatus", initial, PROJECT_NAME); Message expectedMessage = new Message("foo"); ProjectStatus newStatus = ProjectStatusFixture.New(IntegrationStatus.Success, ProjectActivity.Sleeping); newStatus.Messages = new Message[] { expectedMessage }; mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME); mockServerMonitor.ExpectAndReturn("GetProjectStatus", newStatus, PROJECT_NAME); monitor.MessageReceived += new MessageEventHandler(OnMessageReceived); monitor.Poll(); monitor.Poll(); Assert.AreEqual(actualMessage, expectedMessage); }
public void ShouldHandleResultsWithNoBuildLabel() { // Setup ProjectStatus projectStatus1 = ProjectStatusFixture.New(projectSpecifier.ProjectName, null); ProjectStatusOnServer[] statusses = new ProjectStatusOnServer[] { new ProjectStatusOnServer(projectStatus1, serverSpecifier) }; // Execute SetupProjectLinkExpectation(); ProjectGridRow[] rows = projectGrid.GenerateProjectGridRows(statusses, "myAction", ProjectGridSortColumn.Name, true, "", urlBuilderMock, new Translations("en-US")); // Verify Assert.AreEqual(1, rows.Length); Assert.AreEqual("no build available", rows[0].LastBuildLabel); VerifyAll(); }
public void TestCreateGetProjectsByPersonIdQuery_CheckStatus() { var person = new Person { PersonId = 1 }; var status = new ProjectStatus { ProjectStatusId = 1, Status = "status" }; var project = new Project { ProjectId = 1, Status = status, ProjectStatusId = status.ProjectStatusId }; var participant = new Participant { ParticipantId = 1, Person = person, PersonId = person.PersonId, Project = project, ProjectId = project.ProjectId }; context.Participants.Add(participant); var defaultSorter = new ExpressionSorter <ParticipantTimelineDTO>(x => x.Name, SortDirection.Ascending); var queryOperator = new QueryableOperator <ParticipantTimelineDTO>(0, 10, defaultSorter); var projects = ProjectQueries.CreateGetProjectsByPersonIdQuery(context, person.PersonId, queryOperator); Assert.AreEqual(1, projects.Count()); var projectResult = projects.FirstOrDefault(); Assert.AreEqual(status.Status, projectResult.Status); }
private IEnumerable <ProjectStatus> ConvertProjects(TeamCitySharp.TeamCityClient client, List <TeamCitySharp.DomainEntities.Project> projects) { var projectStatus = new List <ProjectStatus>(); var configs = client.BuildConfigs.All(); foreach (var config in configs) { var status = client.Builds.ByBuildConfigId(config.Id).FirstOrDefault(); if (status != null) { var project = projectStatus.FirstOrDefault(p => p.Name == config.ProjectName); if (project == null) { project = new ProjectStatus() { Name = config.ProjectName }; projectStatus.Add(project); } var item = new BuildType() { Name = config.Name, Status = status.Status, LastBuildNumber = status.Number, }; var lastChange = client.Changes.LastChangeDetailByBuildConfigId(config.Id); if (lastChange != null) { item.LastChangedBy = lastChange.Username; var date = lastChange.Date; } project.BuildTypes.Add(item); } } return(projectStatus); }
public List <DatabaseProject> getOwnedProjectsOfUser(int userID) { try { OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = "SELECT Project.* FROM[Project] WHERE Owner = " + userID; OleDbDataReader reader = command.ExecuteReader(); List <DatabaseProject> result = new List <DatabaseProject>(); while (reader.Read()) { int id = 1; string projectName = ""; string description = ""; ProjectType type = ProjectType.Game; ProjectStatus status = ProjectStatus.Completed; ProjectTag tag = ProjectTag.Game; projectName = reader.GetString(1); Enum.TryParse <ProjectType>(reader.GetString(2), out type); description = reader.GetString(3); Enum.TryParse <ProjectTag>(reader.GetString(5), out tag); Enum.TryParse <ProjectStatus>(reader.GetString(6), out status); result.Add(new DatabaseProject(id, projectName, description, null, type, status, tag)); } return(result); } catch (Exception e) { Console.WriteLine(e.ToString()); } Console.WriteLine(); return(null); }
private static void CallUpdateProjectList() { if (ProjectStatus != null) { for (int i = 0; i < ProjectStatus.GetInvocationList().Length;) { Delegate d = ProjectStatus.GetInvocationList()[i]; try { d.DynamicInvoke(new object[] { GetProjects() }); i++; } catch (Exception ex) { logger.Error(ex, "Error updating project list"); ProjectStatus -= (StatusProjectChange)d; } } } }
public ActionResult Create([Bind(Include = "ProjectStatusName" )] ProjectStatus ProjectStatus) { if (ModelState.IsValid) { bool bSucess = false; bSucess = ProjectStatusData.Add(ProjectStatus); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Insert"); } } return(View(ProjectStatus)); }
public IEnumerable <Project> GetLast(ProjectStatus status, int max) { var offset = 0; var lastProjects = new List <Project>(); do { var projects = DaoFactory.ProjectDao.GetLast(status, offset, max); if (!projects.Any()) { return(lastProjects); } lastProjects.AddRange(projects.Where(CanReadDelegate)); offset = offset + max; } while (lastProjects.Count < max); return(lastProjects.Count == max ? lastProjects : lastProjects.GetRange(0, max)); }
public CreateProjectRequest( string name, ProjectType[] projectTypes, string info, ProjectStatus projectStatus, AccessLevel accessLevel, Image landingImage, Image[] screenshots) { Require.NotEmpty(name, nameof(name)); Require.NotEmpty(info, nameof(info)); Require.NotEmpty(projectTypes, nameof(projectTypes)); Name = name; ProjectTypes = projectTypes; Info = info; AccessLevel = accessLevel; LandingImage = landingImage; ProjectStatus = projectStatus; Screenshots = screenshots; }
internal void Init(bool warring) { Status = ProjectStatus.Unload; Preference = GetProjectPreference(); if (Preference == null) { if (warring) MessageBox.Show("無法取得專案設定檔!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } XmlHelper pref = new XmlHelper(Preference); XmlElement devSiteElement = pref.GetElement("Property[@Name='DevSite']/DevSite"); if (devSiteElement == null) { string msg = "無法取得專案『" + this.Name + "』開發站台連線設定, 是否重新設定開發站台位置?"; ShowResetMessage(this.Name, msg); } else { DevSite = DevSiteLoginInfo.Load(devSiteElement); try { DevConnection = DevSite.TryConnect(); Status = ProjectStatus.Succeed; } catch { string msg = "專案『" + this.Name + "』開發站台連線失敗, 是否重新設定開發站台位置?"; ShowResetMessage(this.Name, msg); } } }
/// <summary> /// Change the status of project. /// </summary> /// <param name="status">the status of project.</param> public void ChangeStatus(ProjectStatus status) { if (status == ProjectStatus.Loaded) { executeButton.Enabled = true; formulatorButton.Enabled = true; } else { executeButton.Enabled = false; formulatorButton.Enabled = false; } }
private ProjectHandler(string name, bool loadsucceed) { this.Name = name; this.Status = ProjectStatus.LoadFail; }
internal ProjectHandler(string name) { this.Name = name; this.Status = ProjectStatus.Unload; }
public bool HandleProjectSession(ProjectStatus status) { return true; }
private void SetDevSite(DevSiteLoginInfo devSite) { this.DevSite = devSite; try { DevConnection = this.DevSite.TryConnect(); Status = ProjectStatus.Succeed; } catch { Status = ProjectStatus.LoadFail; } XmlHelper h = new XmlHelper(this.Preference); XmlElement de = h.GetElement("Property/DevSite"); XmlNode dep = de.ParentNode; dep.RemoveChild(de); de = devSite.XmlContent.GetElement("."); XmlNode node = dep.OwnerDocument.ImportNode(de, true); dep.AppendChild(node); if (MainForm.CurrentProject != null) MainForm.CurrentProject.UpdateProjectPreference(this.Preference); }
/// <summary> /// When change system status, change menu enable/disable. /// </summary> /// <param name="type">project status.</param> public override void ChangeStatus(ProjectStatus type) { if (type == ProjectStatus.Loaded) { m_timer.Enabled = true; m_isAutoMenuItem.Enabled = true; m_StaticDebugMenuItem.Enabled = !m_isExecute; } else { m_timer.Enabled = false; m_isAutoMenuItem.Enabled = false; m_StaticDebugMenuItem.Enabled = false; } }
/// <summary> /// When change system status, change menu enable/disable. /// </summary> /// <param name="type">System status.</param> public void ChangeStatus(ProjectStatus type) { if (type == ProjectStatus.Running) { m_dgv.ReadOnly = true; // m_dgv.Enabled = false; m_time.Enabled = true; m_time.Start(); } else if (type == ProjectStatus.Suspended) { m_dgv.ReadOnly = false; // m_dgv.Enabled = true; m_time.Enabled = false; m_time.Stop(); try { UpdatePropForSimulation(); ResetReadOnly(); } catch (Exception) { // ���̃v���O�C���Ńf�[�^��ҏW������ // �V�~�����[�V�������ُ�I���������f�[�^��擾�ł��Ȃ��������߁B // ���̃v���O�C���ŃG���[���b�Z�[�W���\�������̂� // �����ł͏o���Ȃ��悤�ɂ���B } } else if (type == ProjectStatus.Loaded) { // m_dgv.Enabled = true; m_dgv.ReadOnly = false; if (m_status == ProjectStatus.Running || m_status == ProjectStatus.Suspended || m_status == ProjectStatus.Stepping) { m_time.Enabled = false; m_time.Stop(); if (m_current != null) m_current = m_env.DataManager.GetEcellObject(m_current.ModelID, m_current.Key, m_current.Type); ResetProperty(); ResetReadOnly(); } } else if (type == ProjectStatus.Uninitialized) { m_dgv.ReadOnly = true; // m_dgv.Enabled = false; } else if (type == ProjectStatus.Stepping) { m_dgv.ReadOnly = false; // m_dgv.Enabled = true; try { UpdatePropForSimulation(); ResetReadOnly(); } catch (Exception) { // ���̃v���O�C���Ńf�[�^��ҏW������ // �V�~�����[�V�������ُ�I���������f�[�^��擾�ł��Ȃ��������߁B // ���̃v���O�C���ŃG���[���b�Z�[�W���\�������̂� // �����ł͏o���Ȃ��悤�ɂ���B } } m_status = type; m_dgv.ReadOnly = false; }
public Project ChangeStatus(Project project, ProjectStatus status) { if (project == null) throw new ArgumentNullException("project"); ProjectSecurity.DemandEdit(project); project.LastModifiedBy = SecurityContext.CurrentAccount.ID; project.LastModifiedOn = TenantUtil.DateTimeNow(); project.StatusChangedOn = DateTime.Now; project.Status = status; projectDao.Save(project); return project; }
/// <summary> /// Change the status of project. /// </summary> /// <param name="status">the project status.</param> public override void ChangeStatus(ProjectStatus status) { }
public List<Project> GetLast(ProjectStatus? status, int offset, int max) { var query = Query(ProjectsTable) .SetFirstResult(offset) .Select(ProjectColumns) .SetMaxResults(max) .OrderBy("create_on", false); if (status != null) query.Where("status", status); using (var db = new DbManager(DatabaseId)) { return db.ExecuteList(query).ConvertAll(ToProject).ToList(); } }
public ProjectWrapperFull UpdateProject(int id, string title, string description, Guid responsibleId, string tags, ProjectStatus status, bool @private, bool notify) { if (responsibleId == Guid.Empty) throw new ArgumentException(@"responsible can't be empty", "responsibleId"); if (string.IsNullOrEmpty(title)) throw new ArgumentException(@"title can't be empty", "title"); var project = EngineFactory.GetProjectEngine().GetByID(id).NotFoundIfNull(); ProjectSecurity.DemandEdit(project); project.Title = Update.IfNotEmptyAndNotEquals(project.Title, title); /*if (project.Status != status)*/ project.StatusChangedOn = DateTime.Now; project.Status = status; project.Responsible = Update.IfNotEmptyAndNotEquals(project.Responsible, responsibleId); project.Description = Update.IfNotEmptyAndNotEquals(project.Description, description); project.Private = @private; EngineFactory.GetProjectEngine().SaveOrUpdate(project, notify); if (!EngineFactory.GetProjectEngine().IsInTeam(project.ID, project.Responsible)) EngineFactory.GetProjectEngine().AddToTeam(project, EngineFactory.GetParticipantEngine().GetByID(project.Responsible), false); EngineFactory.GetTagEngine().SetProjectTags(project.ID, tags); return new ProjectWrapperFull(project,EngineFactory.GetFileEngine().GetRoot(id)); }
/// <summary> /// When change system status, change menu enable/disable. /// </summary> /// <param name="type">System status.</param> public override void ChangeStatus(ProjectStatus type) { if (type == ProjectStatus.Uninitialized) m_searchMenu.Enabled = false; else m_searchMenu.Enabled = true; }
public ProjectWrapperFull UpdateProject(int id, ProjectStatus status) { var project = EngineFactory.GetProjectEngine().GetByID(id).NotFoundIfNull(); ProjectSecurity.DemandEdit(project); /*if (project.Status != status)*/ project.StatusChangedOn = DateTime.Now; project.Status = status; EngineFactory.GetProjectEngine().SaveOrUpdate(project, false); return new ProjectWrapperFull(project, EngineFactory.GetFileEngine().GetRoot(id)); }
public IEnumerable<ProjectWrapper> GetProjects(ProjectStatus status) { return EngineFactory.GetProjectEngine().GetAll(status, 0).Select(x => new ProjectWrapper(x)).ToSmartList(); }
public List<Project> GetByParticipiant(Guid participantId, ProjectStatus status) { var query = Query(ProjectsTable) .Select(ProjectColumns) .InnerJoin(ParticipantTable, Exp.EqColumns("id", "project_id") & Exp.Eq("removed", false) & Exp.EqColumns("tenant_id", "tenant")) .Where("status", status) .Where("participant_id", participantId.ToString()) .OrderBy("title", true); using (var db = new DbManager(DatabaseId)) { return db.ExecuteList(query).ConvertAll(ToProject).ToList(); } }
public virtual List<Project> GetAll(ProjectStatus status, int max) { return projectDao.GetAll(status, max) .Where(CanRead) .ToList(); }