public void addTopicToEndpointGroup(EndpointGroupDto endpointGroup, TopicDto topic) throws Exception { addTopicToEndpointGroup(endpointGroup.getId(), topic.getId()); }
public void onSuccessImpl(EndpointGroupDto result) { if (create) { goTo(new EndpointGroupPlace(applicationId, result.getId(), false, false)); } else { goTo(place.getPreviousPlace()); } }
private HistoryDto addHistory(EndpointGroupDto dto, ChangeType type, String topicId) { LOG.debug("Add history information about endpoint group update"); HistoryDto history = new HistoryDto(); history.setApplicationId(dto.getApplicationId()); ChangeDto change = new ChangeDto(); change.setEndpointGroupId(dto.getId()); change.setType(type); change.setTopicId(topicId); history.setChange(change); return historyService.saveHistory(history); }
@Test public void findConfigurationsByEndpointGroupIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); List<ConfigurationDto> configurations = generateConfigurationDto(null, group.getId(), 1, true, false); List<ConfigurationDto> dtoList = configurationService.findConfigurationsByEndpointGroupId(group.getId()); Assert.assertNotNull(dtoList); Assert.assertEquals(configurations, dtoList); }
private void findByEndpointGroup() { listView.getEndpointGroupButton().setValue(true); listView.getEndpointKeyHashButton().setValue(false); dataProvider.setNewGroup(listView.getEndpointGroupsInfo().getValue().getId()); dataProvider.update(); }
@Test public void findConfigurationRecordBySchemaIdAndEndpointGroupIdTest() { ConfigurationSchemaDto schema = generateConfSchemaDto(null, null, 1).get(0); EndpointGroupDto group = generateEndpointGroupDto(schema.getApplicationId()); ConfigurationDto activeConfig = generateConfigurationDto(schema.getId(), group.getId(), 1, true, false).get(0); ConfigurationDto inactiveConfig = generateConfigurationDto(schema.getId(), group.getId(), 1, false, false).get(0); StructureRecordDto<ConfigurationDto> record = configurationService .findConfigurationRecordBySchemaIdAndEndpointGroupId(schema.getId(), group.getId()); Assert.assertEquals(activeConfig, record.getActiveStructureDto()); Assert.assertEquals(inactiveConfig, record.getInactiveStructureDto()); }
@Test public void findVacantSchemasByEndpointGroupIdTest() { ApplicationDto application = generateApplicationDto(); List<ConfigurationSchemaDto> schemas = generateConfSchemaDto(null, application.getId(), 4); EndpointGroupDto groupOne = generateEndpointGroupDto(application.getId()); ConfigurationSchemaDto schemaOne = schemas.get(0); generateConfigurationDto(schemaOne.getId(), groupOne.getId(), 1, true, false); EndpointGroupDto groupTwo = generateEndpointGroupDto(application.getId()); List<VersionDto> schemasOne = configurationService.findVacantSchemasByEndpointGroupId(groupOne.getId()); Assert.assertFalse(schemasOne.isEmpty()); Assert.assertEquals(4, schemasOne.size()); List<VersionDto> schemasTwo = configurationService.findVacantSchemasByEndpointGroupId(groupTwo.getId()); Assert.assertFalse(schemasTwo.isEmpty()); Assert.assertEquals(5, schemasTwo.size()); }
@Test public void testFindTopicsByEndpointGroupId() { ApplicationDto app = generateApplicationDto(); EndpointGroupDto group = generateEndpointGroupDto(app.getId()); TopicDto topic = generateTopicDto(app.getId(), null); endpointService.addTopicToEndpointGroup(group.getId(), topic.getId()); List<TopicDto> found = topicService.findTopicsByEndpointGroupId(group.getId()); Assert.assertEquals(topic, found.get(0)); } }
@Test public void findEndpointProfileByEndpointGroupIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); String endpointGroupId = group.getId(); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, DEFAULT_LIMIT, DEFAULT_OFFSET); EndpointProfileDto savedEndpointProfileDto = generateEndpointProfileWithGroupIdDto(endpointGroupId); EndpointProfilesPageDto endpointProfilesPage = endpointService.findEndpointProfileByEndpointGroupId(pageLinkDto); EndpointProfileDto endpointProfileDto = endpointProfilesPage.getEndpointProfiles().get(0); Assert.assertEquals(savedEndpointProfileDto, endpointProfileDto); }
@Test(expected = IncorrectParameterException.class) public void findEndpointGroupByIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); EndpointGroupDto foundGroup = endpointService.findEndpointGroupById(group.getId()); Assert.assertNotNull(foundGroup); group = endpointService.findEndpointGroupById(INCORRECT_ID); }
@Test(expected = IncorrectParameterException.class) public void saveEndpointGroupWithSameWeightTest() { EndpointGroupDto group = generateEndpointGroupDto(null); EndpointGroupDto found = endpointService.findEndpointGroupById(group.getId()); found.setId(null); endpointService.saveEndpointGroup(found); }
@Test public void findConfigurationByEndpointGroupIdAndVersionTest() { ConfigurationSchemaDto schema = generateConfSchemaDto(null, null, 1).get(0); String groupId = generateEndpointGroupDto(schema.getApplicationId()).getId(); ConfigurationDto config = generateConfigurationDto(schema.getId(), groupId, 1, true, false).get(0); ConfigurationDto configuration = configurationService.findConfigurationByEndpointGroupIdAndVersion(groupId, schema.getVersion()); Assert.assertNotNull(configuration); Assert.assertEquals(config, configuration); }
@Test public void testFindVacantTopicsByEndpointGroupId() { ApplicationDto app = generateApplicationDto(); EndpointGroupDto group = generateEndpointGroupDto(app.getId()); TopicDto topic = generateTopicDto(app.getId(), null); List<TopicDto> found = topicService.findVacantTopicsByEndpointGroupId(group.getId()); Assert.assertEquals(topic, found.get(0)); }
@Test public void deleteConfigurationRecordTest() { ConfigurationSchemaDto schemaDto = generateConfSchemaDto(null, null, 1).get(0); EndpointGroupDto group = generateEndpointGroupDto(schemaDto.getApplicationId()); generateConfigurationDto(schemaDto.getId(), group.getId(), 1, true, false); ChangeConfigurationNotification notification = configurationService.deleteConfigurationRecord(schemaDto.getId(), group.getId(), null); Assert.assertNotNull(notification); ConfigurationDto configurationDto = notification.getConfigurationDto(); Assert.assertEquals(UpdateStatus.DEPRECATED, configurationDto.getStatus()); StructureRecordDto<ConfigurationDto> records = configurationService .findConfigurationRecordBySchemaIdAndEndpointGroupId(schemaDto.getId(), group.getId()); Assert.assertNull(records.getInactiveStructureDto()); Assert.assertEquals(UpdateStatus.DEPRECATED, records.getActiveStructureDto().getStatus()); }
@Test public void findEndpointProfileBodyByEndpointGroupIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); String endpointGroupId = group.getId(); PageLinkDto pageLinkDto = new PageLinkDto(endpointGroupId, DEFAULT_LIMIT, DEFAULT_OFFSET); EndpointProfileDto savedEndpointProfileDto = generateEndpointProfileWithGroupIdDto(endpointGroupId); EndpointProfilesBodyDto endpointProfilesPage = endpointService.findEndpointProfileBodyByEndpointGroupId(pageLinkDto); EndpointProfileBodyDto endpointProfileBodyDto = endpointProfilesPage.getEndpointProfilesBody().get(0); Assert.assertEquals(savedEndpointProfileDto.getClientProfileBody(), endpointProfileBodyDto.getClientSideProfile()); }
@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(expected = IncorrectParameterException.class) public void saveEndpointGroupWithSameNameTest() { EndpointGroupDto group = generateEndpointGroupDto(null); EndpointGroupDto found = endpointService.findEndpointGroupById(group.getId()); found.setId(null); found.setWeight(found.getWeight() + 1); endpointService.saveEndpointGroup(found); }
@Test public void removeTopicByIdAddedToGroupTest() { TopicDto topic = generateTopicDto(null, null); EndpointGroupDto groupDto = generateEndpointGroupDto(topic.getApplicationId()); endpointService.addTopicToEndpointGroup(groupDto.getId(), topic.getId()); topicService.removeTopicById(topic.getId()); TopicDto found = topicService.findTopicById(topic.getId()); Assert.assertNull(found); }
@Test(expected = UpdateStatusConflictException.class) public void updateDefaultProfileFilter() { ApplicationDto app = generateApplicationDto(null); EndpointProfileSchemaDto schema = generateProfSchemaDto(app.getTenantId(), app.getId(), 1).get(0); ServerProfileSchemaDto serverSchema = generateServerProfileSchema(app.getId(), app.getTenantId()); EndpointGroupDto defaultGroup = endpointService.findDefaultGroup(app.getId()); ProfileFilterDto filter = new ProfileFilterDto(); filter.setApplicationId(app.getId()); filter.setBody("true"); filter.setEndpointProfileSchemaId(schema.getId()); filter.setServerProfileSchemaId(serverSchema.getId()); filter.setEndpointGroupId(defaultGroup.getId()); filter = profileService.saveProfileFilter(filter); profileService.activateProfileFilter(filter.getId(), "test"); }