com.saucelabs.bamboo.sod.action.EnvironmentConfigurator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bamboo-sauceondemand-plugin Show documentation
Show all versions of bamboo-sauceondemand-plugin Show documentation
This is the Sauce OnDemand plugin for Bamboo
The newest version!
package com.saucelabs.bamboo.sod.action;
import com.atlassian.bamboo.buildqueue.manager.CustomPreBuildQueuedAction;
import com.atlassian.bamboo.configuration.AdministrationConfigurationManager;
import com.atlassian.bamboo.v2.build.BuildContext;
import com.saucelabs.bamboo.sod.AbstractSauceBuildPlugin;
import com.saucelabs.bamboo.sod.config.SODMappedBuildConfiguration;
import com.saucelabs.bamboo.sod.variables.VariableModifier;
import com.saucelabs.ci.BrowserFactory;
import org.jetbrains.annotations.NotNull;
/**
* Pre Build Action which generates and adds the Selenium environment variables that apply to the build
* plan to the builder.
*
* @author Jonathan Doklovic
* @author Ross Rowe
*/
public class EnvironmentConfigurator extends AbstractSauceBuildPlugin implements CustomPreBuildQueuedAction {
/**
* Populated via dependency injection.
*/
private AdministrationConfigurationManager administrationConfigurationManager;
/**
* Populated via dependency injection.
*/
private BrowserFactory sauceBrowserFactory;
/**
* Entry point into build action.
*
* @return ??? FIXME
*/
@NotNull
@Override
public BuildContext call() {
final SODMappedBuildConfiguration config = new SODMappedBuildConfiguration(buildContext.getBuildDefinition().getCustomConfiguration());
if (config.isEnabled()) {
setSeleniumEnvironmentVars(config);
}
return buildContext;
}
/**
* @param config
*/
private void setSeleniumEnvironmentVars(SODMappedBuildConfiguration config){
VariableModifier variableModifier = getVariableModifier(config, buildContext.getBuildDefinition());
variableModifier.setAdministrationConfigurationManager(administrationConfigurationManager);
variableModifier.setSauceBrowserFactory(getSauceBrowserFactory());
variableModifier.storeVariables();
variableModifier.populateVariables(buildContext.getVariableContext());
}
public void setAdministrationConfigurationManager(AdministrationConfigurationManager administrationConfigurationManager) {
this.administrationConfigurationManager = administrationConfigurationManager;
}
public void setSauceBrowserFactory(BrowserFactory sauceBrowserFactory) {
this.sauceBrowserFactory = sauceBrowserFactory;
}
public BrowserFactory getSauceBrowserFactory() {
if (sauceBrowserFactory == null) {
setSauceBrowserFactory(BrowserFactory.getInstance());
}
return sauceBrowserFactory;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy