Exemple #1
0
        private void CheckRule(CodeBinaryOperatorExpression expression, bool executed, string error)
        {
            WorkflowInstance wi;
            WorkflowRuntime  workflowRuntime = new WorkflowRuntime();
            Type             type            = typeof(WorkFlowIfElseRule);

            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

            executed1       = false;
            executed2       = false;
            check_condition = expression;
            wi = workflowRuntime.CreateWorkflow(type);
            wi.Start();
            waitHandle.WaitOne();

            if (executed)
            {
                Assert.AreEqual(true, executed1, error);
                Assert.AreEqual(false, executed2, error);
            }
            else
            {
                Assert.AreEqual(false, executed1, error);
                Assert.AreEqual(true, executed2, error);
            }

            workflowRuntime.Dispose();
        }
Exemple #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // Dispose managed resources
         workflowRuntime.Dispose();
     }
 }
Exemple #3
0
 public override void Dispose()
 {
     base.Dispose();
     if (_runtime != null)
     {
         _runtime.Dispose();
     }
 }
Exemple #4
0
        public void TestCleanup()
        {
            _workflowRuntime.StopRuntime();
            _workflowRuntime.Dispose();

            _workflowRuntime = null;
            _scheduler       = null;
            _dataExchange    = null;
        }
Exemple #5
0
 public void Dispose()
 {
     if (workflowRuntime != null)
     {
         workflowRuntime.StopRuntime();
         workflowRuntime.Dispose();
         workflowRuntime = null;
     }
 }
 public static void Dispose()
 {
     if (null != _Runtime)
     {
         _Runtime.StopRuntime();
         _Runtime.Dispose();
         _Runtime = null;
     }
 }
 /// <summary>
 /// Cleanup the workflow runtime
 /// </summary>
 public void Dispose()
 {
     if (_workflowRuntime != null)
     {
         _workflowRuntime.StopRuntime();
         _workflowRuntime.Dispose();
     }
     ClearAllWorkflows();
 }
Exemple #8
0
        protected void Application_End(object sender, EventArgs e)
        {
            // obtain reference to workflow runtime
            WorkflowRuntime workflowRuntime = Application[WorkflowManager.WorkflowRuntimeKey] as WorkflowRuntime;

            // stop the runtime
            if (workflowRuntime != null)
            {
                workflowRuntime.StopRuntime();
                workflowRuntime.Dispose();
            }
        }
Exemple #9
0
        static void Main()
        {
            WorkflowRuntime workflowRuntime = new WorkflowRuntime();

            Type type = typeof(WorkFlowIfElse);

            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

            workflowRuntime.CreateWorkflow(type).Start();
            waitHandle.WaitOne();
            workflowRuntime.Dispose();
        }
		public void WorkFlowTest ()
		{
			WorkflowRuntime workflowRuntime = new WorkflowRuntime ();

			Type type = typeof (SequentialWorkflow);
			workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

			workflowRuntime.CreateWorkflow (type).Start ();
            		waitHandle.WaitOne ();
            		workflowRuntime.Dispose ();

			Assert.AreEqual (true, code_execute, "C1#1");
		}
        public void WorkFlowTest()
        {
            WorkflowRuntime workflowRuntime = new WorkflowRuntime();

            Type type = typeof(SequentialWorkflow);

            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

            workflowRuntime.CreateWorkflow(type).Start();
            waitHandle.WaitOne();
            workflowRuntime.Dispose();

            Assert.AreEqual(true, code_execute, "C1#1");
        }
        public void SetGetBinding()
        {
            WorkflowRuntime workflowRuntime = new WorkflowRuntime();

            Type type = typeof(WorkFlowDataBinding);

            workflowRuntime.WorkflowCompleted += WorkFlowDataBinding.OnWorkflowCompleted;
            workflowRuntime.CreateWorkflow(type).Start();
            waitHandle.WaitOne();

            Assert.AreEqual("Default", ourCodeActivity.DataValue, "C1#1");

            workflowRuntime.Dispose();
        }
        public void WorkFlowTest()
        {
            WorkflowRuntime workflowRuntime = new WorkflowRuntime();

            Type type = typeof(SimpleWorkFlowDelay);

            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

            workflowRuntime.CreateWorkflow(type).Start();
            waitHandle.WaitOne();
            workflowRuntime.Dispose();

            Assert.AreEqual(3, files_counted, "C1#1");
            Assert.AreEqual(3, backup_executed, "C1#2");
        }
