@Test public void testConfPath() throws IOException { File target = new File(System.getProperty("user.dir"), "target"); assertTrue("'target' build directory does not exist", target.exists()); File testDir = new File(target, getClass().getName()); if (!testDir.exists()) { assertTrue("Failed to create test dir " + testDir, testDir.mkdirs()); } File clientConf = new File(testDir, "client.conf"); if (!clientConf.exists()) { assertTrue("Failed to create file " + clientConf, clientConf.createNewFile()); } assertEquals(clientConf.toString(), ClientConfiguration.getClientConfPath(testDir.toString())); assertEquals(clientConf.toString(), ClientConfiguration.getClientConfPath(clientConf.toString())); final File missing = new File("foobarbaz12332112"); assertEquals(missing.toString(), ClientConfiguration.getClientConfPath(missing.toString())); assertNull(ClientConfiguration.getClientConfPath(null)); }
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "process runs in same security context as user who provided path") static String getClientConfPath(String clientConfPath) { if (clientConfPath == null) { return null; } File filePath = new File(clientConfPath); if (filePath.exists() && filePath.isDirectory()) { return new File(filePath, "client.conf").toString(); } return clientConfPath; }
ClientConfiguration { @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "process runs in same security context as user who provided path") static String getClientConfPath(String clientConfPath) { if (clientConfPath == null) { return null; } File filePath = new File(clientConfPath); if (filePath.exists() && filePath.isDirectory()) { return new File(filePath, "client.conf").toString(); } return clientConfPath; } }
ClientConfiguration { @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "process runs in same security context as user who provided path") static String getClientConfPath(String clientConfPath) { if (clientConfPath == null) { return null; } File filePath = new File(clientConfPath); if (filePath.exists() && filePath.isDirectory()) { return new File(filePath, "client.conf").toString(); } return clientConfPath; } private  ClientConfiguration(List<? extends Configuration> configs); }
ClientConfiguration { @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "process runs in same security context as user who provided path") static String getClientConfPath(String clientConfPath) { if (clientConfPath == null) { return null; } File filePath = new File(clientConfPath); if (filePath.exists() && filePath.isDirectory()) { return new File(filePath, "client.conf").toString(); } return clientConfPath; } private  ClientConfiguration(List<? extends Configuration> configs); static ClientConfiguration loadDefault(); static ClientConfiguration create(); static ClientConfiguration fromFile(File file); static ClientConfiguration fromMap(Map<String,String> properties); static ClientConfiguration deserialize(String serializedConfig); String serialize(); String get(ClientProperty prop); Map<String,String> getAllPropertiesWithPrefix(ClientProperty property); void setProperty(ClientProperty prop, String value); ClientConfiguration with(ClientProperty prop, String value); void setProperty(String prop, String value); ClientConfiguration with(String prop, String value); ClientConfiguration withInstance(String instanceName); ClientConfiguration withInstance(UUID instanceId); ClientConfiguration withZkHosts(String zooKeepers); ClientConfiguration withZkTimeout(int timeout); ClientConfiguration withSsl(boolean sslEnabled); ClientConfiguration withSsl(boolean sslEnabled, boolean useJsseConfig); ClientConfiguration withTruststore(String path); ClientConfiguration withTruststore(String path, String password, String type); ClientConfiguration withKeystore(String path); ClientConfiguration withKeystore(String path, String password, String type); ClientConfiguration withSasl(boolean saslEnabled); boolean hasSasl(); ClientConfiguration withSasl(boolean saslEnabled, String kerberosServerPrimary); boolean containsKey(String key); Iterator<String> getKeys(); String getString(String key); }
ClientConfiguration { @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "process runs in same security context as user who provided path") static String getClientConfPath(String clientConfPath) { if (clientConfPath == null) { return null; } File filePath = new File(clientConfPath); if (filePath.exists() && filePath.isDirectory()) { return new File(filePath, "client.conf").toString(); } return clientConfPath; } private  ClientConfiguration(List<? extends Configuration> configs); static ClientConfiguration loadDefault(); static ClientConfiguration create(); static ClientConfiguration fromFile(File file); static ClientConfiguration fromMap(Map<String,String> properties); static ClientConfiguration deserialize(String serializedConfig); String serialize(); String get(ClientProperty prop); Map<String,String> getAllPropertiesWithPrefix(ClientProperty property); void setProperty(ClientProperty prop, String value); ClientConfiguration with(ClientProperty prop, String value); void setProperty(String prop, String value); ClientConfiguration with(String prop, String value); ClientConfiguration withInstance(String instanceName); ClientConfiguration withInstance(UUID instanceId); ClientConfiguration withZkHosts(String zooKeepers); ClientConfiguration withZkTimeout(int timeout); ClientConfiguration withSsl(boolean sslEnabled); ClientConfiguration withSsl(boolean sslEnabled, boolean useJsseConfig); ClientConfiguration withTruststore(String path); ClientConfiguration withTruststore(String path, String password, String type); ClientConfiguration withKeystore(String path); ClientConfiguration withKeystore(String path, String password, String type); ClientConfiguration withSasl(boolean saslEnabled); boolean hasSasl(); ClientConfiguration withSasl(boolean saslEnabled, String kerberosServerPrimary); boolean containsKey(String key); Iterator<String> getKeys(); String getString(String key); static final String USER_ACCUMULO_DIR_NAME; static final String USER_CONF_FILENAME; static final String GLOBAL_CONF_FILENAME; }