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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class ManagementSecurityTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
@Override
|
||||
@BeforeEach
|
||||
public void beforeAll() throws Exception {
|
||||
public void beforeAll() {
|
||||
// override - shall not do anything
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class TestConfiguration implements AsyncConfigurer {
|
||||
}
|
||||
|
||||
@Bean
|
||||
ArtifactStorage artifactRepository(final FileArtifactProperties artifactFilesystemProperties) {
|
||||
ArtifactStorage artifactStorage(final FileArtifactProperties artifactFilesystemProperties) {
|
||||
return new FileArtifactStorage(artifactFilesystemProperties);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public abstract class AbstractIntegrationTest {
|
||||
@Autowired
|
||||
protected SystemSecurityContext systemSecurityContext;
|
||||
@Autowired
|
||||
protected ArtifactStorage binaryArtifactRepository;
|
||||
protected ArtifactStorage artifactStorage;
|
||||
@Autowired
|
||||
protected QuotaManagement quotaManagement;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user