@Test public void testGetHighWaterMark() throws Exception { Properties properties = new Properties(); properties.setProperty(IntegrationTestHelper.Config.ZNODE_PATH, "/client/cli/test"); properties.setProperty(IntegrationTestHelper.Config.NUM_PARTITIONS, String.valueOf(CLUSTER_NUM_PARTITIONS)); properties.setProperty(IntegrationTestHelper.Config.ZK_SESSION_TIMEOUT, "30000"); IntegrationTestHelper helper = new IntegrationTestHelper(properties); Properties cfgProperties = createProperties(helper.getZkConnectString(), helper.getZnodePath(), helper.getZkSessionTimeout(), helper.getSslSetup()); String configFilePath = IntegrationTestHelper.createYamlConfigFile(DIR_NAME, CONFIG_FILE_NAME, cfgProperties); helper.startZooKeeperServer(); helper.startWaltzStorage(true); String storage = helper.getHost() + ":" + helper.getStorageAdminPort(); addPartitionsToStorage(CLUSTER_NUM_PARTITIONS, storage, configFilePath); helper.startWaltzServer(true); try { String[] args1 = { "validate", "--txn-per-client", "50", "--num-clients", "2", "--interval", "20", "--num-active-partitions", "1", "--cli-config-path", configFilePath }; ClientCli.testMain(args1); String[] args2 = { "high-water-mark", "--partition", "0", "--cli-config-path", configFilePath }; ClientCli.testMain(args2); assertFalse(errContent.toString("UTF-8").contains("Error")); assertTrue(outContent.toString("UTF-8").contains("Partition 0 current high watermark: 99")); } finally { helper.closeAll(); } }
private static long getHighWaterMark(int partitionId, WaltzClientConfig config) throws Exception { WaltzClient client = null; try { DummyTxnCallbacks callbacks = new DummyTxnCallbacks(); client = new WaltzClient(callbacks, config); return client.getHighWaterMark(partitionId); } finally { if (client != null) { client.close(); } } }
ClientCli extends SubcommandCli { private static long getHighWaterMark(int partitionId, WaltzClientConfig config) throws Exception { WaltzClient client = null; try { DummyTxnCallbacks callbacks = new DummyTxnCallbacks(); client = new WaltzClient(callbacks, config); return client.getHighWaterMark(partitionId); } finally { if (client != null) { client.close(); } } } }
ClientCli extends SubcommandCli { private static long getHighWaterMark(int partitionId, WaltzClientConfig config) throws Exception { WaltzClient client = null; try { DummyTxnCallbacks callbacks = new DummyTxnCallbacks(); client = new WaltzClient(callbacks, config); return client.getHighWaterMark(partitionId); } finally { if (client != null) { client.close(); } } } private  ClientCli(String[] args,  boolean useByTest); }
ClientCli extends SubcommandCli { private static long getHighWaterMark(int partitionId, WaltzClientConfig config) throws Exception { WaltzClient client = null; try { DummyTxnCallbacks callbacks = new DummyTxnCallbacks(); client = new WaltzClient(callbacks, config); return client.getHighWaterMark(partitionId); } finally { if (client != null) { client.close(); } } } private  ClientCli(String[] args,  boolean useByTest); static void testMain(String[] args); static void main(String[] args); }
ClientCli extends SubcommandCli { private static long getHighWaterMark(int partitionId, WaltzClientConfig config) throws Exception { WaltzClient client = null; try { DummyTxnCallbacks callbacks = new DummyTxnCallbacks(); client = new WaltzClient(callbacks, config); return client.getHighWaterMark(partitionId); } finally { if (client != null) { client.close(); } } } private  ClientCli(String[] args,  boolean useByTest); static void testMain(String[] args); static void main(String[] args);  }