Example #1
0
        /// <summary>
        /// Create a fresh test app with the given name, delete the existing
        /// test app and reboot Splunk.
        /// </summary>
        /// <param name="name">The app name</param>
        public static async Task <Application> RecreateAsync(this ApplicationCollection applications, string name)
        {
            var app = await applications.GetOrNullAsync(name);

            if (app != null)
            {
                await app.RemoveAsync();
            }

            await applications.CreateAsync(name, "sample_app");

            app = await applications.GetOrNullAsync(name);

            Assert.NotNull(app);

            return(app);
        }
Example #2
0
        /// <summary>
        /// Asynchronously removes an application by name, if it exists.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the application existed and was removed; otherwise, if
        /// the application did not exist, <c>false</c>.
        /// </returns>
        /// <param name="applications">Applications.</param>
        /// <param name="name">Name.</param>
        public static async Task <bool> RemoveAsync(this ApplicationCollection applications, string name)
        {
            Application app = await applications.GetOrNullAsync(name);

            if (app == null)
            {
                return(false);
            }

            await app.RemoveAsync();

            return(true);
        }