All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.thucydides.easyb.ThucydidesExtensions.groovy Maven / Gradle / Ivy

There is a newer version: 0.9.268
Show newest version
package net.thucydides.easyb

import javax.imageio.spi.ServiceRegistry
import org.easyb.plugin.EasybPlugin

public class ThucydidesExtensions {

    private ThucydidesPlugin plugin = null

    public PluginConfiguration getThucydides() {
        def configuration = getPlugin().getConfiguration();
        return configuration;
    }


    private ThucydidesPlugin getPlugin() {
        if (plugin == null) {
            plugin = getLocalThucydidesPlugin()
        }
        return plugin
    }

    private ThucydidesPlugin getLocalThucydidesPlugin() {

        Iterator providers = ServiceRegistry.lookupProviders(EasybPlugin, ClassLoader.getSystemClassLoader())

        def registeredPlugin = null
        providers.each { provider ->
            if (provider instanceof ThucydidesPlugin) {
                registeredPlugin = provider;
            }
        }

        if (registeredPlugin) {
            return registeredPlugin
        }
        throw new IllegalStateException("No Thucydides Plugin was found for this story.")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy