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

ru.yandex.qatools.allure.data.AllureGuiceModule Maven / Gradle / Ivy

There is a newer version: 1.5.4
Show newest version
package ru.yandex.qatools.allure.data;

import com.google.inject.AbstractModule;
import com.google.inject.TypeLiteral;
import ru.yandex.qatools.allure.data.converters.DefaultTestCaseConverter;
import ru.yandex.qatools.allure.data.converters.TestCaseConverter;
import ru.yandex.qatools.allure.data.index.DefaultAttachmentsIndex;
import ru.yandex.qatools.allure.data.index.DefaultPluginsIndex;
import ru.yandex.qatools.allure.data.io.AttachmentReader;
import ru.yandex.qatools.allure.data.io.EnvironmentReader;
import ru.yandex.qatools.allure.data.io.Reader;
import ru.yandex.qatools.allure.data.io.ResultDirectories;
import ru.yandex.qatools.allure.data.io.TestCaseReader;
import ru.yandex.qatools.allure.data.io.TestSuiteReader;
import ru.yandex.qatools.allure.data.plugins.AttachmentsIndex;
import ru.yandex.qatools.allure.data.plugins.PluginClassLoader;
import ru.yandex.qatools.allure.data.plugins.PluginLoader;
import ru.yandex.qatools.allure.data.plugins.PluginLoaderSpi;
import ru.yandex.qatools.allure.data.plugins.PluginsIndex;
import ru.yandex.qatools.allure.model.TestCaseResult;
import ru.yandex.qatools.allure.model.TestSuiteResult;
import ru.yandex.qatools.commons.model.Environment;

import java.io.File;

/**
 * eroshenkoam
 * 03/02/15
 */
public class AllureGuiceModule extends AbstractModule {

    private File[] inputDirectories;

    private ClassLoader classLoader;

    public AllureGuiceModule(ClassLoader classLoader, File... inputDirectories) {
        this.classLoader = classLoader;
        this.inputDirectories = inputDirectories;
    }

    @Override
    protected void configure() {
        bind(File[].class).annotatedWith(ResultDirectories.class).toInstance(inputDirectories);
        bind(ClassLoader.class).annotatedWith(PluginClassLoader.class).toInstance(classLoader);

        bind(new TypeLiteral>() {
        }).to(TestSuiteReader.class);
        bind(new TypeLiteral>() {
        }).to(TestCaseReader.class);
        bind(new TypeLiteral>() {
        }).to(EnvironmentReader.class);
        bind(new TypeLiteral>() {
        }).to(AttachmentReader.class);

        bind(PluginLoader.class).to(PluginLoaderSpi.class);
        bind(AttachmentsIndex.class).to(DefaultAttachmentsIndex.class);
        bind(PluginsIndex.class).to(DefaultPluginsIndex.class);

        bind(TestCaseConverter.class).to(DefaultTestCaseConverter.class);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy