02ea3f2af3a1bc36c761cc3ef17df71f1261d6e0
[sdc.git] / openecomp-be / backend / openecomp-sdc-vendor-software-product-manager / src / test / java / org / openecomp / sdc / vendorsoftwareproduct / impl / orchestration / csar / validation / SOL004Version3MetaDirectoryValidatorTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2021 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ============LICENSE_END=========================================================
17  */
18
19 package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
20
21 import static org.openecomp.sdc.tosca.csar.ManifestTokenType.ATTRIBUTE_VALUE_SEPARATOR;
22 import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.OTHER_DEFINITIONS;
23 import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.TOSCA_DEFINITION_FILEPATH;
24
25 import org.openecomp.sdc.tosca.csar.ManifestTokenType;
26 import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager;
27
28 public class SOL004Version3MetaDirectoryValidatorTest extends SOL004MetaDirectoryValidatorTest {
29
30     private static int MANIFEST_DEFINITION_ERROR_COUNT_VERSION_3 = 2;
31
32     @Override
33     public SOL004MetaDirectoryValidator getSOL004MetaDirectoryValidator() {
34         return new SOL004Version3MetaDirectoryValidator();
35     }
36
37     @Override
38     public StringBuilder getMetaFileBuilder() {
39         return super.getMetaFileBuilder().append(OTHER_DEFINITIONS.getName())
40         .append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_DEFINITION_FILEPATH).append("\n");
41     }
42
43     @Override
44     protected SOL004MetaDirectoryValidator getSol004WithSecurity(SecurityManager securityManagerMock) {
45         return new SOL004Version3MetaDirectoryValidator(securityManagerMock);
46     }
47
48     @Override
49     protected ManifestBuilder getVnfManifestSampleBuilder() {
50         return super.getVnfManifestSampleBuilder()
51             .withMetaData(ManifestTokenType.VNFD_ID.getToken(), "2116fd24-83f2-416b-bf3c-ca1964793aca")
52             .withMetaData(ManifestTokenType.COMPATIBLE_SPECIFICATION_VERSIONS.getToken(), "2.7.1,3.3.1")
53             .withMetaData(ManifestTokenType.VNF_SOFTWARE_VERSION.getToken(), "1.0.0")
54             .withMetaData(ManifestTokenType.VNFM_INFO.getToken(), "etsivnfm:v2.3.1,0:myGreatVnfm-1");
55     }
56
57     @Override
58     protected ManifestBuilder getPnfManifestSampleBuilder() {
59         return super.getPnfManifestSampleBuilder()
60             .withMetaData(ManifestTokenType.COMPATIBLE_SPECIFICATION_VERSIONS.getToken(), "2.7.1,3.3.1");
61     }
62
63     @Override
64     protected int getManifestDefintionErrorCount() {
65         return MANIFEST_DEFINITION_ERROR_COUNT_VERSION_3;
66     }
67 }