public void RetrieveSnapshotFromManager() { CruiseServerSnapshot snapshot = new CruiseServerSnapshot(); Expect.Call(serverClient.GetCruiseServerSnapshot()).Return(snapshot); mocks.ReplayAll(); CruiseServerSnapshot actual = manager.GetCruiseServerSnapshot(); Assert.AreSame(snapshot, actual); }
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> /// Attempt to retrieve a snapshot from the remote server. /// </summary> private void RetrieveSnapshot() { // Retrieve the snapshot ServerUpdateArgs args; try { CruiseServerSnapshot snapshot = null; try { snapshot = client.GetCruiseServerSnapshot(); } catch (NotImplementedException) { // This is an older style server, try fudging the snapshot snapshot = new CruiseServerSnapshot { ProjectStatuses = client.GetProjectStatus() }; } args = new ServerUpdateArgs(snapshot); } catch (Exception error) { args = new ServerUpdateArgs(error); } // Fire the update if (Update != null) { Update(this, args); } }
public void RetrieveSnapshotFromManager() { var snapshot = new CruiseServerSnapshot(); Expect.Call(cruiseManagerMock.GetCruiseServerSnapshot()) .IgnoreArguments() .Return(snapshot); mocks.ReplayAll(); CruiseServerSnapshot result = manager.GetCruiseServerSnapshot(); Assert.AreEqual(snapshot, result); }
/// <summary> /// Gets the projects and integration queues snapshot from this server. /// </summary> public CruiseServerSnapshot GetCruiseServerSnapshot() { // Question - what should happen if we get a System.Net.WebException (timeout) here? // I frequently see these when querying a CruiseControl.java instance. try { var snapshot = manager.GetCruiseServerSnapshot(); return(snapshot); } catch (System.Net.WebException) { return(new CruiseServerSnapshot()); } }
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); } }
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> /// Gets the projects and integration queues snapshot from this server. /// </summary> public CruiseServerSnapshot GetCruiseServerSnapshot() { var snapshot = manager.GetCruiseServerSnapshot(); return(snapshot); }
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); } }
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); } }