InteractiveQueryCommand extends MultiClusterCommandBase { public static InteractiveQueryCommand parse(String commandString, ExecutionContext sessionContext) { boolean matched = false; if (commandString.matches(startRegex) || commandString.matches(useRegex)) { matched = true; sessionContext.setInteractiveQuery(true); } else if (commandString.matches(stopRegex) || commandString.matches(stopWithIdRegex)) { matched = true; sessionContext.setInteractiveQuery(false); } else if (commandString.matches(listRegex) || commandString.matches(setInformationRegex) || commandString.matches(getInformationRegex)) { matched = true; } if (commandString.matches(attachRegex)) { matched = true; sessionContext.setInteractiveQuery(true); } else if (commandString.matches(detachRegex)) { matched = true; sessionContext.setInteractiveQuery(false); } if (matched || sessionContext.isInteractiveQuery()) { commandString = commandString.trim(); return new InteractiveQueryCommand(commandString, sessionContext); } return null; } InteractiveQueryCommand(String commandText, ExecutionContext context); @Override void run(); static InteractiveQueryCommand parse(String commandString, ExecutionContext sessionContext);  }
@Test public void testParse() throws ODPSConsoleException, OdpsException { for (String cmd : sessionCMD) { System.out.println(cmd); ExecutionContext context = ExecutionContext.init(); InteractiveQueryCommand command = InteractiveQueryCommand.parse(cmd, context); assertNotNull(command); } }