Fix DS Type update to do not remove mandatory/optional module types (#2598)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-08-07 14:29:54 +03:00
committed by GitHub
parent e2beb898f8
commit 08ff739bbe
4 changed files with 9 additions and 13 deletions

View File

@@ -811,11 +811,13 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
.build(),
DistributionSetTypeManagement.Create.builder()
.key("testKey2").name("TestName2").description("Desc2").colour("col")
.mandatoryModuleTypes(Set.of())
.optionalModuleTypes(Set.of(runtimeType, osType, appType))
.build(),
DistributionSetTypeManagement.Create.builder()
.key("testKey3").name("TestName3").description("Desc3").colour("col")
.mandatoryModuleTypes(Set.of(runtimeType, osType))
.optionalModuleTypes(Set.of())
.build());
}

View File

@@ -3015,15 +3015,12 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
assertThat(targetManagement.isControllerAttributesRequested(knownTargetId)).isTrue();
}
private String getCreateTargetsListJsonString(final String controllerId, final String name,
final String description) {
return "[{\"name\":\"" + name + "\",\"controllerId\":\"" + controllerId + "\",\"description\":\"" + description
+ "\"}]";
private String getCreateTargetsListJsonString(final String controllerId, final String name, final String description) {
return "[{\"name\":\"" + name + "\",\"controllerId\":\"" + controllerId + "\",\"description\":\"" + description + "\"}]";
}
private Target createSingleTarget(final String controllerId, final String name) {
targetManagement.create(entityFactory.target().create().controllerId(controllerId).name(name)
.description(TARGET_DESCRIPTION_TEST));
targetManagement.create(entityFactory.target().create().controllerId(controllerId).name(name).description(TARGET_DESCRIPTION_TEST));
return controllerManagement.findOrRegisterTargetIfItDoesNotExist(controllerId, LOCALHOST);
}

View File

@@ -17,7 +17,6 @@ import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@@ -125,9 +124,7 @@ public interface DistributionSetTypeManagement<T extends DistributionSetType>
@Size(max = Type.COLOUR_MAX_SIZE)
private String colour;
@Builder.Default
private Set<? extends SoftwareModuleType> mandatoryModuleTypes = Set.of();
@Builder.Default
private Set<? extends SoftwareModuleType> optionalModuleTypes = Set.of();
private Set<? extends SoftwareModuleType> mandatoryModuleTypes;
private Set<? extends SoftwareModuleType> optionalModuleTypes;
}
}

View File

@@ -50,7 +50,7 @@ import org.junit.jupiter.api.Test;
class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTest {
/**
* Verifies that management get access react as specfied on calls for non existing entities by means
* Verifies that management get access react as specified on calls for non existing entities by means
* of Optional not present.
*/
@Test
@@ -62,7 +62,7 @@ class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTest {
}
/**
* Verifies that management queries react as specfied on calls for non existing entities
* Verifies that management queries react as specified on calls for non existing entities
* by means of throwing EntityNotFoundException.
*/
@Test