AddResourceCommand extends AbstractCommand { public static boolean isSecurityCommand(String cmd) { if (cmd == null || cmd.length() == 0) { return false; } boolean r = false; Matcher m = TO_PACKAGE_REGEX.matcher(cmd); if (m != null && m.matches()) { r = true; } return r; } AddResourceCommand(String commandText, ExecutionContext context);  AddResourceCommand(String commandText,
                            ExecutionContext context, String refName, String alias,
                            String comment, String type, String partitionSpec, boolean isUpdate, String projectName); static void printUsage(PrintStream out); String getRefName(); String getAlias(); String getComment(); String getType(); String getPartitionSpec(); boolean isUpdate(); void run(); static boolean isSecurityCommand(String cmd); static AddResourceCommand parse(String commandString, ExecutionContext sessionContext); static final String[] HELP_TAGS; }
@Test public void testIsSecurityCommand() { assertTrue(AddResourceCommand.isSecurityCommand("add table t1 to package testpack")); assertTrue(AddResourceCommand .isSecurityCommand("add table t1 to package testpack WITH PRIVILEGES privileges")); assertTrue(AddResourceCommand.isSecurityCommand("\t\nadD tablE t1 tO pAckage testpack;\t\n")); assertFalse(AddResourceCommand .isSecurityCommand("\t\nadD \rtablE t1 tO pAckage testpack;\t\n")); }