LuaContainerLaunchParameters implements ContainerLaunchParameters { @Override public List<String> getCommands() { List<String> cmds = Lists.newArrayList(); if (!lv.isNil(LuaFields.COMMANDS)) { Iterator<LuaPair> pairsIter = lv.getTable(LuaFields.COMMANDS).arrayIterator(); while (pairsIter.hasNext()) { LuaValue c = pairsIter.next().value; if (c.isstring()) { cmds.add(c.tojstring()); } else if (c.istable()) { cmds.add(toCommand(new LuaWrapper(c.checktable()))); } } } else if (!lv.isNil(LuaFields.COMMAND)) { if (lv.isTable(LuaFields.COMMAND)) { cmds.add(toCommand(lv.getTable(LuaFields.COMMAND))); } else { cmds.add(lv.getString(LuaFields.COMMAND)); } } if (cmds.isEmpty()) { LOG.fatal("No commands found in container!"); } return cmds; } LuaContainerLaunchParameters(LuaValue lv, Configuration conf, Map<String, URI> localFileUris);  LuaContainerLaunchParameters(LuaWrapper lv, Configuration conf, Map<String, URI> localFileUris);  LuaContainerLaunchParameters(LuaWrapper lv, Configuration conf,
      Map<String, URI> localFileUris, Extras extras); int getCores(); int getMemory(); @Override Resource getContainerResource(Resource clusterMax); @Override int getPriority(); @Override int getNumInstances(); @Override Map<String, LocalResource> getLocalResources(); @Override Map<String, String> getEnvironment(); @Override List<String> getCommands(); String toCommand(LuaWrapper table);  }
@Test public void testRawCommands() { LuaWrapper cmds = env.createTable(LuaFields.COMMANDS); cmds.addString("/bin/sh foo.sh"); cmds.addString("echo 'hello world'"); assertEquals(ImmutableList.of("/bin/sh foo.sh", "echo 'hello world'"), lclp.getCommands()); }