summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java120
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java99
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java69
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNFWithNonMano.mf1
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/csar-and-cms-in-root.zipbin0 -> 304 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/fakeNonSignedZipPackage.zipbin0 -> 694 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package-tampered-data.zipbin0 -> 4242 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package.zipbin0 -> 4242 bytes
12 files changed, 279 insertions, 66 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
index b922da9b46..c17c33142c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
@@ -38,6 +38,7 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.exception.OnboardPackageException;
import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactData;
import org.openecomp.sdc.vendorsoftwareproduct.questionnaire.QuestionnaireDataService;
@@ -72,7 +73,7 @@ public class QuestionnaireDataServiceTest {
}
// TODO: 3/15/2017 fix and enable //@Test
- public void testQuestionnaireDataAfterLegalUploadWithComposition() throws IOException {
+ public void testQuestionnaireDataAfterLegalUploadWithComposition() throws IOException, OnboardPackageException {
InformationArtifactData informationArtifactData =
uploadFileAndValidateInformationArtifactData("/fullComposition", 5);
@@ -81,15 +82,15 @@ public class QuestionnaireDataServiceTest {
// TODO: 3/15/2017 fix and enable //@Test
- public void testQuestionnaireDataAfterLegalUploadEmptyComposition() throws IOException {
+ public void testQuestionnaireDataAfterLegalUploadEmptyComposition() throws IOException, OnboardPackageException {
uploadFileAndValidateInformationArtifactData("/emptyComposition", 0);
}
// TODO: 3/15/2017 fix and enable //@Test
- public void testQuestionnaireDataAfterIllegalUpload() throws IOException {
+ public void testQuestionnaireDataAfterIllegalUpload() throws IOException, OnboardPackageException {
try (InputStream zipInputStream = uploadFileTest.getZipInputStream("/missingYml")) {
- onboardPackageInfo = new OnboardPackageInfo("missingYml", CSAR, convertFileInputStream(zipInputStream));
+ onboardPackageInfo = new OnboardPackageInfo("missingYml", CSAR, convertFileInputStream(zipInputStream), OnboardingTypesEnum.CSAR);
UploadFileResponse uploadFileResponse =
candidateManager.upload(vspDetails, onboardPackageInfo);
}
@@ -100,11 +101,11 @@ public class QuestionnaireDataServiceTest {
private InformationArtifactData uploadFileAndValidateInformationArtifactData(final String filePath,
final int listSizeToCheck)
- throws IOException {
+ throws IOException, OnboardPackageException {
try (final InputStream zipInputStream = uploadFileTest.getZipInputStream(filePath)) {
onboardPackageInfo = new OnboardPackageInfo("file", OnboardingTypesEnum.CSAR.toString(),
- convertFileInputStream(zipInputStream));
+ convertFileInputStream(zipInputStream), OnboardingTypesEnum.CSAR);
final UploadFileResponse uploadFileResponse = candidateManager.upload(vspDetails, onboardPackageInfo);
candidateManager.process(vspId, VERSION);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java
new file mode 100644
index 0000000000..a62aea761a
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java
@@ -0,0 +1,120 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding;
+
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.openecomp.sdc.common.errors.Messages.PACKAGE_EMPTY_ERROR;
+import static org.openecomp.sdc.common.errors.Messages.PACKAGE_INVALID_EXTENSION;
+
+import com.google.common.collect.ImmutableSet;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo;
+
+@RunWith(Parameterized.class)
+public class OnboardingPackageProcessorTest {
+ private static final String BASE_DIR = "/vspmanager.csar/";
+ private final String packageName;
+ private final byte[] packageBytes;
+ private final Set<ErrorMessage> expectedErrorSet;
+ private final OnboardingTypesEnum expectedPackageType;
+
+ public OnboardingPackageProcessorTest(final String packageName, final byte[] packageBytes,
+ final Set<ErrorMessage> expectedErrorSet,
+ final OnboardingTypesEnum expectedPackageType) {
+ this.packageName = packageName;
+ this.packageBytes = packageBytes;
+ this.expectedErrorSet = expectedErrorSet;
+ this.expectedPackageType = expectedPackageType;
+ }
+
+ @Parameters(name = "Run {index} for {0}")
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][]{
+ {"emptyPackage.csar", new byte[0],
+ ImmutableSet.of(
+ new ErrorMessage(ErrorLevel.ERROR, PACKAGE_EMPTY_ERROR.formatMessage("emptyPackage.csar"))
+ ), null},
+
+ {"notCsar.txt", getFileBytes("notCsar.txt"),
+ ImmutableSet.of(
+ new ErrorMessage(ErrorLevel.ERROR,
+ PACKAGE_INVALID_EXTENSION.formatMessage("notCsar.txt", "csar, zip"))
+ ), null},
+
+ {"signed-package.zip", getFileBytes("signing/signed-package.zip"), Collections.emptySet(),
+ OnboardingTypesEnum.SIGNED_CSAR},
+
+ {"csar-and-cms-in-root.zip", getFileBytes("signing/csar-and-cms-in-root.zip"), Collections.emptySet(),
+ OnboardingTypesEnum.SIGNED_CSAR},
+
+ {"successfulUpload.csar", getFileBytes("successfulUpload.csar"), Collections.emptySet(),
+ OnboardingTypesEnum.CSAR},
+
+ {"fakeNonSignedZipPackage.zip", getFileBytes("signing/fakeNonSignedZipPackage.zip"), Collections.emptySet(),
+ OnboardingTypesEnum.ZIP}
+ });
+ }
+
+ @Test
+ public void processPackage() {
+ final OnboardingPackageProcessor onboardingPackageProcessor = new OnboardingPackageProcessor(packageName, packageBytes);
+ assertThat("Should contains errors", onboardingPackageProcessor.hasErrors(), is(!expectedErrorSet.isEmpty()));
+ assertThat("Should have the same number of errors", onboardingPackageProcessor.getErrorMessageSet().size(), equalTo(expectedErrorSet.size()));
+ if (expectedErrorSet.size() > 0) {
+ assertThat("Should have the expected errors", onboardingPackageProcessor.getErrorMessageSet(), containsInAnyOrder(expectedErrorSet.toArray()));
+ return;
+ }
+ final OnboardPackageInfo onboardPackageInfo = onboardingPackageProcessor.getOnboardPackageInfo().orElse(null);
+ assertThat("Should build onboardPackageInfo", onboardPackageInfo, is(notNullValue()));
+ assertThat("Should have the expected package type", onboardPackageInfo.getPackageType(), is(equalTo(expectedPackageType)));
+ }
+
+ private static byte[] getFileBytes(final String filePath) {
+ final Path path = Paths.get(BASE_DIR, filePath);
+ try {
+ return Files.readAllBytes(Paths.get(
+ OnboardingPackageProcessorTest.class.getResource(path.toString()).toURI()));
+ } catch (final IOException | URISyntaxException e) {
+ fail(String.format("Could not load file %s", path.toString()));
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java
new file mode 100644
index 0000000000..0fce606052
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java
@@ -0,0 +1,99 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.OnboardingPackageProcessor;
+import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager;
+import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManagerException;
+import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo;
+import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardSignedPackage;
+
+public class CsarSecurityValidatorTest {
+
+ private static final String BASE_DIR = "/vspmanager.csar/";
+ private CsarSecurityValidator csarSecurityValidator;
+ @Mock
+ SecurityManager securityManager;
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ csarSecurityValidator = new CsarSecurityValidator(securityManager);
+ }
+
+ @Test
+ public void isSignatureValidTestCorrectStructureAndValidSignatureExists() throws SecurityManagerException {
+ final byte[] packageBytes = getFileBytesOrFail("signing/signed-package.zip");
+ final OnboardSignedPackage onboardSignedPackage = loadSignedPackage("signed-package.zip",
+ packageBytes);
+ when(securityManager.verifySignedData(any(), any(), any())).thenReturn(true);
+ final boolean isSignatureValid = csarSecurityValidator.verifyPackageSignature(onboardSignedPackage);
+ assertThat("Signature should be valid", isSignatureValid, is(true));
+ }
+
+ @Test(expected = SecurityManagerException.class)
+ public void isSignatureValidTestCorrectStructureAndNotValidSignatureExists() throws SecurityManagerException {
+ final byte[] packageBytes = getFileBytesOrFail("signing/signed-package-tampered-data.zip");
+ final OnboardSignedPackage onboardSignedPackage = loadSignedPackage("signed-package-tampered-data.zip",
+ packageBytes);
+ //no mocked securityManager
+ csarSecurityValidator = new CsarSecurityValidator();
+ csarSecurityValidator.verifyPackageSignature(onboardSignedPackage);
+ }
+
+ private byte[] getFileBytesOrFail(final String path) {
+ try {
+ return getFileBytes(path);
+ } catch (final URISyntaxException | IOException e) {
+ fail("Could not load file " + path);
+ return null;
+ }
+ }
+
+ private byte[] getFileBytes(final String path) throws URISyntaxException, IOException {
+ return Files.readAllBytes(Paths.get(
+ CsarSecurityValidatorTest.class.getResource(BASE_DIR + path).toURI()));
+ }
+
+ private OnboardSignedPackage loadSignedPackage(final String packageName, final byte[] packageBytes) {
+ final OnboardingPackageProcessor onboardingPackageProcessor =
+ new OnboardingPackageProcessor(packageName, packageBytes);
+ final OnboardPackageInfo onboardPackageInfo = onboardingPackageProcessor.getOnboardPackageInfo().orElse(null);
+ if (onboardPackageInfo == null) {
+ fail("Unexpected error. Could not load original package");
+ }
+
+ return (OnboardSignedPackage) onboardPackageInfo.getOriginalOnboardPackage();
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java
index 6dc8e1a5c6..799e0cc342 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java
@@ -37,14 +37,11 @@ public class ONAPCsarValidatorTest {
private ONAPCsarValidator onapCsarValidator;
private FileContentHandler contentHandler;
- private List<String> folderList;
@Before
public void setUp() throws IOException{
onapCsarValidator = new ONAPCsarValidator();
contentHandler = new FileContentHandler();
- folderList = new ArrayList<>();
-
contentHandler.addFile("TOSCA-Metadata/TOSCA.meta", ValidatorUtil.getFileResource("/validation.files/metafile/nonSOL004WithMetaDirectoryCompliantMetaFile.meta"));
contentHandler.addFile("MainServiceTemplate.mf", ValidatorUtil.getFileResource("/validation.files/manifest/sampleManifest.mf"));
contentHandler.addFile(TestConstants.TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(TestConstants.SAMPLE_DEFINITION_FILE_PATH));
@@ -53,7 +50,7 @@ public class ONAPCsarValidatorTest {
@Test
public void testGivenCSARPackage_withValidContent_thenNoErrorsReturned() {
assertExpectedErrors("Valid CSAR Package should have 0 errors",
- onapCsarValidator.validateContent(contentHandler, folderList), 0);
+ onapCsarValidator.validateContent(contentHandler), 0);
}
@Test
@@ -63,23 +60,21 @@ public class ONAPCsarValidatorTest {
contentHandler.addFile("MainServiceTemplate.mf", ValidatorUtil.getFileResource("/validation.files/manifest/invalidManifest.mf"));
contentHandler.addFile(TestConstants.TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(TestConstants.SAMPLE_DEFINITION_FILE_PATH));
- assertExpectedErrors("CSAR package with invalid manifest file should have errors", onapCsarValidator.validateContent(contentHandler, folderList), 1);
+ assertExpectedErrors("CSAR package with invalid manifest file should have errors", onapCsarValidator.validateContent(contentHandler), 1);
}
@Test
public void testGivenCSARPackage_withUnwantedFolders_thenErrorsReturned(){
-
- folderList.add("Files/");
- assertExpectedErrors("CSAR package with unwanted folders should fail with errors", onapCsarValidator.validateContent(contentHandler, folderList), 1);
+ contentHandler.addFolder("Files/");
+ assertExpectedErrors("CSAR package with unwanted folders should fail with errors", onapCsarValidator.validateContent(contentHandler), 1);
}
@Test
public void testGivenCSARPackage_withUnwantedFiles_thenErrorsReturned(){
-
contentHandler.addFile("ExtraFile.text", "".getBytes());
assertExpectedErrors("CSAR package with unwanted files should fail with errors",
- onapCsarValidator.validateContent(contentHandler, folderList), 1);
+ onapCsarValidator.validateContent(contentHandler), 1);
}
private void assertExpectedErrors( String testCase, Map<String, List<ErrorMessage>> errors, int expectedErrors){
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java
index 2e0fd8643a..17b06793a2 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java
@@ -100,7 +100,7 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileWithInvalidEntry.getBytes(StandardCharsets.UTF_8));
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytes(SAMPLE_DEFINITION_FILE_PATH));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("TOSCA Meta file with no entries", errors, 1);
}
@@ -110,9 +110,8 @@ public class SOL004MetaDirectoryValidatorTest {
final String entryTestFilePath = "Files/Tests";
final String entryLicenseFilePath = "Files/Licenses";
- final List<String> folderList = new ArrayList<>();
- folderList.add("Files/Tests/");
- folderList.add("Files/Licenses/");
+ handler.addFolder("Files/Tests/");
+ handler.addFolder("Files/Licenses/");
metaFile = metaFile +
TOSCA_META_ETSI_ENTRY_TESTS + ATTRIBUTE_VALUE_SEPARATOR.getToken() + entryTestFilePath + "\n" +
@@ -138,7 +137,7 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, folderList);
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertEquals(0, errors.size());
}
@@ -147,7 +146,7 @@ public class SOL004MetaDirectoryValidatorTest {
metaFile = "Entry-Events: Definitions/events.log";
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFile.getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE);
assertTrue(errors.size() == 1 && errorMessages.size() == 1);
assertSame(ErrorLevel.ERROR, errorMessages.get(0).getLevel());
@@ -180,7 +179,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Invalid TOSCA-Meta-File-Version and CSAR-Version attributes", errors, 2);
}
@@ -188,7 +187,7 @@ public class SOL004MetaDirectoryValidatorTest {
public void testGivenTOSCAMetaFile_withNonExistentFileReferenced_thenErrorsReturned() {
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFile.getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE);
assertTrue(errors.size() == 1 && errorMessages.size() == 3);
}
@@ -217,7 +216,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertEquals(0, errors.size());
}
@@ -249,7 +248,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertEquals(0, errors.size());
}
@@ -274,7 +273,7 @@ public class SOL004MetaDirectoryValidatorTest {
String manifest = manifestBuilder.build();
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifest.getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("", errors, 1);
}
@@ -303,7 +302,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest referenced import file missing", errors, 1);
}
@@ -330,7 +329,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Reference with invalid YAML format", errors, 1);
}
@@ -360,7 +359,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertEquals(0, errors.size());
}
@@ -392,7 +391,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with non existent source files", errors, 1);
}
@@ -407,7 +406,7 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytes(SAMPLE_DEFINITION_FILE_PATH));
handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, "".getBytes());
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("TOSCA manifest with invalid data", errors, 1);
}
@@ -430,7 +429,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertEquals(0, errors.size());
}
@@ -464,7 +463,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource("Definitions/MainServiceTemplate2.mf");
handler.addFile("Definitions/MainServiceTemplate2.mf", manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Main TOSCA definitions file and Manifest file with different name should return error",
errors, 1);
}
@@ -496,7 +495,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource("Definitions/MainServiceTemplate.txt");
handler.addFile("Definitions/MainServiceTemplate.txt", manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest file with different extension than .mf should return error",
errors, 1);
}
@@ -515,7 +514,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with valid vnf mandatory values should not return any errors", errors, 0);
}
@@ -536,7 +535,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with valid pnf mandatory values should not return any errors", errors, 0);
}
@@ -561,7 +560,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with mixed metadata should return error", errors, 1);
}
@@ -586,7 +585,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with missing vnf or pnf mandatory entries should return error", errors, 1);
}
@@ -609,7 +608,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with metadata missing pnf mandatory entries should return error", errors, 1);
}
@@ -632,7 +631,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with metadata missing vnf mandatory entries should return error", errors, 1);
}
@@ -660,7 +659,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest with more than 4 metadata entries should return error", errors, 1);
}
@@ -684,10 +683,8 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
-
- final List<String> folderList = new ArrayList<>();
- folderList.add("Files/Certificates/");
- final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, folderList);
+ handler.addFolder("Files/Certificates/");
+ final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Tosca.meta should not have entries applicable only to VF", errors, 2);
}
@@ -719,7 +716,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator.validateContent(handler);
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
@@ -756,7 +753,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
- final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList());
+ final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator.validateContent(handler);
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
@@ -791,7 +788,7 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler, Collections.emptyList());
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), Collections.emptyList());
}
@@ -829,7 +826,7 @@ public class SOL004MetaDirectoryValidatorTest {
);
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler, Collections.emptyList());
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -867,7 +864,7 @@ public class SOL004MetaDirectoryValidatorTest {
);
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler, Collections.emptyList());
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -905,7 +902,7 @@ public class SOL004MetaDirectoryValidatorTest {
);
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler, Collections.emptyList());
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
index 8081184f68..cc73bd766f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
@@ -52,6 +52,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.exception.OnboardPackageException;
import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.CandidateServiceImpl;
@@ -62,9 +63,6 @@ import org.openecomp.sdc.versioning.dao.types.Version;
public class UploadFileTest {
private static final Logger LOGGER = LoggerFactory.getLogger(UploadFileTest.class);
-
- private static final String USER1 = "vspTestUser1";
-
public static final Version VERSION01 = new Version(0, 1);
@Mock
@@ -98,21 +96,22 @@ public class UploadFileTest {
}
@Test
- public void testUploadFile() throws IOException {
+ public void testUploadFile() throws IOException, OnboardPackageException {
doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
try (final InputStream inputStream = getZipInputStream("/legalUpload")) {
onboardPackageInfo = new OnboardPackageInfo("legalUpload", OnboardingTypesEnum.ZIP.toString(),
- convertFileInputStream(inputStream));
+ convertFileInputStream(inputStream), OnboardingTypesEnum.ZIP);
candidateManager.upload(vspDetails, onboardPackageInfo);
}
}
- private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
+ private void testLegalUpload(String vspId, Version version, InputStream upload, String user)
+ throws IOException, OnboardPackageException {
onboardPackageInfo = new OnboardPackageInfo("file", OnboardingTypesEnum.ZIP.toString(),
- convertFileInputStream(upload));
+ convertFileInputStream(upload), OnboardingTypesEnum.ZIP);
final UploadFileResponse uploadFileResponse = candidateManager.upload(vspDetails, onboardPackageInfo);
- assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.ZIP);
+ assertEquals(OnboardingTypesEnum.ZIP, uploadFileResponse.getOnboardingType());
OrchestrationTemplateEntity uploadData = orchestrationTemplateDataDaoMock.get(vspId, version);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
index 7a183c0dbb..017ba2fbc2 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
@@ -45,6 +45,7 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.exception.OnboardPackageException;
import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.CandidateServiceImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.ManifestCreatorNamingConventionImpl;
@@ -119,23 +120,23 @@ public class UploadCSARFileTest {
}
@Test
- public void testUploadFileIsEmpty() throws Exception {
+ public void testUploadFileIsEmpty() throws OnboardPackageException {
doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
onboardPackageInfo = new OnboardPackageInfo("file", OnboardingTypesEnum.CSAR.toString(),
- ByteBuffer.wrap(new byte[]{}));
+ ByteBuffer.wrap(new byte[]{}), OnboardingTypesEnum.CSAR);
UploadFileResponse uploadFileResponse = candidateManager.upload(vspDetails, onboardPackageInfo);
assertEquals(1, uploadFileResponse.getErrors().size());
}
@Test
- public void testInvalidManifestContent() throws Exception {
+ public void testInvalidManifestContent() throws IOException, OnboardPackageException {
doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
try (InputStream inputStream = getClass()
.getResourceAsStream(BASE_DIR + "/invalidManifestContent.csar")) {
onboardPackageInfo = new OnboardPackageInfo("invalidManifestContent",
- OnboardingTypesEnum.CSAR.toString(), convertFileInputStream(inputStream));
+ OnboardingTypesEnum.CSAR.toString(), convertFileInputStream(inputStream), OnboardingTypesEnum.CSAR);
UploadFileResponse response =
candidateManager.upload(vspDetails, onboardPackageInfo);
assertEquals(1, response.getErrors().size());
@@ -156,12 +157,12 @@ public class UploadCSARFileTest {
}
private UploadFileResponse testCsarUpload(final String csarFileName,
- final int expectedErrorsNumber) throws IOException {
+ final int expectedErrorsNumber) throws IOException, OnboardPackageException {
UploadFileResponse uploadFileResponse;
try (final InputStream inputStream = getClass()
.getResourceAsStream(BASE_DIR + File.separator + csarFileName)) {
onboardPackageInfo = new OnboardPackageInfo(csarFileName, OnboardingTypesEnum.CSAR.toString(),
- convertFileInputStream(inputStream));
+ convertFileInputStream(inputStream), OnboardingTypesEnum.CSAR);
uploadFileResponse = candidateManager.upload(vspDetails, onboardPackageInfo);
assertThat(String.format("Expecting %s error(s) in file '%s'", expectedErrorsNumber, csarFileName), uploadFileResponse.getErrors().size(), is(expectedErrorsNumber));
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNFWithNonMano.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNFWithNonMano.mf
index 02275e1bca..23ceffd512 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNFWithNonMano.mf
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNFWithNonMano.mf
@@ -5,6 +5,7 @@ metadata:
pnfd_release_date_time: 2017-01-01T10:00:00+03:00
Source: MainServiceTemplate.yaml
+Source: Artifacts/Deployment/ANOTHER/authorized_keys
non_mano_artifact_sets:
onap_others:
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/csar-and-cms-in-root.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/csar-and-cms-in-root.zip
new file mode 100644
index 0000000000..07331466df
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/csar-and-cms-in-root.zip
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/fakeNonSignedZipPackage.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/fakeNonSignedZipPackage.zip
new file mode 100644
index 0000000000..b54fb5f7ff
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/fakeNonSignedZipPackage.zip
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package-tampered-data.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package-tampered-data.zip
new file mode 100644
index 0000000000..0cfb9e0265
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package-tampered-data.zip
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package.zip
new file mode 100644
index 0000000000..a64ddd9be2
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/signing/signed-package.zip
Binary files differ