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

de.otto.jlineup.cli.Utils Maven / Gradle / Ivy

There is a newer version: 4.13.1
Show newest version
package de.otto.jlineup.cli;

import de.otto.jlineup.RunStepConfig;
import de.otto.jlineup.config.JobConfig;

import java.io.IOException;

import static com.google.common.base.MoreObjects.firstNonNull;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;

public class Utils {

    public static JobConfig readConfig(final JLineup parameters) throws IOException {
        return JobConfig.readConfig(parameters.getWorkingDirectory(), parameters.getConfigFile());
    }

    public static RunStepConfig convertCommandLineParametersToRunConfiguration(JLineup commandLineParameters) {
        return RunStepConfig.jLineupRunConfigurationBuilder()
                .withWorkingDirectory(commandLineParameters.getWorkingDirectory())
                .withScreenshotsDirectory(commandLineParameters.getScreenshotDirectory())
                .withReportDirectory(commandLineParameters.getReportDirectory())
                .withStep(commandLineParameters.getStep())
                .withUrlReplacements(firstNonNull(commandLineParameters.getUrlReplacements(), emptyMap()))
                .withChromeParameters(firstNonNull(commandLineParameters.getChromeParameters(), emptyList()))
                .withFirefoxParameters(firstNonNull(commandLineParameters.getFirefoxParameters(), emptyList()))
                .build();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy