Exemple #1
0
        /**
         * Gets service status of remote servers.
         */
        public ServiceStatus GetServiceStatus()
        {
            var result = new ServiceStatus();

            if (Server.IsRemote == false)
            {
                result.isRemoteServer = false;
                return(result);
            }
            result.isRemoteServer = true;

            Trace.TraceInformation("Pinging VF and getting status");

            Jenkins.UserProfile.UserProfile info = null;

            if (JenkinsInstance.PingVF(out info))
            {
                result.vfConnected = true;
                if (JenkinsInstance.PingJenkins(out result.statusInfo))
                {
                    result.jenkinsConnected = true;
                }
            }

            if (ServiceStatusUpdated != null)
            {
                ServiceStatusUpdated(result);
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Test VF connection and see if the user is logged in or not.
        /// </summary>
        /// <param name="info">Gets details about the user.</param>
        /// <returns>True if VF connection is alive and we have a logged in session, otherwise false</returns>
        public bool PingVF(out UserProfile.UserProfile info)
        {
            bool result = false;

            info = null;

            try
            {
                info   = this.GetUserProfile(rethrow: true);
                result = true;
            }
            catch (Exception ex)
            {
                // TODO: refine it to webexception and error codes
                Trace.TraceError(ex.ToString());
                result = false;
            }

            return(result);
        }
Exemple #3
0
        public UserProfile.UserProfile GetUserProfile(bool rethrow = false)
        {
            Login();
            string response = SendGetRequest(ServerUrl + Queries.USER_PROFILE, rethrow: rethrow);

            //Console.WriteLine(response);
            UserProfile.UserProfile result = null;
            if (response != null)
            {
                try
                {
                    result = Newtonsoft.Json.JsonConvert.DeserializeObject <UserProfile.UserProfile>(response);
                }
                catch (Newtonsoft.Json.JsonException ex)
                {
                    Trace.TraceError(ex.ToString());
                }
            }
            return(result);
        }
Exemple #4
0
 /// <summary>
 /// Test VF connection and see if the user is logged in or not.
 /// </summary>
 /// <returns>True if VF connection is alive and we have a logged in session, otherwise false</returns>
 public bool PingVF()
 {
     UserProfile.UserProfile info = null;
     return(this.PingVF(out info));
 }