Inheritance: SenseNet.Workflow.WorkflowHandlerBase
Ejemplo n.º 1
0
        public void WF_Delay1()
        {
            DelayTestWorkflow wfContent1;

            //-- creating workflow state contents
            wfContent1                = new DelayTestWorkflow(TestRoot);
            wfContent1.Name           = "WF1";
            wfContent1.TestInstanceId = "WF1";
            wfContent1.Timeout        = TimeSpan.Parse("00:00:00:10");
            wfContent1.Save();
            wfContent1 = Node.Load <DelayTestWorkflow>(wfContent1.Id);

            //-- starting the workflow
            InstanceManager.Start(wfContent1);

            InstanceManager._Poll();

            InstanceManager._Poll();

            wfContent1 = Node.Load <DelayTestWorkflow>(wfContent1.Id);
            Debug.WriteLine("##WF> @@@@ WorkflowStatus: " + wfContent1.WorkflowStatus);

            // var result = SenseNet.Search.ContentQuery.Query("WorkflowStarted:yes .AUTOFILTERS:OFF");

            //-- checking final status
            Assert.IsTrue(wfContent1.WorkflowStatus == WorkflowStatusEnum.Completed,
                          String.Concat("WorkflowStatus: ", wfContent1.WorkflowStatus, ". Expected: ", WorkflowStatusEnum.Completed));
        }
Ejemplo n.º 2
0
        public void WF_Delay()
        {
            //if (!Node.Exists("/Root/System/WorkflowProtoTypes/DelayTest"))
            //{
            //    var prototypesFolder = Node.LoadNode("/Root/System/WorkflowProtoTypes");
            //    if (prototypesFolder == null)
            //    {
            //        prototypesFolder = Content.CreateNew("Folder", Repository.SystemFolder, "WorkflowProtoTypes").ContentHandler;
            //        prototypesFolder.Save();
            //    }
            //    var wfProto = new DelayTestWorkflow(prototypesFolder);
            //    wfProto.Name = "DelayTest";
            //    wfProto.Save();
            //}

            DelayTestWorkflow wfContent1, wfContent2;

            //-- creating workflow state contents
            wfContent1                = new DelayTestWorkflow(TestRoot);
            wfContent1.Name           = "WF1";
            wfContent1.TestInstanceId = "WF1";
            wfContent1.Timeout        = TimeSpan.Parse("00:00:00:10");
            wfContent1.Save();
            wfContent1 = Node.Load <DelayTestWorkflow>(wfContent1.Id);

            wfContent2                = new DelayTestWorkflow(TestRoot);
            wfContent2.Name           = "WF2";
            wfContent2.TestInstanceId = "WF2";
            wfContent2.Timeout        = TimeSpan.Parse("00:00:00:10");
            wfContent2.Save();
            wfContent2 = Node.Load <DelayTestWorkflow>(wfContent2.Id);

            //-- starting the workflow
            InstanceManager.Start(wfContent1);
            Thread.Sleep(10);
            InstanceManager.Start(wfContent2);

            Thread.Sleep(25 * 1000);

            wfContent1 = Node.Load <DelayTestWorkflow>(wfContent1.Id);
            Debug.WriteLine("##WF> @@@@ WorkflowStatus: " + wfContent1.WorkflowStatus);
            wfContent2 = Node.Load <DelayTestWorkflow>(wfContent2.Id);
            Debug.WriteLine("##WF> @@@@ WorkflowStatus: " + wfContent2.WorkflowStatus);

            // var result = SenseNet.Search.ContentQuery.Query("WorkflowStarted:yes .AUTOFILTERS:OFF");

            //-- checking final status
            var    expectedMessage = "Finished";
            string msg;

            if (!WfWatcher.WaitForFinished(out msg))
            {
                Assert.Inconclusive("Workflow message was not received");
            }
            Assert.IsTrue(msg == expectedMessage, String.Concat("Received message: '", msg, "'. Expected: '", expectedMessage, "'"));
        }