Exemple #14
0
 /// <summary>
 /// Diposes the workflow runtime.
 /// </summary>
 public void DisposeRuntime()
 {
     // dispose runtime
     if (_workflowRuntime != null)
     {
         _workflowRuntime.Dispose();
     }
     _workflowRuntime = null;
     if (_waitHandle != null)
     {
         _waitHandle.Close();
     }
     _waitHandle = null;
     _instance   = null;
 }
Exemple #15
0
        public void IfElseConditionTrue()
        {
            WorkflowRuntime workflowRuntime = new WorkflowRuntime();

            Type type = typeof(WorkFlowIfElse);

            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

            ifelse_condition1 = true;
            executed1         = false;
            executed2         = false;
            workflowRuntime.CreateWorkflow(type).Start();
            waitHandle.WaitOne();

            Assert.AreEqual(true, executed1, "C1#1");
            Assert.AreEqual(false, executed2, "C1#2");

            workflowRuntime.Dispose();
        }
Exemple #16
0
        public void TestActivity()
        {
            WorkflowRuntime workflowRuntime = new WorkflowRuntime();
            DocumentService DocumentService = new DocumentService();

            Type type = typeof(WorkFlowCallExternal);

            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

            ExternalDataExchangeService dataExchangeService = new ExternalDataExchangeService();

            workflowRuntime.AddService(dataExchangeService);
            dataExchangeService.AddService(DocumentService);

            workflowRuntime.CreateWorkflow(type).Start();
            waitHandle.WaitOne();
            workflowRuntime.Dispose();

            Assert.AreEqual("Joan Martinez", text, "C1#1");
            Assert.AreEqual("First", document, "C1#2");
        }
        public void WorkFlowTest()
        {
            events = new List <string> ();
            WorkflowRuntime workflowRuntime = new WorkflowRuntime();

            Type type = typeof(SequentialWorkflowParallel);

            workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

            workflowRuntime.CreateWorkflow(type).Start();

            waitHandle.WaitOne();
            workflowRuntime.Dispose();

            Assert.AreEqual("IfElseCondition", events[0], "C1#1");
            Assert.AreEqual("PrepareMail1_ExecuteCode", events[1], "C1#2");
            Assert.AreEqual("PrepareMail2_ExecuteCode", events[2], "C1#3");
            Assert.AreEqual("PrepareMail3_ExecuteCode", events[3], "C1#4");
            Assert.AreEqual("CodeCloseMailProgram2_ExecuteCode", events[4], "C1#8");
            Assert.AreEqual("CodeCloseMailProgram3_ExecuteCode", events[5], "C1#9");
            Assert.AreEqual("CodeCloseMailProgram1_ExecuteCode", events[6], "C1#10");
        }
