summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2022-02-26 17:22:58 +0000
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-02-26 18:25:12 +0000
commit4b978c9cc115c4f4032d5f3dbc4d3cde002449cc (patch)
treeb3986d499eb989c5210a25522258c6678b691dd3 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp
parentd0c2403f1f7088d60b135976c40917302daf8b9e (diff)
Implement improved MinIo client
Change-Id: Ic9abd6b0bdaa17e9deff2279a64416d81f7ad606 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3886
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImplTest.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImplTest.java
index 6c21cc471e..802d6d885a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImplTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImplTest.java
@@ -65,6 +65,7 @@ import org.openecomp.sdc.be.csar.storage.MinIoStorageArtifactStorageConfig;
import org.openecomp.sdc.be.csar.storage.MinIoStorageArtifactStorageConfig.Credentials;
import org.openecomp.sdc.be.csar.storage.MinIoStorageArtifactStorageConfig.EndPoint;
import org.openecomp.sdc.be.csar.storage.PackageSizeReducer;
+import org.openecomp.sdc.be.csar.storage.StorageFactory;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
@@ -100,6 +101,10 @@ class OrchestrationTemplateCandidateImplTest {
private PackageSizeReducer packageSizeReducer;
@Mock
private OrchestrationTemplateCandidateUploadManager orchestrationTemplateCandidateUploadManager;
+ @Mock
+ private StorageFactory storageFactory;
+ @Mock
+ private Attachment fileToUpload;
@InjectMocks
private OrchestrationTemplateCandidateImpl orchestrationTemplateCandidate;
@@ -178,9 +183,10 @@ class OrchestrationTemplateCandidateImplTest {
@Test
void uploadNotSignedArtifactStorageManagerIsEnabledTest() throws IOException {
+ when(storageFactory.createArtifactStorageManager()).thenReturn(artifactStorageManager);
when(artifactStorageManager.isEnabled()).thenReturn(true);
- when(artifactStorageManager.getStorageConfiguration()).thenReturn(
- new MinIoStorageArtifactStorageConfig(true, new EndPoint("host", 9000, false), new Credentials("accessKey", "secretKey"), "tempPath"));
+ when(artifactStorageManager.getStorageConfiguration()).thenReturn(new MinIoStorageArtifactStorageConfig
+ (true, new EndPoint("host", 9000, false), new Credentials("accessKey", "secretKey"), "tempPath", 10_000_000));
final Path path = Path.of("src/test/resources/files/sample-not-signed.csar");
final String vspId = "vspId";
@@ -316,12 +322,10 @@ class OrchestrationTemplateCandidateImplTest {
vspUploadStatusDto.setLockId(UUID.randomUUID());
when(orchestrationTemplateCandidateUploadManager.putUploadInProgress(candidateId, versionId, user)).thenReturn(vspUploadStatusDto);
final RuntimeException forcedException = new RuntimeException();
- when(artifactStorageManager.isEnabled()).thenThrow(forcedException);
- final Attachment mock = Mockito.mock(Attachment.class);
- when(mock.getDataHandler()).thenReturn(Mockito.mock(DataHandler.class));
+ when(fileToUpload.getDataHandler()).thenThrow(forcedException);
//when
final RuntimeException actualException = assertThrows(RuntimeException.class,
- () -> orchestrationTemplateCandidate.upload(candidateId, versionId, mock, user));
+ () -> orchestrationTemplateCandidate.upload(candidateId, versionId, fileToUpload, user));
//then
assertEquals(forcedException, actualException);
verify(orchestrationTemplateCandidateUploadManager)