Skip to content
Permalink
Browse files

JENKINS-15261 Lookup SeleniumRC browsers from correct list. Fixed typ…

…o which was causing SELENIUM_API_KEY variable to not be set
  • Loading branch information
rossrowe committed Oct 13, 2012
1 parent 7f5df52 commit e5ebf30a450010980956179da148e0d40cb50999
@@ -23,6 +23,7 @@
*/
package hudson.plugins.sauce_ondemand;

import com.saucelabs.ci.Browser;
import com.saucelabs.ci.BrowserFactory;
import hudson.Extension;
import hudson.matrix.Axis;
@@ -59,7 +60,7 @@ public boolean hasValue(String v) {
* @param map
*/
public void addBuildVariable(String value, Map<String, String> map) {
com.saucelabs.ci.Browser browserInstance = BrowserFactory.getInstance().webDriverBrowserForKey(value);
Browser browserInstance = getBrowserForKey(value);
if (browserInstance != null) { // should never be null, but let's be defensive in case of downgrade.
map.put(getName(), browserInstance.getUri());
map.put(SauceOnDemandBuildWrapper.SELENIUM_PLATFORM, browserInstance.getPlatform().toString());
@@ -74,5 +75,7 @@ public void addBuildVariable(String value, Map<String, String> map) {
}
}

protected abstract Browser getBrowserForKey(String value);


}
@@ -78,7 +78,7 @@
public static final String SELENIUM_PORT = "SELENIUM_PORT";
public static final String SELENIUM_STARTING_URL = "SELENIUM_STARTING_URL";
private static final String SAUCE_USERNAME = "SAUCE_USER_NAME";
private static final String SAUCE_API_KEY = "3";
private static final String SAUCE_API_KEY = "SAUCE_API_KEY";

private boolean enableSauceConnect;

@@ -25,6 +25,11 @@ public SeleniumRCAxis(List<String> values) {
super(values);
}

@Override
protected Browser getBrowserForKey(String value) {
return BrowserFactory.getInstance().seleniumBrowserForKey(value);
}

@Extension
public static class DescriptorImpl extends AxisDescriptor {
@Override
@@ -24,22 +24,27 @@ public WebDriverAxis(List<String> values) {
super(values);
}

@Override
protected Browser getBrowserForKey(String value) {
return BrowserFactory.getInstance().webDriverBrowserForKey(value);
}

@Extension
public static class DescriptorImpl extends AxisDescriptor {
@Override
public String getDisplayName() {
return "Sauce OnDemand WebDriver tests";
}
public static class DescriptorImpl extends AxisDescriptor {
@Override
public String getDisplayName() {
return "Sauce OnDemand WebDriver tests";
}

public List<Browser> getBrowsers() {
try {
return BrowserFactory.getInstance().getWebDriverBrowsers();
} catch (IOException e) {
logger.log(Level.WARNING, "Error retrieving browsers from Saucelabs", e);
} catch (JSONException e) {
logger.log(Level.WARNING, "Error parsing JSON response", e);
}
return Collections.emptyList();
}
}
public List<Browser> getBrowsers() {
try {
return BrowserFactory.getInstance().getWebDriverBrowsers();
} catch (IOException e) {
logger.log(Level.WARNING, "Error retrieving browsers from Saucelabs", e);
} catch (JSONException e) {
logger.log(Level.WARNING, "Error parsing JSON response", e);
}
return Collections.emptyList();
}
}
}

0 comments on commit e5ebf30

Please sign in to comment.
You can’t perform that action at this time.