Ejemplo n.º 1
0
        /// <summary>
        /// Provides the components required by the tests
        /// </summary>
        internal IBuildComponent GetComponent(BuildComponentType type)
        {
            switch (type)
            {
                case BuildComponentType.RequestBuilder:
                    RequestBuilder requestBuilder = new RequestBuilder();
                    return (IBuildComponent)requestBuilder;

                case BuildComponentType.TaskBuilder:
                    TaskBuilder taskBuilder = new TaskBuilder();
                    return (IBuildComponent)taskBuilder;

                case BuildComponentType.TargetBuilder:
                    QAMockTargetBuilder targetBuilder = new QAMockTargetBuilder();
                    return (IBuildComponent)targetBuilder;

                case BuildComponentType.ResultsCache:
                    return (IBuildComponent)_resultsCache;

                default:
                    throw new ArgumentException("Unexpected type requested. Type = " + type.ToString());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Signal that the legacy thread is starting work.
        /// </summary>
        internal void SignalLegacyThreadStart(RequestBuilder instance)
        {
            ErrorUtilities.VerifyThrow
                (
                    instance != null &&
                    instance.RequestEntry != null &&
                    instance.RequestEntry.Request != null,
                    "Cannot signal legacy thread start for a RequestBuilder without a request"
                );

            int submissionId = instance.RequestEntry.Request.SubmissionId;
            this.InstanceForMainThread = instance;

            Tuple<AutoResetEvent, ManualResetEvent> legacyThreadingEvents = null;
            lock (_legacyThreadingEventsLock)
            {
                _legacyThreadingEventsById.TryGetValue(submissionId, out legacyThreadingEvents);
            }

            ErrorUtilities.VerifyThrow(legacyThreadingEvents != null, "We're trying to signal that the legacy thread is ready for submission {0} to execute, but that submission has not been registered", submissionId);

            // signal that this submission is currently controlling the legacy thread
            legacyThreadingEvents.Item1.Set();

            // signal that the legacy thread is not currently idle
            legacyThreadingEvents.Item2.Reset();
        }