private void Init()
        {
            if (!first)
            {
                return;
            }
            string host = null;
            string port = null;

            try
            {
                enabled = Boolean.Parse(Configuration.Instance.GetProperty(CONFIGURATION_SECTION, "enabled"));
            }
            catch
            {
                enabled = false;
            }

            try
            {
                if (!enabled)
                {
                    return;
                }
                host = Configuration.Instance.GetProperty(CONFIGURATION_SECTION, "host");
                port = Configuration.Instance.GetProperty(CONFIGURATION_SECTION, "port");
                ExecutionDetails executionDetails = new ExecutionDetails();
                if (Configuration.Instance.IsPropertyExists(CONFIGURATION_SECTION, "executionDescription"))
                {
                    executionDetails.description = Configuration.Instance.GetProperty(CONFIGURATION_SECTION, "executionDescription");
                }
                if (Configuration.Instance.IsPropertyExists(CONFIGURATION_SECTION, "executionProperties"))
                {
                    string executionPropertiesValue = Configuration.Instance.GetProperty(CONFIGURATION_SECTION, "executionProperties");

                    // Parsing the properties from the configuration file and adding them as execution properties
                    executionDetails.executionProperties = executionPropertiesValue.Split(';')
                                                           .Select(value => value.Split('='))
                                                           .ToDictionary(pair => pair[0], pair => pair[1]);

                    // We are also adding the execution properties as scenario properties so we could see it in the ElasticSearch
                    Scenario scenario = (Scenario)CurrentExecution.GetLastMachine().children[0];
                    scenario.scenarioProperties = executionDetails.executionProperties;
                }

                client      = new DifidoClient(host, Int32.Parse(port));
                executionId = client.AddExecution(executionDetails);
                machineId   = client.AddMachine(executionId, CurrentExecution.GetLastMachine());
                enabled     = true;
            }
            catch
            {
                enabled = false;
            }
            first = false;
        }
Beispiel #2
0
        private void Init()
        {
            if (!first)
            {
                return;
            }
            string host = "localhost";
            int    port = 8080;

            try
            {
                if (!enabled)
                {
                    return;
                }
                // host = Configuration.Instance.GetProperty("report", "reportServerHost");
                // port = Configuration.Instance.GetProperty("report", "reportServerPort");
                ExecutionDetails executionDetails = new ExecutionDetails();
                //executionDetails.description = "Some description";

                //string executionPropertiesValue = "key0=val0;key1=val1";

                //// Parsing the properties from the configuration file and adding them as execution properties
                //executionDetails.executionProperties = executionPropertiesValue.Split(';')
                //    .Select(value => value.Split('='))
                //    .ToDictionary(pair => pair[0], pair => pair[1]);

                //// We are also adding the execution properties as scenario properties so we could see it in the ElasticSearch
                //Scenario scenario = (Scenario)CurrentExecution.GetLastMachine().children[0];
                //scenario.scenarioProperties = executionDetails.executionProperties;

                client      = new DifidoClient(host, port);
                executionId = client.AddExecution(executionDetails);
                machineId   = client.AddMachine(executionId, CurrentExecution.GetLastMachine());
                enabled     = true;
            }
            catch
            {
                enabled = false;
            }
            first = false;
        }