Exemple #18
0
        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);

            if (!string.IsNullOrEmpty(config["applicationName"]))
            {
                this._applicationName = config["applicationName"];
                config.Remove("applicationName");
            }

            if (!string.IsNullOrEmpty(config["connectionStringName"]))
            {
                this._connectionStringName = config["connectionStringName"];
                config.Remove("connectionStringName");
            }

            if (!string.IsNullOrEmpty(config["synchronousExecution"]))
            {
                this._synchronousExecution = Convert.ToBoolean(config["synchronousExecution"]);
                config.Remove("synchronousExecution");
            }

            if (!string.IsNullOrEmpty(config["defaultStartTime"]))
            {
                this._defaultEndTime = config["defaultStartTime"];
                config.Remove("defaultStartTime");
            }

            if (!string.IsNullOrEmpty(config["defaultEndTime"]))
            {
                this._defaultEndTime = config["defaultEndTime"];
                config.Remove("defaultEndTime");
            }

            if (!string.IsNullOrEmpty(config["timeToExpire"]))
            {
                this._timeToExpire = TimeSpan.Parse(config["timeToExpire"]);
                config.Remove("timeToExpire");
            }

            if (!string.IsNullOrEmpty(config["includeWeekends"]))
            {
                this._includeWeekends = Convert.ToBoolean(config["includeWeekends"]);
                config.Remove("includeWeekends");
            }

            if (!string.IsNullOrEmpty(config["requestSchemaPath"]))
            {
                this._requestSchemaPath = config["requestSchemaPath"];
                config.Remove("requestSchemaPath");
            }

            if (!string.IsNullOrEmpty(config["responseSchemaPath"]))
            {
                this._responseSchemaPath = config["responseSchemaPath"];
                config.Remove("responseSchemaPath");
            }

            if (config.Count > 0)
                throw new ProviderException(string.Format("Unknown config attribute '{0}'", config.GetKey(0)));

            #region Workflow Runtime Initialization

            if (theWorkflowRuntime == null)
            {
                lock (this)
                {
                    if (theWorkflowRuntime == null)
                    {
                        theWorkflowRuntime = new WorkflowRuntime();

                        theWorkflowRuntime.WorkflowLoaded += new EventHandler<WorkflowEventArgs>(theWorkflowRuntime_WorkflowLoaded);
                        theWorkflowRuntime.WorkflowIdled += new EventHandler<WorkflowEventArgs>(theWorkflowRuntime_WorkflowIdled);
                        theWorkflowRuntime.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(theWorkflowRuntime_WorkflowCompleted);
                        theWorkflowRuntime.WorkflowTerminated += new EventHandler<WorkflowTerminatedEventArgs>(theWorkflowRuntime_WorkflowTerminated);
                        theWorkflowRuntime.WorkflowSuspended += new EventHandler<WorkflowSuspendedEventArgs>(theWorkflowRuntime_WorkflowSuspended);

                        // Used for synchronous execution of workflow instances.
                        if (this.SynchronousExecution)
                            theSchedulerService = theWorkflowRuntime.GetService<ManualWorkflowSchedulerService>();

                        // Add the external data service
                        ExternalDataExchangeService dataService = new ExternalDataExchangeService();
                        theWorkflowRuntime.AddService(dataService);

                        // Add custom wiki management service.
                        theServiceProvider = new ServiceProviderHelper();
                        dataService.AddService(theServiceProvider);

                        // Add system SQL state service.
                        SqlWorkflowPersistenceService stateService = new SqlWorkflowPersistenceService(
                            ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString);
                        theWorkflowRuntime.AddService(stateService);

                        try
                        {
                            Trace.TraceInformation("Starting workflow engine.");
                            // Start
                            theWorkflowRuntime.StartRuntime();
                            Trace.TraceInformation("Workflow engine was sucessfully started.");
                        }
                        catch (Exception ex)
                        {
                            Trace.TraceError(string.Format(
                                "Error while starting the workflow engine. Description: {0}", ex.Message));
                            theWorkflowRuntime.Dispose();
                            throw;
                        }
                    }
                }
            }

            #endregion
        }
Exemple #19
0
 /// <summary>
 /// Dispose of the workflow runtime
 /// </summary>
 public void Dispose()
 {
     _workflowRuntime.StopRuntime();
     _workflowRuntime.Dispose();
 }
Exemple #20
0
 private void Mainform_FormClosing(object sender, FormClosingEventArgs e)
 {
     SaveWorkflowData();
     runtime.StopRuntime();
     runtime.Dispose();
 }
