@Override public void onSuccess(EndpointProfilesPageDto result) { Set<EndpointProfileDto> hs = new HashSet<>(); hs.addAll(result.getEndpointProfiles()); hs.addAll(endpointProfilesList); endpointProfilesList.clear(); endpointProfilesList.addAll(hs); callback.onSuccess(endpointProfilesList); offset = result.getPageLinkDto().getOffset(); } });
@Test public void testFindByEndpointGroupId() throws Exception { PageLinkDto pageLink = getPageLinkDto(); EndpointProfilesPageDto found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); int lim = Integer.valueOf(TEST_LIMIT); Assert.assertEquals(lim, found.getEndpointProfiles().size()); pageLink.setApplicationId(TEST_APPID); EndpointProfilesPageDto foundbyAppId = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(foundbyAppId.getEndpointProfiles().isEmpty()); Assert.assertEquals(lim, foundbyAppId.getEndpointProfiles().size()); }
@Test public void testFindByEndpointGroupIdWithNfGroupState() throws Exception { PageLinkDto pageLink = getPageLinkDto(); EndpointProfilesPageDto found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); int lim = Integer.valueOf(TEST_LIMIT); Assert.assertEquals(lim, found.getEndpointProfiles().size()); pageLink.setApplicationId(TEST_APPID); EndpointProfilesPageDto foundbyAppId = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(foundbyAppId.getEndpointProfiles().isEmpty()); Assert.assertEquals(lim, foundbyAppId.getEndpointProfiles().size()); }
@Test public void findByEndpointGroupIdTest() { 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); EndpointProfilesPageDto found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); Assert.assertEquals(lim, found.getEndpointProfiles().size()); }
@Test public void findByEndpointGroupIdWithNfGroupStateTest() { 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); EndpointProfilesPageDto found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); Assert.assertEquals(lim, found.getEndpointProfiles().size()); }
@Test public void findEndpointProfileByEndpointGroupIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); String endpointGroupId = group.getId(); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, DEFAULT_LIMIT, DEFAULT_OFFSET); EndpointProfileDto savedEndpointProfileDto = generateEndpointProfileWithGroupIdDto(endpointGroupId); EndpointProfilesPageDto endpointProfilesPage = endpointService.findEndpointProfileByEndpointGroupId(pageLinkDto); EndpointProfileDto endpointProfileDto = endpointProfilesPage.getEndpointProfiles().get(0); Assert.assertEquals(savedEndpointProfileDto, endpointProfileDto); }
pageLink = new PageLinkDto(endpointGroupId[i], limit, offset); found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); Assert.assertTrue(found.getEndpointProfiles().isEmpty());
pageLink = new PageLinkDto(endpointGroupId[i], limit, offset); found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); Assert.assertTrue(found.getEndpointProfiles().isEmpty());