@Override @Transactional public EndpointProfilesPageDto findEndpointProfileByEndpointGroupId(PageLinkDto pageLink) { validateSqlId(pageLink.getLimit(), "Can't find endpoint group by id. Incorrect limit parameter " + pageLink.getLimit()); validateString(pageLink.getOffset(), "Can't find endpoint group by id. Incorrect offset " + "parameter " + pageLink.getOffset()); return endpointProfileDao.findByEndpointGroupId(pageLink); }
@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()); }
for (int i = 0; i < 2; i++) { pageLink = new PageLinkDto(endpointGroupId[i], limit, offset); found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertTrue(found.getEndpointProfiles().isEmpty());
for (int i = 0; i < 2; i++) { pageLink = new PageLinkDto(endpointGroupId[i], limit, offset); found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertFalse(found.getEndpointProfiles().isEmpty()); found = endpointProfileDao.findByEndpointGroupId(pageLink); Assert.assertTrue(found.getEndpointProfiles().isEmpty());