Java Code Examples for org.apache.hadoop.hbase.IntegrationTestingUtility#setUseDistributedCluster()

The following examples show how to use org.apache.hadoop.hbase.IntegrationTestingUtility#setUseDistributedCluster() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: End2EndTestDriver.java    From phoenix with Apache License 2.0 6 votes vote down vote up
@Override
protected int doWork() throws Exception {
  //this is called from the command line, so we should set to use the distributed cluster
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  Class<?>[] classes = findEnd2EndTestClasses();
  System.out.println("Found " + classes.length + " end2end tests to run:");
  for (Class<?> aClass : classes) {
      System.out.println("  " + aClass);
  }
  if(skipTests) return 0;
  
  JUnitCore junit = new JUnitCore();
  junit.addListener(new End2EndTestListenter(System.out));
  Result result = junit.run(classes);

  return result.wasSuccessful() ? 0 : 1;
}
 
Example 2
Source File: ChaosMonkeyRunner.java    From hbase with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  String[] actualArgs = args;
  if (args.length > 0 && "-c".equals(args[0])) {
    int argCount = args.length - 2;
    if (argCount < 0) {
      throw new IllegalArgumentException("Missing path for -c parameter");
    }
    // load the resource specified by the second parameter
    conf.addResource(args[1]);
    actualArgs = new String[argCount];
    System.arraycopy(args, 2, actualArgs, 0, argCount);
  }
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  int ret = ToolRunner.run(conf, new ChaosMonkeyRunner(), actualArgs);
  System.exit(ret);
}
 
Example 3
Source File: IntegrationTestWithCellVisibilityLoadAndVerify.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
public int runTestFromCommandLine() throws Exception {
  IntegrationTestingUtility.setUseDistributedCluster(getConf());
  int numPresplits = getConf().getInt("loadmapper.numPresplits", 5);
  // create HTableDescriptor for specified table
  TableDescriptorBuilder.ModifyableTableDescriptor tableDescriptor =
    new TableDescriptorBuilder.ModifyableTableDescriptor(getTablename());
  tableDescriptor.setColumnFamily(
    new ColumnFamilyDescriptorBuilder.ModifyableColumnFamilyDescriptor(TEST_FAMILY));

  try (Connection conn = ConnectionFactory.createConnection(getConf());
      Admin admin = conn.getAdmin()) {
    admin.createTable(tableDescriptor, Bytes.toBytes(0L), Bytes.toBytes(-1L), numPresplits);
  }
  doLoad(getConf(), tableDescriptor);
  doVerify(getConf(), tableDescriptor);
  getTestingUtil(getConf()).deleteTable(getTablename());
  return 0;
}
 
Example 4
Source File: End2EndTestDriver.java    From phoenix with Apache License 2.0 6 votes vote down vote up
@Override
protected int doWork() throws Exception {
  //this is called from the command line, so we should set to use the distributed cluster
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  Class<?>[] classes = findEnd2EndTestClasses();
  System.out.println("Found " + classes.length + " end2end tests to run:");
  for (Class<?> aClass : classes) {
      System.out.println("  " + aClass);
  }
  if(skipTests) return 0;
  
  JUnitCore junit = new JUnitCore();
  junit.addListener(new End2EndTestListenter(System.out));
  Result result = junit.run(classes);

  return result.wasSuccessful() ? 0 : 1;
}
 
Example 5
Source File: IntegrationTestMonkeys.java    From hbase with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: IntegrationTestImportTsv.java    From hbase with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  util = new IntegrationTestingUtility(conf);
  int status = ToolRunner.run(conf, new IntegrationTestImportTsv(), args);
  System.exit(status);
}
 
Example 7
Source File: Monkeys.java    From hbase with Apache License 2.0 5 votes vote down vote up
public Monkeys(Configuration conf) {
  this.conf = Preconditions.checkNotNull(conf, "Should specify a configuration");
  this.monkeyRunner = new ChaosMonkeyRunner();
  this.runner = () -> {
    try {
      monkeyRunner.getAndStartMonkey();
    } catch (Exception e) {
      LOG.error("Exception occurred when running chaos monkeys: ", e);
    }
  };
  this.executor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder()
      .setDaemon(true).setNameFormat("ChaosMonkey").build());
  IntegrationTestingUtility.setUseDistributedCluster(this.conf);
}
 
Example 8
Source File: IntegrationTestZKAndFSPermissions.java    From hbase with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration configuration = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(configuration);
  IntegrationTestZKAndFSPermissions tool = new IntegrationTestZKAndFSPermissions();
  int ret = ToolRunner.run(configuration, tool, args);
  System.exit(ret);
}
 
