Improve autowiring for tests (Sonar) (#2217)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -37,6 +37,7 @@ import org.springframework.util.MimeTypeUtils;
|
||||
/**
|
||||
* Test the remote entity events.
|
||||
*/
|
||||
@SuppressWarnings("java:S6813") // constructor injects are not possible for test classes
|
||||
public abstract class AbstractRemoteEventTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -78,6 +78,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@ContextConfiguration(classes = { RepositoryApplicationConfiguration.class, TestConfiguration.class })
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
@TestPropertySource(locations = "classpath:/jpa-test.properties")
|
||||
@SuppressWarnings("java:S6813") // constructor injects are not possible for test classes
|
||||
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
|
||||
|
||||
protected static final String INVALID_TEXT_HTML = "</noscript><br><script>";
|
||||
@@ -91,58 +92,40 @@ public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest
|
||||
|
||||
@Autowired
|
||||
protected TargetRepository targetRepository;
|
||||
|
||||
@Autowired
|
||||
protected ActionRepository actionRepository;
|
||||
|
||||
@Autowired
|
||||
protected DistributionSetRepository distributionSetRepository;
|
||||
|
||||
@Autowired
|
||||
protected SoftwareModuleRepository softwareModuleRepository;
|
||||
|
||||
@Autowired
|
||||
protected TenantMetaDataRepository tenantMetaDataRepository;
|
||||
|
||||
@Autowired
|
||||
protected DistributionSetTypeRepository distributionSetTypeRepository;
|
||||
|
||||
@Autowired
|
||||
protected SoftwareModuleTypeRepository softwareModuleTypeRepository;
|
||||
|
||||
@Autowired
|
||||
protected TargetTagRepository targetTagRepository;
|
||||
|
||||
@Autowired
|
||||
protected TargetTypeRepository targetTypeRepository;
|
||||
|
||||
@Autowired
|
||||
protected DistributionSetTagRepository distributionSetTagRepository;
|
||||
|
||||
@Autowired
|
||||
protected SoftwareModuleMetadataRepository softwareModuleMetadataRepository;
|
||||
|
||||
@Autowired
|
||||
protected ActionStatusRepository actionStatusRepository;
|
||||
|
||||
@Autowired
|
||||
protected LocalArtifactRepository artifactRepository;
|
||||
|
||||
@Autowired
|
||||
protected RolloutGroupRepository rolloutGroupRepository;
|
||||
|
||||
@Autowired
|
||||
protected RolloutTargetGroupRepository rolloutTargetGroupRepository;
|
||||
|
||||
@Autowired
|
||||
protected RolloutRepository rolloutRepository;
|
||||
|
||||
@Autowired
|
||||
protected TenantConfigurationProperties tenantConfigurationProperties;
|
||||
|
||||
@Autowired
|
||||
protected RolloutTestApprovalStrategy approvalStrategy;
|
||||
|
||||
@Autowired
|
||||
private JpaProperties jpaProperties;
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.springframework.data.domain.Slice;
|
||||
*/
|
||||
@Feature("Component Tests - Repository")
|
||||
@Story("Auto assign checker")
|
||||
@SuppressWarnings("java:S6813") // constructor injects are not possible for test classes
|
||||
class AutoAssignCheckerIntTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
private static final String SPACE_AND_DESCRIPTION = " description";
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*/
|
||||
@Feature("Component Tests - Repository")
|
||||
@Story("Action cleanup handler")
|
||||
@SuppressWarnings("java:S6813") // constructor injects are not possible for test classes
|
||||
class AutoActionCleanupTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.integration.support.locks.LockRegistry;
|
||||
*/
|
||||
@Feature("Component Tests - Repository")
|
||||
@Story("Auto cleanup scheduler")
|
||||
@SuppressWarnings("java:S6813") // constructor injects are not possible for test classes
|
||||
class AutoCleanupSchedulerTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
private final AtomicInteger counter = new AtomicInteger();
|
||||
|
||||
@@ -50,6 +50,7 @@ import org.springframework.context.event.EventListener;
|
||||
@Feature("Component Tests - Repository")
|
||||
@Story("Entity Events")
|
||||
@SpringBootTest(classes = { RepositoryTestConfiguration.class }, webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
@SuppressWarnings("java:S6813") // constructor injects are not possible for test classes
|
||||
public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
|
||||
@@ -1283,7 +1283,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
.asList(DistributionSetSpecification.isDeleted(true), DistributionSetSpecification.isCompleted(true))),
|
||||
PAGE).getContent()).as("wrong size of founded ds").hasSize(noOfDistributionSets);
|
||||
|
||||
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
||||
for (final DistributionSet ignored : deploymentResult.getDistributionSets()) {
|
||||
testdataFactory.sendUpdateActionStatusToTargets(deploymentResult.getDeployedTargets(), Status.FINISHED,
|
||||
Collections.singletonList("blabla alles gut"));
|
||||
}
|
||||
@@ -1316,7 +1316,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
final DeploymentResult deploymentResult = prepareComplexRepo(undeployedTargetPrefix, noOfUndeployedTargets,
|
||||
deployedTargetPrefix, noOfDeployedTargets, noOfDistributionSets, "myTestDS");
|
||||
|
||||
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
||||
for (final DistributionSet ignored : deploymentResult.getDistributionSets()) {
|
||||
testdataFactory.sendUpdateActionStatusToTargets(deploymentResult.getDeployedTargets(), Status.FINISHED,
|
||||
Collections.singletonList("blabla alles gut"));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Feature("Component Tests - Repository")
|
||||
@Story("RSQL filter suggestion")
|
||||
@SuppressWarnings("java:S6813") // constructor injects are not possible for test classes
|
||||
public class RSQLParserValidationOracleTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
private static final String[] OP_SUGGESTIONS = new String[] { "==", "!=", "=ge=", "=le=", "=gt=", "=lt=", "=in=",
|
||||
@@ -35,6 +36,7 @@ public class RSQLParserValidationOracleTest extends AbstractJpaIntegrationTest {
|
||||
.map(field -> field.name().toLowerCase()).toArray(String[]::new);
|
||||
private static final String[] AND_OR_SUGGESTIONS = new String[] { "and", "or" };
|
||||
private static final String[] NAME_VERSION_SUGGESTIONS = new String[] { "name", "version" };
|
||||
|
||||
@Autowired
|
||||
private RsqlValidationOracle rsqlValidationOracle;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user