Example #1
0
 public void GetWebServiceTimeout()
 {
     #region GetWebServiceTimeout
     TimeSpan timeout = WebServiceConfig.GetWebServiceTimeout();
     #endregion
     Assert.AreEqual(10, timeout.Seconds);
 }
Example #2
0
 public void GetWebServiceUrl()
 {
     #region WebServiceConfig
     string url = WebServiceConfig.GetWebServiceUri();
     #endregion
     Assert.AreEqual("http://magenicautomation.azurewebsites.net", url);
 }
Example #3
0
        public void CanOverrideWebServiceDriver()
        {
            WebServiceDriver tempDriver = new WebServiceDriver(WebServiceConfig.GetWebServiceUri());

            this.WebServiceDriver = tempDriver;

            Assert.AreEqual(this.TestObject.WebServiceManager.Get(), tempDriver);
        }
        public static void TestCleanup()
        {
            // Do web service post run cleanup
            WebServiceDriver client = new WebServiceDriver(new Uri(WebServiceConfig.GetWebServiceUri()));
            string           result = client.Delete("/api/String/Delete/1", "text/plain", true);

            Assert.AreEqual(string.Empty, result);
        }
Example #5
0
        public void WebServiceDriverUsesProxy()
        {
            string url = WebServiceConfig.GetWebServiceUri().Replace("https://", "http://");

            this.WebServiceDriver.HttpClient.BaseAddress = new Uri(url);

            this.WebServiceDriver.GetWithResponse("/api/XML_JSON/GetAllProducts", "application/json");

            bool proxyUsed = RequestsHistory.Values.Any(r => r.RequestUri.ToString().Contains("/api/XML_JSON/GetAllProducts"));

            Assert.IsTrue(proxyUsed, "Failed to assert the proxy was used by the Web Service Driver.");
        }
