Example usage for org.apache.hadoop.yarn.api.records.timeline TimelineDomain getReaders

List of usage examples for org.apache.hadoop.yarn.api.records.timeline TimelineDomain getReaders

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records.timeline TimelineDomain getReaders.

Prototype

@XmlElement(name = "readers")
public String getReaders() 

Source Link

Document

Get the reader (and/or reader group) list string

Usage

From source file:org.apache.tez.dag.history.ats.acls.TestATSHistoryWithACLs.java

License:Apache License

private TimelineDomain getDomain(String domainId) {
    assertNotNull(timelineAddress);/*from  ww  w  .  j a v a 2 s  . c om*/
    String url = "http://" + timelineAddress + "/ws/v1/timeline/domain/" + domainId;
    LOG.info("Getting timeline domain: " + url);
    TimelineDomain domain = getTimelineData(url, TimelineDomain.class);
    assertNotNull(domain);
    assertNotNull(domain.getOwner());
    assertNotNull(domain.getReaders());
    assertNotNull(domain.getWriters());
    LOG.info("TimelineDomain for id " + domainId + ", owner=" + domain.getOwner() + ", readers="
            + domain.getReaders() + ", writers=" + domain.getWriters());
    return domain;
}

From source file:org.apache.tez.dag.history.ats.acls.TestATSHistoryWithACLs.java

License:Apache License

private void verifyDomainACLs(TimelineDomain timelineDomain, Collection<String> users,
        Collection<String> groups) {
    String readers = timelineDomain.getReaders();
    int pos = readers.indexOf(" ");
    String readerUsers = readers.substring(0, pos);
    String readerGroups = readers.substring(pos + 1);

    assertTrue(readerUsers.contains(user));
    for (String s : users) {
        assertTrue(readerUsers.contains(s));
    }//from w w w . j a  va  2s.c o  m
    for (String s : groups) {
        assertTrue(readerGroups.contains(s));
    }

    if (!user.equals("nobody1") && !users.contains("nobody1")) {
        assertFalse(readerUsers.contains("nobody1"));
    }

}