private EndpointGroupDto createDefaultGroup(String appId, String createdUsername) { EndpointGroupDto endpointGroup = new EndpointGroupDto(); endpointGroup.setName(GROUP_ALL); endpointGroup.setCreatedUsername(createdUsername); endpointGroup.setApplicationId(appId); return endpointService.saveEndpointGroup(endpointGroup); }
protected EndpointGroupDto generateEndpointGroupDto(String appId, String endpointGroupName) { EndpointGroupDto group = new EndpointGroupDto(); if (isBlank(appId)) { appId = generateApplicationDto(null).getId(); } group.setApplicationId(appId); group.setName(endpointGroupName); group.setWeight(RANDOM.nextInt()); return endpointService.saveEndpointGroup(group); }
@Test(expected = IncorrectParameterException.class) public void invalidUpdateEndpointGroupTest() { ApplicationDto app = generateApplicationDto(); List<EndpointGroupDto> groups = endpointService.findEndpointGroupsByAppId(app.getId()); Assert.assertFalse(groups.isEmpty()); EndpointGroupDto group = groups.get(0); group.setName("Updated Group Name"); endpointService.saveEndpointGroup(group); }
@Override protected void onSave() { entity.setName(detailsView.getName().getValue()); entity.setWeight(detailsView.getWeight().getValue()); entity.setDescription(detailsView.getDescription().getValue()); }
protected EndpointGroupDto generateEndpointGroup(String applicationId, String endpointGroupName) { EndpointGroupDto group = new EndpointGroupDto(); if (isBlank(applicationId)) { applicationId = generateApplication(null).getId(); } group.setApplicationId(applicationId); group.setName(endpointGroupName); group.setWeight(random.nextInt()); return endpointService.saveEndpointGroup(group); } }
@Test(expected = IncorrectParameterException.class) public void saveEndpointGroupWithExistingWeightTest() { ApplicationDto app = generateApplicationDto(); List<EndpointGroupDto> groups = endpointService.findEndpointGroupsByAppId(app.getId()); Assert.assertFalse(groups.isEmpty()); EndpointGroupDto group = groups.get(0); group.setId(null); group.setName("Updated Group Name"); endpointService.saveEndpointGroup(group); }
@Override public EndpointGroupDto toDto() { EndpointGroupDto dto = createDto(); dto.setId(getStringId()); dto.setDescription(description); dto.setCreatedUsername(createdUsername); dto.setCreatedTime(createdTime); if (application != null) { dto.setApplicationId(application.getStringId()); } dto.setName(name); dto.setSequenceNumber(sequenceNumber); dto.setWeight(weight); dto.setTopics(getTopicIds(topics)); return dto; }