Fix ArtifactStorage availability in tests (#2644)

After renaming of LocalArtifactRepository to ArtifactRepository

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-09-03 09:29:37 +03:00
committed by GitHub
parent 93f7e51565
commit 0e5f1d6526
5 changed files with 13 additions and 13 deletions

View File

@@ -253,8 +253,8 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
assertThat(artifact1.getSha1Hash()).isNotEqualTo(artifact2.getSha1Hash()); assertThat(artifact1.getSha1Hash()).isNotEqualTo(artifact2.getSha1Hash());
final String currentTenant = tenantAware.getCurrentTenant(); final String currentTenant = tenantAware.getCurrentTenant();
assertThat(binaryArtifactRepository.getBySha1(currentTenant, artifact1.getSha1Hash())).isNotNull(); assertThat(artifactStorage.getBySha1(currentTenant, artifact1.getSha1Hash())).isNotNull();
assertThat(binaryArtifactRepository.getBySha1(currentTenant, artifact2.getSha1Hash())).isNotNull(); assertThat(artifactStorage.getBySha1(currentTenant, artifact2.getSha1Hash())).isNotNull();
artifactManagement.delete(artifact1.getId()); artifactManagement.delete(artifact1.getId());
@@ -262,14 +262,14 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
final String sha1Hash = artifact1.getSha1Hash(); final String sha1Hash = artifact1.getSha1Hash();
assertThatExceptionOfType(ArtifactBinaryNotFoundException.class) assertThatExceptionOfType(ArtifactBinaryNotFoundException.class)
.isThrownBy(() -> binaryArtifactRepository.getBySha1(currentTenant, sha1Hash)); .isThrownBy(() -> artifactStorage.getBySha1(currentTenant, sha1Hash));
assertThat(binaryArtifactRepository.getBySha1(currentTenant, artifact2.getSha1Hash())).isNotNull(); assertThat(artifactStorage.getBySha1(currentTenant, artifact2.getSha1Hash())).isNotNull();
artifactManagement.delete(artifact2.getId()); artifactManagement.delete(artifact2.getId());
final String sha1Hash2 = artifact2.getSha1Hash(); final String sha1Hash2 = artifact2.getSha1Hash();
assertThatExceptionOfType(ArtifactBinaryNotFoundException.class) assertThatExceptionOfType(ArtifactBinaryNotFoundException.class)
.isThrownBy(() -> binaryArtifactRepository.getBySha1(currentTenant, sha1Hash2)); .isThrownBy(() -> artifactStorage.getBySha1(currentTenant, sha1Hash2));
assertThat(artifactRepository.findAll()).isEmpty(); assertThat(artifactRepository.findAll()).isEmpty();
} }
@@ -297,17 +297,17 @@ class ArtifactManagementTest extends AbstractJpaIntegrationTest {
assertThat((artifact1).getSha1Hash()).isEqualTo(artifact2.getSha1Hash()); assertThat((artifact1).getSha1Hash()).isEqualTo(artifact2.getSha1Hash());
assertThat(artifactRepository.findAll()).hasSize(2); assertThat(artifactRepository.findAll()).hasSize(2);
final String currentTenant = tenantAware.getCurrentTenant(); final String currentTenant = tenantAware.getCurrentTenant();
assertThat(binaryArtifactRepository.getBySha1(currentTenant, artifact1.getSha1Hash())).isNotNull(); assertThat(artifactStorage.getBySha1(currentTenant, artifact1.getSha1Hash())).isNotNull();
artifactManagement.delete(artifact1.getId()); artifactManagement.delete(artifact1.getId());
assertThat(artifactRepository.existsById(artifact1.getId())).isFalse(); assertThat(artifactRepository.existsById(artifact1.getId())).isFalse();
assertThat(artifactRepository.findAll()).hasSize(1); assertThat(artifactRepository.findAll()).hasSize(1);
assertThat(binaryArtifactRepository.getBySha1(currentTenant, artifact1.getSha1Hash())).isNotNull(); assertThat(artifactStorage.getBySha1(currentTenant, artifact1.getSha1Hash())).isNotNull();
artifactManagement.delete(artifact2.getId()); artifactManagement.delete(artifact2.getId());
final String sha1Hash = artifact1.getSha1Hash(); final String sha1Hash = artifact1.getSha1Hash();
assertThatExceptionOfType(ArtifactBinaryNotFoundException.class) assertThatExceptionOfType(ArtifactBinaryNotFoundException.class)
.isThrownBy(() -> binaryArtifactRepository.getBySha1(currentTenant, sha1Hash)); .isThrownBy(() -> artifactStorage.getBySha1(currentTenant, sha1Hash));
assertThat(artifactRepository.findAll()).isEmpty(); assertThat(artifactRepository.findAll()).isEmpty();
} }
} }

View File

@@ -76,7 +76,7 @@ class ManagementSecurityTest extends AbstractJpaIntegrationTest {
@Override @Override
@BeforeEach @BeforeEach
public void beforeAll() throws Exception { public void beforeAll() {
// override - shall not do anything // override - shall not do anything
} }

View File

@@ -453,7 +453,7 @@ class SoftwareModuleManagementTest
assertThat(artifactRepository.findAll()).hasSize(results.length); assertThat(artifactRepository.findAll()).hasSize(results.length);
for (final Artifact result : results) { for (final Artifact result : results) {
assertThat(result.getId()).isNotNull(); assertThat(result.getId()).isNotNull();
assertThat(binaryArtifactRepository.getBySha1(tenantAware.getCurrentTenant(), result.getSha1Hash())).isNotNull(); assertThat(artifactStorage.getBySha1(tenantAware.getCurrentTenant(), result.getSha1Hash())).isNotNull();
} }
} }
@@ -462,7 +462,7 @@ class SoftwareModuleManagementTest
final String currentTenant = tenantAware.getCurrentTenant(); final String currentTenant = tenantAware.getCurrentTenant();
final String sha1Hash = result.getSha1Hash(); final String sha1Hash = result.getSha1Hash();
assertThatExceptionOfType(ArtifactBinaryNotFoundException.class) assertThatExceptionOfType(ArtifactBinaryNotFoundException.class)
.isThrownBy(() -> binaryArtifactRepository.getBySha1(currentTenant, sha1Hash)); .isThrownBy(() -> artifactStorage.getBySha1(currentTenant, sha1Hash));
} }
} }
} }

View File

@@ -123,7 +123,7 @@ public class TestConfiguration implements AsyncConfigurer {
} }
@Bean @Bean
ArtifactStorage artifactRepository(final FileArtifactProperties artifactFilesystemProperties) { ArtifactStorage artifactStorage(final FileArtifactProperties artifactFilesystemProperties) {
return new FileArtifactStorage(artifactFilesystemProperties); return new FileArtifactStorage(artifactFilesystemProperties);
} }

View File

@@ -178,7 +178,7 @@ public abstract class AbstractIntegrationTest {
@Autowired @Autowired
protected SystemSecurityContext systemSecurityContext; protected SystemSecurityContext systemSecurityContext;
@Autowired @Autowired
protected ArtifactStorage binaryArtifactRepository; protected ArtifactStorage artifactStorage;
@Autowired @Autowired
protected QuotaManagement quotaManagement; protected QuotaManagement quotaManagement;