sijie commented on a change in pull request #1094: BP-27: New BookKeeper CLI 
URL: https://github.com/apache/bookkeeper/pull/1094#discussion_r166609452
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/client/SimpleTestCommand.java
 ##########
 @@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.tools.cli.commands.client;
+
+import static org.apache.bookkeeper.common.concurrent.FutureUtils.result;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import java.util.concurrent.TimeUnit;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+import org.apache.bookkeeper.client.api.BookKeeper;
+import org.apache.bookkeeper.client.api.DigestType;
+import org.apache.bookkeeper.client.api.WriteHandle;
+import org.apache.bookkeeper.tools.cli.helpers.ClientCommand;
+
+/**
+ * A client command that simply tests if a cluster is healthy.
+ */
+@Accessors(fluent = true)
+@Setter
+@Parameters(commandDescription = "Simple test to create a ledger and write 
entries to it.")
+public class SimpleTestCommand extends ClientCommand {
+
+    @Parameter(names = { "-e", "--ensemble-size" }, description = "Ensemble 
size (default 3)")
+    private int ensembleSize = 3;
+    @Parameter(names = { "-w", "--write-quorum-size" }, description = "Write 
quorum size (default 2)")
+    private int writeQuorumSize = 2;
+    @Parameter(names = { "-a", "--ack-quorum-size" }, description = "Ack 
quorum size (default 2)")
+    private int ackQuorumSize = 2;
+    @Parameter(names = { "-n", "--num-entries" }, description = "Entries to 
write (default 100)")
+    private int numEntries = 100;
+
+    @Override
+    public String name() {
+        return "simpletest";
+    }
+
+    @Override
+    protected void run(BookKeeper bk) throws Exception {
+        byte[] data = new byte[100]; // test data
+
+        try (WriteHandle wh = result(bk.newCreateLedgerOp()
+            .withEnsembleSize(ensembleSize)
+            .withWriteQuorumSize(writeQuorumSize)
+            .withAckQuorumSize(ackQuorumSize)
+            .withDigestType(DigestType.CRC32C)
 
 Review comment:
   yeah. I changed it to CRC32C intentionally, because I think CRC32C is far 
faster than MAC. since it is a test command, I don't think this change would 
cause any BC concerns. unless I misunderstood this command.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to