public ILavaEngine GetEngineInstance(Type engineType)
        {
            ILavaEngine engine = null;

            if (engineType == typeof(DotLiquidEngine))
            {
                engine = _dotliquidEngine;
            }
            else if (engineType == typeof(FluidEngine))
            {
                engine = _fluidEngine;
            }
            else if (engineType == typeof(RockLiquidEngine))
            {
                engine = _rockliquidEngine;
            }

            if (engine == null)
            {
                throw new Exception($"Lava Engine instance not available. Engine Type \"{engineType}\" is not configured for this test run.");
            }

            // Set the global instance of the engine to ensure that it is available to Lava components.
            LavaService.SetCurrentEngine(engine);

            return(engine);
        }
        /// <summary>
        /// Register the specified shortcodes with the Lava Engine.
        /// </summary>
        /// <param name="engine"></param>
        public static void RegisterShortcodes(ILavaEngine engine)
        {
            ClearCache();

            // Register shortcodes defined in the code base.
            try
            {
                var shortcodeTypes = Rock.Reflection.FindTypes(typeof(ILavaShortcode)).Select(a => a.Value).ToList();

                foreach (var shortcodeType in shortcodeTypes)
                {
                    engine.RegisterShortcode(shortcodeType.Name, (shortcodeName) =>
                    {
                        var shortcode = Activator.CreateInstance(shortcodeType) as ILavaShortcode;

                        return(shortcode);
                    });
                }
            }
            catch (Exception ex)
            {
                ExceptionLogService.LogException(ex, null);
            }

            // Register shortcodes defined in the current database.
            var shortCodes = LavaShortcodeCache.All();

            foreach (var shortcode in shortCodes)
            {
                engine.RegisterShortcode(shortcode.TagName, (shortcodeName) => GetShortcodeDefinition(shortcodeName));
            }
        }
        private static void RegisterStaticShortcodes(ILavaEngine engine)
        {
            // Get all shortcodes and call OnStartup methods
            try
            {
                var shortcodeTypes = Rock.Reflection.FindTypes(typeof(ILavaShortcode)).Select(a => a.Value).ToList();

                foreach (var shortcodeType in shortcodeTypes)
                {
                    // Create an instance of the shortcode to get the registration name.
                    var instance = Activator.CreateInstance(shortcodeType) as ILavaShortcode;

                    var name = instance.SourceElementName;

                    if (string.IsNullOrWhiteSpace(name))
                    {
                        name = shortcodeType.Name;
                    }

                    engine.RegisterShortcode(name, (shortcodeName) =>
                    {
                        var shortcode = Activator.CreateInstance(shortcodeType) as ILavaShortcode;

                        return(shortcode);
                    });
                }
            }
            catch (Exception ex)
            {
                ExceptionLogService.LogException(ex, null);
            }
        }
        /// <summary>
        /// Returns LavaTemplate object from cache.  If template does not already exist in cache, it
        /// will be read and added to cache
        /// </summary>
        /// <param name="engine">The key.</param>
        /// <param name="key">The key.</param>
        /// <param name="content">The content.</param>
        /// <returns></returns>
        public WebsiteLavaTemplateCache Get(ILavaEngine engine, string key, string content)
        {
            WebsiteLavaTemplateCache template;

            // If cache items need to be serialized, do not cache the template because it isn't serializable.
            if (RockCache.IsCacheSerialized)
            {
                template = Load(engine, content);
            }
            else
            {
                var fromCache = true;

                template = WebsiteLavaTemplateCache.GetOrAddExisting(key, () =>
                {
                    fromCache = false;
                    return(Load(engine, content));
                });

                if (fromCache)
                {
                    Interlocked.Increment(ref _cacheHits);
                }
                else
                {
                    Interlocked.Increment(ref _cacheMisses);
                }
            }

            return(template);
        }
