private TimelineDomains doGetDomains(String owner, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineDomains domains = store.getDomains(owner); boolean hasAccess = true; if (domains.getDomains().size() > 0) { // The owner for each domain is the same, just need to check one hasAccess = timelineACLsManager.checkAccess( callerUGI, domains.getDomains().get(0)); } if (hasAccess) { return domains; } else { return new TimelineDomains(); } }
Set<TimelineDomain> domainsOfOneOwner = domainsByOwner.get(owner); if (domainsOfOneOwner == null) { return new TimelineDomains(); TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn;
@Test public void testTimelineDomain() throws Exception { TimelineDomains domains = new TimelineDomains(); domain.setCreatedTime(0L); domain.setModifiedTime(1L); domains.addDomain(domain); Assert.assertEquals(2, domains.getDomains().size()); for (int i = 0; i < domains.getDomains().size(); ++i) { domain = domains.getDomains().get(i); Assert.assertEquals("test id " + (i + 1), domain.getId()); Assert.assertEquals("test description " + (i + 1),
public void testGetDomains() throws IOException { TimelineDomains actualDomains = store.getDomains("owner_1"); assertEquals(2, actualDomains.getDomains().size()); verifyDomainInfo(domain3, actualDomains.getDomains().get(0)); verifyDomainInfo(domain1, actualDomains.getDomains().get(1)); // owner without any domain actualDomains = store.getDomains("owner_4"); assertEquals(0, actualDomains.getDomains().size()); }
@Test public void testTimelineDomain() throws Exception { TimelineDomains domains = new TimelineDomains(); domain.setCreatedTime(0L); domain.setModifiedTime(1L); domains.addDomain(domain); Assert.assertEquals(2, domains.getDomains().size()); for (int i = 0; i < domains.getDomains().size(); ++i) { domain = domains.getDomains().get(i); Assert.assertEquals("test id " + (i + 1), domain.getId()); Assert.assertEquals("test description " + (i + 1),
for (TimelineDomain domain : domains.getDomains()) { try { client.putDomain(domain);
@Test public void testTimelineDomain() throws Exception { TimelineDomains domains = new TimelineDomains(); domain.setCreatedTime(0L); domain.setModifiedTime(1L); domains.addDomain(domain); Assert.assertEquals(2, domains.getDomains().size()); for (int i = 0; i < domains.getDomains().size(); ++i) { domain = domains.getDomains().get(i); Assert.assertEquals("test id " + (i + 1), domain.getId()); Assert.assertEquals("test description " + (i + 1),
/** * Get all the domains that belong to the given owner. If callerUGI is not * the owner or the admin of the domain, empty list is going to be returned. */ public TimelineDomains getDomains(String owner, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineDomains domains = store.getDomains(owner); boolean hasAccess = true; if (domains.getDomains().size() > 0) { // The owner for each domain is the same, just need to check one hasAccess = timelineACLsManager.checkAccess( callerUGI, domains.getDomains().get(0)); } if (hasAccess) { return domains; } else { return new TimelineDomains(); } }
for (TimelineDomain domain : domains.getDomains()) { try { client.putDomain(domain);
Set<TimelineDomain> domainsOfOneOwner = domainsByOwner.get(owner); if (domainsOfOneOwner == null) { return new TimelineDomains(); TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn;
/** * Get all the domains that belong to the given owner. If callerUGI is not * the owner or the admin of the domain, empty list is going to be returned. */ public TimelineDomains getDomains(String owner, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineDomains domains = store.getDomains(owner); boolean hasAccess = true; if (domains.getDomains().size() > 0) { // The owner for each domain is the same, just need to check one hasAccess = timelineACLsManager.checkAccess( callerUGI, domains.getDomains().get(0)); } if (hasAccess) { return domains; } else { return new TimelineDomains(); } }
for (TimelineDomain domain : domains.getDomains()) { try { client.putDomain(domain);
Set<TimelineDomain> domainsOfOneOwner = domainsByOwner.get(owner); if (domainsOfOneOwner == null) { return new TimelineDomains(); TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn;
/** * Get all the domains that belong to the given owner. If callerUGI is not * the owner or the admin of the domain, empty list is going to be returned. */ public TimelineDomains getDomains(String owner, UserGroupInformation callerUGI) throws YarnException, IOException { long startTime = Time.monotonicNow(); metrics.incrGetDomainsOps(); try { TimelineDomains domains = doGetDomains(owner, callerUGI); metrics.incrGetDomainsTotal(domains.getDomains().size()); return domains; } finally { metrics.addGetDomainsTime(Time.monotonicNow() - startTime); } }
TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn;
@Test public void testGetDomains() throws Exception { WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("timeline") .path("domain") .queryParam("owner", "owner_1") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, response.getType().toString()); TimelineDomains domains = response.getEntity(TimelineDomains.class); Assert.assertEquals(2, domains.getDomains().size()); for (int i = 0; i < domains.getDomains().size(); ++i) { verifyDomain(domains.getDomains().get(i), i == 0 ? "domain_id_4" : "domain_id_1"); } }
TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn; } catch(DBException e) {
response.getType().toString()); TimelineDomains domains = response.getEntity(TimelineDomains.class); Assert.assertEquals(2, domains.getDomains().size()); for (int i = 0; i < domains.getDomains().size(); ++i) { verifyDomain(domains.getDomains().get(i), i == 0 ? "domain_id_4" : "domain_id_1"); response.getType().toString()); domains = response.getEntity(TimelineDomains.class); Assert.assertEquals(0, domains.getDomains().size()); } finally { timelineACLsManager.setAdminACLsManager(oldAdminACLsManager);
TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn; } catch(DBException e) {
TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn; } catch(DBException e) {