summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java41
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java171
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java78
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf18
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf12
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf15
13 files changed, 43 insertions, 361 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 275aee646b..19d06ed493 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -19,6 +19,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder.candidateDataNotProcessedOrAbortedErrorBuilder;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder.invalidProcessedCandidate;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder.vspMissingDeploymentFlavorErrorBuilder;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
@@ -106,8 +107,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageInvalidErrorBuilder
import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.TranslationFileCreationErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder;
+import org.openecomp.sdc.tosca.csar.Manifest;
+import org.openecomp.sdc.tosca.csar.OnboardingManifest;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIService;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIServiceImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
@@ -655,7 +660,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public PackageInfo createPackage(String vspId, Version version) {
+ public PackageInfo createPackage(String vspId, Version version) throws IOException {
ToscaServiceModel toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
Version vlmVersion = vspDetails.getVlmVersion();
@@ -669,7 +674,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
FileContentHandler licenseArtifacts = licenseArtifactsService
.createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion,
vspDetails.getFeatureGroups());
- //todo add tosca validation here
+ ETSIService etsiService = new ETSIServiceImpl();
+ if(etsiService.isSol004WithToscaMetaDirectory(toscaServiceModel.getArtifactFiles())){
+ FileContentHandler handler = toscaServiceModel.getArtifactFiles();
+ Manifest onboardingManifest = OnboardingManifest.parse(handler.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME));
+ etsiService.moveNonManoFileToArtifactFolder(handler, onboardingManifest);
+
+ }
packageInfo.setTranslatedFile(ByteBuffer.wrap(
toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts)));
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
index 4047937059..bfe602b3ad 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
@@ -31,7 +31,8 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest;
+import org.openecomp.sdc.tosca.csar.Manifest;
+import org.openecomp.sdc.tosca.csar.OnboardingManifest;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingToscaMetadata;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
@@ -45,7 +46,11 @@ import java.util.Optional;
import java.util.stream.Collectors;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.ELIGBLE_FOLDERS;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.ELIGIBLE_FILES;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME;
public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler
implements OrchestrationTemplateFileHandler {
@@ -114,7 +119,7 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH
try (InputStream fileContent = contentMap.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(fileContent);
+ Manifest onboardingManifest = OnboardingManifest.parse(fileContent);
if (!onboardingManifest.isValid()) {
onboardingManifest.getErrors().forEach(error -> uploadFileResponse.addStructureError(
SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, error)));
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
deleted file mode 100644
index ee81527a18..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright © 2016-2017 European Support Limited
- *
- * 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.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar;
-
-import com.google.common.collect.ImmutableSet;
-
-import static com.google.common.collect.ImmutableSet.of;
-public class CSARConstants {
-
- public static final ImmutableSet<String> ELIGBLE_FOLDERS = of("Artifacts/","Definitions/",
- "Licenses/", "TOSCA-Metadata/");
-
- public static final String MAIN_SERVICE_TEMPLATE_MF_FILE_NAME = "MainServiceTemplate.mf";
- public static final String MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME = "MainServiceTemplate.yaml";
- public static final String TOSCA_META_PATH_FILE_NAME="TOSCA-Metadata/TOSCA.meta";
- public static final String TOSCA_META_ENTRY_DEFINITIONS="Entry-Definitions";
- public static final ImmutableSet<String> ELIGIBLE_FILES =
- of(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME,MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME);
-
- public static final String METADATA_MF_ATTRIBUTE = "metadata";
- public static final String SOURCE_MF_ATTRIBUTE = "Source";
- public static final String SEPERATOR_MF_ATTRIBUTE = ":";
-
- private CSARConstants() {
-
- }
-}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
deleted file mode 100644
index fd3d3c43f2..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright © 2016-2017 European Support Limited
- *
- * 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.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.io.*;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-
-import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
-
-public class OnboardingManifest {
- private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingManifest.class);
- private Map<String, String> metadata;
- private List<String> sources;
- private List<String> errors;
- private State state;
- private enum State {
- START, PROCESS_METADATA, PROCESS_SOURCES, ERROR
- }
-
- public OnboardingManifest(InputStream is) {
- errors = new ArrayList<>();
- sources = new ArrayList<>();
- metadata = new HashMap<>();
- parseManifest(is);
- }
-
- private void parseManifest(InputStream is) {
- try {
- ImmutableList<String> lines = readAllLines(is);
- state = State.START;
-
- for (String line : lines) {
- line = line.trim();
- if (!StringUtils.isEmpty(line.trim())) {
- state = processLine(state, line);
- }
- }
- if (errors.isEmpty()) {
- if (metadata.isEmpty()) {
- errors.add(Messages.MANIFEST_NO_METADATA.getErrorMessage());
- }
- if (sources.isEmpty()) {
- errors.add(Messages.MANIFEST_NO_SOURCES.getErrorMessage());
- }
- }
- } catch (IOException e){
- LOGGER.error(e.getMessage(),e);
- errors.add(Messages.MANIFEST_PARSER_INTERNAL.getErrorMessage());
- }
- }
-
- private State processLine(State state, String line) {
- State newState = state;
- switch (state) {
- case START:
- newState = startProcessLine(state, line);
- break;
- case PROCESS_METADATA:
- newState = processMetaData(state, line);
- break;
- case PROCESS_SOURCES:
- processSourceLine(line);
-
- break;
- case ERROR:
- break;
- default:
- }
- return newState;
- }
-
- private State startProcessLine(State state, String line) {
- State newState = state;
- if (line.trim().equals(METADATA_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)) {
- newState = State.PROCESS_METADATA;
- } else {
- reportError(line);
- }
- return newState;
- }
-
- private State processMetaData(State state, String line) {
- State newState = state;
- String[] metaSplit = line.split(SEPERATOR_MF_ATTRIBUTE);
- if (metaSplit.length < 2){
- reportError(line);
- return state;
- }
- if (!metaSplit[0].equals(SOURCE_MF_ATTRIBUTE)){
- String value = line.replace(metaSplit[0] + SEPERATOR_MF_ATTRIBUTE, "").trim();
- metadata.put(metaSplit[0],value);
- } else {
- newState = State.PROCESS_SOURCES;
- processSourceLine(line);
- }
- return newState;
- }
-
- private void processSourceLine(String line) {
- if (line.startsWith(SOURCE_MF_ATTRIBUTE+SEPERATOR_MF_ATTRIBUTE)){
- String value = line.replaceAll(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE, "").trim();
- sources.add(value);
- }else {
- reportError(line);
- }
- }
-
- private void reportError(String line) {
- errors.add(getErrorWithParameters(Messages.MANIFEST_INVALID_LINE.getErrorMessage(), line));
- state = State.ERROR;
- }
-
- private ImmutableList<String> readAllLines(InputStream is) throws IOException {
- ImmutableList.Builder<String> builder = ImmutableList.<String> builder();
- try (Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8.newDecoder());
- BufferedReader bufferedReader = new BufferedReader(reader);) {
- for (; ; ) {
- String line = bufferedReader.readLine();
- if (line == null)
- break;
- builder.add(line);
- }
- }
- return builder.build();
- }
-
- public Map<String, String> getMetadata() {
- if (!isValid()){
- return Collections.emptyMap();
- }
- return ImmutableMap.copyOf(metadata);
- }
-
- public List<String> getSources() {
- if (!isValid()){
- return Collections.emptyList();
- }
- return ImmutableList.copyOf(sources);
- }
-
- public List<String> getErrors() {
- return ImmutableList.copyOf(errors);
- }
-
- public boolean isValid() {
- return errors.isEmpty();
- }
-}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java
index 037e76aa16..6f06289d96 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java
@@ -27,8 +27,8 @@ import java.io.IOException;
import org.apache.commons.io.IOUtils;
import java.util.List;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE;
public class OnboardingToscaMetadata {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml
new file mode 100644
index 0000000000..b7e4b5b502
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml
@@ -0,0 +1,19 @@
+nonManoKeyFolderMapping:
+ onap_ves_events:
+ location: VES_EVENTS
+ type: Deployment
+ onap_pm_dictionary:
+ location: PM_DICTIONARY
+ type: Deployment
+ onap_yang_modules:
+ location: YANG_MODULES
+ type: Deployment
+ onap_ansible_playbooks:
+ location: ANSIBLE_PLAYBOOK
+ type: Deployment
+ onap_scripts:
+ location: SCRIPTS
+ type: Deployment
+ onap_others:
+ location: OTHER
+ type: Informational \ 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/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index a858e18aea..6e9d1ea83c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -409,7 +409,7 @@ public class VendorSoftwareProductManagerImplTest {
}
@Test
- public void testCreatePackage() {
+ public void testCreatePackage() throws IOException {
/*VspDetails vspDetailsMock = new VspDetails("vspId", new Version(1, 0));
doReturn(vspDetailsMock).when(vspInfoDaoMock).get(anyObject());*/
VersionInfo versionInfo = new VersionInfo();
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java
deleted file mode 100644
index 687ddc18c4..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * 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.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest;
-
-import java.io.IOException;
-import java.io.InputStream;
-import org.testng.annotations.Test;
-
-
-public class ManifestParsingTest {
-
- @Test
- public void testSuccessfulParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
- assertTrue(onboardingManifest.isValid());
- assertEquals(onboardingManifest.getMetadata().size(), 4);
- assertEquals(onboardingManifest.getSources().size(), 5);
- }
- }
-
- @Test
- public void testNoMetadataParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca1.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
- assertFalse(onboardingManifest.isValid());
- assertTrue(onboardingManifest.getErrors().stream().anyMatch(error -> error
- .contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10))));
- }
- }
-
- @Test
- public void testBrokenMDParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
- assertFalse(onboardingManifest.isValid());
- assertTrue(onboardingManifest.getErrors().stream().anyMatch(error -> error
- .contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10))));
- }
- }
-
- @Test
- public void testNoMetaParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca4.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
- assertFalse(onboardingManifest.isValid());
- assertTrue(onboardingManifest.getErrors().stream().anyMatch(error -> error
- .contains(Messages.MANIFEST_NO_METADATA.getErrorMessage().substring(0, 10))));
- }
- }
-
-
-}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
deleted file mode 100644
index ebdec213d3..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-Source: MainServiceTemplate.yaml
-
-Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
-
-Source: Artifacts/install.sh
-
-Source: Artifacts/create_stack.sh
-
-Source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
deleted file mode 100644
index 057f54867b..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
+++ /dev/null
@@ -1,18 +0,0 @@
-metadata:
- vnf_product_name: Mock
- vnf_provider_id: ZTE
-
-Source: MainServiceTemplate.yaml
-
- vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
-
-
-
-Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
-
-Source: Artifacts/install.sh
-
-Source: Artifacts/create_stack.sh
-
-Source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
deleted file mode 100644
index 64e9445f7f..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
+++ /dev/null
@@ -1,7 +0,0 @@
-metadata:
- vnf_product_name: Mock
- vnf_provider_id: ZTE
- vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
-
-
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
deleted file mode 100644
index d8e291c4a3..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
+++ /dev/null
@@ -1,12 +0,0 @@
-metadata:
-
-
-Source: MainServiceTemplate.yaml
-
-Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
-
-Source: Artifacts/install.sh
-
-Source: Artifacts/create_stack.sh
-
-Source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
deleted file mode 100644
index b2accb7a1c..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
+++ /dev/null
@@ -1,15 +0,0 @@
-metadata:
- vnf_product_name: Mock
- vnf_provider_id: ZTE
- vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
-
-Source: MainServiceTemplate.yaml
-
-Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
-
-Source: Artifacts/install.sh
-
-Source: Artifacts/create_stack.sh
-
-Source: Licenses/license.xml