Exemplo n.º 5
0
        private static void InitializeLavaBlocks(ILavaEngine engine)
        {
            // Get all blocks and call OnStartup methods
            try
            {
                var blockTypes = Rock.Reflection.FindTypes(typeof(ILavaBlock)).Select(a => a.Value).ToList();

                foreach (var blockType in blockTypes)
                {
                    var blockInstance = Activator.CreateInstance(blockType) as ILavaBlock;

                    engine.RegisterBlock(blockInstance.SourceElementName, (blockName) =>
                    {
                        return(Activator.CreateInstance(blockType) as ILavaBlock);
                    });

                    try
                    {
                        blockInstance.OnStartup(engine);
                    }
                    catch (Exception ex)
                    {
                        ExceptionLogService.LogException(ex, null);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogService.LogException(ex, null);
            }
        }
        /// <summary>
        /// Process the specified input template and return the result.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns></returns>
        public LavaRenderResult GetTemplateRenderResult(ILavaEngine engine, string inputTemplate, LavaRenderParameters parameters = null, LavaTestRenderOptions options = null)
        {
            inputTemplate = inputTemplate ?? string.Empty;

            var context = engine.NewRenderContext();

            if (parameters == null)
            {
                parameters = LavaRenderParameters.WithContext(context);
            }

            // If options are specified, replace the render parameters.
            if (options != null)
            {
                context.SetEnabledCommands(options.EnabledCommands, options.EnabledCommandsDelimiter);
                context.SetMergeFields(options.MergeFields);

                if (options.ExceptionHandlingStrategy != null)
                {
                    parameters.ExceptionHandlingStrategy = options.ExceptionHandlingStrategy;
                }
            }

            var result = engine.RenderTemplate(inputTemplate.Trim(), parameters);

            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Helper method to register the entity commands.
        /// </summary>
        public static void RegisterEntityCommands(ILavaEngine engine)
        {
            var entityTypes = EntityTypeCache.All();

            // register a business entity
            engine.RegisterBlock("business", (name) => { return(new RockEntityBlock()); });

            // Register the core models, replacing existing blocks of the same name if necessary.
            foreach (var entityType in entityTypes
                     .Where(e =>
                            e.IsEntity &&
                            e.Name.StartsWith("Rock.Model") &&
                            e.FriendlyName != null &&
                            e.FriendlyName != ""))
            {
                RegisterEntityCommand(engine, entityType, useQualifiedNameIfExists: true);
            }

            // Register plugin models, using fully-qualified namespace if necessary.
            foreach (var entityType in entityTypes
                     .Where(e =>
                            e.IsEntity &&
                            !e.Name.StartsWith("Rock.Model") &&
                            e.FriendlyName != null &&
                            e.FriendlyName != "")
                     .OrderBy(e => e.Id))
            {
                RegisterEntityCommand(engine, entityType, useQualifiedNameIfExists: true);
            }
        }
        /// <summary>
        /// Process the specified input template and return the result.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns></returns>
        public string GetTemplateOutput(ILavaEngine engine, string inputTemplate, LavaDataDictionary mergeFields = null)
        {
            inputTemplate = inputTemplate ?? string.Empty;

            var result = engine.RenderTemplate(inputTemplate.Trim(), mergeFields);

            return(result.Text);
        }
        /// <summary>
        /// Process the specified input template and return the result.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns></returns>
        public string GetTemplateOutput(ILavaEngine engine, string inputTemplate, ILavaRenderContext context)
        {
            inputTemplate = inputTemplate ?? string.Empty;

            var result = engine.RenderTemplate(inputTemplate.Trim(), LavaRenderParameters.WithContext(context));

            return(result.Text);
        }
Exemplo n.º 10
0
        /// <summary>
        ///  Initialize this shortcode instance with metadata provided by a shortcode definition.
        /// </summary>
        /// <param name="definition"></param>
        public void Initialize(DynamicShortcodeDefinition definition, ILavaEngine engine)
        {
            if (_shortcode != null)
            {
                throw new Exception();
            }

            _shortcode = definition;
            _engine    = engine;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Process the specified input template and verify against the expected output regular expression.
        /// </summary>
        /// <param name="expectedOutputRegex"></param>
        /// <param name="inputTemplate"></param>
        public void AssertTemplateOutputRegex(ILavaEngine engine, string expectedOutputRegex, string inputTemplate, LavaDataDictionary mergeValues = null)
        {
            var outputString = GetTemplateOutput(engine, inputTemplate, mergeValues);

            var regex = new Regex(expectedOutputRegex);

            WriteOutputToDebug(engine, outputString);

            StringAssert.Matches(outputString, regex);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Sets the global instance of the Lava Engine.
        /// </summary>
        public static void SetCurrentEngine(ILavaEngine engine)
        {
            // Set the global instance of the Lava Engine.
            // Used for internal test purposes.
            lock ( _initializationLock )
            {
                _engine = engine;

                // Reset the exception strategy to ensure that it is aligned with the RockLiquidIsEnabled setting.
                ExceptionHandlingStrategy = _engine.ExceptionHandlingStrategy;
            }
        }
Exemplo n.º 13
0
        private static void AssertTemplateResult(string expected, string template)
        {
            // Tests in this class are only compatible with the DotLiquid engine.
            // If/when these tests are reworked for the Fluid engine, they should be moved to the Rock.Tests.UnitTests.Lava namespace.
            if (_lavaEngine == null)
            {
                _lavaEngine = LavaService.NewEngineInstance(typeof(global::Rock.Lava.DotLiquid.DotLiquidEngine), new LavaEngineConfigurationOptions());
            }

            var result = _lavaEngine.RenderTemplate(template);

            Assert.That.AreEqual(expected, result.Text);
        }
Exemplo n.º 14
0
        private LavaRenderResult ExecuteSqlBlock(ILavaEngine engine, string lavaScript)
        {
            var renderContext = engine.NewRenderContext(new List <string> {
                "Sql"
            });

            var result = engine.RenderTemplate(lavaScript,
                                               new LavaRenderParameters {
                Context = renderContext, ExceptionHandlingStrategy = ExceptionHandlingStrategySpecifier.RenderToOutput
            });

            return(result);
        }
Exemplo n.º 15
0
 private static void RegisterFilters(ILavaEngine engine)
 {
     // Register the common Rock.Lava filters first, then overwrite with the web-specific filters.
     if (engine.EngineIdentifier == TestGuids.LavaEngines.RockLiquid.AsGuid())
     {
         engine.RegisterFilters(typeof(global::Rock.Lava.Filters.TemplateFilters));
         engine.RegisterFilters(typeof(global::Rock.Lava.RockFilters));
     }
     else
     {
         engine.RegisterFilters(typeof(global::Rock.Lava.Filters.TemplateFilters));
         engine.RegisterFilters(typeof(global::Rock.Lava.LavaFilters));
     }
 }
 private static void RegisterFilters(ILavaEngine engine)
 {
     // Register the common Rock.Lava filters first, then overwrite with the web-specific filters.
     if (engine.GetType() == typeof(RockLiquidEngine))
     {
         engine.RegisterFilters(typeof(global::Rock.Lava.Filters.TemplateFilters));
         engine.RegisterFilters(typeof(Rock.Lava.RockFilters));
     }
     else
     {
         engine.RegisterFilters(typeof(global::Rock.Lava.Filters.TemplateFilters));
         engine.RegisterFilters(typeof(Rock.Lava.LavaFilters));
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// Process the specified input template and return the result.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns></returns>
        public string GetTemplateOutput(ILavaEngine engine, string inputTemplate, LavaDataDictionary mergeValues = null)
        {
            inputTemplate = inputTemplate ?? string.Empty;

            if (engine == null)
            {
                throw new Exception("Engine instance is required.");
            }

            var context = engine.NewRenderContext(mergeValues);

            return(GetTemplateOutput(engine, inputTemplate, new LavaRenderParameters {
                Context = context
            }));
        }
        private WebsiteLavaTemplateCache Load(ILavaEngine engine, string content)
        {
            if (engine == null)
            {
                throw new Exception("WebsiteLavaTemplateCache template load failed. The cache must be initialized for a specific engine.");
            }

            var result = engine.ParseTemplate(content);

            var cacheEntry = new WebsiteLavaTemplateCache {
                Template = result.Template
            };

            return(cacheEntry);
        }
        /// <summary>
        /// Verify that the specified template is invalid.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns></returns>
        public void AssertTemplateIsInvalid(ILavaEngine engine, string inputTemplate, LavaDataDictionary mergeFields = null)
        {
            inputTemplate = inputTemplate ?? string.Empty;

            Assert.That.ThrowsException <LavaException>(
                () =>
            {
                var renderOptions = new LavaRenderParameters
                {
                    Context = engine.NewRenderContext(mergeFields),
                    ExceptionHandlingStrategy = ExceptionHandlingStrategySpecifier.Throw
                };

                _ = engine.RenderTemplate(inputTemplate.Trim(), renderOptions);
            },
                "Invalid template expected.");
        }
Exemplo n.º 20
0
        public void Initialize(bool testRockLiquidEngine, bool testDotLiquidEngine, bool testFluidEngine)
        {
            // Verify the test environment: RockLiquidEngine and DotLiquidEngine are mutually exclusive test environments.
            if (testRockLiquidEngine && testDotLiquidEngine)
            {
                throw new Exception("RockLiquidEngine/DotLiquidEngine cannot be tested simultaneously because they require different global configurations of the DotLiquid library.");
            }

            RockLiquidEngineIsEnabled = testRockLiquidEngine;
            DotLiquidEngineIsEnabled  = testDotLiquidEngine;
            FluidEngineIsEnabled      = testFluidEngine;

            RegisterLavaEngines();

            if (RockLiquidEngineIsEnabled)
            {
                // Initialize the Rock variant of the DotLiquid Engine
                var engineOptions = new LavaEngineConfigurationOptions();

                _rockliquidEngine = LavaService.NewEngineInstance(typeof(RockLiquidEngine), engineOptions);

                // Register the common Rock.Lava filters first, then overwrite with the web-based RockFilters as needed.
                RegisterFilters(_rockliquidEngine);
            }

            if (DotLiquidEngineIsEnabled)
            {
                // Initialize the DotLiquid Engine
                var engineOptions = new LavaEngineConfigurationOptions();

                _dotliquidEngine = LavaService.NewEngineInstance(typeof(DotLiquidEngine), engineOptions);

                RegisterFilters(_dotliquidEngine);
            }

            if (FluidEngineIsEnabled)
            {
                // Initialize Fluid Engine
                var engineOptions = new LavaEngineConfigurationOptions();

                _fluidEngine = LavaService.NewEngineInstance(typeof(FluidEngine), engineOptions);

                RegisterFilters(_fluidEngine);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Process the specified input template and verify against the expected output.
        /// </summary>
        /// <param name="expectedOutput"></param>
        /// <param name="inputTemplate"></param>
        public void AssertTemplateOutput(ILavaEngine engine, string expectedOutput, string inputTemplate, LavaRenderParameters renderParameters, bool ignoreWhitespace = false)
        {
            var outputString = GetTemplateOutput(engine, inputTemplate, renderParameters);

            var debugString = outputString;

            if (ignoreWhitespace)
            {
                expectedOutput = expectedOutput.RemoveWhiteSpace();
                outputString   = outputString.RemoveWhiteSpace();

                debugString += "\n(Comparison ignores WhiteSpace)";
            }

            DebugWriteRenderResult(engine, inputTemplate, debugString);

            Assert.That.Equal(expectedOutput, outputString);
        }
        ILavaTemplate ILavaTemplateCacheService.GetOrAddTemplate(ILavaEngine engine, string templateContent, string cacheKey)
        {
            if (string.IsNullOrWhiteSpace(cacheKey))
            {
                cacheKey = GetTemplateKey(templateContent);
            }

            var templateCache = Get(engine, cacheKey, templateContent);

            if (templateCache == null)
            {
                return(null);
            }
            else
            {
                return(templateCache.Template);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Process the specified input template and return the result.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns></returns>
        public string GetTemplateOutput(ILavaEngine engine, string inputTemplate, LavaRenderParameters renderParameters)
        {
            inputTemplate = inputTemplate ?? string.Empty;

            if (engine == null)
            {
                throw new Exception("Engine instance is required.");
            }

            var result = engine.RenderTemplate(inputTemplate.Trim(), renderParameters);

            if (result.HasErrors)
            {
                throw result.Error;
            }

            return(result.Text);
        }
Exemplo n.º 24
0
        private static void InitializeLavaShortcodes(ILavaEngine engine)
        {
            // Register shortcodes defined in the codebase.
            try
            {
                var shortcodeTypes = Rock.Reflection.FindTypes(typeof(ILavaShortcode)).Select(a => a.Value).ToList();

                foreach (var shortcodeType in shortcodeTypes)
                {
                    // Create an instance of the shortcode to get the registration name.
                    var instance = Activator.CreateInstance(shortcodeType) as ILavaShortcode;

                    var name = instance.SourceElementName;

                    if (string.IsNullOrWhiteSpace(name))
                    {
                        name = shortcodeType.Name;
                    }

                    // Register the shortcode with a factory method to create a new instance of the shortcode from the System.Type defined in the codebase.
                    engine.RegisterShortcode(name, (shortcodeName) =>
                    {
                        var shortcode = Activator.CreateInstance(shortcodeType) as ILavaShortcode;

                        return(shortcode);
                    });
                }
            }
            catch (Exception ex)
            {
                ExceptionLogService.LogException(ex, null);
            }

            // Register shortcodes defined in the current database.
            var shortCodes = LavaShortcodeCache.All();

            foreach (var shortcode in shortCodes)
            {
                // Register the shortcode with the current Lava Engine.
                // The provider is responsible for retrieving the shortcode definition from the data store and managing the web-based shortcode cache.
                WebsiteLavaShortcodeProvider.RegisterShortcode(engine, shortcode.TagName);
            }
        }
Exemplo n.º 25
0
        private static void InitializeLavaTags(ILavaEngine engine)
        {
            // Get all tags and call OnStartup methods
            try
            {
                var elementTypes = Rock.Reflection.FindTypes(typeof(ILavaTag)).Select(a => a.Value).ToList();

                foreach (var elementType in elementTypes)
                {
                    var instance = Activator.CreateInstance(elementType) as ILavaTag;

                    var name = instance.SourceElementName;

                    if (string.IsNullOrWhiteSpace(name))
                    {
                        name = elementType.Name;
                    }

                    engine.RegisterTag(name, (shortcodeName) =>
                    {
                        var shortcode = Activator.CreateInstance(elementType) as ILavaTag;

                        return(shortcode);
                    });

                    try
                    {
                        instance.OnStartup(engine);
                    }
                    catch (Exception ex)
                    {
                        var lavaException = new Exception(string.Format("Lava component initialization failure. Startup failed for Lava Tag \"{0}\".", elementType.FullName), ex);

                        ExceptionLogService.LogException(lavaException, null);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogService.LogException(ex, null);
            }
        }
        private static void RegisterDynamicShortcodes(ILavaEngine engine)
        {
            // Register dynamic shortcodes with a factory method to ensure that the latest definition is retrieved from the global cache each time the shortcode is used.
            Func <string, DynamicShortcodeDefinition> shortCodeFactory = (shortcodeName) =>
            {
                var shortcodeDefinition = LavaShortcodeCache.All().Where(c => c.TagName == shortcodeName).FirstOrDefault();

                if (shortcodeDefinition == null)
                {
                    return(null);
                }

                var newShortcode = new DynamicShortcodeDefinition();

                newShortcode.Name           = shortcodeDefinition.Name;
                newShortcode.TemplateMarkup = shortcodeDefinition.Markup;

                var parameters = RockSerializableDictionary.FromUriEncodedString(shortcodeDefinition.Parameters);

                newShortcode.Parameters = new Dictionary <string, string>(parameters.Dictionary);

                newShortcode.EnabledLavaCommands = shortcodeDefinition.EnabledLavaCommands.SplitDelimitedValues(",", StringSplitOptions.RemoveEmptyEntries).ToList();

                if (shortcodeDefinition.TagType == TagType.Block)
                {
                    newShortcode.ElementType = LavaShortcodeTypeSpecifier.Block;
                }
                else
                {
                    newShortcode.ElementType = LavaShortcodeTypeSpecifier.Inline;
                }

                return(newShortcode);
            };

            var shortCodes = LavaShortcodeCache.All();

            foreach (var shortcode in shortCodes)
            {
                engine.RegisterShortcode(shortcode.TagName, shortCodeFactory);
            }
        }
        /// <summary>
        /// Process the specified input template and return the result.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns></returns>
        public string GetTemplateOutput(ILavaEngine engine, string inputTemplate, LavaTestRenderOptions options)
        {
            inputTemplate = inputTemplate ?? string.Empty;

            var context = engine.NewRenderContext();

            var parameters = LavaRenderParameters.WithContext(context);

            if (options != null)
            {
                context.SetEnabledCommands(options.EnabledCommands, options.EnabledCommandsDelimiter);
                context.SetMergeFields(options.MergeFields);

                parameters.ExceptionHandlingStrategy = options.ExceptionHandlingStrategy;
            }

            var result = engine.RenderTemplate(inputTemplate.Trim(), parameters);

            return(result.Text);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Process the specified input template and verify the output against an expected DateTime result.
        /// </summary>
        /// <param name="expectedDateTime"></param>
        /// <param name="inputTemplate"></param>
        /// <param name="maximumDelta"></param>
        public void AssertTemplateOutputDate(ILavaEngine engine, DateTime?expectedDateTime, string inputTemplate, TimeSpan?maximumDelta = null)
        {
            AssertDateIsUtc(expectedDateTime);

            var outputString = GetTemplateOutput(engine, inputTemplate);

            var outputDateUtc = LavaDateTime.ParseToUtc(outputString, null);

            WriteOutputToDebug(engine, outputString);

            Assert.That.IsNotNull(outputDateUtc, $"Template Output does not represent a valid DateTime. [Output=\"{ outputString }\"]");

            if (maximumDelta != null)
            {
                DateTimeAssert.AreEqual(expectedDateTime, outputDateUtc, maximumDelta.Value);
            }
            else
            {
                DateTimeAssert.AreEqual(expectedDateTime, outputDateUtc);
            }
        }
        public static void Initialize(bool testRockLiquidEngine, bool testDotLiquidEngine, bool testFluidEngine)
        {
            // Verify the test environment: RockLiquidEngine and DotLiquidEngine are mutually exclusive test environments.
            if (testRockLiquidEngine && testDotLiquidEngine)
            {
                throw new Exception("RockLiquidEngine/DotLiquidEngine cannot be tested simultaneously because they require different global configurations of the DotLiquid library.");
            }

            RockLiquidEngineIsEnabled = testRockLiquidEngine;
            DotLiquidEngineIsEnabled  = testDotLiquidEngine;
            FluidEngineIsEnabled      = testFluidEngine;

            RegisterLavaEngines();

            var engineOptions = new LavaEngineConfigurationOptions();

            engineOptions.ExceptionHandlingStrategy = ExceptionHandlingStrategySpecifier.RenderToOutput;
            engineOptions.FileSystem   = new MockFileProvider();
            engineOptions.CacheService = new MockTemplateCacheService();

            if (RockLiquidEngineIsEnabled)
            {
                // Initialize the Rock variant of the DotLiquid Engine.
                _rockliquidEngine = global::Rock.Lava.LavaService.NewEngineInstance(typeof(RockLiquidEngine), engineOptions);
            }

            if (DotLiquidEngineIsEnabled)
            {
                // Initialize the Lava library DotLiquid Engine.
                _dotliquidEngine = global::Rock.Lava.LavaService.NewEngineInstance(typeof(DotLiquidEngine), engineOptions);
            }

            if (FluidEngineIsEnabled)
            {
                // Initialize the Fluid Engine.
                _fluidEngine = global::Rock.Lava.LavaService.NewEngineInstance(typeof(FluidEngine), engineOptions);
            }

            _instance = new LavaIntegrationTestHelper();
        }
Exemplo n.º 30
0
        /// <summary>
        /// Sets the global instance of the Lava Engine with the specified configuration options.
        /// </summary>
        /// <param name="lavaEngineType"></param>
        /// <param name="options"></param>
        public static void SetCurrentEngine(Type lavaEngineType, LavaEngineConfigurationOptions options)
        {
            lock ( _initializationLock )
            {
                // Release the current instance.
                _engine = null;

                if (lavaEngineType != null)
                {
                    var engine = NewEngineInstance(lavaEngineType, options);

                    // Assign the current instance.
                    _engine = engine;

                    // If RockLiquid is enabled, set the Lava Engine to throw exceptions so they can be logged.
                    if (RockLiquidIsEnabled)
                    {
                        ExceptionHandlingStrategy = ExceptionHandlingStrategySpecifier.Throw;
                    }
                }
            }
        }