
com.slickqa.jupiter.DefaultAttributes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of slickqa-junit-jupiter Show documentation
Show all versions of slickqa-junit-jupiter Show documentation
Junit Jupiter extension that reports results to slick
package com.slickqa.jupiter;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class DefaultAttributes {
protected static HashMap attributesCache = null;
protected static Map EnvironmentVariables = System.getenv();
public static void wipeCache() {
attributesCache = null;
}
public static HashMap getAttributesFromEnvironment(boolean useCache) {
if(useCache && attributesCache != null) {
return new HashMap<>(attributesCache);
}
HashMap attrs = new HashMap<>();
for(String name : System.getProperties().stringPropertyNames()) {
if(name.startsWith("attr.")) {
attrs.put(name.substring(5), System.getProperties().getProperty(name));
}
}
for(String name : EnvironmentVariables.keySet()) {
if(name.startsWith("ATTR_")) {
attrs.put(name.substring(5), EnvironmentVariables.get(name));
}
}
attributesCache = new HashMap<>(attrs);
return attrs;
}
public static HashMap getAttributesFromEnvironment() {
return getAttributesFromEnvironment(true);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy