Beispiel #1
0
        static void Main(string[] args)
        {
            string url = "http://www.crowe.chili/5.4/main.asmx";

            ChiliService.mainSoapClient soapClient = Connector.SetupConnection(url);

            string environment = "";
            string testName    = environment;

            // Needs to be an admin key
            KeyMaster.GetKey(soapClient, "admin", "admin");

            Dictionary <string, string> documentsToTest = new Dictionary <string, string>()
            {
            };

            GenerationTask render = new GenerationTask("", environment, soapClient);
            //render.copyDocument = true;
            //render.savedInEdtiorFalse = true;
            //render.allowServerRendering = true;

            List <GenerationTask> generationTasks = new List <GenerationTask>()
            {
                render
            };


            StressTest stressTest = new StressTest(soapClient, generationTasks, documentsToTest, 1, true, true, true, false, testName);

            Console.ReadKey();
        }
Beispiel #2
0
        public static List <string> GetAllDocumentsInFolder(ChiliService.mainSoapClient soapClient, string parentFolder, int levels = 1)
        {
            List <string> documents = new List <string>();

            string resourceGetTree = soapClient.ResourceGetTreeLevel(KeyMaster.key, "Documents", parentFolder, levels);


            if (resourceGetTree != null)
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(resourceGetTree);

                GetDocumentsInFolder(xmlDocument.FirstChild, ref documents, 0);
            }

            return(documents);
        }
Beispiel #3
0
        public static string GetKey(ChiliService.mainSoapClient soapClient, string username, string password)
        {
            if (key == null || key == "")
            {
                string keyXml = soapClient.GenerateApiKey("Admin", username, password);

                XmlDocument xmlDocument = new XmlDocument();

                xmlDocument.LoadXml(keyXml);

                if (xmlDocument.FirstChild.Attributes["key"] != null)
                {
                    key = xmlDocument.FirstChild.Attributes["key"].Value.ToString();
                }
            }

            return(key);
        }
Beispiel #4
0
        public StressTest(ChiliService.mainSoapClient soapClient, List <GenerationTask> generationTasks, Dictionary <string, string> documentsToTest = null, int batchAmount = 1, bool includeUrls = false, bool downloadPdf = true, bool showErrors = false, bool finalErrorReport = true, string testHeader = "")
        {
            this.soapClient       = soapClient;
            this.key              = GetKey();
            this.downloadPdf      = downloadPdf;
            this.includeUrls      = includeUrls;
            this.showErrors       = showErrors;
            this.finalErrorReport = finalErrorReport;

            if (documentsToTest != null)
            {
                this.documentsToTest = documentsToTest;
            }

            currentDirectory = $"{Directory.GetCurrentDirectory()}\\tests\\{DateTime.Now.Month}-{DateTime.Now.Day} at {DateTime.Now.Hour}_{DateTime.Now.Minute}";

            if (testHeader != "")
            {
                currentDirectory += " " + testHeader + "\\";
            }


            Directory.CreateDirectory(currentDirectory);
            Directory.CreateDirectory(currentDirectory + "\\pdfs\\");

            foreach (KeyValuePair <string, string> documentIdEnv in documentsToTest)
            {
                string environment = documentIdEnv.Value;
                string id          = documentIdEnv.Key;


                foreach (GenerationTask generationTask in generationTasks)
                {
                    RunTest(id, environment, batchAmount, generationTask);
                }
            }
        }
Beispiel #5
0
        public void TestConnection()
        {
            string url = ServerUrl;

            if (url != null)
            {
                if (url.Contains("?wsdl") == false)
                {
                    url += "?wsdl";
                }

                using (WebClient webClient = new WebClient())
                {
                    try
                    {
                        StreamReader streamReader = new StreamReader(webClient.OpenRead(url));
                        string       xml          = streamReader.ReadToEnd();

                        XmlDocument xmlDocument = new XmlDocument();

                        try
                        {
                            xmlDocument.LoadXml(xml);
                        }
                        catch (Exception e)
                        {
                        }

                        foreach (XmlNode xmlNode in xmlDocument.ChildNodes)
                        {
                            if (xmlNode.Attributes != null && xmlNode.Attributes["targetNamespace"] != null)
                            {
                                if (xmlNode.Attributes["targetNamespace"].Value == "http://www.chili-publisher.com/")
                                {
                                    urlGood = true;
                                }
                            }
                        }

                        streamReader.Close();
                    }
                    catch (WebException e)
                    {
                    }
                }
            }

            if (urlGood == true)
            {
                ServerIcon = new BitmapImage(new Uri("/SpicyDataDoctor;component/Images/icons8-ok-32.png", UriKind.Relative));
                Logger writeSav = new Logger(applicationPath + "/lib");
                writeSav.WriteFile(url, "sav1");

                soapClient = Connector.SetupConnection(url);
            }
            else
            {
                System.Windows.MessageBox.Show("Error: CHILI URL is bad");
                ServerIcon = new BitmapImage(new Uri("/SpicyDataDoctor;component/Images/icons8-cancel-32.png", UriKind.Relative));
            }
        }
Beispiel #6
0
 public KeyMaster(ChiliService.mainSoapClient soapClient)
 {
     //this.dataMaster = dataMaster;
     //this.soapClient = soapClient;
 }
Beispiel #7
0
        public static List <GenerationTask> ThreeRendering(string id, string environment, ChiliService.mainSoapClient soapClient)
        {
            GenerationTask gen = new GenerationTask(id, environment, soapClient);

            gen.copyDocument = true;

            GenerationTask genS = new GenerationTask(id, environment, soapClient);

            genS.copyDocument       = true;
            genS.savedInEdtiorFalse = true;

            GenerationTask genR = new GenerationTask(id, environment, soapClient);

            genR.copyDocument         = true;
            genR.allowServerRendering = true;

            return(new List <GenerationTask>()
            {
                gen, genS, genR
            });
        }