@Test public void testConvertWithEmptySecurityRulesAndProvidedGroupIds() { SecurityGroupRequest securityGroupRequest = new SecurityGroupRequest(); securityGroupRequest.setSecurityGroupIds(Set.of("sg-1", "sg-2")); securityGroupRequest.setSecurityRules(List.of()); SecurityGroup result = underTest.convert(securityGroupRequest); assertNotNull(result.getSecurityGroupIds()); assertEquals(2, result.getSecurityGroupIds().size()); assertNotNull(result.getSecurityRules()); assertTrue(result.getSecurityRules().isEmpty()); }
@Override public SecurityGroup convert(@Nonnull SecurityGroupRequest source) { SecurityGroup entity = new SecurityGroup(); entity.setName(missingResourceNameGenerator.generateName(APIResourceType.SECURITY_GROUP)); entity.setSecurityGroupIds(convertSecurityGroupIdsToList(source)); entity.setSecurityRules(convertSecurityRules(source.getSecurityRules(), entity)); return entity; }
SecurityGroupRequestToSecurityGroupConverter implements Converter<SecurityGroupRequest, SecurityGroup> { @Override public SecurityGroup convert(@Nonnull SecurityGroupRequest source) { SecurityGroup entity = new SecurityGroup(); entity.setName(missingResourceNameGenerator.generateName(APIResourceType.SECURITY_GROUP)); entity.setSecurityGroupIds(convertSecurityGroupIdsToList(source)); entity.setSecurityRules(convertSecurityRules(source.getSecurityRules(), entity)); return entity; } }
SecurityGroupRequestToSecurityGroupConverter implements Converter<SecurityGroupRequest, SecurityGroup> { @Override public SecurityGroup convert(@Nonnull SecurityGroupRequest source) { SecurityGroup entity = new SecurityGroup(); entity.setName(missingResourceNameGenerator.generateName(APIResourceType.SECURITY_GROUP)); entity.setSecurityGroupIds(convertSecurityGroupIdsToList(source)); entity.setSecurityRules(convertSecurityRules(source.getSecurityRules(), entity)); return entity; }  }
SecurityGroupRequestToSecurityGroupConverter implements Converter<SecurityGroupRequest, SecurityGroup> { @Override public SecurityGroup convert(@Nonnull SecurityGroupRequest source) { SecurityGroup entity = new SecurityGroup(); entity.setName(missingResourceNameGenerator.generateName(APIResourceType.SECURITY_GROUP)); entity.setSecurityGroupIds(convertSecurityGroupIdsToList(source)); entity.setSecurityRules(convertSecurityRules(source.getSecurityRules(), entity)); return entity; }  @Override SecurityGroup convert(@Nonnull SecurityGroupRequest source); }
SecurityGroupRequestToSecurityGroupConverter implements Converter<SecurityGroupRequest, SecurityGroup> { @Override public SecurityGroup convert(@Nonnull SecurityGroupRequest source) { SecurityGroup entity = new SecurityGroup(); entity.setName(missingResourceNameGenerator.generateName(APIResourceType.SECURITY_GROUP)); entity.setSecurityGroupIds(convertSecurityGroupIdsToList(source)); entity.setSecurityRules(convertSecurityRules(source.getSecurityRules(), entity)); return entity; }  @Override SecurityGroup convert(@Nonnull SecurityGroupRequest source);  }