congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.chorusbdd.chorus.config
Code IndexAdd Tabnine to your IDE (free)

How to use org.chorusbdd.chorus.config

Best Java code snippets using org.chorusbdd.chorus.config (Showing top 20 results out of 315)

origin: Chorus-bdd/Chorus

  protected ConfigurationProperty getProperty(String s) {
    ConfigurationProperty result = null;
    for (ConfigurationProperty p : properties) {
      if ( p.matchesSwitch(s)) {
        result = p;
        break;
      }
    }
    return result;
  }
}
origin: Chorus-bdd/Chorus

/**
 * Create a configuration using process arguments, System Properties and defaults
 */
public ConfigReader(List<ConfigurationProperty> properties, String[] args) {
  this.properties = properties;
  this.args = args;
  //where a property is in PropertySourceMode.OVERRIDE the ordering of sources here is important
  //sys props are last since it is useful to be able to use a sys prop to override command line
  //parameters for test suites which run as part of a component build which is checked in to source control -
  //otherwise it is necessary to commit changes to files to achieve something simple like increasing logging
  //to debug level. Continuous integration tools such as team city let you set a sys prop easily to do this.
  propertySources = new ConfigSource[] {
    new DefaultsConfigSource(properties),
    new CommandLineParser(properties),
    new SystemPropertyParser(properties)
  };
}
origin: Chorus-bdd/Chorus

  private void checkIfMandatory(Map<ConfigurationProperty, List<String>> results, ConfigurationProperty p) throws InterpreterPropertyException {
    if ( p.isMandatory() && ! results.containsKey(p)) {
      throw new InterpreterPropertyException(
        "Mandatory property " + p + " was not set. " +
        "You can set this property with the -" + p.getSwitchName() + " switch, " +
        "the -" + p.getSwitchShortName() + " switch or the " +
        p.getSystemProperty() + " system property"
      );
    }
  }
}
origin: Chorus-bdd/Chorus

@Test
public void testBooleanSwitchUsingShortName() throws InterpreterPropertyException {
  String[] switches = new String[] { "-f", "./features", "-h", "org.chorusbdd.chorus", "-d" };
  ConfigReader c = new ConfigReader(TestConfigProperty.getAll(), switches);
  c.readConfiguration();
  assertTrue(c.isTrue(TestConfigProperty.DRY_RUN));
  assertTrue(c.isSet(TestConfigProperty.DRY_RUN));
}
origin: Chorus-bdd/Chorus

@Test
public void mandatoryPropertyMustBeSet() {
  System.clearProperty(TestConfigProperty.FEATURE_PATHS.getSystemProperty());  //in case set
  String[] switches = new String[] { "-d" };
  ConfigReader c = new ConfigReader(TestConfigProperty.getAll(), switches);
  try {
    c.readConfiguration();
  } catch (InterpreterPropertyException e) {
    assertTrue(e.getMessage().contains("Mandatory property featurePaths was not set"));
    return;
  }
  fail("Must require mandatory -f property value");
}
origin: Chorus-bdd/Chorus

  public Map<ConfigurationProperty, List<String>> parseProperties(Map<ConfigurationProperty, List<String>> propertyMap, String... args) throws InterpreterPropertyException {
    for ( ConfigurationProperty p : getProperties()) {
      if (  p.hasDefaults()) {
        List<String> properties = getOrCreatePropertyList(propertyMap, p);
        Collections.addAll(properties, p.getDefaults());
      }
    }
    return propertyMap;
  }
}
origin: Chorus-bdd/Chorus

private void checkValueCount(ConfigurationProperty p, List<String> values) throws InterpreterPropertyException {
  if ( values.size() < p.getMinValueCount()) {
    throw new InterpreterPropertyException("At least " + p.getMinValueCount() + " value(s) must be supplied for the property " + p);
  } else if ( values.size() > p.getMaxValueCount()) {
    throw new InterpreterPropertyException("At most " + p.getMaxValueCount() + " value(s) must be supplied for the property " + p);
  }
}
origin: Chorus-bdd/Chorus

public static ConfigurationProperty getConfigPropertyForSysProp(String systemProperty) {
  ConfigurationProperty result = null;
  for ( ConfigurationProperty p : values()) {
    if ( p.getSystemProperty().equals(systemProperty)) {
      result = p;
      break;
    }
  }
  return result;
}
origin: Chorus-bdd/Chorus

  private ConfigurationProperty getProperty(String parameterList, StringTokenizer st) throws InterpreterPropertyException {
    String switchProperty = st.nextToken();
    ConfigurationProperty property = getProperty(switchProperty);
    if (property == null ) {
      throw new InterpreterPropertyException("Unsupported parameter " + parameterList);
    }
    return property;
  }
}
origin: Chorus-bdd/Chorus

