Skip to content

Commit

Permalink
Refactored class names to refer to Jenkins not Hudson
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrowe committed Jun 9, 2012
1 parent f770e87 commit aed1e3e
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 20 deletions.
26 changes: 26 additions & 0 deletions .gitignore
Expand Up @@ -11,3 +11,29 @@ httpclient.log
atlassian-ide-plugin.xml

lightweight.log

sauce_connect.log

sauce_connect.log.8

settings.xml

jenkins.bmml

lightweight.log.zip

sauce_connect.log.1

sauce_connect.log.2

sauce_connect.log.3

sauce_connect.log.4

sauce_connect.log.5

sauce_connect.log.6

sauce_connect.log.7

test.log
2 changes: 1 addition & 1 deletion README
Expand Up @@ -6,4 +6,4 @@ To build and unit test the plugin, execute:

To deploy a built version, execute

mvn release:prepare release:perform
mvn release:prepare release:perform
Expand Up @@ -7,7 +7,7 @@
/**
* @author Ross Rowe
*/
public class HudsonSauceConnectManager extends SauceConnectTwoManager {
public class JenkinsSauceConnectManager extends SauceConnectTwoManager {

@Override
public String getSauceConnectWorkingDirectory() {
Expand Down
Expand Up @@ -16,7 +16,7 @@
/**
* @author Ross Rowe
*/
public class HudsonSauceLibraryManager extends SauceLibraryManager {
public class JenkinsSauceLibraryManager extends SauceLibraryManager {
/**
*
* @param jarFile
Expand Down
Expand Up @@ -13,19 +13,19 @@
/**
* @author Ross Rowe
*/
public class HudsonSauceManagerFactory {
public class JenkinsSauceManagerFactory {

private static final HudsonSauceManagerFactory INSTANCE = new HudsonSauceManagerFactory();
private static final JenkinsSauceManagerFactory INSTANCE = new JenkinsSauceManagerFactory();

private PlexusContainer plexus = null;

private Lock accessLock = new ReentrantLock();

public static HudsonSauceManagerFactory getInstance() {
public static JenkinsSauceManagerFactory getInstance() {
return INSTANCE;
}

private HudsonSauceManagerFactory() {
private JenkinsSauceManagerFactory() {
}

public SauceConnectTwoManager createSauceConnectManager() throws ComponentLookupException {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/plugins/sauce_ondemand/PluginImpl.java
Expand Up @@ -24,8 +24,8 @@
package hudson.plugins.sauce_ondemand;

import com.saucelabs.ci.SauceLibraryManager;
import com.saucelabs.hudson.HudsonSauceLibraryManager;
import com.saucelabs.hudson.HudsonSauceManagerFactory;
import com.saucelabs.hudson.JenkinsSauceLibraryManager;
import com.saucelabs.hudson.JenkinsSauceManagerFactory;
import com.saucelabs.rest.Credential;
import com.saucelabs.rest.SauceTunnelFactory;
import hudson.Extension;
Expand Down Expand Up @@ -55,7 +55,7 @@ public class PluginImpl extends Plugin implements Describable<PluginImpl> {

private static final Logger logger = Logger.getLogger(PluginImpl.class);

private SauceLibraryManager libraryManager = new HudsonSauceLibraryManager();
private SauceLibraryManager libraryManager = new JenkinsSauceLibraryManager();
/**
* User name to access Sauce OnDemand.
*/
Expand Down Expand Up @@ -86,7 +86,7 @@ public void start() throws Exception {
Items.XSTREAM.alias("hudson.plugins.sauce_ondemand.SauceOnDemandBuildWrapper", SauceOnDemandBuildWrapper.class);

load();
HudsonSauceManagerFactory.getInstance().start();
JenkinsSauceManagerFactory.getInstance().start();
}

public void setCredential(String username, String apiKey) throws IOException {
Expand Down
Expand Up @@ -28,7 +28,7 @@
import com.saucelabs.ci.BrowserFactory;
import com.saucelabs.ci.sauceconnect.SauceConnectUtils;
import com.saucelabs.ci.sauceconnect.SauceTunnelManager;
import com.saucelabs.hudson.HudsonSauceManagerFactory;
import com.saucelabs.hudson.JenkinsSauceManagerFactory;
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
Expand All @@ -50,6 +50,7 @@
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.text.DecimalFormat;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -86,7 +87,7 @@ public class SauceOnDemandBuildWrapper extends BuildWrapper implements Serializa
* TODO provide mechanism to set launchOnSlave via UI
*/
private boolean launchSauceConnectOnSlave = false;
public static final Pattern ENVIRONMENT_VARIABLE_PATTERN = Pattern.compile("[$|%]([A-Z]+)");
public static final Pattern ENVIRONMENT_VARIABLE_PATTERN = Pattern.compile("[$|%]([a-zA-Z_][a-zA-Z0-9_]+)");

@DataBoundConstructor
public SauceOnDemandBuildWrapper(Credentials
Expand Down Expand Up @@ -149,7 +150,8 @@ public void buildEnvVars(Map<String, String> env) {
env.put(SAUCE_ONDEMAND_BROWSERS, StringEscapeUtils.escapeJava(browsersJSON.toString()));
}
env.put(SELENIUM_HOST, getHostName());
env.put(SELENIUM_PORT, Integer.toString(getPort()));
DecimalFormat myFormatter = new DecimalFormat("###");
env.put(SELENIUM_PORT, myFormatter.format(getPort()));
if (getStartingURL() != null) {
env.put(SELENIUM_STARTING_URL, getStartingURL());
}
Expand Down Expand Up @@ -310,7 +312,7 @@ public TunnelHolder(String username) {

public void close(TaskListener listener) {
try {
HudsonSauceManagerFactory.getInstance().createSauceConnectManager().closeTunnelsForPlan(username, listener.getLogger());
JenkinsSauceManagerFactory.getInstance().createSauceConnectManager().closeTunnelsForPlan(username, listener.getLogger());
} catch (ComponentLookupException e) {
//shouldn't happen
logger.log(Level.SEVERE, "Unable to close tunnel", e);
Expand Down Expand Up @@ -375,7 +377,7 @@ public ITunnelHolder call() throws IOException {
TunnelHolder tunnelHolder = new TunnelHolder(username);
SauceTunnelManager sauceManager = null;
try {
sauceManager = HudsonSauceManagerFactory.getInstance().createSauceConnectManager();
sauceManager = JenkinsSauceManagerFactory.getInstance().createSauceConnectManager();
Process process = sauceManager.openConnection(username, key, port, sauceConnectJar, listener.getLogger());
return tunnelHolder;
} catch (ComponentLookupException e) {
Expand Down
Expand Up @@ -57,7 +57,6 @@ public class SauceOnDemandReport extends TestAction {
*/
private final boolean matchingJobNames;
private static final String HMAC_KEY = "HMACMD5";
;

public SauceOnDemandReport(CaseResult parent, List<String> ids, boolean matchingJobNames) {
this.parent = parent;
Expand Down Expand Up @@ -93,7 +92,7 @@ public String getDisplayName() {
return "Sauce OnDemand report";
}

public String getUrlName() {
public String getUrlName() {
return "sauce-ondemand-report";
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plexus/components.xml
Expand Up @@ -20,7 +20,7 @@ under the License.
<components>
<component>
<role>com.saucelabs.ci.sauceconnect.SauceTunnelManager</role>
<implementation>com.saucelabs.hudson.HudsonSauceConnectManager</implementation>
<implementation>com.saucelabs.hudson.JenkinsSauceConnectManager</implementation>
</component>
</components>
</component-set>
@@ -1,3 +1,3 @@
<div>
The name of the Selenium Port to be used. For tests run using Sauce Connect, this should be 4445. If using ondemand.saucelabs.com for the Selenium Host, then use 4444. The value of the host will be stored in the SAUCE_ONDEMAND_HOST environment variable.
The name of the Selenium Port to be used. For tests run using Sauce Connect, this should be 4445. If using ondemand.saucelabs.com for the Selenium Host, then use 4444. The value of the host will be stored in the SAUCE_ONDEMAND_PORT environment variable.
</div>

0 comments on commit aed1e3e

Please sign in to comment.