/// <summary>
 /// Destroy the extension manager.
 /// </summary>
 public static void Destroy()
 {
     lock (synclock)
     {
         settingsProviderExtensionManager = null;
     }
 }
        /// <summary>
        /// Creates an instance of the settings provider.
        /// </summary>
        /// <returns>Instance of the settings provider.</returns>
        public static SettingsProviderExtensionManager Create()
        {
            if (settingsProviderExtensionManager == null)
            {
                lock (synclock)
                {
                    if (settingsProviderExtensionManager == null)
                    {
                        IEnumerable <LazyExtension <ISettingsProvider, Dictionary <string, object> > >  unfilteredTestExtensions;
                        IEnumerable <LazyExtension <ISettingsProvider, ISettingsProviderCapabilities> > testExtensions;

                        TestPluginManager.Instance
                        .GetSpecificTestExtensions <TestSettingsProviderPluginInformation, ISettingsProvider, ISettingsProviderCapabilities, TestSettingsProviderMetadata>(
                            TestPlatformConstants.TestAdapterEndsWithPattern,
                            out unfilteredTestExtensions,
                            out testExtensions);

                        settingsProviderExtensionManager = new SettingsProviderExtensionManager(
                            testExtensions, unfilteredTestExtensions, TestSessionMessageLogger.Instance);
                    }
                }
            }

            return(settingsProviderExtensionManager);
        }
Example #3
0
        /// <summary>
        /// Creates an instance of the settings provider.
        /// </summary>
        /// <returns>Instance of the settings provider.</returns>
        public static SettingsProviderExtensionManager Create()
        {
            if (settingsProviderExtensionManager == null)
            {
                lock (synclock)
                {
                    if (settingsProviderExtensionManager == null)
                    {
                        IEnumerable <LazyExtension <ISettingsProvider, Dictionary <string, object> > >  unfilteredTestExtensions;
                        IEnumerable <LazyExtension <ISettingsProvider, ISettingsProviderCapabilities> > testExtensions;

                        TestPluginManager.Instance
                        .GetTestExtensions
                        <ISettingsProvider, ISettingsProviderCapabilities, TestSettingsProviderMetadata>(
                            out unfilteredTestExtensions,
                            out testExtensions);

                        settingsProviderExtensionManager = new SettingsProviderExtensionManager(
                            testExtensions, unfilteredTestExtensions, TestSessionMessageLogger.Instance);
                    }
                }
            }

            return(settingsProviderExtensionManager);
        }
Example #4
0
        /// <summary>
        /// Load all the settings provider and fail on error
        /// </summary>
        /// <param name="shouldThrowOnError"> Indicates whether this method should throw on error. </param>
        public static void LoadAndInitializeAllExtensions(bool shouldThrowOnError)
        {
            var extensionManager = SettingsProviderExtensionManager.Create();

            try
            {
                foreach (var settingsProvider in extensionManager.SettingsProvidersMap)
                {
                    // Note: - The below Verbose call should not be under IsVerboseEnabled check as we want to
                    // call executor.Value even if logging is not enabled.
                    EqtTrace.Verbose("SettingsProviderExtensionManager: Loading settings provider {0}", settingsProvider.Value.Value);
                }
            }
            catch (Exception ex)
            {
                if (EqtTrace.IsErrorEnabled)
                {
                    EqtTrace.Error("SettingsProviderExtensionManager: LoadAndInitialize: Exception occured while loading extensions {0}", ex);
                }

                if (shouldThrowOnError)
                {
                    throw;
                }
            }
        }
Example #5
0
        /// <summary>
        /// Creates an instance of the settings provider.
        /// </summary>
        /// <returns>Instance of the settings provider.</returns>
        public static SettingsProviderExtensionManager Create()
        {
            if (settingsProviderExtensionManager == null)
            {
                lock (synclock)
                {
                    if (settingsProviderExtensionManager == null)
                    {
                        TestPluginManager.Instance
                        .GetSpecificTestExtensions <TestSettingsProviderPluginInformation, ISettingsProvider, ISettingsProviderCapabilities, TestSettingsProviderMetadata>(
                            TestPlatformConstants.TestAdapterEndsWithPattern,
                            out var unfilteredTestExtensions,
                            out var testExtensions);

                        settingsProviderExtensionManager = new SettingsProviderExtensionManager(
                            testExtensions, unfilteredTestExtensions, TestSessionMessageLogger.Instance);
                    }
                }
            }

            return(settingsProviderExtensionManager);
        }