@Override public List<EndpointGroupDto> getEndpointGroupsByApplicationId(String applicationId) throws ControlServiceException { return endpointService.findEndpointGroupsByAppId(applicationId); }
@Test public void removeEndpointGroupByAppIdTest() { String appId = generateApplicationDto().getId(); List<EndpointGroupDto> groupDtoList = endpointService.findEndpointGroupsByAppId(appId); Assert.assertNotNull(groupDtoList); Assert.assertFalse(groupDtoList.isEmpty()); endpointService.removeEndpointGroupByAppId(appId); groupDtoList = endpointService.findEndpointGroupsByAppId(appId); Assert.assertNotNull(groupDtoList); Assert.assertTrue(groupDtoList.isEmpty()); }
@Test public void findEndpointGroupsByAppIdTest() { EndpointGroupDto group = generateEndpointGroupDto(null); List<EndpointGroupDto> groups = endpointService.findEndpointGroupsByAppId(group.getApplicationId()); Assert.assertNotNull(groups); Assert.assertFalse(groups.isEmpty()); Assert.assertEquals(2, groups.size()); ; }
@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); }
@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); }
@Test(expected = IncorrectParameterException.class) public void saveEndpointGroupWithExistingNameTest() { ApplicationDto app = generateApplicationDto(); List<EndpointGroupDto> groups = endpointService.findEndpointGroupsByAppId(app.getId()); Assert.assertFalse(groups.isEmpty()); EndpointGroupDto group = groups.get(0); group.setId(null); group.setWeight(group.getWeight() + 1); endpointService.saveEndpointGroup(group); }
@Test public void removeTopicByIdTest() { TopicDto topic = generateTopicDto(null, null); topicService.removeTopicById(topic.getId()); TopicDto found = topicService.findTopicById(topic.getId()); Assert.assertNull(found); List<EndpointGroupDto> groups = endpointService.findEndpointGroupsByAppId(topic.getApplicationId()); Assert.assertFalse(groups.isEmpty()); }