Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax #292

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.saucelabs.saucebindings.junit5;

import org.junit.platform.engine.ConfigurationParameters;
import org.junit.platform.engine.support.hierarchical.ParallelExecutionConfiguration;
import org.junit.platform.engine.support.hierarchical.ParallelExecutionConfigurationStrategy;

public class CustomParallelStrategy implements ParallelExecutionConfiguration, ParallelExecutionConfigurationStrategy {

@Override
public int getParallelism() {
return getParallelCount();
}

@Override
public int getMinimumRunnable() {
return 0;
}

@Override
public int getMaxPoolSize() {
return getParallelCount();
}

@Override
public int getCorePoolSize() {
return getParallelCount();
}

@Override
public int getKeepAliveSeconds() {
return 60;
}

@Override
public ParallelExecutionConfiguration createConfiguration(final ConfigurationParameters configurationParameters) {
return this;
}

private int getParallelCount() {
if (System.getProperty("PARALLEL_COUNT") != null) {
return Integer.parseInt(System.getProperty("PARALLEL_COUNT"));
} else {
return Runtime.getRuntime().availableProcessors();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import org.junit.platform.engine.support.hierarchical.ParallelExecutionConfiguration;
import org.junit.platform.engine.support.hierarchical.ParallelExecutionConfigurationStrategy;

/**
* @deprecated use CustomParallelStrategy instead
*/
@Deprecated
public class CustomStrategy implements ParallelExecutionConfiguration, ParallelExecutionConfigurationStrategy {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import java.util.Map;
import java.util.Set;

/**
* Valid Browsers.
*
* @see <a href="https://docs.saucelabs.com/dev/test-configuration-options/#browsername">browserName</a>
*/
public enum Browser {
CHROME("chrome"),
INTERNET_EXPLORER("internet explorer"),
Expand All @@ -17,10 +22,10 @@ public enum Browser {
private final String value;

private static final class BrowserLookup {
private static final Map<String, String> lookup = new HashMap<String, String>();
private static final Map<String, String> lookup = new HashMap<>();
}

public static Set keys() {
public static Set<String> keys() {
return BrowserLookup.lookup.keySet();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private static void storeBuildInfo() {

/**
* The default build name based on CI Tool.
*
* @return the constant name of the build
*/
public static String getBuildName() {
Expand All @@ -64,6 +65,7 @@ public static String getBuildName() {

/**
* The default build number based on CI Tool.
*
* @return the variable number of the current build
*/
public static String getBuildNumber() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import lombok.Getter;

/**
* Valid Data Center Server Names.
*
* @see <a href="https://docs.saucelabs.com/basics/data-center-endpoints/">Data Center Endpoints</a>
*/
@Getter
public enum DataCenter {
US_WEST("us-west-1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import java.util.Map;
import java.util.Set;

/**
* Valid Job Visibility Options.
* The Sauce Labs name for this capability is "public"
*
* @see <a href="https://docs.saucelabs.com/dev/test-configuration-options/#public">public</a>
*/
public enum JobVisibility {
PUBLIC("public"),
PUBLIC_RESTRICTED("public restricted"),
Expand All @@ -17,10 +23,10 @@ public enum JobVisibility {
private final String value;

private static final class JobVisibilityLookup {
private static final Map<String, String> lookup = new HashMap<String, String>();
private static final Map<String, String> lookup = new HashMap<>();
}

public static Set keys() {
public static Set<String> keys() {
return JobVisibilityLookup.lookup.keySet();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import java.util.Map;
import java.util.Set;

/**
* Valid Page Load Strategies.
*
* @see <a href="https://docs.saucelabs.com/dev/test-configuration-options/#pageloadstrategy">pageLoadStrategy</a>
*/
public enum PageLoadStrategy {
NONE("none"),
EAGER("eager"),
Expand All @@ -15,10 +20,10 @@ public enum PageLoadStrategy {
private final String value;

private static final class PageLoadStrategyLookup {
private static final Map<String, String> lookup = new HashMap<String, String>();
private static final Map<String, String> lookup = new HashMap<>();
}

public static Set keys() {
public static Set<String> keys() {
return PageLoadStrategyLookup.lookup.keySet();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import java.util.Map;
import java.util.Set;

/**
* Valid Pre-run executable options.
*
* @see <a href="https://docs.saucelabs.com/dev/test-configuration-options/#pre-run-executables">Pre-Run Executables</a>
*/
public enum Prerun {
EXECUTABLE("executable"),
ARGS("args"),
Expand All @@ -16,10 +21,10 @@ public enum Prerun {
private final String value;

private static final class PrerunLookup {
private static final Map<String, String> lookup = new HashMap<String, String>();
private static final Map<String, String> lookup = new HashMap<>();
}

public static Set keys() {
public static Set<String> keys() {
return PrerunLookup.lookup.keySet();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.saucelabs.saucebindings;

/**
* Setting Environment Variables to Authenticate with Sauce Labs is required.
*/
class SauceEnvironmentVariablesNotSetException extends RuntimeException {
public SauceEnvironmentVariablesNotSetException(String message) {
super(message);
Expand Down
Loading