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()); }
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); }
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()); }
private void testQuotesSub(RslNode node) { NameOpValue nv = null; List values; nv = node.getParam("arg1"); values = nv.getValues(); assertEquals("arg1", "foo\"bar", ((Value) values.get(0)).getCompleteValue()); nv = node.getParam("arg2"); values = nv.getValues(); assertEquals("arg2", "foo'bar", ((Value) values.get(0)).getCompleteValue()); nv = node.getParam("arg3"); values = nv.getValues(); assertEquals("arg3", "", ((Value) values.get(0)).getCompleteValue()); nv = node.getParam("arg4"); values = nv.getValues(); assertEquals("arg4", "", ((Value) values.get(0)).getCompleteValue()); nv = node.getParam("executable"); values = nv.getValues(); assertEquals("executable", "/bin/echo", ((Value) values.get(0)).getCompleteValue()); nv = node.getParam("arguments"); values = nv.getValues(); assertEquals("arguments", "mis", ((Value) values.get(0)).getCompleteValue()); }