Search in sources :

Example 6 with Address

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());
}
Also used : Random(java.util.Random) Address(alluxio.wire.Address) PropertyKey(alluxio.conf.PropertyKey) Before(org.junit.Before)

Example 7 with Address

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());
}
Also used : Address(alluxio.wire.Address) List(java.util.List) Test(org.junit.Test)

Example 8 with Address

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);
        }
    }
}
Also used : Address(alluxio.wire.Address) Optional(java.util.Optional) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) PropertyKey(alluxio.conf.PropertyKey)

Aggregations

Address (alluxio.wire.Address)8 WorkerNetAddress (alluxio.wire.WorkerNetAddress)4 List (java.util.List)4 PropertyKey (alluxio.conf.PropertyKey)3 MasterWorkerInfo (alluxio.master.block.meta.MasterWorkerInfo)3 ArrayList (java.util.ArrayList)3 StorageList (alluxio.grpc.StorageList)2 Random (java.util.Random)2 Test (org.junit.Test)2 ConcurrentHashSet (alluxio.collections.ConcurrentHashSet)1 NotFoundException (alluxio.exception.status.NotFoundException)1 ConfigProperty (alluxio.grpc.ConfigProperty)1 RegisterWorkerPOptions (alluxio.grpc.RegisterWorkerPOptions)1 BlockLocation (alluxio.proto.meta.Block.BlockLocation)1 LockResource (alluxio.resource.LockResource)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Nullable (javax.annotation.Nullable)1