@Test public void testVerifyCommandWithPartitionOption() throws Exception { int numPartitions = 3; int numStorageNodes = 3; Properties properties = new Properties(); properties.setProperty(IntegrationTestHelper.Config.ZNODE_PATH, "/cluster/cli/test"); properties.setProperty(IntegrationTestHelper.Config.NUM_PARTITIONS, String.valueOf(numPartitions)); properties.setProperty(IntegrationTestHelper.Config.ZK_SESSION_TIMEOUT, "30000"); properties.setProperty(IntegrationTestHelper.Config.NUM_STORAGES, String.valueOf(numStorageNodes)); IntegrationTestHelper helper = new IntegrationTestHelper(properties); Properties configProperties = createProperties(helper.getZkConnectString(), helper.getZnodePath(), helper.getZkSessionTimeout(), helper.getSslSetup()); String configFilePath = IntegrationTestHelper.createYamlConfigFile(DIR_NAME, CONFIG_FILE_NAME, configProperties); String host = InetAddress.getLocalHost().getCanonicalHostName(); int partitionId = 1; try { helper.startZooKeeperServer(); for (int i = 0; i < numStorageNodes; i++) { WaltzStorageRunner storageRunner = helper.getWaltzStorageRunner(i); storageRunner.startAsync(); storageRunner.awaitStart(); String[] args0 = { "add-partition", "--storage", host + ":" + helper.getStorageAdminPort(i), "--partition", String.valueOf(partitionId), "--cli-config-path", configFilePath }; StorageCli.testMain(args0); } helper.startWaltzServer(true); String[] args1 = { "verify", "--cli-config-path", configFilePath, "--partition", String.valueOf(partitionId) }; ClusterCli.testMain(args1); assertFalse(outContent.toString("UTF-8") .contains("Validation PARTITION_ASSIGNMENT_ZK_SERVER_CONSISTENCY failed for partition " + partitionId)); assertFalse(outContent.toString("UTF-8") .contains("Validation SERVER_STORAGE_CONNECTIVITY failed for partition " + partitionId)); assertFalse(outContent.toString("UTF-8") .contains("Validation REPLICA_RECOVERY_STATUS failed for partition " + partitionId)); WaltzServerRunner waltzServerRunner = helper.getWaltzServerRunner(helper.getServerPort(), helper.getServerJettyPort()); waltzServerRunner.closeNetworkServer(); WaltzStorageRunner waltzStorageRunner = helper.getWaltzStorageRunner(); waltzStorageRunner.stop(); waltzStorageRunner = helper.getWaltzStorageRunner(1); waltzStorageRunner.stop(); String[] args2 = { "verify", "--cli-config-path", configFilePath, "--partition", String.valueOf(partitionId) }; ClusterCli.testMain(args2); assertTrue(outContent.toString("UTF-8") .contains("Validation PARTITION_ASSIGNMENT_ZK_SERVER_CONSISTENCY failed for partition " + partitionId)); assertTrue(outContent.toString("UTF-8") .contains("Validation SERVER_STORAGE_CONNECTIVITY failed for partition " + partitionId)); } finally { helper.closeAll(); } }
public static void testMain(String[] args) { new ClusterCli(args, true).processCmd(); }
ClusterCli extends SubcommandCli { public static void testMain(String[] args) { new ClusterCli(args, true).processCmd(); } }
ClusterCli extends SubcommandCli { public static void testMain(String[] args) { new ClusterCli(args, true).processCmd(); } private  ClusterCli(String[] args, boolean useByTest); }
ClusterCli extends SubcommandCli { public static void testMain(String[] args) { new ClusterCli(args, true).processCmd(); } private  ClusterCli(String[] args, boolean useByTest); static void testMain(String[] args); static void main(String[] args); }
ClusterCli extends SubcommandCli { public static void testMain(String[] args) { new ClusterCli(args, true).processCmd(); } private  ClusterCli(String[] args, boolean useByTest); static void testMain(String[] args); static void main(String[] args);  }