예제 #1
0
 private static bool IsActivityScheduledTracked(ActivityScheduledQuery activityScheduledQuery, string activityName)
 {
     if (
         (activityScheduledQuery.ChildActivityName == "*" || activityScheduledQuery.ChildActivityName == activityName)
         )
     {
         return(true);
     }
     return(false);
 }
예제 #2
0
        public void ActivityScheduledTracking()
        {
            Console.WriteLine();
            Console.WriteLine("*** ActivityScheduledTracking ***");
            Console.WriteLine();
            MyTrackingParticipant participant;

            // First, let's just get all parent and child activities tracked.
            TrackingProfile        profile = new TrackingProfile();
            ActivityScheduledQuery query   = new ActivityScheduledQuery();

            query.ActivityName      = "*";
            query.ChildActivityName = "*";
            profile.Queries.Add(query);
            RunWorkflow(profile, out participant);
            Assert.True(participant.ActivityScheduledRecords.Contains("Tracking Sequence:Tracking BookmarkActivity"));

            // Now lets test filtering.

            profile                 = new TrackingProfile();
            query                   = new ActivityScheduledQuery();
            query.ActivityName      = "Tracking Sequence";
            query.ChildActivityName = "*";
            profile.Queries.Add(query);
            RunWorkflow(profile, out participant);
            Assert.True(participant.ActivityScheduledRecords.Contains("Tracking Sequence:Tracking BookmarkActivity"));

            profile                 = new TrackingProfile();
            query                   = new ActivityScheduledQuery();
            query.ActivityName      = "Tracking Sequence";
            query.ChildActivityName = "Tracking BookmarkActivity";
            profile.Queries.Add(query);
            RunWorkflow(profile, out participant);
            Assert.True(participant.ActivityScheduledRecords.Contains("Tracking Sequence:Tracking BookmarkActivity"));

            profile                 = new TrackingProfile();
            query                   = new ActivityScheduledQuery();
            query.ActivityName      = "Incorrect Parent Activity Name";
            query.ChildActivityName = "Tracking BookmarkActivity";
            profile.Queries.Add(query);
            RunWorkflow(profile, out participant);
            Assert.True(!participant.ActivityScheduledRecords.Contains("Tracking Sequence:Tracking BookmarkActivity"));

            profile                 = new TrackingProfile();
            query                   = new ActivityScheduledQuery();
            query.ActivityName      = "Tracking Sequence";
            query.ChildActivityName = "Incorrect Child Activity Name";
            profile.Queries.Add(query);
            RunWorkflow(profile, out participant);
            Assert.True(!participant.ActivityScheduledRecords.Contains("Tracking Sequence:Tracking BookmarkActivity"));
        }
