コード例 #1
0
ファイル: Driver.cs プロジェクト: manikyab/UTMonitor
        private Dictionary <string, string> GetResult(string ResultLocation)//Getting test case result
        {
            Dictionary <string, string> result = null;

            using (var XMLparse = new XMLParser.XMLParser())
            {
                result = XMLparse.ResultDisplay(ResultLocation, errorFetcher);
            }
            return(result);
        }
コード例 #2
0
        public int Deserialize_msg(Messages msg)
        {
            (" [[ Displaying Requirement 4 ---->>> Processing Dequeued Request Concurrently ]]").title('=');
            Messages      receivedTestrequest;
            List <string> dllList;
            string        time    = null;
            string        dirPath = null;

            lock (locker)
            {
                xmlParser           = new XMLParser.XMLParser();
                receivedTestrequest = new Messages();
                receivedTestrequest = msg;
                dllList             = new List <string>();
                time    = msg.time.ToString("MM-dd-yyyy") + " " + msg.time.Hour + "-" + msg.time.Minute + "-" + msg.time.Second + " " + msg.time.ToString("tt");
                dirPath = @"..\..\..\..\" + msg.author + "-" + time;
            }
            Console.WriteLine("creating director with name: {0}", dirPath); // creates a temporary directory
            Directory.CreateDirectory(dirPath);
            // TempDir.Add(dirPath);
            Queue <KeyValuePair <string, string> > xml_Info_queue;
            int nu, count;

            lock (locker)
            {
                xml_Info_queue    = new Queue <KeyValuePair <string, string> >();
                xml_Info_queue    = xmlParser.Parse(msg.message_content); // call parser
                testRequest_Queue = new Queue <KeyValuePair <string, string> >();
                savePath          = Path.GetFullPath(dirPath);            // this is the path of the temporary directory where the repo will upload files
                Console.WriteLine("Parsed in App domain manager");
                nu = xml_Info_queue.Count;
            }
            for (int i = 0; i < nu; i++)
            {
                var de = xml_Info_queue.Dequeue();
                testRequest_Queue.Enqueue(new KeyValuePair <string, string>(de.Key, de.Value));
                Console.WriteLine("key is: {0}  and val is: {1}", de.Key, de.Value);
                if (de.Key != "author")
                {
                    dllList.Add(de.Value); // makes a dll list to be retrived for testing from the repository
                }
            }
            lock (locker)
            {           // now the manager will ask the repository to send these files in this local directory..
                count = dllList.Count;
                Messages message_for_Repo = makeMessage("Repository", endPoint, RepositoryEndPoint);
                message_for_Repo.command         = "DLL_Request";
                message_for_Repo.message_content = dllList.ToXml();
                comm.sndr.PostMessage(message_for_Repo);
            }
            Console.WriteLine("waiting for repository to upload files: \n");
            lock (locker)
                receiveFiles(); // opens host for receiving files
            return(count);
        }
コード例 #3
0
        public async Task TestMethod1()
        {
            string             fileName = "defaultFile_2019_05_19_13_42_33.xml";
            ILogParserSettings lp       = new LogParserSettings();

            lp.IsConfigured = true;
            lp.AddMap(AnalogyLogMessagePropertyName.Id, "ID");
            lp.SupportedFilesExtensions = new List <string>()
            {
                "*.xml"
            };
            var fp = new XMLParser.XMLParser(lp);
            CancellationTokenSource  ts      = new CancellationTokenSource();
            MessageHandlerForTesting handler = new MessageHandlerForTesting();
            await fp.Process(fileName, ts.Token, handler);
        }
コード例 #4
0
ファイル: Append.cs プロジェクト: Shannarra/SASH
        /// <summary>
        /// Processes the given file and attends to parse it as .sashs file.
        /// </summary>
        /// <param name="name"></param>
        private void Process(string name)
        {
            if (!System.IO.File.Exists(System.IO.Path.Combine(this.path, name)))
            {
                Internal.Error($"The given file \"{System.IO.Path.Combine(this.path, name)}\" doesn't exist!");
                Internal.Starter(this.path);
            }
            else
            {
                var fullName = System.IO.Path.Combine(this.path, name);

                if (System.IO.Path.GetExtension(fullName) != ".sashs")
                {
                    Internal.Error("Expected a \".sashs\" file!");
                    Internal.Starter(this.path);
                }
                else
                {
                    System.Console.WriteLine("Parsing...");
                    XMLParser.XMLParser parser = new XMLParser.XMLParser(fullName, true);
                    System.Console.WriteLine("DONE!");
                }
            }
        }