/** * Construct an {@link Instance} entry point to Accumulo using a {@link MiniAccumuloCluster} * directory */ public MiniAccumuloInstance(String instanceName, File directory) throws FileNotFoundException { super(ClientConfiguration.fromFile(new File(new File(directory, "conf"), "client.conf")) .withInstance(instanceName).withZkHosts(getZooKeepersFromDir(directory))); }
/** * Automatically update the options to use a KerberosToken when SASL is enabled for RPCs. Don't * overwrite the options if the user has provided something specifically. */ public void updateKerberosCredentials() { ClientConfiguration clientConfig; try { if (clientConfigFile == null) clientConfig = ClientConfiguration.loadDefault(); else clientConfig = ClientConfiguration.fromFile(new File(clientConfigFile)); } catch (Exception e) { throw new IllegalArgumentException(e); } updateKerberosCredentials(clientConfig); }
if (props.containsKey("clientConfigurationFile")) { String clientConfFile = props.getProperty("clientConfigurationFile"); clientConf = ClientConfiguration.fromFile(new File(clientConfFile)); } else { clientConf = ClientConfiguration.loadDefault();
protected ClientConfiguration getClientConfig() throws Exception { return ClientConfiguration.fromFile(getCluster().getConfig().getClientConfFile()); }
this.clientConf = ClientConfiguration.fromFile(clientConfFile);
clientConfig = ClientConfiguration.loadDefault(); else clientConfig = ClientConfiguration.fromFile(new File(clientConfigFile)); } catch (Exception e) { throw new IllegalArgumentException(e);
public ClientConfiguration getClientConfiguration() throws ConfigurationException, FileNotFoundException { ClientConfiguration clientConfig = clientConfigFile == null ? ClientConfiguration.loadDefault() : ClientConfiguration.fromFile(new File(getClientConfigFile())); if (useSsl()) { clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SSL_ENABLED, "true");
TestShell(String user, String rootPass, String instanceName, String zookeepers, File configFile) throws IOException { ClientConfiguration clientConf; clientConf = ClientConfiguration.fromFile(configFile); // start the shell output = new TestOutputStream(); input = new StringInputStream(); shell = new Shell(new ConsoleReader(input, output)); shell.setLogErrorsToConsole(); if (clientConf.hasSasl()) { // Pull the kerberos principal out when we're using SASL shell.config("-u", user, "-z", instanceName, zookeepers, "--config-file", configFile.getAbsolutePath()); } else { shell.config("-u", user, "-p", rootPass, "-z", instanceName, zookeepers, "--config-file", configFile.getAbsolutePath()); } exec("quit", true); shell.start(); shell.setExit(false); }