@Test(expected = IncorrectParameterException.class) public void invalidProfileFilterDeactivationTest() { String id = "-1"; profileService.deactivateProfileFilter(id, null); }
@Override public ProfileFilterDto deactivateProfileFilter(String profileFilterId, String deactivatedUsername) throws ControlServiceException { ChangeProfileFilterNotification cpfNotification = profileService .deactivateProfileFilter(profileFilterId, deactivatedUsername); ChangeNotificationDto notification = cpfNotification.getChangeNotificationDto(); if (notification != null) { notifyEndpoints(notification, cpfNotification.getProfileFilterDto(), null); } return cpfNotification.getProfileFilterDto(); }
@Test public void findAllProfileFilterRecordsByEndpointGroupIdTest() { ApplicationDto app = generateApplicationDto(null); String appId = app.getId(); EndpointGroupDto groupDto = generateEndpointGroupDto(appId); EndpointProfileSchemaDto schema = generateProfSchemaDto(app.getTenantId(), appId, 1).get(0); ServerProfileSchemaDto serverProfileSchema = generateServerProfileSchema(app.getId(), app.getTenantId()); ProfileFilterDto filter = generateFilterDto(schema.getId(), serverProfileSchema.getId(), groupDto.getId(), 3, true).get(2); Assert.assertEquals(UpdateStatus.ACTIVE, filter.getStatus()); profileService.deactivateProfileFilter(filter.getId(), null); List<ProfileFilterRecordDto> records = (List<ProfileFilterRecordDto>) profileService.findAllProfileFilterRecordsByEndpointGroupId(groupDto.getId(), true); Assert.assertNotNull(records); Assert.assertEquals(1, records.size()); Assert.assertEquals(UpdateStatus.DEPRECATED, records.get(0).getActiveStructureDto().getStatus()); }
@Test public void deactivateProfileFilterTest() { List<ProfileFilterDto> filterList = generateFilterDto(null, null, null, 1, true); ProfileFilterDto pf = filterList.get(0); String appId = pf.getApplicationId(); List<ProfileFilterDto> filters = profileService.findProfileFiltersByAppIdAndVersionsCombination(pf.getApplicationId(), pf.getEndpointProfileSchemaVersion(), pf.getServerProfileSchemaVersion()); Assert.assertNotNull(filters); ProfileFilterDto filter = filters.get(0); filter.setId(null); EndpointGroupDto group = generateEndpointGroupDto(appId); filter.setEndpointGroupId(group.getId()); ProfileFilterDto dto = profileService.saveProfileFilter(filter); ChangeProfileFilterNotification change = profileService.activateProfileFilter(dto.getId(), null); Assert.assertNotNull(change); Assert.assertEquals(UpdateStatus.ACTIVE, change.getProfileFilterDto().getStatus()); change = profileService.deactivateProfileFilter(dto.getId(), null); Assert.assertNotNull(change); Assert.assertEquals(UpdateStatus.DEPRECATED, change.getProfileFilterDto().getStatus()); }