Codota Logo
InterpreterPropertyException
Code IndexAdd Codota to your IDE (free)

How to use
InterpreterPropertyException
in
org.chorusbdd.chorus.config

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: Chorus-bdd/Chorus

public static void main(String[] args) {
  boolean proceed = handleVersionOrHelpSwitches(args);
  if ( proceed ) {
    boolean success = false;
    try {
      Chorus chorus = new Chorus(args);
      success = chorus.run();
    } catch (InterpreterPropertyException e) {
      ChorusOut.err.println(e.getMessage());
      ChorusOut.err.print(ChorusConfigProperty.getHelpText());
    } catch (Throwable t) {
      ChorusOut.err.println("Chorus encountered an error and had to exit");
      ChorusOut.err.print(t.toString());
    }
    //We should exit with a code between 0-255 since this is the valid range for unix exit statuses
    //(windows supports signed integer exit status, unix does not)
    //choosing the most obvious, 0 = success, 1 = failure, we could expand on this if needed
    int exitCode = success ? 0 : 1;
    System.exit(exitCode);
  }
}
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

  chorus = new Chorus(args.split(" "));
} catch (InterpreterPropertyException e) {
  throw new RuntimeException("Error with Chorus command line " + e.getMessage());
origin: Chorus-bdd/Chorus

private void checkValues(ConfigurationProperty p, List<String> values) throws InterpreterPropertyException {
  Pattern pattern = Pattern.compile(p.getValidatingExpression());
  for (String value : values) {
    Matcher m = pattern.matcher(value);
    if ( ! m.matches()) {
      throw new InterpreterPropertyException(
        "Could not parse the value for interpreter property " + p +
        " expected to be in the form " + p.getExample()
      );
    }
  }
}
origin: Chorus-bdd/Chorus

@Test
public void testCannotSetMoreThanMaxValues() {
  ConfigurationProperty propertyWithMinValues = new TestProperty(TestConfigProperty.HANDLER_PACKAGES) {
    public int getMaxValueCount() {
      return 1;
    }
  };
  ConfigReader c = new ConfigReader(Collections.singletonList(propertyWithMinValues), new String[] { "-h", "onevalue", "twovalues" });
  try {
    c.readConfiguration();
  } catch (InterpreterPropertyException e) {
    assertTrue("contains At Most 1", e.getMessage().contains("At most 1 value(s) must be supplied"));
    return;
  }
  fail("Must complain when more than max vals set");
}
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

@Test
public void testCannotSetLessThanMinimumValues() {
  ConfigurationProperty propertyWithMinValues = new TestProperty(TestConfigProperty.HANDLER_PACKAGES) {
    public int getMinValueCount() {
      return 2;
    }
  };
  ConfigReader c = new ConfigReader(Collections.singletonList(propertyWithMinValues), new String[] { "-h", "onevalue" });
  try {
    c.readConfiguration();
  } catch (InterpreterPropertyException e) {
    assertTrue("contains At Least 2", e.getMessage().contains("At least 2 value(s) must be supplied"));
    return;
  }
  fail("Must complain when less than min vals set");
}
origin: Chorus-bdd/Chorus

throw new InterpreterPropertyException("arguments must start with a switch, e.g. -f");
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

private void addPropertyValues(Map<ConfigurationProperty, List<String>> propertyMap, StringTokenizer st, ConfigurationProperty property) throws InterpreterPropertyException {
  List<String> l = getOrCreatePropertyList(propertyMap, property);
  if ( ! st.hasMoreTokens() ) {
    if (isBooleanSwitchProperty(property)) {
      l.add("true");
    } else {
      throw new InterpreterPropertyException(
        String.format("No value was given for switch -%s (-%s), and Chorus cannot provide a default",
          property.getSwitchShortName(),
          property.getSwitchName()
        )
      );
    }
  } else {
    while(st.hasMoreTokens()) {
      l.add(st.nextToken());
    }
  }
}
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"
      );
    }
  }
}
org.chorusbdd.chorus.configInterpreterPropertyException

Javadoc

Created with IntelliJ IDEA. User: Nick E Date: 12/06/12 Time: 10:30 An exception thrown when the properties specified for the interpreter are invalid

Most used methods

  • getMessage
  • <init>

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • setContentView (Activity)
  • getApplicationContext (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • JCheckBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now