use of alluxio.wire.Address in project alluxio by Alluxio.
the class ServerConfigurationStoreTest method before.
@Before
public void before() {
PropertyKey keyEnforce = PropertyKey.ZOOKEEPER_ELECTION_PATH;
PropertyKey keyWarn = PropertyKey.WORKER_FREE_SPACE_TIMEOUT;
mConfigListOne = Arrays.asList(ConfigProperty.newBuilder().setName(keyEnforce.getName()).setSource("Test").setValue("Value").build(), ConfigProperty.newBuilder().setName(keyWarn.getName()).setSource("Test").setValue("Value2").build());
mConfigListTwo = Arrays.asList(ConfigProperty.newBuilder().setName(keyEnforce.getName()).setSource("Test").setValue("Value3").build(), ConfigProperty.newBuilder().setName(keyWarn.getName()).setSource("Test").setValue("Value4").build());
Random random = new Random();
mAddressOne = new Address(RandomStringUtils.randomAlphanumeric(10), random.nextInt());
mAddressTwo = new Address(RandomStringUtils.randomAlphanumeric(10), random.nextInt());
}
use of alluxio.wire.Address in project alluxio by Alluxio.
the class ServerConfigurationStoreTest method registerNewConfUnknownProperty.
@Test
public void registerNewConfUnknownProperty() {
Address testAddress = new Address("test", 0);
ServerConfigurationStore configStore = new ServerConfigurationStore();
configStore.registerNewConf(testAddress, Arrays.asList(ConfigProperty.newBuilder().setName("unknown.property").build()));
Map<Address, List<ConfigRecord>> confMap = configStore.getConfMap();
assertTrue(confMap.containsKey(testAddress));
assertEquals("unknown.property", confMap.get(testAddress).get(0).getKey().getName());
}
use of alluxio.wire.Address in project alluxio by Alluxio.
the class ServerConfigurationChecker method fillConfMap.
/**
* Fills the configuration map.
*
* @param targetMap the map to fill
* @param recordMap the map to get data from
*/
private void fillConfMap(Map<PropertyKey, Map<Optional<String>, List<String>>> targetMap, Map<Address, List<ConfigRecord>> recordMap) {
for (Map.Entry<Address, List<ConfigRecord>> record : recordMap.entrySet()) {
Address address = record.getKey();
String addressStr = String.format("%s:%s", address.getHost(), address.getRpcPort());
for (ConfigRecord conf : record.getValue()) {
PropertyKey key = conf.getKey();
if (key.getConsistencyLevel() == ConsistencyCheckLevel.IGNORE) {
continue;
}
Optional<String> value = conf.getValue();
targetMap.putIfAbsent(key, new HashMap<>());
Map<Optional<String>, List<String>> values = targetMap.get(key);
values.putIfAbsent(value, new ArrayList<>());
values.get(value).add(addressStr);
}
}
}
Aggregations