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

View File

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

View File

@@ -453,7 +453,7 @@ class SoftwareModuleManagementTest
assertThat(artifactRepository.findAll()).hasSize(results.length);
for (final Artifact result : results) {
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 sha1Hash = result.getSha1Hash();
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
ArtifactStorage artifactRepository(final FileArtifactProperties artifactFilesystemProperties) {
ArtifactStorage artifactStorage(final FileArtifactProperties artifactFilesystemProperties) {
return new FileArtifactStorage(artifactFilesystemProperties);
}

View File

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