Ejemplo n.º 3
0
        public void WF_Delay1()
        {
            DelayTestWorkflow wfContent1;

            //-- creating workflow state contents
            wfContent1 = new DelayTestWorkflow(TestRoot);
            wfContent1.Name = "WF1";
            wfContent1.TestInstanceId = "WF1";
            wfContent1.Timeout = TimeSpan.Parse("00:00:00:10");
            wfContent1.Save();
            wfContent1 = Node.Load<DelayTestWorkflow>(wfContent1.Id);

            //-- starting the workflow
            InstanceManager.Start(wfContent1);

            InstanceManager._Poll();

            InstanceManager._Poll();

            wfContent1 = Node.Load<DelayTestWorkflow>(wfContent1.Id);
            Debug.WriteLine("##WF> @@@@ WorkflowStatus: " + wfContent1.WorkflowStatus);

            // var result = SenseNet.Search.ContentQuery.Query("WorkflowStarted:yes .AUTOFILTERS:OFF");

            //-- checking final status
            Assert.IsTrue(wfContent1.WorkflowStatus == WorkflowStatusEnum.Completed,
                String.Concat("WorkflowStatus: ", wfContent1.WorkflowStatus, ". Expected: ", WorkflowStatusEnum.Completed));
        }
Ejemplo n.º 4
0
        public void WF_Delay()
        {
            //if (!Node.Exists("/Root/System/WorkflowProtoTypes/DelayTest"))
            //{
            //    var prototypesFolder = Node.LoadNode("/Root/System/WorkflowProtoTypes");
            //    if (prototypesFolder == null)
            //    {
            //        prototypesFolder = Content.CreateNew("Folder", Repository.SystemFolder, "WorkflowProtoTypes").ContentHandler;
            //        prototypesFolder.Save();
            //    }
            //    var wfProto = new DelayTestWorkflow(prototypesFolder);
            //    wfProto.Name = "DelayTest";
            //    wfProto.Save();
            //}

            DelayTestWorkflow wfContent1, wfContent2;

            //-- creating workflow state contents
            wfContent1 = new DelayTestWorkflow(TestRoot);
            wfContent1.Name = "WF1";
            wfContent1.TestInstanceId = "WF1";
            wfContent1.Timeout = TimeSpan.Parse("00:00:00:10");
            wfContent1.Save();
            wfContent1 = Node.Load<DelayTestWorkflow>(wfContent1.Id);

            wfContent2 = new DelayTestWorkflow(TestRoot);
            wfContent2.Name = "WF2";
            wfContent2.TestInstanceId = "WF2";
            wfContent2.Timeout = TimeSpan.Parse("00:00:00:10");
            wfContent2.Save();
            wfContent2 = Node.Load<DelayTestWorkflow>(wfContent2.Id);

            //-- starting the workflow
            InstanceManager.Start(wfContent1);
            Thread.Sleep(10);
            InstanceManager.Start(wfContent2);

            Thread.Sleep(25 * 1000);

            wfContent1 = Node.Load<DelayTestWorkflow>(wfContent1.Id);
            Debug.WriteLine("##WF> @@@@ WorkflowStatus: " + wfContent1.WorkflowStatus);
            wfContent2 = Node.Load<DelayTestWorkflow>(wfContent2.Id);
            Debug.WriteLine("##WF> @@@@ WorkflowStatus: " + wfContent2.WorkflowStatus);

            // var result = SenseNet.Search.ContentQuery.Query("WorkflowStarted:yes .AUTOFILTERS:OFF");

            //-- checking final status
            var expectedMessage = "Finished";
            string msg;
            if (!WfWatcher.WaitForFinished(out msg))
                Assert.Inconclusive("Workflow message was not received");
            Assert.IsTrue(msg == expectedMessage, String.Concat("Received message: '", msg, "'. Expected: '", expectedMessage, "'"));
        }