From 15adb84494fafe322992d0c5ba708030573afbc2 Mon Sep 17 00:00:00 2001 From: IWAMURO Motonori Date: Wed, 14 Feb 2018 00:14:15 +0900 Subject: [PATCH] refine code. --- .../selenese/config/DefaultConfig.java | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/main/java/jp/vmi/selenium/selenese/config/DefaultConfig.java b/src/main/java/jp/vmi/selenium/selenese/config/DefaultConfig.java index 26c3c41df..93ddd3372 100644 --- a/src/main/java/jp/vmi/selenium/selenese/config/DefaultConfig.java +++ b/src/main/java/jp/vmi/selenium/selenese/config/DefaultConfig.java @@ -82,140 +82,140 @@ private static String statusListItem(Level level) { @Option(name = "--config", aliases = "-c", metaVar = "", usage = "load option information from file.") private String config; - @Option(name = "--driver", aliases = "-d", metaVar = "", + @Option(name = "--" + DRIVER, aliases = "-d", metaVar = "", usage = "firefox (default) | chrome | ie | edge | safari | htmlunit | phantomjs | remote | appium | FQCN-of-WebDriverFactory") private String driver; - @Option(name = "--headless", usage = "use headless mode if driver is supported (currently, Chrome and Firefox)") + @Option(name = "--" + HEADLESS, usage = "use headless mode if driver is supported (currently, Chrome and Firefox)") private Boolean headless; - @Option(name = "--profile", aliases = "-p", metaVar = "", usage = "profile name (Firefox only *1)") + @Option(name = "--" + PROFILE, aliases = "-p", metaVar = "", usage = "profile name (Firefox only *1)") private String profile; - @Option(name = "--profile-dir", aliases = "-P", metaVar = "", usage = "profile directory (Firefox only *1)") + @Option(name = "--" + PROFILE_DIR, aliases = "-P", metaVar = "", usage = "profile directory (Firefox only *1)") private String profileDir; - @Option(name = "--chrome-experimental-options", metaVar = "", usage = "path to json file specify experimental options for chrome (Chrome only *1)") + @Option(name = "--" + CHROME_EXPERIMENTAL_OPTIONS, metaVar = "", usage = "path to json file specify experimental options for chrome (Chrome only *1)") private String chromeExperimentalOptions; - @Option(name = "--chrome-extension", metaVar = "", usage = "chrome extension file (multiple, Chrome only *1)") + @Option(name = "--" + CHROME_EXTENSION, metaVar = "", usage = "chrome extension file (multiple, Chrome only *1)") private String[] chromeExtension; - @Option(name = "--proxy", metaVar = "", usage = "proxy host and port (HOST:PORT) (excepting IE)") + @Option(name = "--" + PROXY, metaVar = "", usage = "proxy host and port (HOST:PORT) (excepting IE)") private String proxy; - @Option(name = "--proxy-user", metaVar = "", usage = "proxy username (HtmlUnit only *2)") + @Option(name = "--" + PROXY_USER, metaVar = "", usage = "proxy username (HtmlUnit only *2)") private String proxyUser; - @Option(name = "--proxy-password", metaVar = "", usage = "proxy password (HtmlUnit only *2)") + @Option(name = "--" + PROXY_PASSWORD, metaVar = "", usage = "proxy password (HtmlUnit only *2)") private String proxyPassword; - @Option(name = "--no-proxy", metaVar = "", usage = "no-proxy hosts") + @Option(name = "--" + NO_PROXY, metaVar = "", usage = "no-proxy hosts") private String noProxy; - @Option(name = "--cli-args", metaVar = "", usage = "add command line arguments at starting up driver (multiple)") + @Option(name = "--" + CLI_ARGS, metaVar = "", usage = "add command line arguments at starting up driver (multiple)") private String[] cliArgs; - @Option(name = "--remote-url", metaVar = "", usage = "Remote test runner URL (Remote only)") + @Option(name = "--" + REMOTE_URL, metaVar = "", usage = "Remote test runner URL (Remote only)") private String remoteUrl; - @Option(name = "--remote-platform", metaVar = "", usage = "Desired remote platform (Remote only)") + @Option(name = "--" + REMOTE_PLATFORM, metaVar = "", usage = "Desired remote platform (Remote only)") private String remotePlatform; - @Option(name = "--remote-browser", metaVar = "", usage = "Desired remote browser (Remote only)") + @Option(name = "--" + REMOTE_BROWSER, metaVar = "", usage = "Desired remote browser (Remote only)") private String remoteBrowser; - @Option(name = "--remote-version", metaVar = "", usage = "Desired remote browser version (Remote only)") + @Option(name = "--" + REMOTE_VERSION, metaVar = "", usage = "Desired remote browser version (Remote only)") private String remoteVersion; - @Option(name = "--highlight", aliases = "-H", usage = "highlight locator always.") + @Option(name = "--" + HIGHLIGHT, aliases = "-H", usage = "highlight locator always.") private Boolean highlight; - @Option(name = "--interactive", aliases = "-i", usage = "interactive mode.") + @Option(name = "--" + INTERACTIVE, aliases = "-i", usage = "interactive mode.") private Boolean interactive; - @Option(name = "--screenshot-dir", aliases = "-s", metaVar = "", usage = "override captureEntirePageScreenshot directory.") + @Option(name = "--" + SCREENSHOT_DIR, aliases = "-s", metaVar = "", usage = "override captureEntirePageScreenshot directory.") private String screenshotDir; - @Option(name = "--screenshot-all", aliases = "-S", metaVar = "", usage = "take screenshot at all commands to specified directory.") + @Option(name = "--" + SCREENSHOT_ALL, aliases = "-S", metaVar = "", usage = "take screenshot at all commands to specified directory.") private String screenshotAll; - @Option(name = "--screenshot-on-fail", metaVar = "", usage = "take screenshot on fail commands to specified directory.") + @Option(name = "--" + SCREENSHOT_ON_FAIL, metaVar = "", usage = "take screenshot on fail commands to specified directory.") private String screenshotOnFail; - @Option(name = "--ignore-screenshot-command", usage = "ignore captureEntirePageScreenshot command.") + @Option(name = "--" + IGNORE_SCREENSHOT_COMMAND, usage = "ignore captureEntirePageScreenshot command.") private Boolean ignoreScreenshotCommand; - @Option(name = "--baseurl", aliases = "-b", metaVar = "", usage = "override base URL set in selenese.") + @Option(name = "--" + BASEURL, aliases = "-b", metaVar = "", usage = "override base URL set in selenese.") private String baseurl; - @Option(name = "--firefox", metaVar = "", usage = "path to 'firefox' binary. (implies '--driver firefox')") + @Option(name = "--" + FIREFOX, metaVar = "", usage = "path to 'firefox' binary. (implies '--driver firefox')") private String firefox; - @Option(name = "--geckodriver", metaVar = "", usage = "path to 'geckodriver' binary. (implies '--driver firefox')") + @Option(name = "--" + GECKODRIVER, metaVar = "", usage = "path to 'geckodriver' binary. (implies '--driver firefox')") private String geckodriver; - @Option(name = "--chromedriver", metaVar = "", usage = "path to 'chromedriver' binary. (implies '--driver chrome')") + @Option(name = "--" + CHROMEDRIVER, metaVar = "", usage = "path to 'chromedriver' binary. (implies '--driver chrome')") private String chromedriver; - @Option(name = "--iedriver", metaVar = "", usage = "path to 'IEDriverServer' binary. (implies '--driver ie')") + @Option(name = "--" + IEDRIVER, metaVar = "", usage = "path to 'IEDriverServer' binary. (implies '--driver ie')") private String iedriver; - @Option(name = "--edgedriver", metaVar = "", usage = "path to Edge 'WebDriver' binary. (implies '--driver edge')") + @Option(name = "--" + EDGEDRIVER, metaVar = "", usage = "path to Edge 'WebDriver' binary. (implies '--driver edge')") private String edgedriver; - @Option(name = "--phantomjs", metaVar = "", usage = "path to 'phantomjs' binary. (implies '--driver phantomjs')") + @Option(name = "--" + PHANTOMJS, metaVar = "", usage = "path to 'phantomjs' binary. (implies '--driver phantomjs')") private String phantomjs; - @Option(name = "--xml-result", metaVar = "", usage = "output XML JUnit results to specified directory.") + @Option(name = "--" + XML_RESULT, metaVar = "", usage = "output XML JUnit results to specified directory.") private String xmlResult; - @Option(name = "--html-result", metaVar = "", usage = "output HTML results to specified directory.") + @Option(name = "--" + HTML_RESULT, metaVar = "", usage = "output HTML results to specified directory.") private String htmlResult; - @Option(name = "--timeout", aliases = "-t", metaVar = "", usage = "set timeout (ms) for waiting. (default: " + DEFAULT_TIMEOUT_MILLISEC_N + " ms)") + @Option(name = "--" + TIMEOUT, aliases = "-t", metaVar = "", usage = "set timeout (ms) for waiting. (default: " + DEFAULT_TIMEOUT_MILLISEC_N + " ms)") private String timeout; - @Option(name = "--set-speed", metaVar = "", usage = "same as executing setSpeed(ms) command first.") + @Option(name = "--" + SET_SPEED, metaVar = "", usage = "same as executing setSpeed(ms) command first.") private String setSpeed; - @Option(name = "--height", metaVar = "", usage = "set initial height. (excluding mobile)") + @Option(name = "--" + HEIGHT, metaVar = "", usage = "set initial height. (excluding mobile)") private String height; - @Option(name = "--width", metaVar = "", usage = "set initial width. (excluding mobile)") + @Option(name = "--" + WIDTH, metaVar = "", usage = "set initial width. (excluding mobile)") private String width; - @Option(name = "--define", aliases = "-D", metaVar = "[:][+]=", + @Option(name = "--" + DEFINE, aliases = "-D", metaVar = "[:][+]=", usage = "define parameters for capabilities. is a value type: str (default), int or bool (multiple)") private String[] define; - @Option(name = "--var", aliases = "-V", metaVar = "=", + @Option(name = "--" + VAR, aliases = "-V", metaVar = "=", usage = "set JSON value to variable with a specified name. (multiple)") private String[] var; - @Option(name = "--rollup", metaVar = "", usage = "define rollup rule by JavaScript. (multiple)") + @Option(name = "--" + ROLLUP, metaVar = "", usage = "define rollup rule by JavaScript. (multiple)") private String[] rollup; - @Option(name = "--cookie-filter", metaVar = "<+RE|-RE>", usage = "filter cookies to log by RE matching the name. (\"+\" is passing, \"-\" is suppressing)") + @Option(name = "--" + COOKIE_FILTER, metaVar = "<+RE|-RE>", usage = "filter cookies to log by RE matching the name. (\"+\" is passing, \"-\" is suppressing)") private String cookieFilter; - @Option(name = "--log-filter", metaVar = "<+type|-type>", + @Option(name = "--" + LOG_FILTER, metaVar = "<+type|-type>", usage = "filter the logging information by the specified type. (multiple. \"+\" is passing, \"-\" is suppressing. type: cookie, title, url, pageinfo(= cookie & title & url))") private String[] logFilter; - @Option(name = "--command-factory", metaVar = "", usage = "register user defined command factory. (See Note *3)") + @Option(name = "--" + COMMAND_FACTORY, metaVar = "", usage = "register user defined command factory. (See Note *3)") private String commandFactory; - @Option(name = "--no-exit", usage = "don't call System.exit at end.") + @Option(name = "--" + NO_EXIT, usage = "don't call System.exit at end.") private Boolean noExit; - @Option(name = "--strict-exit-code", usage = "return strict exit code, reflected by selenese command results at end. (See Note *4)") + @Option(name = "--" + STRICT_EXIT_CODE, usage = "return strict exit code, reflected by selenese command results at end. (See Note *4)") private Boolean strictExitCode; - @Option(name = "--max-time", metaVar = "", usage = "Maximum time in seconds that you allow the entire operation to take.") + @Option(name = "--" + MAX_TIME, metaVar = "", usage = "Maximum time in seconds that you allow the entire operation to take.") private String maxTime; - @Option(name = "--help", aliases = "-h", usage = "show this message.") + @Option(name = "--" + HELP, aliases = "-h", usage = "show this message.") private Boolean help; @Argument