*
* @throws Exception In case of exception.
*/
public void testCreation() throws Exception {
// Validate default configuration.
GridClientConfiguration cfg = new GridClientConfiguration();
cfg.setServers(Arrays.asList("localhost:11211"));
validateConfig(0, cfg);
// Validate default properties-based configuration.
cfg = new GridClientConfiguration();
cfg.setServers(Arrays.asList("localhost:11211"));
validateConfig(0, cfg);
// Validate loaded configuration.
Properties props = loadProperties(1, GRID_CLIENT_CONFIG);
validateConfig(0, new GridClientConfiguration(props));
// Validate loaded configuration with changed key prefixes.
Properties props2 = new Properties();
for (Map.Entry<Object, Object> e : props.entrySet())
props2.put("new." + e.getKey(), e.getValue());
validateConfig(0, new GridClientConfiguration("new.gg.client", props2));
validateConfig(0, new GridClientConfiguration("new.gg.client.", props2));
// Validate loaded test configuration.
File tmp = uncommentProperties(GRID_CLIENT_CONFIG);
props = loadProperties(25, tmp.toURI().toURL());
validateConfig(2, new GridClientConfiguration(props));
// Validate loaded test configuration with changed key prefixes.
props2 = new Properties();
for (Map.Entry<Object, Object> e : props.entrySet())
props2.put("new." + e.getKey(), e.getValue());
validateConfig(2, new GridClientConfiguration("new.gg.client", props2));
validateConfig(2, new GridClientConfiguration("new.gg.client.", props2));
// Validate loaded test configuration with empty key prefixes.
props2 = new Properties();
for (Map.Entry<Object, Object> e : props.entrySet())
props2.put(e.getKey().toString().replace("gg.client.", ""), e.getValue());
validateConfig(2, new GridClientConfiguration("", props2));
validateConfig(2, new GridClientConfiguration(".", props2));
}