@Test public void saveFilterObjectWithoutInactiveFilterTest() { ProfileFilterDto filterDto = generateFilterDto(null, null, null, 1, true).get(0); filterDto.setId(null); ProfileFilterDto saved = profileService.saveProfileFilter(filterDto); Assert.assertNotNull(saved); Assert.assertEquals(saved.getStatus(), UpdateStatus.INACTIVE); Assert.assertEquals(saved.getSequenceNumber(), filterDto.getSequenceNumber()); Assert.assertNotEquals(saved.getId(), filterDto.getId()); }
@Test public void activateProfileFilterTest() { List<ProfileFilterDto> filters = generateFilterDto(null, null, null, 1, false); ProfileFilterDto filterDto = filters.get(0); Assert.assertNotNull(filterDto); Assert.assertEquals(UpdateStatus.INACTIVE, filterDto.getStatus()); ChangeProfileFilterNotification activated = profileService.activateProfileFilter(filterDto.getId(), null); Assert.assertNotNull(activated); ProfileFilterDto profileFilterDto = activated.getProfileFilterDto(); Assert.assertNotNull(profileFilterDto); Assert.assertEquals(UpdateStatus.ACTIVE, profileFilterDto.getStatus()); Assert.assertNotEquals(filterDto.getSequenceNumber(), profileFilterDto.getSequenceNumber()); }
/** * Notify endpoints. * * @param notification the notification * @param profileFilter the profile filter * @param configuration the configuration */ private void notifyEndpoints(ChangeNotificationDto notification, ProfileFilterDto profileFilter, ConfigurationDto configuration) { Notification thriftNotification = new Notification(); thriftNotification.setAppId(notification.getAppId()); thriftNotification.setAppSeqNumber(notification.getAppSeqNumber()); thriftNotification.setGroupId(notification.getGroupId()); thriftNotification.setGroupSeqNumber(notification.getGroupSeqNumber()); if (profileFilter != null) { thriftNotification.setProfileFilterId(profileFilter.getId()); thriftNotification.setProfileFilterSeqNumber(profileFilter.getSequenceNumber()); } if (configuration != null) { thriftNotification.setConfigurationId(configuration.getId()); thriftNotification.setConfigurationSeqNumber(configuration.getSequenceNumber()); } controlZkService.sendEndpointNotification(thriftNotification); }