Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@InterfaceAudience.Private
class TestingHBaseClusterImpl implements TestingHBaseCluster {

private final HBaseTestingUtil util = new HBaseTestingUtil();
private final HBaseTestingUtil util;

private final StartTestingClusterOption option;

Expand All @@ -47,6 +47,7 @@ class TestingHBaseClusterImpl implements TestingHBaseCluster {
private boolean miniHBaseClusterRunning = false;

TestingHBaseClusterImpl(TestingHBaseClusterOption option) {
this.util = new HBaseTestingUtil(option.conf());
this.option = option.convert();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.StartTestingClusterOption;
import org.apache.yetus.audience.InterfaceAudience;

Expand All @@ -39,6 +40,11 @@
@InterfaceAudience.Public
public final class TestingHBaseClusterOption {

/**
* Configuration for this testing cluster. Can be {@code null}.
*/
private final Configuration conf;

/**
* Number of masters to start up. We'll start this many hbase masters.
*/
Expand Down Expand Up @@ -95,9 +101,10 @@ public final class TestingHBaseClusterOption {
/**
* Private constructor. Use {@link Builder#build()}.
*/
private TestingHBaseClusterOption(int numMasters, int numAlwaysStandByMasters,
private TestingHBaseClusterOption(Configuration conf, int numMasters, int numAlwaysStandByMasters,
int numRegionServers, List<Integer> rsPorts, int numDataNodes, String[] dataNodeHosts,
int numZkServers, boolean createRootDir, boolean createWALDir) {
this.conf = conf;
this.numMasters = numMasters;
this.numAlwaysStandByMasters = numAlwaysStandByMasters;
this.numRegionServers = numRegionServers;
Expand All @@ -109,6 +116,10 @@ private TestingHBaseClusterOption(int numMasters, int numAlwaysStandByMasters,
this.createWALDir = createWALDir;
}

public Configuration conf() {
return conf;
}

public int getNumMasters() {
return numMasters;
}
Expand Down Expand Up @@ -176,6 +187,7 @@ public static Builder builder() {
* tests fail.
*/
public static final class Builder {
private Configuration conf;
private int numMasters = 1;
private int numAlwaysStandByMasters = 0;
private int numRegionServers = 1;
Expand All @@ -193,8 +205,14 @@ public TestingHBaseClusterOption build() {
if (dataNodeHosts != null && dataNodeHosts.length != 0) {
numDataNodes = dataNodeHosts.length;
}
return new TestingHBaseClusterOption(numMasters, numAlwaysStandByMasters, numRegionServers,
rsPorts, numDataNodes, dataNodeHosts, numZkServers, createRootDir, createWALDir);
return new TestingHBaseClusterOption(conf, numMasters, numAlwaysStandByMasters,
numRegionServers, rsPorts, numDataNodes, dataNodeHosts, numZkServers, createRootDir,
createWALDir);
}

public Builder conf(Configuration conf) {
this.conf = conf;
return this;
}

public Builder numMasters(int numMasters) {
Expand Down