Exemplo n.º 1
0
        /// <summary>
        /// Records the test result
        /// </summary>
        /// <param name="TestRunId"></param>
        /// <param name="Actual"></param>
        /// <param name="Expected"></param>
        /// <param name="Sign"></param>
        private static void RecordResult(int TestRunId, object Actual, string Expected, string Sign)
        {
            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder hostServerConnectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            hostServerConnectionString.Host           = "localhost";
            hostServerConnectionString.Port           = 5555;
            hostServerConnectionString.IsPrimaryLogin = true;
            hostServerConnectionString.Integrated     = true;

            SourceCode.SmartObjects.Client.SmartObjectClientServer serverName = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
            serverName.CreateConnection();
            serverName.Connection.Open(hostServerConnectionString.ToString());

            try
            {
                SourceCode.SmartObjects.Client.SmartObject smartObject = serverName.GetSmartObject("K2C_TST_SMO_TestRun");
                smartObject.MethodToExecute = "Execute_NaN";
                smartObject.GetMethod("Execute_NaN").Parameters["pTestRunId"].Value      = TestRunId.ToString();
                smartObject.GetMethod("Execute_NaN").Parameters["pResult"].Value         = Actual.ToString();
                smartObject.GetMethod("Execute_NaN").Parameters["pExpectedResult"].Value = Expected;
                smartObject.GetMethod("Execute_NaN").Parameters["pPass"].Value           = Result(Actual, Expected, Sign).ToString();


                serverName.ExecuteScalar(smartObject);
            }
            catch (Exception ex)
            {
                string x = ex.Message;
            }
            finally
            {
                serverName.Connection.Close();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update the test details to say it has finished
        /// </summary>
        /// <param name="TestId"></param>
        private static void UpdateTestDetailsEnd(int TestId)
        {
            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder hostServerConnectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            hostServerConnectionString.Host           = "localhost";
            hostServerConnectionString.Port           = 5555;
            hostServerConnectionString.IsPrimaryLogin = true;
            hostServerConnectionString.Integrated     = true;

            SourceCode.SmartObjects.Client.SmartObjectClientServer serverName = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
            serverName.CreateConnection();
            serverName.Connection.Open(hostServerConnectionString.ToString());

            try
            {
                SourceCode.SmartObjects.Client.SmartObject smartObject = serverName.GetSmartObject("K2C_TST_SMO_TestRun");
                smartObject.MethodToExecute = "Execute_NaN_NaN_1";
                smartObject.GetMethod("Execute_NaN_NaN_1").Parameters["pTestId"].Value = TestId.ToString();
                serverName.ExecuteScalar(smartObject);
            }
            catch (Exception ex)
            { string x = ex.Message; }
            finally
            {
                serverName.Connection.Close();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the test details to say it has started
        /// </summary>
        /// <param name="TestDetailsid"></param>
        /// <param name="ProcessInstanceId"></param>
        /// <param name="Folio"></param>
        /// <param name="Originator"></param>
        /// <param name="StartedDate"></param>
        /// <param name="Started"></param>
        private static void UpdateTestDetails(int TestDetailsid, int ProcessInstanceId, string Folio, string Originator, DateTime StartedDate, bool Started)
        {
            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder hostServerConnectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            hostServerConnectionString.Host           = "localhost";
            hostServerConnectionString.Port           = 5555;
            hostServerConnectionString.IsPrimaryLogin = true;
            hostServerConnectionString.Integrated     = true;

            SourceCode.SmartObjects.Client.SmartObjectClientServer serverName = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
            serverName.CreateConnection();
            serverName.Connection.Open(hostServerConnectionString.ToString());

            try
            {
                SourceCode.SmartObjects.Client.SmartObject smartObject = serverName.GetSmartObject("K2C_TST_SMO_TestRun");
                smartObject.MethodToExecute = "Execute_NaN_1";
                smartObject.GetMethod("Execute_NaN_1").Parameters["pTestDetailsid"].Value     = TestDetailsid.ToString();
                smartObject.GetMethod("Execute_NaN_1").Parameters["pProcessInstanceId"].Value = ProcessInstanceId.ToString();
                smartObject.GetMethod("Execute_NaN_1").Parameters["pFolio"].Value             = Folio.ToString();
                smartObject.GetMethod("Execute_NaN_1").Parameters["pOriginator"].Value        = Originator.ToString();
                smartObject.GetMethod("Execute_NaN_1").Parameters["pStartedDate"].Value       = StartedDate.ToString();
                smartObject.GetMethod("Execute_NaN_1").Parameters["pStarted"].Value           = Started.ToString();
                serverName.ExecuteScalar(smartObject);
            }
            catch (Exception ex)
            {
                string x = ex.Message;
            }
            finally
            {
                serverName.Connection.Close();
            }
        }
Exemplo n.º 4
0
        private void Check_SmartObjectClientServer()
        {
            string connStr = string.Format("Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host={0};Port={1}", _K2ServerName, _PortNo);

            try
            {
                if (cServer == null)
                {
                    cServer = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
                    cServer.CreateConnection();
                    cServer.Connection.Open(connStr);
                }
            }
            catch
            {
                throw new Exception("Couldn't create connection to server");
            }
        }
        private SourceCode.SmartObjects.Client.SmartObjectClientServer GetSmOServer()
        {
            SCConnectionStringBuilder ConnectionString = new SCConnectionStringBuilder();
            ConnectionString.Authenticate = true;
            ConnectionString.IsPrimaryLogin = true;
            ConnectionString.Integrated = true;
            ConnectionString.Host = "localhost";
            ConnectionString.Port = 5555;

            SourceCode.SmartObjects.Client.SmartObjectClientServer SmoClient = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
            SmoClient.CreateConnection();
            SmoClient.Connection.Open(ConnectionString.ConnectionString);

            return SmoClient;
        }
        /// <summary>
        /// Gets a list of Events for an activity
        /// </summary>
        /// <param name="activityid"></param>
        /// <returns></returns>
        public List <Events> GetEvents(string activityid)
        {
            List <Events> list = new List <Events>();


            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder hostServerConnectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            hostServerConnectionString.Host           = servername;
            hostServerConnectionString.Port           = 5555;
            hostServerConnectionString.IsPrimaryLogin = true;
            hostServerConnectionString.Integrated     = true;

            SourceCode.SmartObjects.Client.SmartObjectClientServer serverName = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
            serverName.CreateConnection();
            serverName.Connection.Open(hostServerConnectionString.ToString());

            try
            {
                SourceCode.SmartObjects.Client.SmartObject smartObject = serverName.GetSmartObject("Event_Instance");
                smartObject.MethodToExecute = "List";
                smartObject.Properties["ActivityInstanceID"].Value = activityid;
                SourceCode.SmartObjects.Client.SmartObjectList smoList = serverName.ExecuteList(smartObject);
                foreach (SourceCode.SmartObjects.Client.SmartObject item in smoList.SmartObjectsList)
                {
                    int ProcInstId = 0;
                    int ActInstId  = 0;
                    int.TryParse(item.Properties["ProcessInstanceID"].Value, out ProcInstId);
                    int.TryParse(item.Properties["ActivityInstanceID"].Value, out ActInstId);

                    DateTime startDate  = DateTime.Today;
                    DateTime finishDate = DateTime.Today;
                    DateTime.TryParse(item.Properties["StartDate"].Value, out startDate);
                    DateTime.TryParse(item.Properties["FinishDate"].Value, out finishDate);

                    list.Add(new Events
                    {
                        ProcessInstanceId  = ProcInstId,
                        ActivityInstanceId = ActInstId,
                        EventName          = item.Properties["EventName"].Value,
                        Status             = item.Properties["Status"].Value,
                        StartDate          = startDate,
                        FinishDate         = finishDate,
                        Destination        = item.Properties["Destination"].Value
                    });
                }
            }


            catch (Exception ex)
            {
                list.Add(new Events
                {
                    ProcessInstanceId  = 0,
                    ActivityInstanceId = 0,
                    EventName          = ex.Message,
                    Status             = "Error",
                    StartDate          = DateTime.Today,
                    FinishDate         = DateTime.Today
                });
            }
            finally
            {
                serverName.Connection.Close();
            }

            return(list);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Gets the test details
        /// </summary>
        /// <param name="TestId"></param>
        /// <returns></returns>
        public static List <TestPlanDetails> GetTestDetails(int TestId)
        {
            List <TestPlanDetails> list = new List <TestPlanDetails>();


            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder hostServerConnectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            hostServerConnectionString.Host           = "localhost";
            hostServerConnectionString.Port           = 5555;
            hostServerConnectionString.IsPrimaryLogin = true;
            hostServerConnectionString.Integrated     = true;

            SourceCode.SmartObjects.Client.SmartObjectClientServer serverName = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
            serverName.CreateConnection();
            serverName.Connection.Open(hostServerConnectionString.ToString());

            try
            {
                SourceCode.SmartObjects.Client.SmartObject smartObject = serverName.GetSmartObject("K2C_TST_SMO_TestRun");
                SourceCode.SmartObjects.Client.SmartObject returnSmartObject;
                smartObject.MethodToExecute = "List_NaN_NaN";
                smartObject.GetMethod("List_NaN_NaN").Parameters["pTestId"].Value = TestId.ToString();

                returnSmartObject = serverName.ExecuteScalar(smartObject);


                int      ProcessTypeId     = 0;
                int      ProcessInstanceId = 0;
                int      parameters        = 0;
                DateTime StartedDate       = DateTime.Today;
                DateTime FinishedDate      = DateTime.Today;
                int.TryParse(returnSmartObject.Properties["ProcessTypeId"].Value, out ProcessTypeId);
                int.TryParse(returnSmartObject.Properties["ProcessInstanceId"].Value, out ProcessInstanceId);
                DateTime.TryParse(returnSmartObject.Properties["StartedDate"].Value, out StartedDate);
                DateTime.TryParse(returnSmartObject.Properties["FinishedDate"].Value, out FinishedDate);
                list.Add(new TestPlanDetails
                {
                    TestName          = returnSmartObject.Properties["TestName"].Value,
                    WorkflowName      = returnSmartObject.Properties["WorkflowName"].Value,
                    ProcessTypeId     = ProcessTypeId,
                    ProcessInstanceId = ProcessInstanceId,
                    Folio             = returnSmartObject.Properties["Folio"].Value,
                    Originator        = returnSmartObject.Properties["Originator"].Value,
                    Started           = returnSmartObject.Properties["Started"].Value,
                    StartedDate       = StartedDate,
                    Finished          = returnSmartObject.Properties["Finished"].Value,
                    FinishedDate      = FinishedDate,
                    Status            = returnSmartObject.Properties["Status"].Value,
                    Route             = returnSmartObject.Properties["Route"].Value
                });
            }


            catch (Exception ex)
            {
                list.Add(new TestPlanDetails
                {
                    TestName = ex.Message
                });
            }
            finally
            {
                serverName.Connection.Close();
            }

            return(list);
        }
Exemplo n.º 8
0
        /// <summary>
        /// SmartObject call to get a certain test plan
        /// </summary>
        /// <param name="TestId"></param>
        /// <returns></returns>
        public static List <TestPlanTest> BuildTestPlan(int TestId)
        {
            List <TestPlanTest> list = new List <TestPlanTest>();


            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder hostServerConnectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            hostServerConnectionString.Host           = "localhost";
            hostServerConnectionString.Port           = 5555;
            hostServerConnectionString.IsPrimaryLogin = true;
            hostServerConnectionString.Integrated     = true;

            SourceCode.SmartObjects.Client.SmartObjectClientServer serverName = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
            serverName.CreateConnection();
            serverName.Connection.Open(hostServerConnectionString.ToString());

            try
            {
                SourceCode.SmartObjects.Client.SmartObject smartObject = serverName.GetSmartObject("K2C_TST_SMO_TestRun");

                smartObject.MethodToExecute = "List_1";
                smartObject.GetMethod("List_1").Parameters["pTestId"].Value = TestId.ToString();
                SourceCode.SmartObjects.Client.SmartObjectList smoList = serverName.ExecuteList(smartObject);
                foreach (SourceCode.SmartObjects.Client.SmartObject item in smoList.SmartObjectsList)
                {
                    var z = item.Properties["Sign"].Value;


                    int testrunid    = 0;
                    int parameters   = 0;
                    int Milliseconds = 0;
                    int.TryParse(item.Properties["NumberOfParameters"].Value, out parameters);
                    int.TryParse(item.Properties["TestRunId"].Value, out testrunid);
                    int.TryParse(item.Properties["Milliseconds"].Value, out Milliseconds);

                    list.Add(new TestPlanTest
                    {
                        TestRunId = testrunid,

                        TestType           = item.Properties["TestType"].Value,
                        ExpectedResult     = item.Properties["ExpectedResult"].Value,
                        LeftParameter      = item.Properties["LeftParameter"].Value,
                        MiddleParameter    = item.Properties["MiddleParameter"].Value,
                        RightParameter     = item.Properties["RightParameter"].Value,
                        Milliseconds       = Milliseconds,
                        NumberOfParameters = parameters,
                        Sign = item.Properties["Sign"].Value
                    });
                }
            }


            catch (Exception ex)
            {
                list.Add(new TestPlanTest
                {
                });
            }
            finally
            {
                serverName.Connection.Close();
            }

            return(list);
        }