@Override public EndpointProfilesPageDto getEndpointProfileByEndpointGroupId(String endpointGroupId, String limit, String offset) throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { if (Integer.valueOf(limit) > MAX_LIMIT) { throw new IllegalArgumentException( "Incorrect limit parameter. You must enter value not more than " + MAX_LIMIT); } EndpointGroupDto endpointGroupDto = getEndpointGroup(endpointGroupId); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, limit, offset); if (isGroupAll(endpointGroupDto)) { pageLinkDto.setApplicationId(endpointGroupDto.getApplicationId()); } return controlService.getEndpointProfileByEndpointGroupId(pageLinkDto); } catch (Exception ex) { throw Utils.handleException(ex); } }
@Override public EndpointProfilesBodyDto getEndpointProfileBodyByEndpointGroupId(String endpointGroupId, String limit, String offset) throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { if (Integer.valueOf(limit) > MAX_LIMIT) { throw new IllegalArgumentException( "Incorrect limit parameter. You must enter value not more than " + MAX_LIMIT); } EndpointGroupDto endpointGroupDto = getEndpointGroup(endpointGroupId); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, limit, offset); if (isGroupAll(endpointGroupDto)) { pageLinkDto.setApplicationId(endpointGroupDto.getApplicationId()); } return controlService.getEndpointProfileBodyByEndpointGroupId(pageLinkDto); } catch (Exception ex) { throw Utils.handleException(ex); } }
@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()); }
@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 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()); }