Here are the examples of the java api org.apache.hadoop.hbase.HBaseConfiguration.create() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
155 Examples
19
View Complete Implementation : WALPerformanceEvaluation.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
System.exit(innerMain(HBaseConfiguration.create(), args));
}
19
View Complete Implementation : RegionProcedureStorePerformanceEvaluation.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws IOException {
RegionProcedureStorePerformanceEvaluation tool = new RegionProcedureStorePerformanceEvaluation();
tool.setConf(HBaseConfiguration.create());
tool.run(args);
}
19
View Complete Implementation : TestMobFileCache.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Create the mob store file.
*/
private Path createMobStoreFile(String family) throws IOException {
return createMobStoreFile(HBaseConfiguration.create(), family);
}
19
View Complete Implementation : TestZKLeaderManager.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private static ZKWatcher newZK(Configuration conf, String name, Abortable abort) throws Exception {
Configuration copy = HBaseConfiguration.create(conf);
return new ZKWatcher(copy, name, abort);
}
19
View Complete Implementation : IntegrationTestTableMapReduceUtil.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create();
IntegrationTestingUtility.setUseDistributedCluster(conf);
int status = ToolRunner.run(conf, new IntegrationTestTableMapReduceUtil(), args);
System.exit(status);
}
19
View Complete Implementation : IntegrationTestMonkeys.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
// Run chaos monkeys 15 seconds, then stop them.
// After 10 seconds, run chaos monkeys again.
Configuration conf = HBaseConfiguration.create();
IntegrationTestingUtility.setUseDistributedCluster(conf);
int exitCode = ToolRunner.run(conf, new IntegrationTestMonkeys(), args);
System.exit(exitCode);
}
19
View Complete Implementation : TestZKSecretWatcher.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private static ZKWatcher newZK(Configuration conf, String name, Abortable abort) throws Exception {
Configuration copy = HBaseConfiguration.create(conf);
ZKWatcher zk = new ZKWatcher(copy, name, abort);
return zk;
}
19
View Complete Implementation : AbstractHBaseToolTest.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Before
public void setup() {
tool = new TestTool();
tool.setConf(HBaseConfiguration.create());
}
19
View Complete Implementation : IntegrationTestTimeBoundedMultiGetRequestsWithRegionReplicas.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create();
IntegrationTestingUtility.setUseDistributedCluster(conf);
int ret = ToolRunner.run(conf, new IntegrationTestTimeBoundedMultiGetRequestsWithRegionReplicas(), args);
System.exit(ret);
}
19
View Complete Implementation : ConnectionFactory.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Call {@link #createAsyncConnection(Configuration)} using default HBaseConfiguration.
* @see #createAsyncConnection(Configuration)
* @return AsyncConnection object wrapped by CompletableFuture
*/
public static CompletableFuture<AsyncConnection> createAsyncConnection() {
return createAsyncConnection(HBaseConfiguration.create());
}
19
View Complete Implementation : TestDataBlockEncodingTool.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private static void testDataBlockingTool(Path path) throws IOException {
Configuration conf = HBaseConfiguration.create();
int maxKV = Integer.MAX_VALUE;
boolean doVerify = true;
boolean doBenchmark = true;
String testHFilePath = path.toString();
DataBlockEncodingTool.testCodecs(conf, maxKV, testHFilePath, Compression.Algorithm.GZ.getName(), doBenchmark, doVerify);
}
19
View Complete Implementation : TestMetricsUserAggregate.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Before
public void setUp() {
wrapper = new MetricsRegionServerWrapperStub();
Configuration conf = HBaseConfiguration.create();
rsm = new MetricsRegionServer(wrapper, conf, null);
userAgg = (MetricsUserAggregateImpl) rsm.getMetricsUserAggregate();
}
19
View Complete Implementation : IntegrationTestReplication.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create();
IntegrationTestingUtility.setUseDistributedCluster(conf);
int ret = ToolRunner.run(conf, new IntegrationTestReplication(), args);
System.exit(ret);
}
19
View Complete Implementation : Encryption.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Get names of supported encryption algorithms
*
* @return Array of strings, each represents a supported encryption algorithm
*/
public static String[] getSupportedCiphers() {
return getSupportedCiphers(HBaseConfiguration.create());
}
19
View Complete Implementation : TestStripeCompactionPolicy.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testWithParallelCompaction() throws Exception {
// TODO: currently only one compaction at a time per store is allowed. If this changes,
// the appropriate file exclusion testing would need to be done in respective tests.
replacedertNull(createPolicy(HBaseConfiguration.create()).selectCompaction(mock(StripeInformationProvider.clreplaced), al(createFile()), false));
}
19
View Complete Implementation : TestSaslServerAuthenticationProviders.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testInstanceIsCached() {
Configuration conf = HBaseConfiguration.create();
SaslServerAuthenticationProviders providers1 = SaslServerAuthenticationProviders.getInstance(conf);
SaslServerAuthenticationProviders providers2 = SaslServerAuthenticationProviders.getInstance(conf);
replacedertSame(providers1, providers2);
SaslServerAuthenticationProviders.reset();
SaslServerAuthenticationProviders providers3 = SaslServerAuthenticationProviders.getInstance(conf);
replacedertNotSame(providers1, providers3);
replacedertEquals(providers1.getNumRegisteredProviders(), providers3.getNumRegisteredProviders());
}
19
View Complete Implementation : ZKServerTool.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Run the tool.
* @param args Command line arguments.
*/
public static void main(String[] args) {
for (ServerName server : readZKNodes(HBaseConfiguration.create())) {
// bin/zookeeper.sh relies on the "ZK host" string for grepping which is case sensitive.
System.out.println("ZK host: " + server.getHostname());
}
}
19
View Complete Implementation : TestSaslClientAuthenticationProviders.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testInstanceIsCached() {
Configuration conf = HBaseConfiguration.create();
SaslClientAuthenticationProviders providers1 = SaslClientAuthenticationProviders.getInstance(conf);
SaslClientAuthenticationProviders providers2 = SaslClientAuthenticationProviders.getInstance(conf);
replacedertSame(providers1, providers2);
SaslClientAuthenticationProviders.reset();
SaslClientAuthenticationProviders providers3 = SaslClientAuthenticationProviders.getInstance(conf);
replacedertNotSame(providers1, providers3);
replacedertEquals(providers1.getNumRegisteredProviders(), providers3.getNumRegisteredProviders());
}
19
View Complete Implementation : TestCoprocessorHost.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testDoubleLoadingAndPriorityValue() {
final Configuration conf = HBaseConfiguration.create();
final String key = "KEY";
final String coprocessor = "org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver";
CoprocessorHost<RegionCoprocessor, CoprocessorEnvironment<RegionCoprocessor>> host;
host = new CoprocessorHostForTest<>(conf);
// Try and load a coprocessor three times
conf.setStrings(key, coprocessor, coprocessor, coprocessor, SimpleRegionObserverV2.clreplaced.getName());
host.loadSystemCoprocessors(conf, key);
// Two coprocessors(SimpleRegionObserver and SimpleRegionObserverV2) loaded
replacedert.replacedertEquals(2, host.coprocEnvironments.size());
// Check the priority value
CoprocessorEnvironment<?> simpleEnv = host.findCoprocessorEnvironment(SimpleRegionObserver.clreplaced.getName());
CoprocessorEnvironment<?> simpleEnv_v2 = host.findCoprocessorEnvironment(SimpleRegionObserverV2.clreplaced.getName());
replacedertNotNull(simpleEnv);
replacedertNotNull(simpleEnv_v2);
replacedertEquals(Coprocessor.PRIORITY_SYSTEM, simpleEnv.getPriority());
replacedertEquals(Coprocessor.PRIORITY_SYSTEM + 1, simpleEnv_v2.getPriority());
}
19
View Complete Implementation : TestSaslClientAuthenticationProviders.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test(expected = RuntimeException.clreplaced)
public void testDifferentConflictingImplementationsFail() {
Configuration conf = HBaseConfiguration.create();
conf.setStrings(SaslClientAuthenticationProviders.EXTRA_PROVIDERS_KEY, ConflictingProvider1.clreplaced.getName(), ConflictingProvider2.clreplaced.getName());
SaslClientAuthenticationProviders.getInstance(conf);
}
19
View Complete Implementation : ThriftServer.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Start up the Thrift2 server.
*/
public static void main(String[] args) throws Exception {
final Configuration conf = HBaseConfiguration.create();
// for now, only time we return is on an argument error.
final int status = ToolRunner.run(conf, new ThriftServer(conf), args);
System.exit(status);
}
19
View Complete Implementation : ProcedureWALPerformanceEvaluation.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws IOException {
ProcedureWALPerformanceEvaluation tool = new ProcedureWALPerformanceEvaluation();
tool.setConf(HBaseConfiguration.create());
tool.run(args);
}
19
View Complete Implementation : PreUpgradeValidator.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) {
int ret;
Configuration conf = HBaseConfiguration.create();
try {
ret = ToolRunner.run(conf, new PreUpgradeValidator(), args);
} catch (Exception e) {
LOG.error("Error running command-line tool", e);
ret = AbstractHBaseTool.EXIT_FAILURE;
}
System.exit(ret);
}
18
View Complete Implementation : ConnectionFactory.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Create a new Connection instance using default HBaseConfiguration. Connection encapsulates all
* housekeeping for a connection to the cluster. All tables and interfaces created from returned
* connection share zookeeper connection, meta cache, and connections to region servers and
* masters. <br>
* The caller is responsible for calling {@link Connection#close()} on the returned connection
* instance. Typical usage:
*
* <pre>
* Connection connection = ConnectionFactory.createConnection();
* Table table = connection.getTable(TableName.valueOf("mytable"));
* try {
* table.get(...);
* ...
* } finally {
* table.close();
* connection.close();
* }
* </pre>
*
* @return Connection object for <code>conf</code>
*/
public static Connection createConnection() throws IOException {
Configuration conf = HBaseConfiguration.create();
return createConnection(conf, null, AuthUtil.loginClient(conf));
}
18
View Complete Implementation : ProcedureWALPrettyPrinter.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
final Configuration conf = HBaseConfiguration.create();
int exitCode = ToolRunner.run(conf, new ProcedureWALPrettyPrinter(), args);
System.exit(exitCode);
}
18
View Complete Implementation : TestHFile.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private BlockCache initCombinedBlockCache() {
Configuration that = HBaseConfiguration.create(conf);
// 32MB for bucket cache.
that.setFloat(BUCKET_CACHE_SIZE_KEY, 32);
that.set(BUCKET_CACHE_IOENGINE_KEY, "offheap");
BlockCache bc = BlockCacheFactory.createBlockCache(that);
replacedert.replacedertNotNull(bc);
replacedert.replacedertTrue(bc instanceof CombinedBlockCache);
return bc;
}
18
View Complete Implementation : DumpReplicationQueues.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Main
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create();
int ret = ToolRunner.run(conf, new DumpReplicationQueues(), args);
System.exit(ret);
}
18
View Complete Implementation : TestServerLoadDurability.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private static Configuration createConfigurationForNettyRpcServer() {
Configuration conf = HBaseConfiguration.create();
conf.set(RpcServerFactory.CUSTOM_RPC_SERVER_IMPL_CONF_KEY, NettyRpcServer.clreplaced.getName());
return conf;
}
18
View Complete Implementation : TestStripeCompactionPolicy.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testNothingToCompactFromL0() throws Exception {
Configuration conf = HBaseConfiguration.create();
conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 4);
StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 10);
StripeCompactionPolicy policy = createPolicy(conf);
verifyNoCompaction(policy, si);
si = createStripes(3, KEY_A);
verifyNoCompaction(policy, si);
}
18
View Complete Implementation : IntegrationTestLoadAndVerify.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] argv) throws Exception {
Configuration conf = HBaseConfiguration.create();
IntegrationTestingUtility.setUseDistributedCluster(conf);
int ret = ToolRunner.run(conf, new IntegrationTestLoadAndVerify(), argv);
System.exit(ret);
}
18
View Complete Implementation : ZKAclReset.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
System.exit(ToolRunner.run(HBaseConfiguration.create(), new ZKAclReset(), args));
}
18
View Complete Implementation : ZKMainServer.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Run the tool.
* @param args Command line arguments. First arg is path to zookeepers file.
*/
public static void main(String[] args) throws Exception {
String[] newArgs = args;
if (!hreplacederver(args)) {
// Add the zk ensemble from configuration if none preplaceded on command-line.
Configuration conf = HBaseConfiguration.create();
String hostport = new ZKMainServer().parse(conf);
if (hostport != null && hostport.length() > 0) {
newArgs = new String[args.length + 2];
System.arraycopy(args, 0, newArgs, 2, args.length);
newArgs[0] = "-server";
newArgs[1] = hostport;
}
}
// If command-line arguments, run our hack so they are executed.
// ZOOKEEPER-1897 was committed to zookeeper-3.4.6 but elsewhere in this clreplaced we say
// 3.4.6 breaks command-processing; TODO.
if (hasCommandLineArguments(args)) {
HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs);
zkm.runCmdLine();
} else {
ZooKeeperMain.main(newArgs);
}
}
18
View Complete Implementation : TestEncryptionTest.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testTestCipherProvider() {
Configuration conf = HBaseConfiguration.create();
try {
conf.set(HConstants.CRYPTO_CIPHERPROVIDER_CONF_KEY, DefaultCipherProvider.clreplaced.getName());
EncryptionTest.testCipherProvider(conf);
} catch (Exception e) {
fail("Instantiation of test cipher provider should have preplaceded");
}
try {
conf.set(HConstants.CRYPTO_CIPHERPROVIDER_CONF_KEY, FailingCipherProvider.clreplaced.getName());
EncryptionTest.testCipherProvider(conf);
fail("Instantiation of bad test cipher provider should have failed check");
} catch (Exception e) {
}
}
18
View Complete Implementation : TestMetricsUserAggregate.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testPerUserOperations() {
Configuration conf = HBaseConfiguration.create();
User userFoo = User.createUserForTesting(conf, "FOO", new String[0]);
User userBar = User.createUserForTesting(conf, "BAR", new String[0]);
userFoo.getUGI().doAs(new PrivilegedAction<Void>() {
@Override
public Void run() {
doOperations();
return null;
}
});
userBar.getUGI().doAs(new PrivilegedAction<Void>() {
@Override
public Void run() {
doOperations();
return null;
}
});
HELPER.replacedertCounter("userfoometricgetnumops", 10, userAgg.getSource());
HELPER.replacedertCounter("userfoometricscantimenumops", 11, userAgg.getSource());
HELPER.replacedertCounter("userfoometricputnumops", 12, userAgg.getSource());
HELPER.replacedertCounter("userfoometricdeletenumops", 13, userAgg.getSource());
HELPER.replacedertCounter("userfoometricincrementnumops", 14, userAgg.getSource());
HELPER.replacedertCounter("userfoometricappendnumops", 15, userAgg.getSource());
HELPER.replacedertCounter("userfoometricreplaynumops", 16, userAgg.getSource());
HELPER.replacedertCounter("userbarmetricgetnumops", 10, userAgg.getSource());
HELPER.replacedertCounter("userbarmetricscantimenumops", 11, userAgg.getSource());
HELPER.replacedertCounter("userbarmetricputnumops", 12, userAgg.getSource());
HELPER.replacedertCounter("userbarmetricdeletenumops", 13, userAgg.getSource());
HELPER.replacedertCounter("userbarmetricincrementnumops", 14, userAgg.getSource());
HELPER.replacedertCounter("userbarmetricappendnumops", 15, userAgg.getSource());
HELPER.replacedertCounter("userbarmetricreplaynumops", 16, userAgg.getSource());
}
18
View Complete Implementation : TestUser.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testBasicAttributes() throws Exception {
Configuration conf = HBaseConfiguration.create();
User user = User.createUserForTesting(conf, "simple", new String[] { "foo" });
replacedertEquals("Username should match", "simple", user.getName());
replacedertEquals("Short username should match", "simple", user.getShortName());
// don't test shortening of kerberos names because regular Hadoop doesn't support them
}
18
View Complete Implementation : MajorCompactorTTL.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
ToolRunner.run(HBaseConfiguration.create(), new MajorCompactorTTL(), args);
}
18
View Complete Implementation : TestStripeCompactionPolicy.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testInitialCountFromL0() throws Exception {
Configuration conf = HBaseConfiguration.create();
conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 2);
StripeCompactionPolicy policy = createPolicy(conf, defaultSplitSize, defaultSplitCount, 2, false);
StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 8);
verifyCompaction(policy, si, si.getStorefiles(), true, 2, 12L, OPEN_KEY, OPEN_KEY, true);
// If result would be too large, split into smaller parts.
si = createStripesL0Only(3, 10);
verifyCompaction(policy, si, si.getStorefiles(), true, 3, 10L, OPEN_KEY, OPEN_KEY, true);
policy = createPolicy(conf, defaultSplitSize, defaultSplitCount, 6, false);
verifyCompaction(policy, si, si.getStorefiles(), true, 6, 5L, OPEN_KEY, OPEN_KEY, true);
}
18
View Complete Implementation : TestServerNonceManager.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private ServerNonceManager createManager(Integer gracePeriod) {
Configuration conf = HBaseConfiguration.create();
if (gracePeriod != null) {
conf.setInt(ServerNonceManager.HASH_NONCE_GRACE_PERIOD_KEY, gracePeriod.intValue());
}
return new ServerNonceManager(conf);
}
18
View Complete Implementation : RSGroupMajorCompactionTTL.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
ToolRunner.run(HBaseConfiguration.create(), new RSGroupMajorCompactionTTL(), args);
}
18
View Complete Implementation : TestRpcClientDeprecatedNameMapping.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void test() {
Configuration conf = HBaseConfiguration.create();
conf.set(RpcClientFactory.CUSTOM_RPC_CLIENT_IMPL_CONF_KEY, BlockingRpcClient.clreplaced.getName());
try (RpcClient client = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT)) {
replacedertThat(client, instanceOf(BlockingRpcClient.clreplaced));
}
conf.set(RpcClientFactory.CUSTOM_RPC_CLIENT_IMPL_CONF_KEY, "org.apache.hadoop.hbase.ipc.RpcClientImpl");
try (RpcClient client = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT)) {
replacedertThat(client, instanceOf(BlockingRpcClient.clreplaced));
}
conf.set(RpcClientFactory.CUSTOM_RPC_CLIENT_IMPL_CONF_KEY, NettyRpcClient.clreplaced.getName());
try (RpcClient client = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT)) {
replacedertThat(client, instanceOf(NettyRpcClient.clreplaced));
}
conf.set(RpcClientFactory.CUSTOM_RPC_CLIENT_IMPL_CONF_KEY, "org.apache.hadoop.hbase.ipc.AsyncRpcClient");
try (RpcClient client = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT)) {
replacedertThat(client, instanceOf(NettyRpcClient.clreplaced));
}
}
18
View Complete Implementation : TestEncryptionTest.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testTestKeyProvider() {
Configuration conf = HBaseConfiguration.create();
try {
conf.set(HConstants.CRYPTO_KEYPROVIDER_CONF_KEY, KeyProviderForTesting.clreplaced.getName());
EncryptionTest.testKeyProvider(conf);
} catch (Exception e) {
fail("Instantiation of test key provider should have preplaceded");
}
try {
conf.set(HConstants.CRYPTO_KEYPROVIDER_CONF_KEY, FailingKeyProvider.clreplaced.getName());
EncryptionTest.testKeyProvider(conf);
fail("Instantiation of bad test key provider should have failed check");
} catch (Exception e) {
}
}
18
View Complete Implementation : MajorCompactor.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
ToolRunner.run(HBaseConfiguration.create(), new MajorCompactor(), args);
}
18
View Complete Implementation : TestStripeCompactionPolicy.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testOldStripesFromFlush() throws Exception {
StripeCompactionPolicy policy = createPolicy(HBaseConfiguration.create());
StripeInformationProvider si = createStripes(0, KEY_C, KEY_D);
KeyValue[] input = new KeyValue[] { KV_B, KV_C, KV_C, KV_D, KV_E };
KeyValue[][] expected = new KeyValue[][] { new KeyValue[] { KV_B }, new KeyValue[] { KV_C, KV_C }, new KeyValue[] { KV_D, KV_E } };
verifyFlush(policy, si, input, expected, new byte[][] { OPEN_KEY, KEY_C, KEY_D, OPEN_KEY });
}
18
View Complete Implementation : IndexBuilder.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public int run(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create(getConf());
if (args.length < 3) {
System.err.println("Only " + args.length + " arguments supplied, required: 3");
System.err.println("Usage: IndexBuilder <TABLE_NAME> <COLUMN_FAMILY> <ATTR> [<ATTR> ...]");
System.exit(-1);
}
Job job = configureJob(conf, args);
return (job.waitForCompletion(true) ? 0 : 1);
}
18
View Complete Implementation : TestRegionSizeReportingChore.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
/**
* Creates an HBase Configuration object for the default values.
*/
private Configuration getDefaultHBaseConfiguration() {
final Configuration conf = HBaseConfiguration.create();
conf.addResource("hbase-default.xml");
return conf;
}
18
View Complete Implementation : MajorCompactorTTL.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Override
public int run(String[] args) throws Exception {
Options options = getOptions();
final CommandLineParser cmdLineParser = new DefaultParser();
CommandLine commandLine;
try {
commandLine = cmdLineParser.parse(options, args);
} catch (ParseException parseException) {
System.out.println("ERROR: Unable to parse command-line arguments " + Arrays.toString(args) + " due to: " + parseException);
printUsage(options);
return -1;
}
if (commandLine == null) {
System.out.println("ERROR: Failed parse, empty commandLine; " + Arrays.toString(args));
printUsage(options);
return -1;
}
String table = commandLine.getOptionValue("table");
int numServers = Integer.parseInt(commandLine.getOptionValue("numservers", "-1"));
int numRegions = Integer.parseInt(commandLine.getOptionValue("numregions", "-1"));
int concurrency = Integer.parseInt(commandLine.getOptionValue("servers", "1"));
long sleep = Long.parseLong(commandLine.getOptionValue("sleep", Long.toString(30000)));
boolean dryRun = commandLine.hasOption("dryRun");
boolean skipWait = commandLine.hasOption("skipWait");
return compactRegionsTTLOnTable(HBaseConfiguration.create(), table, concurrency, sleep, numServers, numRegions, dryRun, skipWait);
}
18
View Complete Implementation : TestStochasticLoadBalancerRegionReplica.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testReplicaCost() {
Configuration conf = HBaseConfiguration.create();
StochasticLoadBalancer.CostFunction costFunction = new StochasticLoadBalancer.RegionReplicaHostCostFunction(conf);
for (int[] mockCluster : clusterStateMocks) {
BaseLoadBalancer.Cluster cluster = mockCluster(mockCluster);
costFunction.init(cluster);
double cost = costFunction.cost();
replacedertTrue(cost >= 0);
replacedertTrue(cost <= 1.01);
}
}
18
View Complete Implementation : TestCipherProvider.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
@Test
public void testCustomProvider() {
Configuration conf = HBaseConfiguration.create();
conf.set(HConstants.CRYPTO_CIPHERPROVIDER_CONF_KEY, MyCipherProvider.clreplaced.getName());
CipherProvider provider = Encryption.getCipherProvider(conf);
replacedertTrue(provider instanceof MyCipherProvider);
replacedertTrue(Arrays.asList(provider.getSupportedCiphers()).contains("TEST"));
Cipher a = Encryption.getCipher(conf, "TEST");
replacedertNotNull(a);
replacedertTrue(a.getProvider() instanceof MyCipherProvider);
replacedertEquals("TEST", a.getName());
replacedertEquals(0, a.getKeyLength());
}
18
View Complete Implementation : HBaseKerberosUtils.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static Configuration getSecuredConfiguration() {
Configuration conf = HBaseConfiguration.create();
setSecuredConfiguration(conf);
return conf;
}
18
View Complete Implementation : MobRefReporter.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create();
int ret = ToolRunner.run(conf, new MobRefReporter(), args);
System.exit(ret);
}