@ConfigProperty( name= LOG_DIRECTORY_PROPERTY, description="If you turn logging on, use this property to set the log directory. If not specified a logs directory will be created in the same directory as the feature file. May be an absolute path or a path relative to the working directory", mandatory = false ) public void setLogDirectory(String logDirectory) { this.logDirectory = logDirectory; }
ConfigBuilderTypeConverter converterFunction = getConverterFunction(p, javaType); if (!"".equals(p.defaultValue())) { throw new ConfigBuilderException("Default value \"" + p.defaultValue() + "\" was converted to a type " + defaultValue.getClass().getName() + " which did not match the expected class type " + javaType.getName() + " for " + getAnnotationDescription(p)); p.name(), javaType, validationPattern.orElse(null), p.description(), defaultValue, p.mandatory(), converterFunction, method
private void validateDefaultValue(Pattern validationPattern, ConfigProperty p) throws ConfigBuilderException { if (!validationPattern.matcher(p.defaultValue()).matches()) { throw new ConfigBuilderException( String.format("The default value [%s] did not match the validation pattern [%s], for %s", p.defaultValue(), validationPattern.pattern(), getAnnotationDescription(p) ) ); } }
private Pattern compilePattern(ConfigProperty p) throws ConfigBuilderException { Pattern pattern; try { pattern = Pattern.compile(p.validationPattern()); } catch (PatternSyntaxException e) { throw new ConfigBuilderException("The validation pattern '" + p.validationPattern() + "' could not be compiled, for " + getAnnotationDescription(p)); } return pattern; }
private String getAnnotationDescription(ConfigProperty p) { return ConfigProperty.class.getSimpleName() + " annotation with name " + p.name(); }
private Object convertDefaultValue(ConfigProperty p, ConfigBuilderTypeConverter f, Class javaType) throws ConfigBuilderException { return f.convertToTargetType(p.defaultValue(), javaType); }
private Optional<Pattern> getValidationPattern(ConfigProperty p, Class javaType) throws ConfigBuilderException { Optional<Pattern> pattern = p.validationPattern().equals("") ? getDefaultValidationPattern(javaType) : Optional.of(compilePattern(p)); return pattern; }
@ConfigProperty( name= APPEND_TO_LOGS_PROPERTY, description="Whether to append to or overwrite log files", defaultValue = "false", validationPattern = "true|false" ) public void setAppendToLogs(boolean appendToLogs) { this.appendToLogs = appendToLogs; }
@ConfigProperty( name= PROCESS_CHECK_DELAY_PROPERTY, description="Milliseconds after which to check started process is still running or fail the start process step. Longer values add better detection of immediate process start failures but incur an increased delay before subsequent steps run", defaultValue = "500", validationPattern = "(-?)\\d+" ) public void setProcessCheckDelay(int processCheckDelay) { this.processCheckDelay = processCheckDelay; }
@ConfigProperty( name="protocol", description="Protocol to make connection (only JMX supported at present)", defaultValue = "jmx", validationPattern = "jmx" ) public void setProtocol(String protocol) { this.protocol = protocol; }
@ConfigProperty( name = "remoteWebDriver.browserType", description = "If using REMOTE_WEB_DRIVER, a value to pass to the remote selenium web driver to request a browser type, e.g. chrome, firefox, safari", defaultValue = "chrome", mandatory = false ) public void setRemoteWebDriverBrowserType(String remoteWebDriverBrowserType) { this.remoteWebDriverBrowserType = remoteWebDriverBrowserType; }
@ConfigProperty( name="scope", description="Whether the database connection is closed at the end of the scenario or at the end of the feature." + " This will be set automatically to FEATURE for connections established during 'Feature-Start:' if not provided, otherwise Scenario", defaultValue = "SCENARIO" ) public void setScope(Scope scope) { this.scope = scope; }
@ConfigProperty( name= DEBUG_PORT_PROPERTY, description="Enable the debugger when starting the jvm and set it up to listen for connections on the port specified (java processes only), -1 to disable", validationPattern = "(-?)\\d+", defaultValue = "-1" ) public void setDebugPort(int debugPort) { this.debugPort = debugPort; }
@ConfigProperty( name= SCOPE_PROPERTY, description="Whether the process should be shut down at the end of the scenario or the end of the feature." + " this will be set automatically to FEATURE for processes started during 'Feature-Start:' if not provided, otherwise Scenario", defaultValue = "SCENARIO", mandatory = false ) public void setProcessScope(Scope processScope) { this.processScope = processScope; }
@ConfigProperty( name = "stepTimeoutSeconds", description = "How long the Chorus interpreter should wait for a result after executing a step on a web socket client before failing the step", defaultValue = "60", validationPattern = "\\d+" ) public void setStepTimeoutSeconds(int stepTimeoutSeconds) { this.stepTimeoutSeconds = stepTimeoutSeconds; }
@ConfigProperty( name="scope", description="Whether the remoting connection is closed at the end of the scenario or at the end of the feature. " + "This will be set automatically to FEATURE for connections established during 'Feature-Start:' if not provided, otherwise Scenario", defaultValue = "SCENARIO" ) public void setScope(Scope scope) { this.scope = scope; }
@ConfigProperty( name = "chromeDriver.arguments", description = "Arguments to pass to the chrome browser if using CHROME driver type", mandatory = false ) public void setChromeArgs(String chromeArgs) { this.chromeArgs = chromeArgs; }
@ConfigProperty( name="username", description="JDBC connection username", mandatory = false ) public void setUsername(String username) { this.username = username; }
@ConfigProperty( name= JRE_PROPERTY, description="Path to the JRE to be used when executing a Java process. If not set, the Chorus interpreter's JVM will be used", mandatory = false ) public void setJre(String jre) { this.jre = jre; }
@ConfigProperty( name= STD_OUT_MODE_PROPERTY, description="What do to with standard output stream from started process, one of INLINE (combine with interpreter stdout), FILE (write output to file). Other values are deprecated", validationPattern = "(?i)FILE|INLINE|CAPTURED|CAPTUREDWITHLOG", mandatory = false //logging prop may be set instead ) public void setStdOutMode(OutputMode stdOutMode) { this.stdOutMode = stdOutMode; }