public static TestProfileProvider GetInstance(TrackingConfiguration config) { TestProfileProvider testProfileProvider = null; switch (config.ProfileManagerType) { case ProfileManagerType.CodeProfileManager: testProfileProvider = new CustomCodeProfileProvider(); break; default: testProfileProvider = new CustomCodeProfileProvider(); break; } testProfileProvider.ActiveTrackingProfile = config.TestProfileType; if (config is FilteredTrackingConfiguration filteredTrackingConfiguration) { testProfileProvider.ActivityNames = filteredTrackingConfiguration.ActivityNames; testProfileProvider.ActivityStates = filteredTrackingConfiguration.ActivityStates; } return(testProfileProvider); }
public static TrackingProfile GetTrackingProfile(TestTrackingParticipantBase trackingParticipant, TrackingConfiguration config) { trackingParticipant.ProfileProvider = TestProfileProvider.GetInstance(config); trackingParticipant.ProfileProvider.ActiveTrackingProfile = config.TestProfileType; TrackingProfile profile = trackingParticipant.ProfileProvider.GetActiveTrackingProfile(); return(profile); }
public static ExpectedTrace ApplyTrackingProfile(ExpectedTrace expectedTrace, TrackingProfile profile) { ExpectedTrace modifiedTrace = TrackingFilter.RemovePlaceholderTrace(expectedTrace); modifiedTrace = TrackingFilter.RemoveUserTrace(modifiedTrace); TestTraceManager.OptionalLogTrace("[TrackingFilter]After Remove UserTrace, modifiedTrace = {0}", modifiedTrace); modifiedTrace = TrackingFilter.NormalizeTrace(modifiedTrace); TestTraceManager.OptionalLogTrace("[TrackingFilter]After NormalizeTrace, modifiedTrace = {0}", modifiedTrace); //vc temp only till we figure out the user record story for M2. if (profile == null)//all events to be returned { return(modifiedTrace); } int count = modifiedTrace.Trace.Steps.Count; for (int i = 0; i < count; i++) { WorkflowTraceStep workflowTraceStep = modifiedTrace.Trace.Steps[i]; // Check if this is a faulted state. // When we have a faulted state the preceding executing state should be deleted. TrackingConfiguration currentTrackingConfiguration = GetCurrentTP(profile.Name); bool isExecutingRecExpectedOnFaultedState = true; if (!isExecutingRecExpectedOnFaultedState) { ActivityTrace activityTrace = (ActivityTrace)workflowTraceStep; if ((i > 0) && (activityTrace.ActivityStatus == ActivityInstanceState.Faulted)) { ActivityTrace precedingActivityTrace = (ActivityTrace)modifiedTrace.Trace.Steps[i - 1]; if (precedingActivityTrace.ActivityStatus == ActivityInstanceState.Executing) { bool trackScheduledQuery = false; foreach (ActivityScheduledQuery activityScheduledQuery in profile.Queries.OfType <ActivityScheduledQuery>()) { if (IsActivityScheduledTracked(activityScheduledQuery, precedingActivityTrace.ActivityName)) { trackScheduledQuery = true; } } // If we don't track the scheduled records delete the preceding executing state record. // The preceding executing state is from scheduled record. if (!trackScheduledQuery) { modifiedTrace.Trace.Steps.RemoveAt(i - 1); i--; count = modifiedTrace.Trace.Steps.Count; //Log.TraceInternal("[TrackingFilter]Preceding executing activity trace deleted because the current expected trace state is Faulted."); } } } } if (!profile.ShouldTrackStep(workflowTraceStep)) { modifiedTrace.Trace.Steps.RemoveAt(i); count = modifiedTrace.Trace.Steps.Count; //continue at the same step i--; //Log.TraceInternal("[TrackingFilter]Removed event = {0}=", workflowTraceStep); } } return(modifiedTrace); }