DeployCoprocessorCLI { @VisibleForTesting static DeployCoprocessorCLIOps parseArgs(String[] args) { String localCoprocessorJar; int maxThreads = 8; String filterType; String[] entities; if (args == null || args.length <= 1) { printUsageAndExit(); return null; } else if (StringUtils.isNumeric(args[1])) { maxThreads = Integer.parseInt(args[1]); filterType = args[2]; entities = Arrays.copyOfRange(args, 3, args.length); } else { filterType = args[1]; entities = Arrays.copyOfRange(args, 2, args.length); } localCoprocessorJar = args[0]; if (StringUtils.isEmpty(localCoprocessorJar) || StringUtils.isEmpty(filterType)) { printUsageAndExit(); } return new DeployCoprocessorCLIOps(localCoprocessorJar, maxThreads, filterType, entities); }  static void main(String[] args); static void deployCoprocessor(HTableDescriptor tableDesc); static void addCoprocessorOnHTable(HTableDescriptor desc, Path hdfsCoprocessorJar); static boolean resetCoprocessor(String tableName, Admin hbaseAdmin, Path hdfsCoprocessorJar); static Path getNewestCoprocessorJar(KylinConfig config, FileSystem fileSystem); static synchronized Path uploadCoprocessorJar(String localCoprocessorJar, FileSystem fileSystem,
            Set<String> oldJarPaths); static final String CubeEndpointClass; static final String CubeObserverClassOld; static final String CubeObserverClassOld2; static final String IIEndpointClassOld; static final String IIEndpointClass; }
@Test public void testParseNormalArgs1() { DeployCoprocessorCLIOps ops = DeployCoprocessorCLI .parseArgs(new String[] { "$KYLIN_HOME/lib/kylin-coprocessor-*.jar", "6", "all" }); Assert.assertEquals("$KYLIN_HOME/lib/kylin-coprocessor-*.jar", ops.getLocalCoprocessorJar()); Assert.assertEquals(6, ops.getMaxThreads()); Assert.assertEquals("all", ops.getFilterType()); Assert.assertEquals(0, ops.getEntities().length); }
@Test public void testParseNormalArgs2() { DeployCoprocessorCLIOps ops = DeployCoprocessorCLI.parseArgs(new String[] { "default", "-table", "t1", "t2" }); Assert.assertEquals("default", ops.getLocalCoprocessorJar()); Assert.assertEquals(8, ops.getMaxThreads()); Assert.assertEquals("-table", ops.getFilterType()); Assert.assertEquals(2, ops.getEntities().length); }