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());
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user