@Test public void testFindBodyByEndpointGroupIdWithNfGroupState() throws Exception { PageLinkDto pageLink = getPageLinkDto(); EndpointProfilesBodyDto found = endpointProfileDao.findBodyByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfilesBody().isEmpty()); int lim = Integer.valueOf(TEST_LIMIT); Assert.assertEquals(lim, found.getEndpointProfilesBody().size()); pageLink.setApplicationId(TEST_APPID); EndpointProfilesBodyDto foundbyAppId = endpointProfileDao.findBodyByEndpointGroupId(pageLink); Assert.assertFalse(foundbyAppId.getEndpointProfilesBody().isEmpty()); Assert.assertEquals(lim, foundbyAppId.getEndpointProfilesBody().size()); }
private EndpointProfilesBodyDto createNextBodyPage(List<EndpointProfileBodyDto> profilesBodyDto, String endpointGroupId, String limit) { EndpointProfilesBodyDto endpointProfilesBodyDto = new EndpointProfilesBodyDto(); PageLinkDto pageLinkDto = new PageLinkDto(); String next; int lim = Integer.valueOf(limit); if (profilesBodyDto.size() == (lim + 1)) { pageLinkDto.setEndpointGroupId(endpointGroupId); pageLinkDto.setLimit(limit); pageLinkDto.setOffset( Base64.encodeBase64URLSafeString(profilesBodyDto.get(lim).getEndpointKeyHash())); profilesBodyDto.remove(lim); next = null; } else { next = DaoConstants.LAST_PAGE_MESSAGE; } pageLinkDto.setNext(next); endpointProfilesBodyDto.setPageLinkDto(pageLinkDto); endpointProfilesBodyDto.setEndpointProfilesBody(profilesBodyDto); return endpointProfilesBodyDto; }
EndpointProfilesBodyDto endpointProfilesBodyDto = groupService.getEndpointProfileBodyByEndpointGroupId(endpointGroupId, limit, offset); if (endpointProfilesBodyDto.hasEndpointBodies()) { PageLinkDto pageLinkDto = createNext(endpointProfilesBodyDto.getPageLinkDto(), request); endpointProfilesBodyDto.setNext(pageLinkDto.getNext());
profilesBody.add(endpointProfileBodyDto); EndpointProfilesBodyDto endpointProfilesBodyDto = new EndpointProfilesBodyDto(); endpointProfilesBodyDto.setPageLinkDto(pageLink); endpointProfilesBodyDto.setEndpointProfilesBody(profilesBody); return endpointProfilesBodyDto;
@Test public void testFindBodyByEndpointGroupId() throws Exception { PageLinkDto pageLink = getPageLinkDto(); EndpointProfilesBodyDto found = endpointProfileDao.findBodyByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfilesBody().isEmpty()); int lim = Integer.valueOf(TEST_LIMIT); Assert.assertEquals(lim, found.getEndpointProfilesBody().size()); pageLink.setApplicationId(TEST_APPID); EndpointProfilesBodyDto foundbyAppId = endpointProfileDao.findBodyByEndpointGroupId(pageLink); Assert.assertFalse(foundbyAppId.getEndpointProfilesBody().isEmpty()); Assert.assertEquals(lim, foundbyAppId.getEndpointProfilesBody().size()); }
@Test public void findBodyByEndpointGroupIdTest() { for (int i = 0; i < GENERATED_PROFILES_COUNT; i++) { generateEndpointProfileWithGroupIdDto(TEST_ENDPOINT_GROUP_ID); } int lim = Integer.valueOf(TEST_LIMIT); PageLinkDto pageLink = new PageLinkDto(TEST_ENDPOINT_GROUP_ID, TEST_LIMIT, TEST_OFFSET); EndpointProfilesBodyDto found = endpointProfileDao.findBodyByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfilesBody().isEmpty()); Assert.assertEquals(lim, found.getEndpointProfilesBody().size()); }
@Test public void findBodyByEndpointGroupIdWithNfGroupStateTest() { for (int i = 0; i < GENERATED_PROFILES_COUNT; i++) { generateEndpointProfileWithGroupIdDto(TEST_ENDPOINT_GROUP_ID); } int lim = Integer.valueOf(TEST_LIMIT); PageLinkDto pageLink = new PageLinkDto(TEST_ENDPOINT_GROUP_ID, TEST_LIMIT, TEST_OFFSET); EndpointProfilesBodyDto found = endpointProfileDao.findBodyByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfilesBody().isEmpty()); Assert.assertEquals(lim, found.getEndpointProfilesBody().size()); }
@Test public void findEndpointProfileBodyByEndpointGroupIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); String endpointGroupId = group.getId(); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, DEFAULT_LIMIT, DEFAULT_OFFSET); EndpointProfileDto savedEndpointProfileDto = generateEndpointProfileWithGroupIdDto(endpointGroupId); EndpointProfilesBodyDto endpointProfilesPage = endpointService.findEndpointProfileBodyByEndpointGroupId(pageLinkDto); EndpointProfileBodyDto endpointProfileBodyDto = endpointProfilesPage.getEndpointProfilesBody().get(0); Assert.assertEquals(savedEndpointProfileDto.getClientProfileBody(), endpointProfileBodyDto.getClientSideProfile()); }