Exemplo n.º 1
0
  public void testSlash() throws Exception {
    String rsl;
    RslNode node;

    rsl = "&(executable=/bin/echo)(arguments=\\)";

    node = RSLParser.parse(rsl);

    NameOpValue nv = null;
    List values;

    nv = node.getParam("ARGUMENTS");
    values = nv.getValues();

    assertEquals("arg size", 1, values.size());

    assertEquals("arg 1", "\\", ((Value) values.get(0)).getCompleteValue());

    rsl = "&(executable=/bin/echo)(arguments=\"\\\")";

    node = RSLParser.parse(rsl);

    assertEquals("arg size", 1, values.size());

    assertEquals("arg 1", "\\", ((Value) values.get(0)).getCompleteValue());
  }
Exemplo n.º 2
0
  public void testQuotes() throws Exception {
    String rsl;
    RslNode node;

    rsl =
        "&(arg1=\"foo\"\"bar\")(arg2='foo''bar')(arg3='')(arg4=\"\")"
            + "(executable=\"/bin/echo\")(arguments='mis')";

    node = RSLParser.parse(rsl);

    testQuotesSub(node);

    rsl = node.toString();
    node = RSLParser.parse(rsl);

    testQuotesSub(node);
  }
Exemplo n.º 3
0
  public void testInvalid() {
    Enumeration e = invalidRsls.keys();
    String key;
    String rsl;
    while (e.hasMoreElements()) {
      key = (String) e.nextElement();
      rsl = invalidRsls.getProperty(key);

      System.out.println("Parsing invalid rsl " + key + ": " + rsl);
      try {
        RslNode tree = RSLParser.parse(rsl);
        fail("Failed to catch parse error of " + rsl);
      } catch (Exception ex) {
      }
    }
  }
Exemplo n.º 4
0
  public void testValid() {
    Enumeration e = validRsls.keys();
    String key;
    String rsl;
    while (e.hasMoreElements()) {
      key = (String) e.nextElement();
      rsl = validRsls.getProperty(key);

      System.out.println("Parsing valid rsl " + key + ": " + rsl);
      try {
        RSLParser.parse(rsl);
      } catch (Exception ex) {
        ex.printStackTrace();
        fail("Failed to parse!!!");
      }
    }
  }
Exemplo n.º 5
0
  public void testAdvanced() throws Exception {
    String rsl =
        "&(arguments = -e '$GLOBUS_SH_PERL -e ''print STDERR \"stderr\n\"; '"
            + "#                      'print STDOUT \"stdout\n\";''')";

    RslNode node = RSLParser.parse(rsl);

    NameOpValue nv = null;
    List values;

    nv = node.getParam("ARGUMENTS");
    values = nv.getValues();

    assertEquals("arg size", 2, values.size());

    assertEquals("arg 1", "-e", ((Value) values.get(0)).getValue());

    String e = "$GLOBUS_SH_PERL -e 'print STDERR \"stderr\n\"; print STDOUT \"stdout\n\";'";

    assertEquals("arg 2", e, ((Value) values.get(1)).getCompleteValue());
  }