Exemple #21
0
		static void Main ()
        	{
			WorkflowRuntime workflowRuntime = new WorkflowRuntime ();

			Type type = typeof (WorkFlowIfElse);
			workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

			workflowRuntime.CreateWorkflow (type).Start ();
            		waitHandle.WaitOne ();
			workflowRuntime.Dispose ();
		}
		private void CheckRule (CodeBinaryOperatorExpression expression, bool executed, string error)
		{
			WorkflowInstance wi;
			WorkflowRuntime workflowRuntime = new WorkflowRuntime ();
			Type type = typeof (WorkFlowIfElseRule);
			workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

			executed1 = false;
			executed2 = false;
			check_condition = expression;
			wi = workflowRuntime.CreateWorkflow (type);
			wi.Start ();
            		waitHandle.WaitOne ();

            		if (executed) {
				Assert.AreEqual (true, executed1, error);
				Assert.AreEqual (false, executed2, error);
			} else {
				Assert.AreEqual (false, executed1, error);
				Assert.AreEqual (true, executed2, error);
			}

			workflowRuntime.Dispose ();
		}
		public void TestActivity ()
        	{
			WorkflowRuntime workflowRuntime = new WorkflowRuntime ();
			DocumentService DocumentService = new DocumentService ();

			Type type = typeof (WorkFlowCallExternal);
			workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

			ExternalDataExchangeService dataExchangeService = new ExternalDataExchangeService ();
            		workflowRuntime.AddService (dataExchangeService);
            		dataExchangeService.AddService (DocumentService);

			workflowRuntime.CreateWorkflow (type).Start ();
            		waitHandle.WaitOne ();
			workflowRuntime.Dispose ();
			
			Assert.AreEqual ("Joan Martinez", text, "C1#1");
			Assert.AreEqual ("First", document, "C1#2");
		}
 public static void TerminateDefaultRuntime(WorkflowRuntime workflowRuntime)
 {
     workflowRuntime.StopRuntime();
     workflowRuntime.Dispose();
 }
		public void IfElseConditionDoubleFalse ()
		{
			WorkflowRuntime workflowRuntime = new WorkflowRuntime ();

			Type type = typeof (WorkFlowIfElseDoubleCondition);
			workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

			ifelse_condition1 = true;
			ifelse_condition2 = false;
			executed1 = false;
			executed2 = false;
			workflowRuntime.CreateWorkflow (type).Start ();
            		waitHandle.WaitOne ();

			Assert.AreEqual (true, executed1, "C1#1");
			Assert.AreEqual (false, executed2, "C1#2");

			workflowRuntime.Dispose ();
		}
Exemple #26
0
 public void TestCleanup()
 {
     _workflowRuntime.StopRuntime();
     _workflowRuntime.Dispose();
 }
Exemple #27
0
 public void Dispose()
 {
     workflowRuntime.Dispose();
 }
		public void WorkFlowTest ()
		{
			WorkflowRuntime workflowRuntime = new WorkflowRuntime ();

			Type type = typeof (SimpleWorkFlowDelay);
			workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

			workflowRuntime.CreateWorkflow (type).Start ();
            		waitHandle.WaitOne ();
            		workflowRuntime.Dispose ();

			Assert.AreEqual (3, files_counted, "C1#1");
			Assert.AreEqual (3, backup_executed, "C1#2");
		}
Exemple #29
0
 public virtual void OnClose()
 {
     _workflowRuntime.Dispose();
 }
		public void WorkFlowTest ()
		{
			events = new List <string> ();
			WorkflowRuntime workflowRuntime = new WorkflowRuntime ();

			Type type = typeof (SequentialWorkflowParallel);
			workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;

			workflowRuntime.CreateWorkflow (type).Start ();

            		waitHandle.WaitOne ();
            		workflowRuntime.Dispose ();

			Assert.AreEqual ("IfElseCondition", events[0], "C1#1");
			Assert.AreEqual ("PrepareMail1_ExecuteCode", events[1], "C1#2");
			Assert.AreEqual ("PrepareMail2_ExecuteCode", events[2], "C1#3");
			Assert.AreEqual ("PrepareMail3_ExecuteCode", events[3], "C1#4");
			Assert.AreEqual ("CodeCloseMailProgram2_ExecuteCode", events[4], "C1#8");
			Assert.AreEqual ("CodeCloseMailProgram3_ExecuteCode", events[5], "C1#9");
			Assert.AreEqual ("CodeCloseMailProgram1_ExecuteCode", events[6], "C1#10");
		}