예제 #3
0
        public override TrackingProfile GetActiveTrackingProfile()
        {
            //Log.TraceInternal("[CustomCodeProfileProvider]GetActiveTrackingProfile() ProfileType = {0}", this.ActiveTrackingProfile);
            TrackingProfile profile = new TrackingProfile
            {
                // Setting the visibility scope to All will retain the expected behaviour of old tests.
                ImplementationVisibility = ImplementationVisibility.All
            };
            WorkflowInstanceQuery   wfInstanceQuery         = new WorkflowInstanceQuery();
            ActivityStateQuery      activityStateQuery      = new ActivityStateQuery();
            ActivityScheduledQuery  activityScheduledQuery  = new ActivityScheduledQuery();
            BookmarkResumptionQuery bookmarkResumptionQuery = new BookmarkResumptionQuery();
            CustomTrackingQuery     customTrackingQuery     = new CustomTrackingQuery();
            CancelRequestedQuery    cancelRequestedQuery    = new CancelRequestedQuery();
            FaultPropagationQuery   faultPropagationQuery   = new FaultPropagationQuery();
            string all = "*";

            switch (this.ActiveTrackingProfile)
            {
            case TestProfileType.NullProfile:
                profile = null;
                break;

            case TestProfileType.UnavailableProfile:
                //add nothing
                break;

            case TestProfileType.NoProfile:
                //add nothing.
                break;

            case TestProfileType.EmptyProfile:
                //add nothing. simply return the empty profile object
                break;

            case TestProfileType.AllTrackpointsProfile:
                wfInstanceQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(wfInstanceQuery);

                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(activityStateQuery);

                activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                profile.Queries.Add(activityScheduledQuery);

                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);
                break;

            case TestProfileType.AllWfTrackpointsProfile:
                wfInstanceQuery.States.Add(WorkflowElementStates.Started);
                wfInstanceQuery.States.Add(WorkflowElementStates.Idle);
                wfInstanceQuery.States.Add(WorkflowElementStates.Closed);
                wfInstanceQuery.States.Add(WorkflowElementStates.Resumed);
                wfInstanceQuery.States.Add(WorkflowElementStates.Completed);
                profile.Queries.Add(wfInstanceQuery);
                break;

            case TestProfileType.ProfileScopeTarget:
                wfInstanceQuery.States.Add(WorkflowElementStates.Completed);
                profile.Queries.Add(wfInstanceQuery);

                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Closed);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.DefaultITMonitoringProfile:
                wfInstanceQuery.States.Add(WorkflowElementStates.Started);
                profile.Queries.Add(wfInstanceQuery);

                //activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                //profile.Queries.Add(activityScheduledQuery);

                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Executing);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.AllActivityTrackpointsProfile:
            case TestProfileType.ActivityTrackpointOnlyAllActivitiesAllStates:
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.ActivityTrackpointOnlyAllActivities1State:
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Completed);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.ActivityTrackpointOnlyAllActivities2States:
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Completed);
                activityStateQuery.States.Add(WorkflowElementStates.Faulted);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.ActivityTrackpointsOnlyProfile:
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(activityStateQuery);

                activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                profile.Queries.Add(activityScheduledQuery);
                break;

            case TestProfileType.BookmarkTrackpointsOnlyProfile:
                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);
                break;

            case TestProfileType.WFInstanceTrackpointsOnlyProfile:
            case TestProfileType.WFInstanceTrackpointOnlyAllActivitiesAllState:
                wfInstanceQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(wfInstanceQuery);
                break;

            case TestProfileType.WFInstanceTrackpointOnlyAllActivities1State:
                wfInstanceQuery.States.Add(WorkflowElementStates.Started);
                profile.Queries.Add(wfInstanceQuery);
                break;

            case TestProfileType.WFInstanceTrackpointOnlyAllActivities2State:
                wfInstanceQuery.States.Add(WorkflowElementStates.Started);
                wfInstanceQuery.States.Add(WorkflowElementStates.Completed);
                profile.Queries.Add(wfInstanceQuery);
                break;

            case TestProfileType.ActivityandBookmarkOnlyProfile:
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(all);
                profile.Queries.Add(activityStateQuery);

                activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                profile.Queries.Add(activityScheduledQuery);

                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);
                break;

            case TestProfileType.WFInstanceandBookmarkOnlyProfile:
                wfInstanceQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(wfInstanceQuery);

                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);
                break;

            case TestProfileType.CustomWFEventsActivityCompletedOnly:
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Closed);
                wfInstanceQuery.States.Add(WorkflowElementStates.Completed);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.CustomWFEventsActivityExecutingOnly:
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Executing);
                activityStateQuery.States.Add(WorkflowElementStates.Started);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.RandomProfile:
                profile.Queries.Add(wfInstanceQuery);
                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Executing);
                activityStateQuery.States.Add(WorkflowElementStates.Closed);
                profile.Queries.Add(activityStateQuery);
                break;

            case TestProfileType.MissingActivityNameProfile:

                wfInstanceQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(wfInstanceQuery);

                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(activityStateQuery);

                activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                profile.Queries.Add(activityScheduledQuery);

                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);

                break;

            case TestProfileType.FuzzedProfileStatus:

                wfInstanceQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(wfInstanceQuery);

                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(activityStateQuery);

                activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                profile.Queries.Add(activityScheduledQuery);

                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);
                break;

            case TestProfileType.FuzzedProfileStructure:

                wfInstanceQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(wfInstanceQuery);

                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(activityStateQuery);

                activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                profile.Queries.Add(activityScheduledQuery);

                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);
                break;

            case (TestProfileType.RandomFuzzedProfile欱欲欳欴欵欶欷欸欹欺欻欼欽款欿歀歁歂):

                wfInstanceQuery.States.Add(WorkflowElementStates.Completed);
                profile.Queries.Add(wfInstanceQuery);

                activityStateQuery.ActivityName = all;
                activityStateQuery.States.Add(WorkflowElementStates.Closed);
                profile.Queries.Add(activityStateQuery);

                activityScheduledQuery.ActivityName = activityScheduledQuery.ChildActivityName = all;
                profile.Queries.Add(activityScheduledQuery);

                cancelRequestedQuery.ActivityName = cancelRequestedQuery.ChildActivityName = all;
                profile.Queries.Add(cancelRequestedQuery);

                faultPropagationQuery.FaultHandlerActivityName = all;
                profile.Queries.Add(faultPropagationQuery);

                bookmarkResumptionQuery.Name = all;
                profile.Queries.Add(bookmarkResumptionQuery);

                customTrackingQuery.ActivityName = all;
                customTrackingQuery.Name         = all;
                profile.Queries.Add(customTrackingQuery);

                break;

            case TestProfileType.StateMachineTrackpointsOnly:
                wfInstanceQuery.States.Add(WorkflowElementStates.All);
                profile.Queries.Add(wfInstanceQuery);

                profile.Queries.Add(new StateMachineStateQuery()
                {
                    ActivityName = all
                });
                break;

            default:
                //Log.TraceInternal("[CustomCodeProfileProvider]Returning default null profile...");
                profile = null;
                break;
            }

            return(profile);
        }