Example 9
Source File: IntegrationTestTimeBoundedMultiGetRequestsWithRegionReplicas.java    From hbase with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 10
Source File: IntegrationTestWithCellVisibilityLoadAndVerify.java    From hbase with Apache License 2.0 4 votes vote down vote up
public static void main(String argv[]) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  int ret = ToolRunner.run(conf, new IntegrationTestWithCellVisibilityLoadAndVerify(), argv);
  System.exit(ret);
}
 
Example 11
Source File: IntegrationTestLoadAndVerify.java    From hbase with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 12
Source File: IntegrationTestLoadAndVerify.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public int runTestFromCommandLine() throws Exception {
  IntegrationTestingUtility.setUseDistributedCluster(getConf());
  boolean doLoad = false;
  boolean doVerify = false;
  boolean doSearch = false;
  boolean doDelete = getConf().getBoolean("loadmapper.deleteAfter",true);
  int numPresplits = getConf().getInt("loadmapper.numPresplits", 40);

  if (toRun.equalsIgnoreCase("load")) {
    doLoad = true;
  } else if (toRun.equalsIgnoreCase("verify")) {
    doVerify= true;
  } else if (toRun.equalsIgnoreCase("loadAndVerify")) {
    doLoad=true;
    doVerify= true;
  } else if (toRun.equalsIgnoreCase("search")) {
    doLoad=false;
    doVerify= false;
    doSearch = true;
    if (keysDir == null) {
      System.err.println("Usage: search <KEYS_DIR>]");
      return 1;
    }
  } else {
    System.err.println("Invalid argument " + toRun);
    printUsage();
    return 1;
  }

  // create HTableDescriptor for specified table
  TableName table = getTablename();
  TableDescriptorBuilder.ModifyableTableDescriptor tableDescriptor =
    new TableDescriptorBuilder.ModifyableTableDescriptor(table);
  tableDescriptor.setColumnFamily(
    new ColumnFamilyDescriptorBuilder.ModifyableColumnFamilyDescriptor(TEST_FAMILY));

  if (doLoad) {
    try (Connection conn = ConnectionFactory.createConnection(getConf());
        Admin admin = conn.getAdmin()) {
      admin.createTable(tableDescriptor, Bytes.toBytes(0L), Bytes.toBytes(-1L), numPresplits);
      doLoad(getConf(), tableDescriptor);
    }
  }
  if (doVerify) {
    doVerify(getConf(), tableDescriptor);
    if (doDelete) {
      getTestingUtil(getConf()).deleteTable(tableDescriptor.getTableName());
    }
  }
  if (doSearch) {
    return doSearch(getConf(), keysDir);
  }
  return 0;
}
 
Example 13
Source File: IntegrationTestTimeBoundedRequestsWithRegionReplicas.java    From hbase with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  int ret = ToolRunner.run(conf, new IntegrationTestTimeBoundedRequestsWithRegionReplicas(), args);
  System.exit(ret);
}
 
Example 14
Source File: IntegrationTestBigLinkedList.java    From hbase with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  int ret = ToolRunner.run(conf, new IntegrationTestBigLinkedList(), args);
  System.exit(ret);
}
 
Example 15
Source File: IntegrationTestBigLinkedListWithVisibility.java    From hbase with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  int ret = ToolRunner.run(conf, new IntegrationTestBigLinkedListWithVisibility(), args);
  System.exit(ret);
}
 
Example 16
Source File: IntegrationTestReplication.java    From hbase with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 17
Source File: IntegrationTestBulkLoad.java    From hbase with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  int status =  ToolRunner.run(conf, new IntegrationTestBulkLoad(), args);
  System.exit(status);
}
 
Example 18
Source File: IntegrationTestTableSnapshotInputFormat.java    From hbase with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration conf = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  int ret = ToolRunner.run(conf, new IntegrationTestTableSnapshotInputFormat(), args);
  System.exit(ret);
}
 
Example 19
Source File: IntegrationTestTableMapReduceUtil.java    From hbase with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 20
Source File: IntegrationTestSendTraceRequests.java    From hbase with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
  Configuration configuration = HBaseConfiguration.create();
  IntegrationTestingUtility.setUseDistributedCluster(configuration);
  IntegrationTestSendTraceRequests tool = new IntegrationTestSendTraceRequests();
  ToolRunner.run(configuration, tool, args);
}