f26ff584c86e7305914341674ce7095b4f24ebe0
[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     @Override
31     public SOL004MetaDirectoryValidator getSOL004MetaDirectoryValidator() {
32         return new SOL004Version3MetaDirectoryValidator();
33     }
34
35     @Override
36     public StringBuilder getMetaFileBuilder() {
37         return super.getMetaFileBuilder().append(OTHER_DEFINITIONS.getName())
38         .append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_DEFINITION_FILEPATH).append("\n");
39     }
40
41     @Override
42     protected SOL004MetaDirectoryValidator getSol004WithSecurity(SecurityManager securityManagerMock) {
43         return new SOL004Version3MetaDirectoryValidator(securityManagerMock);
44     }
45
46     @Override
47     protected ManifestBuilder getVnfManifestSampleBuilder() {
48         return super.getVnfManifestSampleBuilder()
49             .withMetaData(ManifestTokenType.VNFD_ID.getToken(), "2116fd24-83f2-416b-bf3c-ca1964793aca")
50             .withMetaData(ManifestTokenType.COMPATIBLE_SPECIFICATION_VERSIONS.getToken(), "2.7.1,3.3.1")
51             .withMetaData(ManifestTokenType.VNF_SOFTWARE_VERSION.getToken(), "1.0.0")
52             .withMetaData(ManifestTokenType.VNFM_INFO.getToken(), "etsivnfm:v2.3.1,0:myGreatVnfm-1");
53     }
54
55     @Override
56     protected ManifestBuilder getPnfManifestSampleBuilder() {
57         return super.getPnfManifestSampleBuilder()
58             .withMetaData(ManifestTokenType.COMPATIBLE_SPECIFICATION_VERSIONS.getToken(), "2.7.1,3.3.1");
59     }
60
61     @Override
62     protected int getManifestDefinitionErrorCount() {
63         return 2;
64     }
65 }