/** * Return a single domain of the given domain Id. */ @GET @Path("/domain/{domainId}") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) public TimelineDomain getDomain( @Context HttpServletRequest req, @Context HttpServletResponse res, @PathParam("domainId") String domainId) { init(res); domainId = parseStr(domainId); if (domainId == null || domainId.length() == 0) { throw new BadRequestException("Domain ID is not specified."); } TimelineDomain domain = null; try { domain = timelineDataManager.getDomain( parseStr(domainId), getUser(req)); } catch (Exception e) { LOG.error("Error getting domain", e); throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); } if (domain == null) { throw new NotFoundException("Timeline domain [" + domainId + "] is not found"); } return domain; }
/** * Return a single domain of the given domain Id. */ @GET @Path("/domain/{domainId}") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) public TimelineDomain getDomain( @Context HttpServletRequest req, @Context HttpServletResponse res, @PathParam("domainId") String domainId) { init(res); domainId = parseStr(domainId); if (domainId == null || domainId.length() == 0) { throw new BadRequestException("Domain ID is not specified."); } TimelineDomain domain = null; try { domain = timelineDataManager.getDomain( parseStr(domainId), getUser(req)); } catch (Exception e) { LOG.error("Error getting domain", e); throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); } if (domain == null) { throw new NotFoundException("Timeline domain [" + domainId + "] is not found"); } return domain; }
domain = timelineDataManager.getDomain( parseStr(domainId), getUser(req)); } catch (Exception e) {
@Test public void testParseDomain() throws Exception { // Load test data TimelineDataManager tdm = PluginStoreTestUtils.getTdmWithMemStore(config); DomainLogInfo domainLogInfo = new DomainLogInfo(TEST_ATTEMPT_DIR_NAME, TEST_DOMAIN_FILE_NAME, UserGroupInformation.getLoginUser().getUserName()); domainLogInfo.parseForStore(tdm, getTestRootPath(), true, jsonFactory, objMapper, fs); // Verify domain data TimelineDomain resultDomain = tdm.getDomain("domain_1", UserGroupInformation.getLoginUser()); assertNotNull(resultDomain); assertEquals(testDomain.getReaders(), resultDomain.getReaders()); assertEquals(testDomain.getOwner(), resultDomain.getOwner()); assertEquals(testDomain.getDescription(), resultDomain.getDescription()); }