Fix sonar findings: dupplications (#1989)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-09 20:31:11 +02:00
committed by GitHub
parent a9714337e8
commit e886dda9e6
6 changed files with 39 additions and 30 deletions

View File

@@ -53,9 +53,10 @@ import org.springframework.data.domain.Slice;
@Story("Auto assign checker")
class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
private static final String SPACE_AND_DESCRIPTION = " description";
@Autowired
private AutoAssignChecker autoAssignChecker;
@Autowired
private DeploymentManagement deploymentManagement;
@@ -120,7 +121,7 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
final String targetDsAIdPref = "targ";
final List<Target> targets = testdataFactory.createTargets(25, targetDsAIdPref,
targetDsAIdPref.concat(" description"));
targetDsAIdPref.concat(SPACE_AND_DESCRIPTION));
final int targetsCount = targets.size();
// assign set A to first 10 targets
@@ -199,7 +200,7 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
final String targetDsAIdPref = "targ";
final List<Target> targets = testdataFactory.createTargets(20, targetDsAIdPref,
targetDsAIdPref.concat(" description"));
targetDsAIdPref.concat(SPACE_AND_DESCRIPTION));
// Run the check
autoAssignChecker.checkAllTargets();
@@ -262,10 +263,10 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
implicitLock(setA);
final List<Target> targetsF = testdataFactory.createTargets(10, targetDsFIdPref,
targetDsFIdPref.concat(" description"));
targetDsFIdPref.concat(SPACE_AND_DESCRIPTION));
final List<Target> targetsA = testdataFactory.createTargets(10, targetDsAIdPref,
targetDsAIdPref.concat(" description"));
targetDsAIdPref.concat(SPACE_AND_DESCRIPTION));
final int targetsCount = targetsA.size() + targetsF.size();
@@ -475,7 +476,7 @@ class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
final DistributionSet distributionSet, final ActionType actionType) {
final List<Target> targets = testdataFactory.createTargets(targetCount, "target" + prefix,
prefix.concat(" description"));
prefix.concat(SPACE_AND_DESCRIPTION));
targetFilterQueryManagement.create(
entityFactory.targetFilterQuery().create().name("filter" + prefix).query("id==target" + prefix + "*")
.autoAssignDistributionSet(distributionSet).autoAssignActionType(actionType));

View File

@@ -47,6 +47,8 @@ import org.springframework.data.domain.Sort.Direction;
@Story("Target Management Searches")
class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
private static final String SPACE_AND_DESCRIPTION = " description";
@Test
@Description("Verifies that targets with given target type are returned from repository.")
public void findTargetByTargetType() {
@@ -92,7 +94,7 @@ class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String targetDsAIdPref = "targ-A";
List<Target> targAs = testdataFactory.createTargets(100, targetDsAIdPref,
targetDsAIdPref.concat(" description"), lastTargetQueryNotOverdue);
targetDsAIdPref.concat(SPACE_AND_DESCRIPTION), lastTargetQueryNotOverdue);
targAs = assignTag(targAs, targTagX);
final Target targSpecialName = targetManagement
@@ -100,21 +102,21 @@ class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String targetDsBIdPref = "targ-B";
List<Target> targBs = testdataFactory.createTargets(100, targetDsBIdPref,
targetDsBIdPref.concat(" description"), lastTargetQueryAlwaysOverdue);
targetDsBIdPref.concat(SPACE_AND_DESCRIPTION), lastTargetQueryAlwaysOverdue);
targBs = assignTag(targBs, targTagY);
targBs = assignTag(targBs, targTagW);
final String targetDsCIdPref = "targ-C";
List<Target> targCs = testdataFactory.createTargets(100, targetDsCIdPref,
targetDsCIdPref.concat(" description"), lastTargetQueryAlwaysOverdue);
targetDsCIdPref.concat(SPACE_AND_DESCRIPTION), lastTargetQueryAlwaysOverdue);
targCs = assignTag(targCs, targTagZ);
targCs = assignTag(targCs, targTagW);
final String targetDsDIdPref = "targ-D";
final List<Target> targDs = testdataFactory.createTargets(100, targetDsDIdPref,
targetDsDIdPref.concat(" description"), null);
targetDsDIdPref.concat(SPACE_AND_DESCRIPTION), null);
final String targetDsEIdPref = "targ-E";
final List<Target> targEs = testdataFactory.createTargetsWithType(100, targetDsEIdPref, targetTypeX);