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

ru.yandex.qatools.allure.io.TestSuiteReader Maven / Gradle / Ivy

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

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.yandex.qatools.allure.model.TestSuiteResult;

import javax.inject.Inject;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Iterator;

/**
 * @author Dmitry Baev [email protected]
 *         Date: 08.10.15
 */
public class TestSuiteReader implements Reader {

    private static final Logger LOGGER = LoggerFactory.getLogger(TestSuiteReader.class);

    private final Path[] resultDirectories;

    @Inject
    public TestSuiteReader(@ResultDirectories Path... resultDirectories) {
        this.resultDirectories = resultDirectories;
    }

    @Override
    public Iterator iterator() {
        try {
            return Iterators.concat(
                    new JsonTestSuiteResultIterator(resultDirectories),
                    new XmlTestSuiteResultIterator(resultDirectories)
            );
        } catch (IOException e) {
            LOGGER.error("Could not create iterator", e);
            return ImmutableSet.of().iterator();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy