@Test public void saveConfigurationObjectWithoutInactiveConfigurationTest() throws SchemaCreationException { List<ConfigurationDto> configs = generateConfigurationDto(null, null, 3, true, false); ConfigurationDto saved = configurationService.findConfigurationById(configs.get(2).getId()); String id = saved.getId(); saved.setId(null); ConfigurationDto updated = configurationService.saveConfiguration(saved); Assert.assertNotNull(updated); Assert.assertEquals(updated.getStatus(), UpdateStatus.INACTIVE); Assert.assertEquals(saved.getSequenceNumber(), updated.getSequenceNumber()); Assert.assertNotEquals(id, updated.getId()); }
@Test public void activateConfiguration() { List<ConfigurationDto> configurations = generateConfigurationDto(null, null, 1, false, false); String configId = configurations.get(0).getId(); ConfigurationDto found = configurationService.findConfigurationById(configId); ChangeConfigurationNotification notification = configurationService.activateConfiguration(configId, null); Assert.assertNotNull(notification); ConfigurationDto dto = notification.getConfigurationDto(); Assert.assertNotNull(dto); Assert.assertEquals(dto.getStatus(), UpdateStatus.ACTIVE); Assert.assertEquals(dto.getId(), configId); Assert.assertNotEquals(dto.getSequenceNumber(), found.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); }