コード例 #1
0
		private IResponse GenerateUserList(ICruiseRequest request, string message, string error)
		{
			Hashtable velocityContext = new Hashtable();
			velocityContext["message"] = message;
			velocityContext["error"] = error;

			var links = new List<IAbsoluteLink>();
			links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "User List", ActionName));

			ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken());
			foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
			{
				DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
				links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerUserListServerPlugin.ActionName));
			}
			velocityContext["projectLinks"] = links;
			string sessionToken = request.RetrieveSessionToken(sessionRetriever);
			List<UserDetails> allUsers = farmService.ListAllUsers(request.ServerSpecifier, sessionToken);
			foreach (UserDetails user in allUsers)
			{
				if (user.DisplayName == null) user.DisplayName = string.Empty;
			}
			velocityContext["users"] = allUsers;
			if (!string.IsNullOrEmpty(request.ProjectName))
			{
				velocityContext["currentProject"] = request.ProjectName;
				velocityContext["diagnosticsCall"] = new ProjectLink(request.UrlBuilder, request.ProjectSpecifier, string.Empty, DiagnosticsActionName);
			}
			else
			{
				velocityContext["diagnosticsCall"] = new ServerLink(request.UrlBuilder, request.ServerSpecifier, string.Empty, DiagnosticsActionName);
			}

			return viewGenerator.GenerateView(@"UserList.vm", velocityContext);
		}
コード例 #2
0
		public void Setup()
		{
			projectSpecifier = new DefaultProjectSpecifier(new DefaultServerSpecifier(serverName), projectName);
			urlBuilderMock = new DynamicMock(typeof(ICruiseUrlBuilder));
			projectLink = new ProjectLink((ICruiseUrlBuilder) urlBuilderMock.MockInstance, projectSpecifier, description, this.action);
		}