ACCUMULO-2724 Changed option for threads to --numThreads. - Changed the -t option for threads to --numThreads to elimiate conflict with table name option
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1221381c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1221381c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1221381c Branch: refs/heads/1.8 Commit: 1221381c4d89e124285ca54f7e934afc93a6921f Parents: 0292c08 Author: Ed Coleman <d...@etcoleman.com> Authored: Tue Oct 11 20:24:53 2016 -0400 Committer: Ed Coleman <d...@etcoleman.com> Committed: Tue Oct 11 20:32:31 2016 -0400 ---------------------------------------------------------------------- .../performance/scan/CollectTabletStats.java | 2 +- .../scan/CollectTabletStatsTest.java | 65 ++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/1221381c/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java index 97fbf59..9c1f777 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java @@ -87,7 +87,7 @@ public class CollectTabletStats { static class CollectOptions extends ClientOnRequiredTable { @Parameter(names = "--iterations", description = "number of iterations") int iterations = 3; - @Parameter(names = "-t", description = "number of threads") + @Parameter(names = "--numThreads", description = "number of threads") int numThreads = 1; @Parameter(names = "-f", description = "select far tablets, default is to use local tablets") boolean selectFarTablets = false; http://git-wip-us.apache.org/repos/asf/accumulo/blob/1221381c/test/src/test/java/org/apache/accumulo/test/performance/scan/CollectTabletStatsTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/performance/scan/CollectTabletStatsTest.java b/test/src/test/java/org/apache/accumulo/test/performance/scan/CollectTabletStatsTest.java new file mode 100644 index 0000000..9d2b3e6 --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/test/performance/scan/CollectTabletStatsTest.java @@ -0,0 +1,65 @@ +/* + * 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.accumulo.test.performance.scan; + +import org.apache.accumulo.core.cli.ScannerOpts; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Created by etcoleman on 10/11/16. + */ +public class CollectTabletStatsTest { + + @Test + public void paramsDefaulThreadTest() { + + String tablename = "aTable"; + + String[] args = {"-t", tablename, "--iterations", "2"}; + + final CollectTabletStats.CollectOptions opts = new CollectTabletStats.CollectOptions(); + final ScannerOpts scanOpts = new ScannerOpts(); + opts.parseArgs(CollectTabletStats.class.getName(), args, scanOpts); + + assertEquals("Check iterations is set, default is 3", 2, opts.iterations); + assertEquals("Check tablename is set", 0, tablename.compareTo(opts.getTableName())); + assertEquals("Check default numThreads", 1, opts.numThreads); + + } + + @Test + public void paramsSetThreadsTest() { + + String tablename = "aTable"; + + String[] args = {"-t", tablename, "--iterations", "2", "--numThreads", "99"}; + + final CollectTabletStats.CollectOptions opts = new CollectTabletStats.CollectOptions(); + final ScannerOpts scanOpts = new ScannerOpts(); + opts.parseArgs(CollectTabletStats.class.getName(), args, scanOpts); + + assertEquals("Check iterations is set, default is 3", 2, opts.iterations); + assertEquals("Check tablename is set", 0, tablename.compareTo(opts.getTableName())); + assertEquals("Check numThreads is set", 99, opts.numThreads); + + System.out.println(opts.columns); + } + +}