Remove Deprecations - SoftwareModuleMangement (#1870)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-10-04 15:29:58 +03:00
committed by GitHub
parent d953ec5c7d
commit 56139fea12
3 changed files with 0 additions and 271 deletions

View File

@@ -528,105 +528,6 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
}
}
@Test
@Description("Test verifies that results are returned based on given filter parameters and in the specified order.")
public void findSoftwareModuleOrderByDistributionModuleNameAscModuleVersionAsc() {
// test meta data
final SoftwareModuleType testType = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("thetype").name("thename").maxAssignments(100));
DistributionSetType testDsType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("key").name("name"));
distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(testDsType.getId(),
Collections.singletonList(osType.getId()));
testDsType = distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(testDsType.getId(),
Collections.singletonList(testType.getId()));
// found in test
final SoftwareModule unassigned = testdataFactory.createSoftwareModule("thetype", "unassignedfound", false);
final SoftwareModule one = testdataFactory.createSoftwareModule("thetype", "bfound", false);
final SoftwareModule two = testdataFactory.createSoftwareModule("thetype", "cfound", false);
final SoftwareModule differentName = testdataFactory.createSoftwareModule("thetype", "a", false);
// ignored
final SoftwareModule deleted = testdataFactory.createSoftwareModule("thetype", "deleted", false);
final SoftwareModule four = testdataFactory.createSoftwareModuleOs("e");
final DistributionSet set = distributionSetManagement
.create(entityFactory.distributionSet().create().name("set").version("1").type(testDsType).modules(
List.of(one.getId(), two.getId(), deleted.getId(), four.getId(), differentName.getId())));
softwareModuleManagement.delete(deleted.getId());
// with filter on name, version and module type
assertThat(softwareModuleManagement.findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(PAGE,
set.getId(), "%found%", testType.getId()).getContent())
.as("Found modules with given name, given module type and the assigned ones first")
.containsExactly(new AssignedSoftwareModule(one, true), new AssignedSoftwareModule(two, true),
new AssignedSoftwareModule(unassigned, false));
// with filter on name, version and module type, sorting defined by
// Pagerequest
assertThat(softwareModuleManagement.findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
PageRequest.of(0, 500, Sort.by(Direction.DESC, "name")), set.getId(), "%found%", testType.getId())
.getContent())
.as("Found modules with given name, given module type, the assigned ones first, ordered by name DESC")
.containsExactly(new AssignedSoftwareModule(two, true), new AssignedSoftwareModule(one, true),
new AssignedSoftwareModule(unassigned, false));
// with filter on module type only
assertThat(softwareModuleManagement
.findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(PAGE, set.getId(), null, testType.getId())
.getContent()).as("Found modules with given module type and the assigned ones first")
.containsExactly(new AssignedSoftwareModule(one, true), new AssignedSoftwareModule(two, true),
new AssignedSoftwareModule(differentName, true), new AssignedSoftwareModule(unassigned, false));
// without any filter
assertThat(softwareModuleManagement
.findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(PAGE, set.getId(), null, null)
.getContent()).as("Found modules with the assigned ones first")
.containsExactly(new AssignedSoftwareModule(one, true), new AssignedSoftwareModule(two, true),
new AssignedSoftwareModule(differentName, true), new AssignedSoftwareModule(four, true),
new AssignedSoftwareModule(unassigned, false));
}
@Test
@Description("Checks that number of modules is returned as expected based on given filters.")
public void countSoftwareModuleByFilters() {
// test meta data
final SoftwareModuleType testType = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("thetype").name("thename").maxAssignments(100));
DistributionSetType testDsType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("key").name("name"));
distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(testDsType.getId(),
Collections.singletonList(osType.getId()));
testDsType = distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(testDsType.getId(),
Collections.singletonList(testType.getId()));
// found in test
testdataFactory.createSoftwareModule("thetype", "unassignedfound", false);
final SoftwareModule one = testdataFactory.createSoftwareModule("thetype", "bfound", false);
final SoftwareModule two = testdataFactory.createSoftwareModule("thetype", "cfound", false);
final SoftwareModule differentName = testdataFactory.createSoftwareModule("thetype", "d", false);
// ignored
final SoftwareModule deleted = testdataFactory.createSoftwareModule("thetype", "deleted", false);
final SoftwareModule four = testdataFactory.createSoftwareModuleOs("e");
distributionSetManagement
.create(entityFactory.distributionSet().create().name("set").version("1").type(testDsType).modules(
List.of(one.getId(), two.getId(), deleted.getId(), four.getId(), differentName.getId())));
softwareModuleManagement.delete(deleted.getId());
// test
assertThat(softwareModuleManagement.countByTextAndType("%found%", testType.getId()))
.as("Number of modules with given name or version and type").isEqualTo(3);
assertThat(softwareModuleManagement.countByTextAndType(null, testType.getId()))
.as("Number of modules with given type").isEqualTo(4);
assertThat(softwareModuleManagement.countByTextAndType(null, null)).as("Number of modules overall")
.isEqualTo(5);
}
@Test
@Description("Verfies that all undeleted software modules are found in the repository.")
public void countSoftwareModuleTypesAll() {