public int getMinValueCount() {
  return delegate.getMinValueCount();
}
origin: Chorus-bdd/Chorus

public String getValidatingExpression() {
  return delegate.getValidatingExpression();
}
origin: Chorus-bdd/Chorus

  public PropertySourceMode getPropertySourceMode() {
    return delegate.getPropertySourceMode();
  }
}
origin: Chorus-bdd/Chorus

public String getDescription() {
  return delegate.getDescription();
}
origin: Chorus-bdd/Chorus

public boolean hasDefaults() {
  return getDefaults().length > 0;
}
origin: Chorus-bdd/Chorus

public String toString() {
  return getSwitchName();
}
origin: Chorus-bdd/Chorus

@Test
public void testDefaultValueGetsSetIfAvailable() throws InterpreterPropertyException {
  String[] switches = new String[] { "-f", "./features", "-h", "org.chorusbdd.chorus" };
  ConfigReader c = new ConfigReader(TestConfigProperty.getAll(), switches);
  c.readConfiguration();
  assertTrue(! c.isTrue(TestConfigProperty.DRY_RUN));
  assertTrue(c.isSet(TestConfigProperty.DRY_RUN));
}
origin: Chorus-bdd/Chorus

@Test
public void testBooleanSwitchWithValue() throws InterpreterPropertyException {
  String[] switches = new String[] { "-f", "./features", "-h", "org.chorusbdd.chorus", "-dryrun", "true" };
  ConfigReader c = new ConfigReader(TestConfigProperty.getAll(), switches);
  c.readConfiguration();
  assertTrue(c.isTrue(TestConfigProperty.DRY_RUN));
  assertTrue(c.isSet(TestConfigProperty.DRY_RUN));
}
origin: Chorus-bdd/Chorus

@Test
public void testBooleanSwitchCanBeSetFalse() throws InterpreterPropertyException {
  String[] switches = new String[] { "-f", "./features", "-h", "org.chorusbdd.chorus", "-dryrun", "false" };
  ConfigReader c = new ConfigReader(TestConfigProperty.getAll(), switches);
  c.readConfiguration();
  assertTrue(! c.isTrue(TestConfigProperty.DRY_RUN));
  assertTrue(c.isSet(TestConfigProperty.DRY_RUN));
}
origin: Chorus-bdd/Chorus

@Test
public void testBooleanSwitchWithoutValue() throws InterpreterPropertyException {
  String[] switches = new String[] { "-f", "./features", "-h", "org.chorusbdd.chorus", "-dryrun" };
  ConfigReader c = new ConfigReader(TestConfigProperty.getAll(), switches);
  c.readConfiguration();
  assertTrue(c.isTrue(TestConfigProperty.DRY_RUN));
  assertTrue(c.isSet(TestConfigProperty.DRY_RUN));
}
origin: Chorus-bdd/Chorus

@Test
public void testADefaultValueDoesNotGetSetIfNoDefaultDefined() throws InterpreterPropertyException {
  String[] switches = new String[] { "-f", "./features", "-h", "org.chorusbdd.chorus" };
  ConfigReader c = new ConfigReader(TestConfigProperty.getAll(), switches);
  c.readConfiguration();
  assertTrue(! c.isSet(TestConfigProperty.TAG_EXPRESSION));
}
org.chorusbdd.chorus.config

Most used classes

  • ConfigReader
    Created with IntelliJ IDEA. User: Nick Ebbutt Date: 12/06/12 Time: 09:33 Reads and validates configu
  • ConfigurationProperty
    Created with IntelliJ IDEA. User: nick Date: 06/07/12 Time: 23:05 To change this template use File |
  • InterpreterPropertyException
    Created with IntelliJ IDEA. User: Nick E Date: 12/06/12 Time: 10:30 An exception thrown when the pro
  • CommandLineParser
    Created by: Steve Neal Date: 31/10/11 This class is responsible for parsing command line switches in
  • ConfigProperties
    Created with IntelliJ IDEA. Date: 23/07/12 Time: 13:23 Provide access to get and set ConfigurationPr
  • DefaultsConfigSource,
  • SystemPropertyParser,
  • TestConfigProperty,
  • TestConfigReader$TestProperty,
  • TestConfigReader
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now