コード例 #1
0
        /// <summary>
        /// private Constructor
        /// </summary>
        /// <param name="testSite"></param>
        private SUTControlProtocolHandler(ITestSite testSite)
        {
            this.Site = testSite;

            // Initiate request id
            requestId = 1;

            // Initiate transport
            string transportType = testSite.Properties["SUTControl.TransportType"];
            if (transportType == null)
            {
                transportType = "TCP";
            }
            if (transportType.Equals("TCP"))
            {
                transport = new TCPSUTControlTransport();
            }
            else
            {
                transport = new UDPSUTControlTransport();
            }

            // Initiate timeout time span
            timeout = new TimeSpan(0, 0, 20);

            // Initiate Connect payload type
            bool clientSupportRDPFile = false;
            try
            {
                clientSupportRDPFile = bool.Parse(testSite.Properties["SUTControl.ClientSupportRDPFile"]);
            }
            catch
            {
            }

            // Initiate alwaysNeedResponse
            alwaysNeedResponse = true;
            try
            {
                alwaysNeedResponse = bool.Parse(testSite.Properties["SUTControl.AlwaysNeedResponse"]);
            }
            catch
            {
            }

            // Get Agent addresses
            string addresses = testSite.Properties["SUTControl.AgentAddress"];
            string[] addressList = addresses.Split(';');
            AgentList = new List<IPEndPoint>();
            foreach (string address in addressList)
            {
                try
                {
                    if (address != null && address.Trim().Length > 0)
                    {
                        int separator = address.IndexOf(':');
                        string add = address.Substring(0, separator).Trim();
                        string port = address.Substring(separator + 1).Trim();
                        IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse(add), int.Parse(port));
                        AgentList.Add(endpoint);
                    }

                }
                catch (Exception e)
                {
                    this.Site.Log.Add(LogEntryKind.Comment, "RDP SUT Control Protocol Adapter: Illegal address string :" + e.Message);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// private Constructor
        /// </summary>
        /// <param name="testSite"></param>
        private SUTControlProtocolHandler(ITestSite testSite)
        {
            this.Site = testSite;

            // Initiate request id
            requestId = 1;

            // Initiate transport
            string transportType = testSite.Properties["SUTControl.TransportType"];

            if (transportType == null)
            {
                transportType = "TCP";
            }
            if (transportType.Equals("TCP"))
            {
                transport = new TCPSUTControlTransport();
            }
            else
            {
                transport = new UDPSUTControlTransport();
            }

            // Initiate timeout time span
            timeout = new TimeSpan(0, 0, 20);

            // Initiate Connect payload type
            bool clientSupportRDPFile = false;

            try
            {
                clientSupportRDPFile = bool.Parse(testSite.Properties["SUTControl.ClientSupportRDPFile"]);
            }
            catch
            {
            }

            // Initiate alwaysNeedResponse
            alwaysNeedResponse = true;
            try
            {
                alwaysNeedResponse = bool.Parse(testSite.Properties["SUTControl.AlwaysNeedResponse"]);
            }
            catch
            {
            }

            // Get Agent addresses
            string addresses = testSite.Properties["SUTControl.AgentAddress"];

            string[] addressList = addresses.Split(';');
            AgentList = new List <IPEndPoint>();
            foreach (string address in addressList)
            {
                try
                {
                    if (address != null && address.Trim().Length > 0)
                    {
                        int        separator = address.IndexOf(':');
                        string     add       = address.Substring(0, separator).Trim();
                        string     port      = address.Substring(separator + 1).Trim();
                        IPEndPoint endpoint  = new IPEndPoint(IPAddress.Parse(add), int.Parse(port));
                        AgentList.Add(endpoint);
                    }
                }
                catch (Exception e)
                {
                    this.Site.Log.Add(LogEntryKind.Comment, "RDP SUT Control Protocol Adapter: Illegal address string :" + e.Message);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// private Constructor
        /// </summary>
        /// <param name="testSite"></param>
        private SUTControlProtocolHandler(ITestSite testSite)
        {
            this.Site = testSite;

            // Initiate request id
            requestId = 1;

            // Initiate transport
            string transportType;

            PtfPropUtility.GetPtfPropertyValue(testSite, "TransportType", out transportType, new string[] { RdpPtfGroupNames.SUTControl });
            if (transportType == null)
            {
                transportType = "TCP";
            }
            if (transportType.Equals("TCP"))
            {
                transport = new TCPSUTControlTransport();
            }
            else
            {
                transport = new UDPSUTControlTransport();
            }

            // Initiate timeout time span
            timeout = new TimeSpan(0, 0, 20);

            // Initiate Connect payload type
            bool clientSupportRDPFile = false;

            PtfPropUtility.GetPtfPropertyValue(testSite, "ClientSupportRDPFile", out clientSupportRDPFile, new string[] { RdpPtfGroupNames.SUTControl });

            // Initiate alwaysNeedResponse
            PtfPropUtility.GetPtfPropertyValue(testSite, "AlwaysNeedResponse", out alwaysNeedResponse, new string[] { RdpPtfGroupNames.SUTControl });

            // Get Agent addresses
            string addresses;

            PtfPropUtility.GetPtfPropertyValue(testSite, "AgentAddress", out addresses, new string[] { RdpPtfGroupNames.SUTControl });

            string[] addressList = addresses.Split(';');
            AgentList = new List <IPEndPoint>();
            foreach (string address in addressList)
            {
                try
                {
                    if (address != null && address.Trim().Length > 0)
                    {
                        int separator = address.IndexOf(':');
                        //Consider AgentAddress may be SUT hostname, or IP addresses
                        List <IPAddress> addList = CommonUtility.GetHostIPs(this.Site, address.Substring(0, separator));
                        string           port    = address.Substring(separator + 1).Trim();
                        foreach (IPAddress add in addList)
                        {
                            IPEndPoint endpoint = new IPEndPoint(add, int.Parse(port));
                            AgentList.Add(endpoint);
                        }
                    }
                }
                catch (Exception e)
                {
                    this.Site.Log.Add(LogEntryKind.Comment, "RDP SUT Control Protocol Adapter: Invalid Agent IP address/host name string or port number:" + e.Message);
                }
            }
        }