CopyOfflineModelCommand extends AbstractCommand { public static CopyOfflineModelCommand parse(String cmd, ExecutionContext ctx) throws ODPSConsoleException { if (cmd == null || ctx == null) { return null; } OfflineModelInfo modelInfo = CopyOfflineModelCommand.buildOfflineModelInfo(cmd, PATTERN, ctx); if (modelInfo == null) { return null; } return new CopyOfflineModelCommand(ctx.getProjectName(), modelInfo, cmd, ctx); } CopyOfflineModelCommand(String projectName,
                                 OfflineModelInfo modelInfo,
                                 String cmd,
                                 ExecutionContext ctx); static void printUsage(PrintStream stream); @Override void run(); static OfflineModelInfo buildOfflineModelInfo(
          String cmd, Pattern PATTERN, ExecutionContext ctx); static CopyOfflineModelCommand parse(String cmd, ExecutionContext ctx); static final String[] HELP_TAGS; }
@Test public void testCopyOfflineModelBasic() throws ODPSConsoleException, OdpsException { ExecutionContext context = ExecutionContext.init(); String cmd = "copy offlinemodel " + "-src_model model1 " + "-dest_model model2 " + "-src_project project1 " + "-dest_project project2"; CopyOfflineModelCommand command = CopyOfflineModelCommand.parse(cmd, context); assertNotNull(command); }
@Test public void testCopyOfflineModelOmitProjectName() throws ODPSConsoleException, OdpsException { ExecutionContext context = ExecutionContext.init(); String cmd = "copy offlinemodel " + "-src_model model1 " + "-dest_model model2 "; CopyOfflineModelCommand command = CopyOfflineModelCommand.parse(cmd, context); assertNotNull(command); }
@Test public void testCopyOfflineModelInvalidCommand() throws ODPSConsoleException, OdpsException { ExecutionContext context = ExecutionContext.init(); String cmd = "copy offlinemodel dummy " + "-src_model model1 " + "-dest_model model2 "; CopyOfflineModelCommand command = CopyOfflineModelCommand.parse(cmd, context); assertNotNull(command); }