Example #6
0
 public SysTools()
 {
     try
     {
         string serverIP = Tiger.Tools.ReflectionHelper.GetUrl("ServerIP");
         if (serverIP.Trim() == "")
         {
             serverIP = "localhost";
         }
         Tiger.Tools.WebServiceConfig.SetWebURL(serverIP);
         BasicSer  = new WangDaDll.BaseSerReference.BaseSerSoapClient(WebServiceConfig.BuildBinding(), new System.ServiceModel.EndpointAddress(WebServiceConfig.BaseSerURL));
         WangDaSer = new WangDaDll.WangDaReference.WangDaSerSoapClient(WebServiceConfig.BuildBinding(), new System.ServiceModel.EndpointAddress(WebServiceConfig.WangDaSerURL));
         UserSer   = new WangDaDll.UserSerReference.UserSerSoapClient(WebServiceConfig.BuildBinding(), new System.ServiceModel.EndpointAddress(WebServiceConfig.UserSerURL));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #7
0
        static SysTools()
        {
            try
            {
                string serverIP = ReflectionHelper.GetUrl("ServerIP");
                if (serverIP.Trim() == "")
                {
                    serverIP = "localhost";
                }
                WebServiceConfig.SetWebURL(serverIP);
                basicSer = new BaseSerReference.BaseSerSoapClient(WebServiceConfig.BuildBinding(), new System.ServiceModel.EndpointAddress(WebServiceConfig.BaseSerURL));

                basicService = new BasicServiceReference.BasicServiceSoapClient(WebServiceConfig.BuildBinding(), new System.ServiceModel.EndpointAddress(WebServiceConfig.BasicServiceURL));

                userSer = new UserSerReference.UserSerSoapClient(WebServiceConfig.BuildBinding(), new System.ServiceModel.EndpointAddress(WebServiceConfig.UserSerURL));

                config = new ConfigReference.ConfigSoapClient(WebServiceConfig.BuildBinding(), new System.ServiceModel.EndpointAddress(WebServiceConfig.ConfigURL));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #8
0
 public void GetProxyAddress()
 {
     Assert.AreEqual("127.0.0.1:8001", WebServiceConfig.GetProxyAddress());
 }
Example #9
0
 public void GetUseProxy()
 {
     Assert.IsFalse(WebServiceConfig.GetUseProxy());
 }
Example #10
0
        public void GetWebServiceTimeout()
        {
            TimeSpan timeout = WebServiceConfig.GetWebServiceTimeout();

            Assert.AreEqual(10, timeout.Seconds);
        }
Example #11
0
 public void GetWebServiceVersion()
 {
     Assert.AreEqual("1.1", WebServiceConfig.GetHttpClientVersion());
 }
Example #12
0
        public void GetXmlDeserialized()
        {
            WebServiceDriver client = new WebServiceDriver(new Uri(WebServiceConfig.GetWebServiceUri()));

            client.Get <ArrayOfProduct>("/api/XML_JSON/GetAllProducts", "application/xml", false);
        }
        public void OverrideWorksForFactory()
        {
            HttpClient factoryClient = Magenic.Maqs.BaseWebServiceTest.HttpClientFactory.GetDefaultClient();

            Assert.AreEqual(WebServiceConfig.GetWebServiceUri() + "/", factoryClient.BaseAddress.ToString());
        }
 public HttpService(WebServiceConfig config) : base(config) { }
Example #15
0
        public static async Task <Document> ParseXmlAsync(XmlDocument xmlFile, string fileName)
        {
            XmlNode        root     = xmlFile.DocumentElement;
            XmlNodeList    nodes    = root.ChildNodes;
            Document       document = new Document();
            List <SqlData> SqlData  = new List <SqlData>();

            document.Tags = new List <Tag>();

            document.GlobalResources = null;
            //Dictionary<string, Dictionary<string,string>> nodeMap = new Dictionary<string, Dictionary<string, string>>();
            //Dictionary<Dictionary<string, string>, Dictionary<string, string>> childNodeMap = new Dictionary<Dictionary<string, string>, Dictionary<string, string>>();
            if (fileName.Contains("global"))
            {
                document.IsGlobal                         = true;
                document.GlobalResources                  = new GlobalResources();
                document.GlobalResources.DbConfig         = new List <DbConfig>();
                document.GlobalResources.WebServiceConfig = new List <WebServiceConfig>();
            }

            foreach (XmlNode node in nodes)
            {
                //nodeMap[node.Name] = new Dictionary<string, string>();
                Tag tag = new Tag();
                Console.WriteLine(node.Name);
                tag.tagName = node.Name;
                Console.WriteLine("----------------------");
                if (node.Attributes != null)
                {
                    XmlAttributeCollection attributes = node.Attributes;
                    tag.attributeKeyValue = new Dictionary <string, string>();
                    bool             addNameToNode   = false;
                    bool             dbConfigCreated = false;
                    bool             wsConfigCreated = false;
                    DbConfig         dbConfig        = null;
                    WebServiceConfig wsConfig        = null;
                    var AttributeCount = attributes.Count;

                    var i = 0;
                    foreach (XmlAttribute attribute in attributes)
                    {
                        i++;
                        tag.attributeKeyValue.Add(attribute.Name, attribute.Value);

                        if (node.Name.Equals("flow") || node.Name.Equals("sub-flow"))
                        {
                            if (!addNameToNode && attribute.Name.Equals("name"))
                            {
                                tag.tagName   = node.Name + " (" + attribute.Value + ")";
                                addNameToNode = true;
                            }
                        }
                        else if (fileName.Contains("global"))
                        {
                            //ADDITIONAL CONDITION FOR GLOBAL.XML FILE
                            if (!addNameToNode && attribute.Name.Equals("name"))
                            {
                                tag.tagName   = node.Name + " (" + attribute.Value + ")";
                                addNameToNode = true;
                            }

                            if (node.Name.StartsWith("db:"))
                            {
                                if (!dbConfigCreated)
                                {
                                    dbConfig        = new DbConfig();
                                    dbConfigCreated = true;
                                    dbConfig.DbType = node.Name;
                                }

                                if (attribute.Name.Equals("name"))
                                {
                                    dbConfig.Dbname = attribute.Value;
                                }
                                else if (attribute.Name.Equals("url"))
                                {
                                    dbConfig.DbUrl = attribute.Value;
                                }
                            }
                            if (node.Name.StartsWith("ws:"))
                            {
                                if (!wsConfigCreated)
                                {
                                    wsConfig        = new WebServiceConfig();
                                    wsConfigCreated = true;
                                }

                                if (attribute.Name.Equals("name"))
                                {
                                    wsConfig.WsName = attribute.Value;
                                }
                                else if (attribute.Name.Equals("service"))
                                {
                                    wsConfig.WsService = attribute.Value;
                                }
                                else if (attribute.Name.Equals("port"))
                                {
                                    wsConfig.WsPort = attribute.Value;
                                }
                                else if (attribute.Name.Equals("wsdlLocation"))
                                {
                                    wsConfig.wsdlLocation = attribute.Value;
                                }
                                else if (attribute.Name.Equals("connectorConfig"))
                                {
                                    wsConfig.WsconnectorConfig = attribute.Value;
                                }
                            }
                        }
                        else if (!fileName.Contains("global") && !fileName.Contains("api"))
                        {
                            continue;
                        }
                        Console.WriteLine(attribute.Name + " -> " + attribute.Value);
                        //nodeMap[node.Name][attribute.Name] = attribute.Value;
                        if (i == AttributeCount && node.Name.StartsWith("db:"))
                        {
                            document.GlobalResources.DbConfig.Add(dbConfig);
                        }

                        if (i == AttributeCount && node.Name.StartsWith("ws:"))
                        {
                            document.GlobalResources.WebServiceConfig.Add(wsConfig);
                        }
                    }

                    if (node.HasChildNodes)
                    {
                        tag.hasChildTag = true;

                        tag.childTagList = new List <ChildTag>();

                        XmlNodeList childNodes = node.ChildNodes;

                        foreach (XmlNode childNode in childNodes)
                        {
                            ChildTag childTag = new ChildTag();
                            XmlAttributeCollection childAttributes = childNode.Attributes;
                            if (childAttributes != null)
                            {
                                Console.WriteLine("\n");

                                if (childAttributes.Count == 0)
                                {
                                    break;
                                }

                                childTag.childTagname = childNode.Name;

                                // Console.WriteLine("Child node name: " + childNode.Name);
                                //Console.WriteLine("+++++++++++++++");

                                childTag.childTagCount = childAttributes.Count;
                                //else
                                //{
                                childTag.childAttributeKeyValue = new Dictionary <string, string>();
                                foreach (XmlAttribute attribute in childAttributes)
                                {
                                    Console.WriteLine(attribute.Name + " -> " + attribute.Value);
                                    childTag.childAttributeKeyValue.Add(attribute.Name, attribute.Value);



                                    //ADDITIONAL CHILD NODE CONDITION FOR GLOBAL.XML FILE
                                    if (attribute.Name.Equals("name") && fileName.Contains("global"))
                                    {
                                        childTag.childTagname = childNode.Name + " (" + attribute.Value + ")";
                                    }

                                    if (childNode.Name.Equals("db:select"))
                                    {
                                        if (attribute.Name.Equals("config-ref") && attribute.Value.Equals("Oracle_Configuration_BANNER", StringComparison.InvariantCultureIgnoreCase))
                                        {
                                            if (childNode.HasChildNodes)
                                            {
                                                if (!childNode.InnerText.Equals("#[payload]", StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    XmlNodeList childOfChildNodes = childNode.ChildNodes;
                                                    foreach (XmlNode childofChildNode in childOfChildNodes)
                                                    {
                                                        //Console.WriteLine(childofChildNode.InnerText);
                                                        //Console.WriteLine(childofChildNode.Name);
                                                        if (childofChildNode.Name.Equals("db:parameterized-query"))
                                                        {
                                                            var     sqlQuery = childNode.InnerText;
                                                            SqlData sqlData  = await Run(sqlQuery);

                                                            sqlData.databaseType = attribute.Value;
                                                            sqlData.operation    = childNode.Name;
                                                            SqlData.Add(sqlData);
                                                            //Task.Run(() => Run(sqlQuery)).Wait();
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else if (childNode.Name.Equals("db:stored-procedure") && attribute.Name.Equals("config-ref") && attribute.Value.Equals("Oracle_Configuration_BANNER", StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        if (childNode.HasChildNodes && !childNode.InnerText.Equals("#[payload]", StringComparison.InvariantCultureIgnoreCase))
                                        {
                                            XmlNodeList childOfChildNodes = childNode.ChildNodes;
                                            foreach (XmlNode childofChildNode in childOfChildNodes)
                                            {
                                                if (childofChildNode.Name.Equals("db:parameterized-query"))
                                                {
                                                    SqlData sqlData = new SqlData();
                                                    sqlData.isStoredProcedure = true;
                                                    sqlData.storedProcedure   = childNode.InnerText;
                                                    sqlData.databaseType      = attribute.Value;
                                                    sqlData.operation         = childNode.Name;
                                                    SqlData.Add(sqlData);
                                                }
                                            }
                                        }
                                    }

                                    //CONDITION FOR CHILD NODES
                                    if (childNode.HasChildNodes)
                                    {
                                        childTag.hasGrandchildTag = true;

                                        childTag.grandchildTagList = new List <GrandchildTag>();

                                        XmlNodeList grandchildNodes = childNode.ChildNodes;

                                        foreach (XmlNode grandchildNode in grandchildNodes)
                                        {
                                            GrandchildTag          grandchildTag        = new GrandchildTag();
                                            XmlAttributeCollection grandchildAttributes = grandchildNode.Attributes;
                                            if (grandchildAttributes != null)
                                            {
                                                Console.WriteLine("\n");

                                                if (grandchildAttributes.Count == 0)
                                                {
                                                    break;
                                                }

                                                grandchildTag.grandchildTagname = grandchildNode.Name;

                                                // Console.WriteLine("Child node name: " + childNode.Name);
                                                //Console.WriteLine("+++++++++++++++");

                                                grandchildTag.grandchildTagCount = grandchildAttributes.Count;
                                                //else
                                                //{
                                                grandchildTag.grandchildAttributeKeyValue = new Dictionary <string, string>();
                                                foreach (XmlAttribute gcAttribute in grandchildAttributes)
                                                {
                                                    Console.WriteLine(gcAttribute.Name + " -> " + gcAttribute.Value);
                                                    grandchildTag.grandchildAttributeKeyValue.Add(gcAttribute.Name, gcAttribute.Value);
                                                }
                                            }
                                            childTag.grandchildTagList.Add(grandchildTag);
                                        }
                                    }
                                }
                                document.SqlData = SqlData;
                            }
                            tag.childTagList.Add(childTag);
                        }
                    }

                    Console.WriteLine("\n");
                    if (tag.attributeKeyValue.Count > 0)
                    {
                        document.Tags.Add(tag);
                    }
                }
            }
            return(document);
        }