/// <summary> /// Initializes a new instance of the <see cref="CCQueue"/> class from being created. /// </summary> /// <param name="client">The client.</param> /// <param name="name">The name.</param> /// <param name="requests">The requests.</param> private CCQueue(CruiseServerClientBase client, string name, IEnumerable<QueuedRequestSnapshot> requests) { this.client = client; this.Name = name; this.requests.AddRange( requests.Select(r => new QueuedRequestSnapshot(r.ProjectName, r.Activity, r.RequestTime))); }
public void SetUp() { cruiseManagerMock = mocks.Create <CruiseServerClientBase>(MockBehavior.Strict).Object; buildServer = new BuildServer(ServerUrl); manager = new RemotingCruiseServerManager(cruiseManagerMock, buildServer); }
private ServerAggregatingCruiseManagerWrapper InitialiseServerWrapper(MockRepository mocks, Action <CruiseServerClientBase> additionalSetup) { IRemoteServicesConfiguration configuration = mocks.DynamicMock <IRemoteServicesConfiguration>(); ICruiseServerClientFactory cruiseManagerFactory = mocks.DynamicMock <ICruiseServerClientFactory>(); CruiseServerClientBase cruiseManager = mocks.DynamicMock <CruiseServerClientBase>(); ServerLocation[] servers = new ServerLocation[] { serverLocation, otherServerLocation }; SetupResult.For(configuration.Servers) .Return(servers); SetupResult.For(cruiseManagerFactory.GenerateClient("http://myurl", new ClientStartUpSettings())) .IgnoreArguments() .Return(cruiseManager); ServerAggregatingCruiseManagerWrapper serverWrapper = new ServerAggregatingCruiseManagerWrapper( configuration, cruiseManagerFactory); if (additionalSetup != null) { additionalSetup(cruiseManager); } return(serverWrapper); }
public void SetUp() { cruiseManagerMock = mocks.StrictMock <CruiseServerClientBase>(); buildServer = new BuildServer(ServerUrl); manager = new RemotingCruiseServerManager(cruiseManagerMock, buildServer); }
public void SetUp() { serverClient = mocks.DynamicMock<CruiseServerClientBase>(); buildServer = new BuildServer(SERVER_URL); manager = new HttpCruiseServerManager(serverClient, buildServer); }
public void SetUp() { serverClient = mocks.Create <CruiseServerClientBase>().Object; buildServer = new BuildServer(SERVER_URL); manager = new HttpCruiseServerManager(serverClient, buildServer); }
public void SetUp() { serverClient = mocks.DynamicMock <CruiseServerClientBase>(); buildServer = new BuildServer(SERVER_URL); manager = new HttpCruiseServerManager(serverClient, buildServer); }
public HttpCruiseServerManager(CruiseServerClientBase manager, BuildServer buildServer) { this.manager = manager; this.configuration = buildServer; displayName = GetDisplayNameFromUri(buildServer.Uri); }
/// <summary> /// Initializes a new instance of the <see cref="CCQueue"/> class from being created. /// </summary> /// <param name="client">The client.</param> /// <param name="name">The name.</param> /// <param name="requests">The requests.</param> private CCQueue(CruiseServerClientBase client, string name, IEnumerable <QueuedRequestSnapshot> requests) { this.client = client; this.Name = name; this.requests.AddRange( requests.Select(r => new QueuedRequestSnapshot(r.ProjectName, r.Activity, r.RequestTime))); }
public void SetUp() { cruiseManagerMock = mocks.StrictMock<CruiseServerClientBase>(); buildServer = new BuildServer(ServerUrl); manager = new RemotingCruiseServerManager(cruiseManagerMock, buildServer); }
private static void DisplayServerStatus(CruiseServerClientBase client, bool isQuiet) { try { if (!isQuiet) { WriteLine("Retrieving snapshot from " + client.TargetServer, ConsoleColor.Gray); } CruiseServerSnapshot snapShot = client.GetCruiseServerSnapshot(); if (xml) { XmlSerializer serializer = new XmlSerializer(typeof(CruiseServerSnapshot)); Stream console = Console.OpenStandardOutput(); serializer.Serialize(console, snapShot); console.Close(); } else { foreach (ProjectStatus prj in snapShot.ProjectStatuses) { DisplayProject(prj); } } } catch (Exception error) { WriteError("ERROR: Unable to retrieve server details", error); } }
/// <summary> /// Initialise a new <see cref="ManualServerWatcher"/>. /// </summary> /// <param name="client">The underlying client to poll.</param> public ManualServerWatcher(CruiseServerClientBase client) { if (client == null) { throw new ArgumentNullException("client"); } this.client = client; }
/// <summary> /// Initialise a new <see cref="Server"/> with the default watcher. /// </summary> /// <param name="client">The underlying client.</param> public Server(CruiseServerClientBase client) { if (client == null) { throw new ArgumentNullException("client"); } InitialiseServer(client, new ManualServerWatcher(client), true); }
/// <summary> /// Initialise a new <see cref="Server"/> with the default watcher. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="settings">The start-up settings to use.</param> public Server(CruiseServerClientBase client, ClientStartUpSettings settings) { if (client == null) { throw new ArgumentNullException("client"); } InitialiseServer(client, new ManualServerWatcher(client), settings.FetchVersionOnStartUp); }
/// <summary> /// Wraps the specified queue status. /// </summary> /// <param name="owningClient">The owning client.</param> /// <param name="queueStatus">The queue status.</param> /// <param name="connection">The connection.</param> /// <returns> /// The new <see cref="CCProject"/>. /// </returns> internal static CCQueue Wrap(CruiseServerClientBase owningClient, QueueSnapshot queueStatus, CCConnection connection) { var queue = new CCQueue(owningClient, queueStatus.QueueName, queueStatus.Requests) { Connection = connection }; return(queue); }
/// <summary> /// Initialise a new <see cref="PollingServerWatcher"/>. /// </summary> /// <param name="client">The underlying client to poll.</param> public PollingServerWatcher(CruiseServerClientBase client) { if (client == null) throw new ArgumentNullException("client"); this.client = client; nextRefresh = DateTime.Now.AddSeconds(interval); pollingThread = new Thread(Poll); pollingThread.IsBackground = true; pollingThread.Start(); }
/// <summary> /// Initialise a new build queue. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="server">The server this queue belongs to.</param> /// <param name="buildQueue">The actual build queue details.</param> public BuildQueue(CruiseServerClientBase client,Server server, QueueSnapshot buildQueue) { if (client == null) throw new ArgumentNullException("client"); if (server == null) throw new ArgumentNullException("server"); if (buildQueue == null) throw new ArgumentNullException("buildQueue"); this.client = client; this.server = server; this.buildQueue = buildQueue; }
/// <summary> /// Initializes a new instance of the <see cref="CCPackage"/> class from being created. /// </summary> /// <param name="client">The client.</param> /// <param name="name">The name.</param> /// <param name="buildLabel">The build label.</param> /// <param name="dateTime">The date time.</param> /// <param name="numberOfFiles">The number of files.</param> /// <param name="size">The size.</param> /// <param name="fileName">Name of the file.</param> private CCPackage(CruiseServerClientBase client, string name, string buildLabel, DateTime dateTime, int numberOfFiles, long size, string fileName) : base(fileName) { this.client = client; this.Name = name; this.BuildLabel = buildLabel; this.DateTime = dateTime; this.NumberOfFiles = numberOfFiles; this.Size = size; }
/// <summary> /// Initialise a new <see cref="Server"/> with a watcher and a client. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="watcher">The watcher to use.</param> public Server(CruiseServerClientBase client, IServerWatcher watcher) { if (client == null) { throw new ArgumentNullException("client"); } if (watcher == null) { throw new ArgumentNullException("watcher"); } InitialiseServer(client, watcher, true); }
public void Setup() { this.mocks = new MockRepository(MockBehavior.Default); this.logger = this.mocks.Create <ILogger>(MockBehavior.Strict).Object; this.factory = this.mocks.Create <ICruiseServerClientFactory>(MockBehavior.Strict).Object; this.result = this.mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object; Mock.Get(this.result).SetupProperty(_result => _result.Status); this.result.Status = IntegrationStatus.Unknown; this.buildInfo = this.mocks.Create <BuildProgressInformation>(MockBehavior.Strict, "somewhere", "test").Object; Mock.Get(this.result).SetupGet(_result => _result.BuildProgressInformation).Returns(this.buildInfo); this.client = this.mocks.Create <CruiseServerClientBase>(MockBehavior.Strict).Object; }
private CruiseServerClientBase GetCruiseManager(string url, string sessionToken) { //var config = GetServerUrl(serverSpecifier); CruiseServerClientBase manager = _ccf.GenerateClient(url, new ClientStartUpSettings { BackwardsCompatable = false //config.BackwardCompatible }); manager.SessionToken = sessionToken; return(manager); }
/// <summary> /// Initialise a new <see cref="Server"/> with a watcher and a client. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="watcher">The watcher to use.</param> /// <param name="settings">The start-up settings to use.</param> public Server(CruiseServerClientBase client, IServerWatcher watcher, ClientStartUpSettings settings) { if (client == null) { throw new ArgumentNullException("client"); } if (watcher == null) { throw new ArgumentNullException("watcher"); } InitialiseServer(client, watcher, settings.FetchVersionOnStartUp); }
public void Setup() { this.mocks = new MockRepository(); this.logger = this.mocks.StrictMock<ILogger>(); this.factory = this.mocks.StrictMock<ICruiseServerClientFactory>(); this.result = this.mocks.StrictMock<IIntegrationResult>(); SetupResult.For(this.result.Status).PropertyBehavior(); this.result.Status = IntegrationStatus.Unknown; this.buildInfo = this.mocks.StrictMock<BuildProgressInformation>("somewhere", "test"); SetupResult.For(this.result.BuildProgressInformation).Return(this.buildInfo); this.client = this.mocks.StrictMock<CruiseServerClientBase>(); }
private CruiseServerClientBase GetCruiseManager(IServerSpecifier serverSpecifier, string sessionToken) { var config = GetServerUrl(serverSpecifier); CruiseServerClientBase manager = clientFactory.GenerateClient(config.Url, new ClientStartUpSettings { BackwardsCompatable = config.BackwardCompatible }); manager.SessionToken = sessionToken; return(manager); }
public void Setup() { this.mocks = new MockRepository(); this.logger = this.mocks.StrictMock <ILogger>(); this.factory = this.mocks.StrictMock <ICruiseServerClientFactory>(); this.result = this.mocks.StrictMock <IIntegrationResult>(); SetupResult.For(this.result.Status).PropertyBehavior(); this.result.Status = IntegrationStatus.Unknown; this.buildInfo = this.mocks.StrictMock <BuildProgressInformation>("somewhere", "test"); SetupResult.For(this.result.BuildProgressInformation).Return(this.buildInfo); this.client = this.mocks.StrictMock <CruiseServerClientBase>(); }
/// <summary> /// Caches the project names. /// </summary> /// <param name="logger">The logger.</param> /// <param name="client">The client.</param> private void CacheProjectNames(ILogger logger, CruiseServerClientBase client) { logger.Info("Retrieving projects from server"); this.cachedProjects.Clear(); var serverProjects = client.GetProjectStatus(); foreach (var serverProject in serverProjects) { this.cachedProjects.Add(serverProject.Name); } logger.Debug(this.cachedProjects.Count + " project(s) retrieved"); }
/// <summary> /// Initialise a new <see cref="PollingServerWatcher"/>. /// </summary> /// <param name="client">The underlying client to poll.</param> public PollingServerWatcher(CruiseServerClientBase client) { if (client == null) { throw new ArgumentNullException("client"); } this.client = client; nextRefresh = DateTime.Now.AddSeconds(interval); pollingThread = new Thread(Poll); pollingThread.IsBackground = true; pollingThread.Start(); }
/// <summary> /// Wraps the specified package status. /// </summary> /// <param name="owningClient">The owning client.</param> /// <param name="packageStatus">The package status.</param> /// <param name="project">The project.</param> /// <returns> /// The new <see cref="CCPackage"/>. /// </returns> internal static CCPackage Wrap(CruiseServerClientBase owningClient, PackageDetails packageStatus, CCProject project) { var package = new CCPackage( owningClient, packageStatus.Name, packageStatus.BuildLabel, packageStatus.DateTime, packageStatus.NumberOfFiles, packageStatus.Size, packageStatus.FileName) { Project = project }; return(package); }
/// <summary> /// Initialise a new project build entity. /// </summary> /// <param name="buildName">The name of the build.</param> /// <param name="project">The project this build belongs to.</param> /// <param name="client">The underlying client.</param> public ProjectBuild(string buildName, Project project, CruiseServerClientBase client) { this.name = buildName; this.project = project; this.client = client; // Parse the name for the details BuildDate = DateTime.ParseExact(name.Substring(3, 14), "yyyyMMddHHmmss", CultureInfo.InvariantCulture); IsSuccessful = (name.Substring(17, 1) == "L"); if (IsSuccessful) { var startPos = name.IndexOf("build.", StringComparison.OrdinalIgnoreCase) + 6; var endPos = name.LastIndexOf('.'); Label = name.Substring(startPos, endPos - startPos); } }
/// <summary> /// Initialise a new project build entity. /// </summary> /// <param name="buildName">The name of the build.</param> /// <param name="project">The project this build belongs to.</param> /// <param name="client">The underlying client.</param> public ProjectBuild(string buildName, Project project, CruiseServerClientBase client) { this.name = buildName; this.project = project; this.client = client; // Parse the name for the details BuildDate = DateTime.ParseExact(name.Substring(3, 14), "yyyyMMddHHmmss", CultureInfo.InvariantCulture); IsSuccessful = (name.Substring(17, 1) == "L"); if (IsSuccessful) { var startPos = name.IndexOf("build.", StringComparison.InvariantCultureIgnoreCase) + 6; var endPos = name.LastIndexOf('.'); Label = name.Substring(startPos, endPos - startPos); } }
/// <summary> /// Initialise a new build queue request. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="buildQueue">The queue this project belongs to.</param> /// <param name="snapshot">The actual build queue request details.</param> public BuildQueueRequest(CruiseServerClientBase client, BuildQueue buildQueue, QueuedRequestSnapshot snapshot) { if (client == null) { throw new ArgumentNullException("client"); } if (buildQueue == null) { throw new ArgumentNullException("buildQueue"); } if (snapshot == null) { throw new ArgumentNullException("snapshot"); } this.client = client; this.buildQueue = buildQueue; this.snapshot = snapshot; }
/// <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; }
private static void DisplayProjectStatus(CruiseServerClientBase client, string projectName, bool isQuiet) { try { if (!isQuiet) WriteLine(string.Format("Retrieving project '{0}' on server {1}", projectName, client.TargetServer), ConsoleColor.Gray); CruiseServerSnapshot snapShot = client.GetCruiseServerSnapshot(); foreach (ProjectStatus project in snapShot.ProjectStatuses) { if (string.Equals(project.Name, projectName, StringComparison.CurrentCultureIgnoreCase)) { DisplayProject(project); } } } catch (Exception error) { WriteError("ERROR: Unable to retrieve project details", error); } }
/// <summary> /// Initialise a new build queue. /// </summary> /// <param name="client">The underlying client.</param> /// <param name="server">The server this queue belongs to.</param> /// <param name="buildQueue">The actual build queue details.</param> public BuildQueue(CruiseServerClientBase client, Server server, QueueSnapshot buildQueue) { if (client == null) { throw new ArgumentNullException("client"); } if (server == null) { throw new ArgumentNullException("server"); } if (buildQueue == null) { throw new ArgumentNullException("buildQueue"); } this.client = client; this.server = server; this.buildQueue = buildQueue; }
private static void DisplayProjectStatus(CruiseServerClientBase client, string projectName, bool isQuiet) { try { if (!isQuiet) { WriteLine(string.Format(System.Globalization.CultureInfo.CurrentCulture, "Retrieving project '{0}' on server {1}", projectName, client.TargetServer), ConsoleColor.Gray); } CruiseServerSnapshot snapShot = client.GetCruiseServerSnapshot(); var wasFound = false; foreach (ProjectStatus project in snapShot.ProjectStatuses) { if (string.Equals(project.Name, projectName, StringComparison.CurrentCultureIgnoreCase)) { if (xml) { XmlSerializer serializer = new XmlSerializer(typeof(ProjectStatus)); Stream console = Console.OpenStandardOutput(); serializer.Serialize(console, project); console.Close(); } else { DisplayProject(project); } wasFound = true; break; } } if (!wasFound) { WriteError("Project '" + projectName + "' was not found", null); } } catch (Exception error) { WriteError("ERROR: Unable to retrieve project details", error); } }
/// <summary> /// Initialise the server. /// </summary> /// <param name="client"></param> /// <param name="watcher"></param> /// <param name="fetchVersion">Whether the version number should be fetched or not.</param> private void InitialiseServer(CruiseServerClientBase client, IServerWatcher watcher, bool fetchVersion) { this.watcher = watcher; this.watcher.Update += OnWatcherUpdate; this.client = client; if (fetchVersion) { try { client.ProcessSingleAction(s => { version = new Version(client.GetServerVersion()); }, client); } catch { // This means there will be no version for the server } } }
/// <summary> /// Wraps the specified project status. /// </summary> /// <param name="owningClient">The owning client.</param> /// <param name="projectStatus">The project status.</param> /// <param name="connection">The connection.</param> /// <returns> /// The new <see cref="CCProject"/>. /// </returns> internal static CCProject Wrap(CruiseServerClientBase owningClient, ProjectStatus projectStatus, CCConnection connection) { var project = new CCProject( owningClient, projectStatus.Name, projectStatus.Category, projectStatus.Activity, projectStatus.BuildStatus, projectStatus.Status, projectStatus.WebURL, projectStatus.LastBuildDate, projectStatus.LastBuildLabel, projectStatus.LastSuccessfulBuildLabel, projectStatus.NextBuildTime, projectStatus.BuildStage, projectStatus.Queue, projectStatus.QueuePriority) { Connection = connection }; return(project); }
private ServerAggregatingCruiseManagerWrapper InitialiseServerWrapper(MockRepository mocks, Action <CruiseServerClientBase> additionalSetup) { IRemoteServicesConfiguration configuration = mocks.Create <IRemoteServicesConfiguration>().Object; ICruiseServerClientFactory cruiseManagerFactory = mocks.Create <ICruiseServerClientFactory>().Object; CruiseServerClientBase cruiseManager = mocks.Create <CruiseServerClientBase>().Object; ServerLocation[] servers = new ServerLocation[] { serverLocation, otherServerLocation }; Mock.Get(configuration).SetupGet(_configuration => _configuration.Servers) .Returns(servers); Mock.Get(cruiseManagerFactory).Setup(_cruiseManagerFactory => _cruiseManagerFactory.GenerateClient(It.IsAny <string>(), It.IsAny <ClientStartUpSettings>())) .Returns(cruiseManager); ServerAggregatingCruiseManagerWrapper serverWrapper = new ServerAggregatingCruiseManagerWrapper( configuration, cruiseManagerFactory); if (additionalSetup != null) { additionalSetup(cruiseManager); } return(serverWrapper); }
/// <summary> /// Initializes a new instance of the <see cref="CCProject"/> class from being created. /// </summary> /// <param name="client">The client.</param> /// <param name="name">The name.</param> /// <param name="category">The category.</param> /// <param name="activity">The activity.</param> /// <param name="buildStatus">The build status.</param> /// <param name="status">The status.</param> /// <param name="webURL">The web URL.</param> /// <param name="lastBuildDate">The last build date.</param> /// <param name="lastBuildLabel">The last build label.</param> /// <param name="lastSuccessfulBuildLabel">The last successful build label.</param> /// <param name="nextBuildTime">The next build time.</param> /// <param name="buildStage">The build stage.</param> /// <param name="queue">The queue.</param> /// <param name="queuePriority">The queue priority.</param> /// <param name="parameters">The project parameters</param> private CCProject(CruiseServerClientBase client, string name, string category, ProjectActivity activity, IntegrationStatus buildStatus, ProjectIntegratorState status, string webURL, DateTime lastBuildDate, string lastBuildLabel, string lastSuccessfulBuildLabel, DateTime nextBuildTime, string buildStage, string queue, int queuePriority, List<ParameterBase> parameters) : base(name, category, activity, buildStatus, status, webURL, lastBuildDate, lastBuildLabel, lastSuccessfulBuildLabel, nextBuildTime, buildStage, queue, queuePriority, parameters) { this.client = client; }
/// <summary> /// Wraps the specified project status. /// </summary> /// <param name="owningClient">The owning client.</param> /// <param name="projectStatus">The project status.</param> /// <param name="connection">The connection.</param> /// <returns> /// The new <see cref="CCProject"/>. /// </returns> internal static CCProject Wrap(CruiseServerClientBase owningClient, ProjectStatus projectStatus, CCConnection connection) { var project = new CCProject( owningClient, projectStatus.Name, projectStatus.Category, projectStatus.Activity, projectStatus.BuildStatus, projectStatus.Status, projectStatus.WebURL, projectStatus.LastBuildDate, projectStatus.LastBuildLabel, projectStatus.LastSuccessfulBuildLabel, projectStatus.NextBuildTime, projectStatus.BuildStage, projectStatus.Queue, projectStatus.QueuePriority, projectStatus.Parameters) { Connection = connection }; return project; }
/// <summary> /// Initializes a new instance of the <see cref="CCConnection"/> class. /// </summary> /// <param name="client">The client.</param> /// <param name="version">The version.</param> public CCConnection(CruiseServerClientBase client, Version version) { this.client = client; this.Version = version; }
public HttpCruiseProjectManager(CruiseServerClientBase client, string projectName, ICruiseServerManager serverManager) { this.projectName = projectName; this.client = client; this.serverManager = serverManager; }
/// <summary> /// Initializes a new instance of the <see cref="CruiseControlCommand"/> class. /// </summary> /// <param name="address"> /// The address. /// </param> /// <param name="targetServer"> /// The target server. /// </param> /// <param name="buildNames"> /// The build names. /// </param> public CruiseControlCommand(string address, string targetServer, List<string> buildNames) { this.buildNames = buildNames; this.client = new CruiseServerClientFactory().GenerateHttpClient(address, targetServer) as CruiseServerClient; }
public void SetUp() { serverClient = mocks.DynamicMock<CruiseServerClientBase>(); serverManagerMock = mocks.StrictMock<ICruiseServerManager>(); manager = new HttpCruiseProjectManager(serverClient, "yyy", serverManagerMock); }
/// <summary> /// Initialise a new <see cref="ManualServerWatcher"/>. /// </summary> /// <param name="client">The underlying client to poll.</param> public ManualServerWatcher(CruiseServerClientBase client) { if (client == null) throw new ArgumentNullException("client"); this.client = client; }
private static void DisplayServerStatus(CruiseServerClientBase client, bool isQuiet) { try { if (!isQuiet) WriteLine("Retrieving snapshot from " + client.TargetServer, ConsoleColor.Gray); CruiseServerSnapshot snapShot = client.GetCruiseServerSnapshot(); foreach (ProjectStatus project in snapShot.ProjectStatuses) { DisplayProject(project); } } catch (Exception error) { WriteError("ERROR: Unable to retrieve server details", error); } }
/// <summary> /// Initializes a new instance of the <see cref="CCBuild"/> class. /// </summary> /// <param name="client">The client.</param> /// <param name="summary">The summary.</param> /// <param name="project">The project.</param> public CCBuild(CruiseServerClientBase client, BuildSummary summary, CCProject project) : base(summary) { this.client = client; this.Project = project; }
private static void DisplayProjectStatus(CruiseServerClientBase client, string projectName, bool isQuiet) { try { if (!isQuiet) WriteLine(string.Format(System.Globalization.CultureInfo.CurrentCulture,"Retrieving project '{0}' on server {1}", projectName, client.TargetServer), ConsoleColor.Gray); CruiseServerSnapshot snapShot = client.GetCruiseServerSnapshot(); var wasFound = false; foreach (ProjectStatus project in snapShot.ProjectStatuses) { if (string.Equals(project.Name, projectName, StringComparison.CurrentCultureIgnoreCase)) { if (xml) { XmlSerializer serializer = new XmlSerializer(typeof(ProjectStatus)); Stream console = Console.OpenStandardOutput(); serializer.Serialize(console, project); console.Close(); } else { DisplayProject(project); } wasFound = true; break; } } if (!wasFound) { WriteError("Project '" + projectName + "' was not found", null); } } catch (Exception error) { WriteError("ERROR: Unable to retrieve project details", error); } }
private static void DisplayServerStatus(CruiseServerClientBase client, bool isQuiet) { try { if (!isQuiet) WriteLine("Retrieving snapshot from " + client.TargetServer, ConsoleColor.Gray); CruiseServerSnapshot snapShot = client.GetCruiseServerSnapshot(); if (xml) { XmlSerializer serializer = new XmlSerializer(typeof(CruiseServerSnapshot)); Stream console = Console.OpenStandardOutput(); serializer.Serialize(console, snapShot); console.Close(); } else { foreach (ProjectStatus prj in snapShot.ProjectStatuses) { DisplayProject(prj); } } } catch (Exception error) { WriteError("ERROR: Unable to retrieve server details", error); } }
public void SetUp() { serverClient = mocks.DynamicMock<CruiseServerClientBase>(); manager = new HttpCruiseProjectManager(serverClient, "yyy"); }
/// <summary> /// Wraps the specified queue status. /// </summary> /// <param name="owningClient">The owning client.</param> /// <param name="queueStatus">The queue status.</param> /// <param name="connection">The connection.</param> /// <returns> /// The new <see cref="CCProject"/>. /// </returns> internal static CCQueue Wrap(CruiseServerClientBase owningClient, QueueSnapshot queueStatus, CCConnection connection) { var queue = new CCQueue(owningClient, queueStatus.QueueName, queueStatus.Requests) { Connection = connection }; return queue; }
/// <summary> /// Retrieves the action to perform. /// </summary> /// <param name="logger">The logger.</param> /// <param name="client">The client.</param> /// <param name="action">The action definition.</param> /// <returns>The action to perform.</returns> private static Action<string> RetrieveAction(ILogger logger, CruiseServerClientBase client, CruiseServerControlTaskAction action) { Action<string> projectAction = null; switch (action.Type) { case CruiseServerControlTaskActionType.StartProject: logger.Info("Performing start project action"); projectAction = p => { client.StartProject(p); }; break; case CruiseServerControlTaskActionType.StopProject: logger.Info("Performing stop project action"); projectAction = p => { client.StopProject(p); }; break; } return projectAction; }
/// <summary> /// Wraps the specified package status. /// </summary> /// <param name="owningClient">The owning client.</param> /// <param name="packageStatus">The package status.</param> /// <param name="project">The project.</param> /// <returns> /// The new <see cref="CCPackage"/>. /// </returns> internal static CCPackage Wrap(CruiseServerClientBase owningClient, PackageDetails packageStatus, CCProject project) { var package = new CCPackage( owningClient, packageStatus.Name, packageStatus.BuildLabel, packageStatus.DateTime, packageStatus.NumberOfFiles, packageStatus.Size, packageStatus.FileName) { Project = project }; return package; }
public HttpCruiseProjectManager(CruiseServerClientBase client, string projectName) { this.projectName = projectName; this.client = client; }
public RemotingCruiseServerManager(CruiseServerClientBase manager, BuildServer buildServer) { this.manager = manager; this.displayName = buildServer.DisplayName; this.configuration = buildServer; }
public RemotingCruiseProjectManager(CruiseServerClientBase manager, string projectName) { this.manager = manager; this.projectName = projectName; }
public void SetUp() { mockCruiseManager = repository.StrictMock<CruiseServerClientBase>(); manager = new RemotingCruiseProjectManager(mockCruiseManager, PROJECT_NAME); }