public MiniAccumuloClusterImpl create(
      String testClassName,
      String testMethodName,
      AuthenticationToken token,
      MiniClusterConfigurationCallback configCallback,
      TestingKdc kdc)
      throws Exception {
    requireNonNull(token);
    checkArgument(
        token instanceof PasswordToken || token instanceof KerberosToken,
        "A PasswordToken or KerberosToken is required");

    String rootPasswd;
    if (token instanceof PasswordToken) {
      rootPasswd = new String(((PasswordToken) token).getPassword(), UTF_8);
    } else {
      rootPasswd = UUID.randomUUID().toString();
    }

    File baseDir = AccumuloClusterHarness.createTestDir(testClassName + "_" + testMethodName);
    MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(baseDir, rootPasswd);

    // Enable native maps by default
    cfg.setNativeLibPaths(NativeMapIT.nativeMapLocation().getAbsolutePath());
    cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, Boolean.TRUE.toString());

    Configuration coreSite = new Configuration(false);

    // Setup SSL and credential providers if the properties request such
    configureForEnvironment(
        cfg, getClass(), AccumuloClusterHarness.getSslDir(baseDir), coreSite, kdc);

    // Invoke the callback for tests to configure MAC before it starts
    configCallback.configureMiniCluster(cfg, coreSite);

    MiniAccumuloClusterImpl miniCluster = new MiniAccumuloClusterImpl(cfg);

    // Write out any configuration items to a file so HDFS will pick them up automatically (from the
    // classpath)
    if (coreSite.size() > 0) {
      File csFile = new File(miniCluster.getConfig().getConfDir(), "core-site.xml");
      if (csFile.exists()) throw new RuntimeException(csFile + " already exist");

      OutputStream out =
          new BufferedOutputStream(
              new FileOutputStream(
                  new File(miniCluster.getConfig().getConfDir(), "core-site.xml")));
      coreSite.writeXml(out);
      out.close();
    }

    return miniCluster;
  }
 public MiniAccumuloClusterImpl create(
     AccumuloClusterHarness testBase,
     AuthenticationToken token,
     MiniClusterConfigurationCallback callback)
     throws Exception {
   return create(
       testBase.getClass().getName(), testBase.testName.getMethodName(), token, callback);
 }
 public MiniAccumuloClusterImpl create(
     AccumuloClusterHarness testBase, AuthenticationToken token, TestingKdc kdc) throws Exception {
   return create(
       testBase.getClass().getName(), testBase.testName.getMethodName(), token, testBase, kdc);
 }