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

org.sitoolkit.tester.infra.PropertyManager Maven / Gradle / Ivy

The newest version!
package org.sitoolkit.tester.infra;

import java.util.Properties;

import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PropertyManager {

    private static final Logger LOG = LoggerFactory.getLogger(PropertyManager.class);

    private Properties properties = new Properties();

    public int getWindowWidth() {
        return NumberUtils.toInt(getProperty("window.width"), 900);
    }

    public int getWindowHeight() {
        return NumberUtils.toInt(getProperty("window.height"), 900);
    }

    public int getImplicitlyWait() {
        return NumberUtils.toInt(getProperty("implicitly.wait"), 5000);
    }

    public boolean isResizeWindow() {
        return Boolean.parseBoolean(getProperty("window.resize"));
    }

    public String getPageObjectDir() {
        return getProperty("pageobj.dir", "pageobj");
    }

    private String getProperty(String key) {
        return getProperty(key, "");
    }

    private String getProperty(String key, String defaultValue) {
        return properties.getProperty(key, System.getProperty("sitwt." + key, defaultValue));
    }

    public Properties getProperties() {
        return properties;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
        LOG.info("プロパティが設定されました。{}", properties);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy