15487d7ea03c332399d198131b596cb1c2f67862
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / impl / ServiceImportBussinessLogicBaseTestSetup.java
1 /*
2
3  * Copyright (c) 2018 AT&T Intellectual Property.
4
5  *
6
7  * Licensed under the Apache License, Version 2.0 (the "License");
8
9  * you may not use this file except in compliance with the License.
10
11  * You may obtain a copy of the License at
12
13  *
14
15  *     http://www.apache.org/licenses/LICENSE-2.0
16
17  *
18
19  * Unless required by applicable law or agreed to in writing, software
20
21  * distributed under the License is distributed on an "AS IS" BASIS,
22
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
25  * See the License for the specific language governing permissions and
26
27  * limitations under the License.
28
29  */
30
31 package org.openecomp.sdc.be.components.impl;
32
33 import fj.data.Either;
34
35 import java.io.IOException;
36 import java.lang.reflect.InvocationTargetException;
37 import java.lang.reflect.Method;
38 import java.nio.file.Files;
39 import java.nio.file.Path;
40 import java.nio.file.Paths;
41 import java.util.HashMap;
42 import java.util.Map;
43
44 import org.apache.commons.codec.binary.Base64;
45 import org.junit.Before;
46 import org.mockito.Mock;
47 import org.mockito.Mockito;
48 import org.openecomp.sdc.ElementOperationMock;
49 import org.openecomp.sdc.be.auditing.impl.AuditingManager;
50 import org.openecomp.sdc.be.components.csar.CsarArtifactsAndGroupsBusinessLogic;
51 import org.openecomp.sdc.be.components.csar.CsarInfo;
52 import org.openecomp.sdc.be.components.distribution.engine.DistributionEngine;
53 import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
54 import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic;
55 import org.openecomp.sdc.be.components.impl.utils.CreateServiceFromYamlParameter;
56 import org.openecomp.sdc.be.components.path.ForwardingPathValidator;
57 import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
58 import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation;
59 import org.openecomp.sdc.be.components.validation.UserValidations;
60 import org.openecomp.sdc.be.components.validation.component.*;
61 import org.openecomp.sdc.be.components.validation.service.*;
62 import org.openecomp.sdc.be.dao.api.ActionStatus;
63 import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
64 import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
65 import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
66 import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter;
67 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
68 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
69 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
70 import org.openecomp.sdc.be.externalapi.servlet.representation.*;
71 import org.openecomp.sdc.be.facade.operations.CatalogOperation;
72 import org.openecomp.sdc.be.impl.ComponentsUtils;
73 import org.openecomp.sdc.be.impl.WebAppContextWrapper;
74 import org.openecomp.sdc.be.model.*;
75 import org.openecomp.sdc.be.model.category.CategoryDefinition;
76 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation;
77 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
78 import org.openecomp.sdc.be.model.operations.api.IElementOperation;
79 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
80 import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
81 import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent;
82 import org.openecomp.sdc.be.servlets.AbstractValidationsServlet;
83 import org.openecomp.sdc.be.user.Role;
84 import org.openecomp.sdc.be.user.UserBusinessLogic;
85 import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
86 import org.openecomp.sdc.common.api.Constants;
87 import org.openecomp.sdc.common.api.UploadArtifactInfo;
88 import org.openecomp.sdc.exception.ResponseFormat;
89 import org.springframework.web.context.WebApplicationContext;
90
91 import javax.servlet.ServletContext;
92 import java.util.*;
93
94 import static org.assertj.core.api.Java6Assertions.assertThat;
95 import static org.junit.Assert.assertEquals;
96 import static org.mockito.ArgumentMatchers.*;
97 import static org.mockito.Mockito.when;
98
99 public class ServiceImportBussinessLogicBaseTestSetup extends BaseBusinessLogicMock {
100     protected ServiceImportBusinessLogic sIB1;
101     protected static final String SERVICE_CATEGORY = "Mobility";
102     protected static final String INSTANTIATION_TYPE = "A-la-carte";
103     protected final ServletContext servletContext = Mockito.mock(ServletContext.class);
104     protected UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class);
105     protected WebAppContextWrapper webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class);
106     protected WebApplicationContext webAppContext = Mockito.mock(WebApplicationContext.class);
107     protected ResponseFormatManager responseManager = null;
108     protected ComponentsUtils componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class));
109     protected AuditCassandraDao auditingDao = Mockito.mock(AuditCassandraDao.class);
110     protected ArtifactsBusinessLogic artifactBl = Mockito.mock(ArtifactsBusinessLogic.class);
111     protected GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class);
112     protected JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class);
113     protected ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
114     protected CsarArtifactsAndGroupsBusinessLogic csarArtifactsAndGroupsBusinessLogic = Mockito.mock(CsarArtifactsAndGroupsBusinessLogic.class);
115     protected GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class);
116     protected UserValidations userValidations = Mockito.mock(UserValidations.class);
117     protected ResourceAdminEvent auditArchive1 = Mockito.mock(ResourceAdminEvent.class);
118     protected CatalogOperation catalogOperation = Mockito.mock(CatalogOperation.class);
119     protected ResourceAdminEvent auditArchive2 = Mockito.mock(ResourceAdminEvent.class);
120     protected ResourceAdminEvent auditRestore = Mockito.mock(ResourceAdminEvent.class);
121     protected ServiceImportParseLogic serviceImportParseLogic = Mockito.mock(ServiceImportParseLogic.class);
122     IElementOperation mockElementDao = new ElementOperationMock();
123     DistributionEngine distributionEngine = Mockito.mock(DistributionEngine.class);
124     ServiceDistributionValidation serviceDistributionValidation = Mockito.mock(ServiceDistributionValidation.class);
125     ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class);
126     ForwardingPathValidator forwardingPathValidator = Mockito.mock(ForwardingPathValidator.class);
127     UiComponentDataConverter uiComponentDataConverter = Mockito.mock(UiComponentDataConverter.class);
128     NodeFilterOperation serviceFilterOperation = Mockito.mock(NodeFilterOperation.class);
129     NodeFilterValidator serviceFilterValidator = Mockito.mock(NodeFilterValidator.class);
130     protected ServiceTypeValidator serviceTypeValidator = new ServiceTypeValidator(componentsUtils);
131     protected ServiceCategoryValidator serviceCategoryValidator = new ServiceCategoryValidator(componentsUtils, mockElementDao);
132     protected ServiceRoleValidator serviceRoleValidator = new ServiceRoleValidator(componentsUtils);
133     protected ServiceFunctionValidator serviceFunctionValidator = new ServiceFunctionValidator(componentsUtils);
134     protected ServiceInstantiationTypeValidator serviceInstantiationTypeValidator = new ServiceInstantiationTypeValidator(componentsUtils);
135     protected ComponentDescriptionValidator componentDescriptionValidator = new ComponentDescriptionValidator(componentsUtils);
136     protected ComponentProjectCodeValidator componentProjectCodeValidator = new ComponentProjectCodeValidator(componentsUtils);
137     protected ComponentIconValidator componentIconValidator = new ComponentIconValidator(componentsUtils);
138     protected ComponentContactIdValidator componentContactIdValidator = new ComponentContactIdValidator(componentsUtils);
139     protected ComponentTagsValidator componentTagsValidator = new ComponentTagsValidator(componentsUtils);
140     protected ComponentNameValidator componentNameValidator = new ComponentNameValidator(componentsUtils, toscaOperationFacade);
141     protected final ComponentValidator componentValidator = Mockito.mock(ComponentValidator.class);
142     protected ServiceValidator serviceValidator = createServiceValidator();
143
144     protected User user = null;
145     protected Resource genericService = null;
146
147     private static final String RESOURCE_NAME = "My-Resource_Name with   space";
148     private static final String RESOURCE_TOSCA_NAME = "My-Resource_Tosca_Name";
149     private static final String RESOURCE_CATEGORY1 = "Network Layer 2-3";
150     private static final String RESOURCE_SUBCATEGORY = "Router";
151     protected static final String CERTIFIED_VERSION = "1.0";
152     protected static final String UNCERTIFIED_VERSION = "0.2";
153     protected static final String COMPONNET_ID = "myUniqueId";
154     protected static final String GENERIC_SERVICE_NAME = "org.openecomp.resource.abstract.nodes.service";
155
156     protected static final String SERVICE_ROLE = JsonPresentationFields.SERVICE_ROLE.getPresentation();
157     protected static final String SERVICE_TYPE = JsonPresentationFields.SERVICE_TYPE.getPresentation();
158     protected static final String SERVICE_FUNCTION = JsonPresentationFields.SERVICE_FUNCTION.getPresentation();
159
160     public ServiceImportBussinessLogicBaseTestSetup() {
161
162     }
163
164     protected ServiceValidator createServiceValidator() {
165         List<ComponentFieldValidator> componentFieldValidators = Arrays.asList(componentContactIdValidator,
166                 componentDescriptionValidator,
167                 componentIconValidator, componentNameValidator,
168                 new ComponentProjectCodeValidator(componentsUtils),
169                 componentTagsValidator);
170
171         List<ServiceFieldValidator> serviceFieldValidators = Arrays.asList(serviceCategoryValidator, new ServiceEnvironmentContextValidator(),
172                 serviceInstantiationTypeValidator, new ServiceNamingPolicyValidator(componentsUtils),
173                 serviceRoleValidator, serviceTypeValidator);
174         return new ServiceValidator(componentsUtils, componentFieldValidators, serviceFieldValidators);
175     }
176
177     @Before
178     public void setup() {
179
180         // Elements
181         IElementOperation mockElementDao = new ElementOperationMock();
182
183         // User data and management
184         user = new User();
185         user.setUserId("jh0003");
186         user.setFirstName("Jimmi");
187         user.setLastName("Hendrix");
188         user.setRole(Role.ADMIN.name());
189
190         when(mockUserAdmin.getUser("jh0003", false)).thenReturn(user);
191         when(userValidations.validateUserExists(eq("jh0003"))).thenReturn(user);
192         when(userValidations.validateUserNotEmpty(eq(user), anyString())).thenReturn(user);
193 //        when(userValidations.validateUserRole(user))
194         // Servlet Context attributes
195         when(servletContext.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).thenReturn(configurationManager);
196 //        when(servletContext.getAttribute(Constants.SERVICE_OPERATION_MANAGER)).thenReturn(new ServiceOperation());
197         when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(webAppContextWrapper);
198         when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webAppContext);
199         when(webAppContext.getBean(IElementOperation.class)).thenReturn(mockElementDao);
200         when(graphLockOperation.lockComponent(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Service))).thenReturn(StorageOperationStatus.OK);
201         when(graphLockOperation.lockComponentByName(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Service))).thenReturn(StorageOperationStatus.OK);
202         when(catalogOperation.updateCatalog(Mockito.any(), Mockito.any())).thenReturn(ActionStatus.OK);
203         // artifact bussinesslogic
204         ArtifactDefinition artifactDef = new ArtifactDefinition();
205         when(artifactBl.createArtifactPlaceHolderInfo(Mockito.any(), Mockito.anyString(), Mockito.anyMap(), Mockito.any(User.class), Mockito.any(ArtifactGroupTypeEnum.class))).thenReturn(artifactDef);
206
207         // createService
208         Service serviceResponse = createServiceObject(true);
209         Either<Component, StorageOperationStatus> eitherCreate = Either.left(serviceResponse);
210         when(toscaOperationFacade.createToscaComponent(Mockito.any(Component.class))).thenReturn(eitherCreate);
211         when(toscaOperationFacade.getToscaElement(Mockito.anyString())).thenReturn(eitherCreate);
212         Either<Boolean, StorageOperationStatus> eitherCount = Either.left(false);
213         when(toscaOperationFacade.validateComponentNameExists("Service", null, ComponentTypeEnum.SERVICE)).thenReturn(eitherCount);
214         Either<Boolean, StorageOperationStatus> eitherCountExist = Either.left(true);
215         when(toscaOperationFacade.validateComponentNameExists("alreadyExist", null, ComponentTypeEnum.SERVICE)).thenReturn(eitherCountExist);
216         when(userValidations.validateUserExists(user)).thenReturn(user);
217
218         // createResource
219         Resource resourceRsponse = createParseResourceObject(true);
220         Either<Component, StorageOperationStatus> eitherResourceCreate = Either.left(resourceRsponse);
221         when(toscaOperationFacade.createToscaComponent(Mockito.any(Component.class))).thenReturn(eitherResourceCreate);
222         Either<Component, StorageOperationStatus> eitherResourceRes = Either.left(resourceRsponse);
223         when(toscaOperationFacade.getToscaFullElement(Mockito.anyString())).thenReturn(eitherResourceRes);
224
225         Either<Boolean, StorageOperationStatus> eitherResourceCount = Either.left(false);
226         when(toscaOperationFacade.validateComponentNameExists("Resource", null, ComponentTypeEnum.RESOURCE)).thenReturn(eitherResourceCount);
227         Either<Boolean, StorageOperationStatus> eitherResourceCountExist = Either.left(true);
228         when(toscaOperationFacade.validateComponentNameExists("alreadyExist", null, ComponentTypeEnum.RESOURCE)).thenReturn(eitherResourceCountExist);
229
230         genericService = setupGenericServiceMock();
231         Either<Resource, StorageOperationStatus> findLatestGeneric = Either.left(genericService);
232         when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_SERVICE_NAME)).thenReturn(findLatestGeneric);
233
234         when(serviceImportParseLogic.isArtifactDeletionRequired(anyString(),any(),anyBoolean())).thenReturn(true);
235         Either<Boolean, ResponseFormat> validateCGD = Either.left(true);
236         when(serviceImportParseLogic.validateCyclicGroupsDependencies(any())).thenReturn(validateCGD);
237
238         sIB1 = new ServiceImportBusinessLogic(elementDao, groupOperation, groupInstanceOperation,
239                 groupTypeOperation, groupBusinessLogic, interfaceOperation, interfaceLifecycleTypeOperation,
240                 artifactBl, distributionEngine, componentInstanceBusinessLogic,
241                 serviceDistributionValidation, forwardingPathValidator, uiComponentDataConverter, serviceFilterOperation,
242                 serviceFilterValidator, artifactToscaOperation, componentContactIdValidator,
243                 componentNameValidator, componentTagsValidator, componentValidator,
244                 componentIconValidator, componentProjectCodeValidator, componentDescriptionValidator);
245
246
247         mockAbstract();
248
249         responseManager = ResponseFormatManager.getInstance();
250     }
251
252     protected Service createServiceObject(boolean afterCreate) {
253         Service service = new Service();
254         service.setUniqueId("sid");
255         service.setName("Service");
256         CategoryDefinition category = new CategoryDefinition();
257         category.setName(SERVICE_CATEGORY);
258         category.setIcons(Collections.singletonList("defaulticon"));
259         List<CategoryDefinition> categories = new ArrayList<>();
260         categories.add(category);
261         service.setCategories(categories);
262         service.setInstantiationType(INSTANTIATION_TYPE);
263
264         service.setDescription("description");
265         List<String> tgs = new ArrayList<>();
266         tgs.add(service.getName());
267         service.setTags(tgs);
268         // service.setVendorName("Motorola");
269         // service.setVendorRelease("1.0.0");
270         service.setIcon("defaulticon");
271         // service.setState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
272         service.setContactId("aa1234");
273         service.setProjectCode("12345");
274         service.setEcompGeneratedNaming(true);
275
276         if (afterCreate) {
277             service.setVersion("0.1");
278             service.setUniqueId(service.getName() + ":" + service.getVersion());
279             service.setCreatorUserId(user.getUserId());
280             service.setCreatorFullName(user.getFirstName() + " " + user.getLastName());
281         }
282         return service;
283     }
284
285     protected Resource createResourceObject(boolean afterCreate) {
286         Resource resource = new Resource();
287         resource.setUniqueId("sid");
288         resource.setName("Service");
289         CategoryDefinition category = new CategoryDefinition();
290         category.setName(SERVICE_CATEGORY);
291         category.setIcons(Collections.singletonList("defaulticon"));
292         List<CategoryDefinition> categories = new ArrayList<>();
293         categories.add(category);
294         resource.setCategories(categories);
295
296
297         resource.setDescription("description");
298         List<String> tgs = new ArrayList<>();
299         tgs.add(resource.getName());
300         resource.setTags(tgs);
301         resource.setIcon("defaulticon");
302         resource.setContactId("aa1234");
303         resource.setProjectCode("12345");
304
305
306         if (afterCreate) {
307             resource.setVersion("0.1");
308             resource.setUniqueId(resource.getName() + ":" + resource.getVersion());
309             resource.setCreatorUserId(user.getUserId());
310             resource.setCreatorFullName(user.getFirstName() + " " + user.getLastName());
311         }
312         return resource;
313     }
314         
315 protected Resource createParseResourceObject(boolean afterCreate) {
316         Resource resource = new Resource();
317         resource.setName(RESOURCE_NAME);
318         resource.setToscaResourceName(RESOURCE_TOSCA_NAME);
319         resource.addCategory(RESOURCE_CATEGORY1, RESOURCE_SUBCATEGORY);
320         resource.setDescription("My short description");
321         List<String> tgs = new ArrayList<>();
322         tgs.add("test");
323         tgs.add(resource.getName());
324         resource.setTags(tgs);
325         List<String> template = new ArrayList<>();
326         template.add("tosca.nodes.Root");
327         resource.setDerivedFrom(template);
328         resource.setVendorName("Motorola");
329         resource.setVendorRelease("1.0.0");
330         resource.setContactId("ya5467");
331         resource.setIcon("defaulticon");
332         Map<String, List<RequirementDefinition>> requirements = new HashMap<>();
333         List<RequirementDefinition> requirementDefinitionList= new ArrayList<>();
334         requirements.put("test", requirementDefinitionList);
335         resource.setRequirements(requirements);
336
337         if (afterCreate) {
338             resource.setName(resource.getName());
339             resource.setVersion("0.1");
340             resource.setUniqueId(resource.getName()
341                     .toLowerCase() + ":" + resource.getVersion());
342             resource.setCreatorUserId(user.getUserId());
343             resource.setCreatorFullName(user.getFirstName() + " " + user.getLastName());
344             resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
345         }
346         return resource;
347     }
348     protected Resource setupGenericServiceMock() {
349         Resource genericService = new Resource();
350         genericService.setVersion("1.0");
351         genericService.setToscaResourceName(GENERIC_SERVICE_NAME);
352         return genericService;
353     }
354
355     protected UploadComponentInstanceInfo createUploadComponentInstanceInfo(){
356         UploadComponentInstanceInfo uploadComponentInstanceInfo = new UploadComponentInstanceInfo();
357         uploadComponentInstanceInfo.setName("UploadComponentInstanceInfo");
358         return uploadComponentInstanceInfo;
359     }
360
361     private void mockAbstract() {
362         checkCreateAbstract();
363         checkCreateOther();
364         checkCreateFile();
365     }
366
367     private void checkCreateAbstract(){
368         AbstractResourceInfo abstractResourceInfo = new AbstractResourceInfo();
369         List<RequirementCapabilityRelDef> componentInstancesRelations = new ArrayList<>();
370         abstractResourceInfo.setComponentInstancesRelations(componentInstancesRelations);
371         abstractResourceInfo.setAbstractResourceUniqueId("abstractResourceUniqueId");
372         abstractResourceInfo.setAbstractResourceName("abstractResourceName");
373         abstractResourceInfo.setAbstractResourceUUid("abstractResourceUUid");
374
375         AbstractResourceInfo getAbstractResourceInfo = new AbstractResourceInfo();
376         getAbstractResourceInfo.getAbstractResourceName();
377         getAbstractResourceInfo.getAbstractResourceUniqueId();
378         getAbstractResourceInfo.getAbstractResourceUUid();
379         getAbstractResourceInfo.getComponentInstancesRelations();
380
381         AbstractTemplateInfo createAbstractTemplateInfo = new AbstractTemplateInfo();
382         List<AbstractResourceInfo> abstractResourceInfoList = new ArrayList<>();
383         abstractResourceInfoList.add(abstractResourceInfo);
384         createAbstractTemplateInfo.setAbstractResourceInfoList(abstractResourceInfoList);
385         createAbstractTemplateInfo.setServiceUniqueId("serviceUniqueId");
386         createAbstractTemplateInfo.setIsAbstractTemplate(true);
387         createAbstractTemplateInfo.setServiceUUid("serviceUUid");
388
389         AbstractTemplateInfo getAbstractTemplateInfo = new AbstractTemplateInfo();
390         getAbstractTemplateInfo.getAbstractResourceInfoList();
391         getAbstractTemplateInfo.getIsAbstractTemplate();
392         getAbstractTemplateInfo.getServiceUniqueId();
393         getAbstractTemplateInfo.getServiceUUid();
394
395         CopyServiceInfo copyServiceInfo = new CopyServiceInfo();
396         copyServiceInfo.setNewServiceName("newServiceName");
397         copyServiceInfo.setNewServiceUUid("serviceUUid");
398         copyServiceInfo.setOldServiceUUid("oldServiceUUid");
399
400         CopyServiceInfo getCopyServiceInfo = new CopyServiceInfo();
401         getCopyServiceInfo.getNewServiceName();
402         getCopyServiceInfo.getNewServiceUUid();
403         getCopyServiceInfo.getOldServiceUUid();
404
405         ReplaceVNFInfo replaceVNFInfo = new ReplaceVNFInfo();
406         ComponentInstance realVNFComponentInstance = new ComponentInstance();
407         replaceVNFInfo.setAbstractResourceUniqueId("abstractResourceUniqueId");
408         replaceVNFInfo.setRealVNFComponentInstance(realVNFComponentInstance);
409         replaceVNFInfo.setServiceUniqueId("serviceUniqueId");
410
411         ReplaceVNFInfo getReplaceVNFInfo = new ReplaceVNFInfo();
412         getReplaceVNFInfo.getServiceUniqueId();
413         getReplaceVNFInfo.getAbstractResourceUniqueId();
414         getReplaceVNFInfo.getRealVNFComponentInstance();
415     }
416
417     private void checkCreateOther(){
418         ResourceInstanceMetadata resourceInstanceMetadata = new ResourceInstanceMetadata();
419         List<ArtifactMetadata> artifacts = new ArrayList<>();
420         resourceInstanceMetadata.setArtifacts(artifacts);
421         resourceInstanceMetadata.setResoucreType("resoucreType");
422         resourceInstanceMetadata.setResourceInstanceName("resourceInstanceName");
423         resourceInstanceMetadata.setResourceInvariantUUID("resourceInvariantUUID");
424         resourceInstanceMetadata.setResourceName("resourceName");
425         resourceInstanceMetadata.setResourceUUID("resourceUUID");
426         resourceInstanceMetadata.setResourceVersion("resourceVersion");
427
428         ResourceInstanceMetadata getResourceInstanceMetadata = new ResourceInstanceMetadata();
429         getResourceInstanceMetadata.getArtifacts();
430         getResourceInstanceMetadata.getResoucreType();
431         getResourceInstanceMetadata.getResourceInstanceName();
432         getResourceInstanceMetadata.getResourceInvariantUUID();
433         getResourceInstanceMetadata.getResourceName();
434         getResourceInstanceMetadata.getResourceUUID();
435         getResourceInstanceMetadata.getResourceVersion();
436
437         UploadServiceInfo uploadServiceInfo = new UploadServiceInfo();
438         List<String> tags = new ArrayList<>();
439         List<CategoryDefinition> categories = new ArrayList<>();
440         List<UploadArtifactInfo> artifactList = new ArrayList<>();
441         uploadServiceInfo.setProjectCode("projectCode");
442         uploadServiceInfo.setCategories(categories);
443         uploadServiceInfo.setServiceType("");
444         uploadServiceInfo.setServiceVendorModelNumber("serviceVendorModelNumber");
445         uploadServiceInfo.setVendorRelease("vendorRelease");
446         uploadServiceInfo.setVendorName("vendorName");
447         uploadServiceInfo.setServiceIconPath("serviceIconPath");
448         uploadServiceInfo.setName("uploadServiceInfo");
449         uploadServiceInfo.setContactId("contactId");
450         uploadServiceInfo.setIcon("icon");
451         uploadServiceInfo.setNamingPolicy("namingPolicy");
452         uploadServiceInfo.setEcompGeneratedNaming("ecompGeneratedNaming");
453         uploadServiceInfo.setServiceEcompNaming("serviceEcompNaming");
454         uploadServiceInfo.setServiceRole("serviceRole");
455         uploadServiceInfo.setSubcategory("subcategory");
456         uploadServiceInfo.setCategory("category");
457         uploadServiceInfo.setType("type");
458         uploadServiceInfo.setUUID("UUID");
459         uploadServiceInfo.setInvariantUUID("invariantUUID");
460         uploadServiceInfo.setResourceVendorRelease("resourceVendorRelease");
461         uploadServiceInfo.setResourceVendor("resourceVendor");
462         uploadServiceInfo.setDescription("description");
463         uploadServiceInfo.setTags(tags);
464         uploadServiceInfo.setArtifactList(artifactList);
465         uploadServiceInfo.setPayloadName("payloadName");
466         uploadServiceInfo.setPayloadData("payloadData");
467     }
468
469     protected void checkGetUploadServiceInfo(){
470         UploadServiceInfo uploadServiceInfo = new UploadServiceInfo();
471         List<String> tags = new ArrayList<>();
472         List<CategoryDefinition> categories = new ArrayList<>();
473         List<UploadArtifactInfo> artifactList = new ArrayList<>();
474         uploadServiceInfo.getProjectCode();
475         uploadServiceInfo.getCategories();
476         uploadServiceInfo.getServiceType();
477         uploadServiceInfo.getServiceVendorModelNumber();
478         uploadServiceInfo.getVendorRelease();
479         uploadServiceInfo.getVendorName();
480         uploadServiceInfo.getServiceIconPath();
481         uploadServiceInfo.getName();
482         uploadServiceInfo.getContactId();
483         uploadServiceInfo.getIcon();
484         uploadServiceInfo.getNamingPolicy();
485         uploadServiceInfo.getEcompGeneratedNaming();
486         uploadServiceInfo.getServiceEcompNaming();
487         uploadServiceInfo.getServiceRole();
488         uploadServiceInfo.getSubcategory();
489         uploadServiceInfo.getCategory();
490         uploadServiceInfo.getType();
491         uploadServiceInfo.getUUID();
492         uploadServiceInfo.getInvariantUUID();
493         uploadServiceInfo.getResourceVendorRelease();
494         uploadServiceInfo.getResourceVendor();
495         uploadServiceInfo.getDescription();
496         uploadServiceInfo.getTags();
497         uploadServiceInfo.getArtifactList();
498         uploadServiceInfo.getPayloadName();
499         uploadServiceInfo.getPayloadData();
500     }
501
502     private void checkCreateFile(){
503         CreateServiceFromYamlParameter csfp = new CreateServiceFromYamlParameter();
504         Map<String, NodeTypeInfo> nodeTypesInfo = new HashMap<>();
505         ParsedToscaYamlInfo parsedToscaYamlInfo = new ParsedToscaYamlInfo();
506         List<ArtifactDefinition> createdArtifacts = new ArrayList<>();
507         CsarInfo csarInfo = getCsarInfo();
508         csfp.setYamlName("yamlName");
509         csfp.setNodeTypesInfo(nodeTypesInfo);
510         csfp.setParsedToscaYamlInfo(parsedToscaYamlInfo);
511         csfp.setCsarInfo(csarInfo);
512         csfp.setCreatedArtifacts(createdArtifacts);
513         csfp.setYamlName("yamlName");
514         csfp.setShouldLock(true);
515         csfp.setInTransaction(true);
516         csfp.setNodeName("nodeName");
517
518         CreateServiceFromYamlParameter getCsfy = new CreateServiceFromYamlParameter();
519         getCsfy.getYamlName();
520         getCsfy.getNodeTypesInfo();
521         getCsfy.getParsedToscaYamlInfo();
522         getCsfy.getCsarInfo();
523         getCsfy.getCreatedArtifacts();
524         getCsfy.getYamlName();
525         getCsfy.isShouldLock();
526         getCsfy.isInTransaction();
527         getCsfy.getNodeName();
528     }
529
530     protected CsarInfo getCsarInfo ()
531     {
532         String csarUuid = "0010";
533         User user = new User();
534         Map<String, byte[]> csar = crateCsarFromPayload();
535         String vfReousrceName = "resouceName";
536         String mainTemplateName = "mainTemplateName";
537         String mainTemplateContent = getMainTemplateContent();
538         final Service service = createServiceObject(false);
539         CsarInfo csarInfo = new CsarInfo(user, csarUuid,  csar, vfReousrceName, mainTemplateName, mainTemplateContent, false);
540         return csarInfo;
541     }
542
543     protected Map<String, byte[]> crateCsarFromPayload() {
544         String payloadName = "valid_vf.csar";
545         byte[] data = new byte[1024];
546         Map<String, byte[]> returnValue = new HashMap<>();
547         returnValue.put(payloadName,data);
548
549         return returnValue;
550     }
551
552     protected String getGroupsYaml(){
553         return "zxjTestImportServiceAb 0:\n" +
554                 "      type: org.openecomp.resource.vf.Zxjtestimportserviceab\n" +
555                 "      metadata:\n" +
556                 "        invariantUUID: 41474f7f-3195-443d-a0a2-eb6020a56279\n" +
557                 "        UUID: 92e32e49-55f8-46bf-984d-a98c924037ec\n" +
558                 "        customizationUUID: 40286158-96d0-408e-9f27-21d43817d37c\n" +
559                 "        version: '1.0'\n" +
560                 "        name: zxjTestImportServiceAb\n" +
561                 "        description: zxjTestImportServiceAbstract\n" +
562                 "        type: VF\n" +
563                 "        category: Generic\n" +
564                 "        subcategory: Abstract\n" +
565                 "        resourceVendor: zxjImportService\n" +
566                 "        resourceVendorRelease: '1.0'\n" +
567                 "        resourceVendorModelNumber: ''\n" +
568                 "      properties:\n" +
569                 "        skip_post_instantiation_configuration: true\n" +
570                 "        nf_naming:\n" +
571                 "          ecomp_generated_naming: true\n" +
572                 "        multi_stage_design: 'false'\n" +
573                 "        controller_actor: SO-REF-DATA\n" +
574                 "        availability_zone_max_count: 1\n" +
575                 "      requirements:\n" +
576                 "      - imagefile.dependency:\n" +
577                 "          capability: feature\n" +
578                 "          node: ext ZTE VL 0\n" +
579                 "      - mme_ipu_vdu.dependency:\n" +
580                 "          capability: feature\n" +
581                 "          node: ExtCP 0\n" +
582                 "      capabilities:\n" +
583                 "        mme_ipu_vdu.scalable:\n" +
584                 "          properties:\n" +
585                 "            max_instances: 1\n" +
586                 "            min_instances: 1\n" +
587                 "        mme_ipu_vdu.nfv_compute:\n" +
588                 "          properties:\n" +
589                 "            num_cpus: '2'\n" +
590                 "            flavor_extra_specs: {\n" +
591                 "              }\n" +
592                 "            mem_size: '8192'";
593     }
594
595     protected String getYamlFileContent(){
596         return "tosca_definitions_version: tosca_simple_yaml_1_1\n" +
597                 "imports:\n" +
598                 "- data.yml\n" +
599                 "group_types:\n" +
600                 "  tosca.groups.Root:\n" +
601                 "    description: The TOSCA Group Type all other TOSCA Group Types derive from\n" +
602                 "    interfaces:\n" +
603                 "      Standard:\n" +
604                 "        type: tosca.interfaces.node.lifecycle.Standard\n" +
605                 "  org.openecomp.groups.heat.HeatStack:\n" +
606                 "    derived_from: tosca.groups.Root\n" +
607                 "    description: Grouped all heat resources which are in the same heat stack\n" +
608                 "    properties:\n" +
609                 "      heat_file:\n" +
610                 "        type: string\n" +
611                 "        description: Heat file which associate to this group/heat stack\n" +
612                 "        required: true\n" +
613                 "        status: supported\n" +
614                 "      description:\n" +
615                 "        type: string\n" +
616                 "        description: group description\n" +
617                 "        required: true\n" +
618                 "        status: supported\n" +
619                 "  org.openecomp.groups.VfModule:\n" +
620                 "    derived_from: tosca.groups.Root\n" +
621                 "    description: Grouped all heat resources which are in the same VF Module\n" +
622                 "    properties:\n" +
623                 "      isBase:\n" +
624                 "        type: boolean\n" +
625                 "        description: Whether this module should be deployed before other modules\n" +
626                 "        required: true\n" +
627                 "        default: false\n" +
628                 "        status: supported\n" +
629                 "      vf_module_label:\n" +
630                 "        type: string\n" +
631                 "        required: true\n" +
632                 "        description: |\n" +
633                 "          Alternate textual key used to reference this VF-Module model. Must be unique within the VNF model\n" +
634                 "      vf_module_description:\n" +
635                 "        type: string\n" +
636                 "        required: true\n" +
637                 "        description: |\n" +
638                 "          Description of the VF-modules contents and purpose (e.g. \"Front-End\" or \"Database Cluster\")\n" +
639                 "      min_vf_module_instances:\n" +
640                 "        type: integer\n" +
641                 "        required: true\n" +
642                 "        description: The minimum instances of this VF-Module\n" +
643                 "      max_vf_module_instances:\n" +
644                 "        type: integer\n" +
645                 "        required: false\n" +
646                 "        description: The maximum instances of this VF-Module\n" +
647                 "      initial_count:\n" +
648                 "        type: integer\n" +
649                 "        required: false\n" +
650                 "        description: |\n" +
651                 "          The initial count of instances of the VF-Module. The value must be in the range between min_vfmodule_instances and max_vfmodule_instances. If no value provided the initial count is the min_vfmodule_instances.\n" +
652                 "      vf_module_type:\n" +
653                 "        type: string\n" +
654                 "        required: true\n" +
655                 "        constraint:\n" +
656                 "        - valid_values:\n" +
657                 "          - Base\n" +
658                 "          - Expansion\n" +
659                 "      volume_group:\n" +
660                 "        type: boolean\n" +
661                 "        required: true\n" +
662                 "        default: false\n" +
663                 "        description: |\n" +
664                 "          \"true\" indicates that this VF Module model requires attachment to a Volume Group. VID operator must select the Volume Group instance to attach to a VF-Module at deployment time.\n" +
665                 "      availability_zone_count:\n" +
666                 "        type: integer\n" +
667                 "        required: false\n" +
668                 "        description: |\n" +
669                 "          Quantity of Availability Zones needed for this VF-Module (source: Extracted from VF-Module HEAT template)\n" +
670                 "      vfc_list:\n" +
671                 "        type: map\n" +
672                 "        entry_schema:\n" +
673                 "          description: <vfc_id>:<count>\n" +
674                 "          type: string\n" +
675                 "        required: false\n" +
676                 "        description: |\n" +
677                 "          Identifies the set of VM types and their count included in the VF-Module\n" +
678                 "  org.openecomp.groups.NetworkCollection:\n" +
679                 "    derived_from: tosca.groups.Root\n" +
680                 "    description: groups l3-networks in network collection\n" +
681                 "    properties:\n" +
682                 "      network_collection_function:\n" +
683                 "        type: string\n" +
684                 "        required: true\n" +
685                 "        description: network collection function\n" +
686                 "      network_collection_description:\n" +
687                 "        type: string\n" +
688                 "        required: true\n" +
689                 "        description: network collection description, free format text\n" +
690                 "  org.openecomp.groups.VfcInstanceGroup:\n" +
691                 "    derived_from: tosca.groups.Root\n" +
692                 "    description: groups VFCs with same parent port role\n" +
693                 "    properties:\n" +
694                 "      vfc_instance_group_function:\n" +
695                 "        type: string\n" +
696                 "        required: true\n" +
697                 "        description: function of this VFC group\n" +
698                 "      vfc_parent_port_role:\n" +
699                 "        type: string\n" +
700                 "        required: true\n" +
701                 "        description: common role of parent ports of VFCs in this group\n" +
702                 "      network_collection_function:\n" +
703                 "        type: string\n" +
704                 "        required: true\n" +
705                 "        description: network collection function assigned to this group\n" +
706                 "      subinterface_role:\n" +
707                 "        type: string\n" +
708                 "        required: true\n" +
709                 "        description: common role of subinterfaces of VFCs in this group, criteria the group is created\n" +
710                 "    capabilities:\n" +
711                 "      vlan_assignment:\n" +
712                 "        type: org.openecomp.capabilities.VLANAssignment\n" +
713                 "        properties:\n" +
714                 "          vfc_instance_group_reference:\n" +
715                 "            type: string\n" +
716                 "  tosca.groups.nfv.PlacementGroup:\n" +
717                 "    derived_from: tosca.groups.Root\n" +
718                 "    description: PlacementGroup is used for describing the affinity or anti-affinity relationship applicable between the virtualization containers to be created based on different VDUs, or between internal VLs to be created based on different VnfVirtualLinkDesc(s)\n" +
719                 "    properties:\n" +
720                 "      description:\n" +
721                 "        type: string\n" +
722                 "        description: Human readable description of the group\n" +
723                 "        required: true\n" +
724                 "    members:\n" +
725                 "    - tosca.nodes.nfv.Vdu.Compute\n" +
726                 "    - tosca.nodes.nfv.VnfVirtualLink";
727     }
728
729     public String getMainTemplateContent(){
730         return "tosca_definitions_version: tosca_simple_yaml_1_1\n"
731                 + "metadata:\n"
732                 + "  invariantUUID: 6d17f281-683b-4198-a676-0faeecdc9025\n"
733                 + "  UUID: bfeab6b4-199b-4a2b-b724-de416c5e9811\n"
734                 + "  name: ser09080002\n"
735                 + "  description: ser09080002\n"
736                 + "  type: Service\n"
737                 + "  category: E2E Service\n"
738                 + "  serviceType: ''\n"
739                 + "  serviceRole: ''\n"
740                 + "  instantiationType: A-la-carte\n"
741                 + "  serviceEcompNaming: true\n"
742                 + "  ecompGeneratedNaming: true\n"
743                 + "  namingPolicy: ''\n"
744                 + "  environmentContext: General_Revenue-Bearing\n"
745                 + "  serviceFunction: ''\n"
746                 + "imports:\n"
747                 + "- nodes:\n"
748                 + "    file: nodes.yml\n"
749                 + "- datatypes:\n"
750                 + "    file: data.yml\n"
751                 + "- capabilities:\n"
752                 + "    file: capabilities.yml\n"
753                 + "- relationships:\n"
754                 + "    file: relationships.yml\n"
755                 + "- groups:\n"
756                 + "    file: groups.yml\n"
757                 + "- policies:\n"
758                 + "    file: policies.yml\n"
759                 + "- annotations:\n"
760                 + "    file: annotations.yml\n"
761                 + "- service-ser09080002-interface:\n"
762                 + "    file: service-Ser09080002-template-interface.yml\n"
763                 + "- resource-ExtCP:\n"
764                 + "    file: resource-Extcp-template.yml\n"
765                 + "- resource-zxjTestImportServiceAb:\n"
766                 + "    file: resource-Zxjtestimportserviceab-template.yml\n"
767                 + "- resource-zxjTestImportServiceAb-interface:\n"
768                 + "    file: resource-Zxjtestimportserviceab-template-interface.yml\n"
769                 + "- resource-zxjTestServiceNotAbatract:\n"
770                 + "    file: resource-Zxjtestservicenotabatract-template.yml\n"
771                 + "- resource-zxjTestServiceNotAbatract-interface:\n"
772                 + "    file: resource-Zxjtestservicenotabatract-template-interface.yml\n"
773                 + "- resource-ext ZTE VL:\n"
774                 + "    file: resource-ExtZteVl-template.yml\n"
775                 + "topology_template:\n"
776                 + "  inputs:\n"
777                 + "    skip_post_instantiation_configuration:\n"
778                 + "      default: true\n"
779                 + "      type: boolean\n"
780                 + "      required: false\n"
781                 + "    controller_actor:\n"
782                 + "      default: SO-REF-DATA\n"
783                 + "      type: string\n"
784                 + "      required: false\n"
785                 + "    cds_model_version:\n"
786                 + "      type: string\n"
787                 + "      required: false\n"
788                 + "    cds_model_name:\n"
789                 + "      type: string\n"
790                 + "      required: false\n"
791                 + "  node_templates:\n"
792                 + "    ext ZTE VL 0:\n"
793                 + "      type: tosca.nodes.nfv.ext.zte.VL\n"
794                 + "      metadata:\n"
795                 + "        invariantUUID: 27ab7610-1a97-4daa-938a-3b48e7afcfd0\n"
796                 + "        UUID: 9ea63e2c-4b8a-414f-93e3-5703ca5cee0d\n"
797                 + "        customizationUUID: e45e79b0-07ab-46b4-ac26-1e9f155ce53c\n"
798                 + "        version: '1.0'\n"
799                 + "        name: ext ZTE VL\n"
800                 + "        description: Ext ZTE VL\n"
801                 + "        type: VL\n"
802                 + "        category: Generic\n"
803                 + "        subcategory: Network Elements\n"
804                 + "        resourceVendor: ONAP (Tosca)\n"
805                 + "        resourceVendorRelease: 1.0.0.wd03\n"
806                 + "        resourceVendorModelNumber: ''\n"
807                 + "    zxjTestServiceNotAbatract 0:\n"
808                 + "      type: org.openecomp.resource.vf.Zxjtestservicenotabatract\n"
809                 + "      metadata:\n"
810                 + "        invariantUUID: ce39ce8d-6f97-4e89-8555-ae6789cdcf1c\n"
811                 + "        UUID: 4ac822be-f1ae-4ace-a4b8-bf6b5d977005\n"
812                 + "        customizationUUID: ee34e1e8-68e2-480f-8ba6-f257bbe90d6a\n"
813                 + "        version: '1.0'\n"
814                 + "        name: zxjTestServiceNotAbatract\n"
815                 + "        description: zxjTestServiceNotAbatract\n"
816                 + "        type: VF\n"
817                 + "        category: Network L4+\n"
818                 + "        subcategory: Common Network Resources\n"
819                 + "        resourceVendor: zxjImportService\n"
820                 + "        resourceVendorRelease: '1.0'\n"
821                 + "        resourceVendorModelNumber: ''\n"
822                 + "      properties:\n"
823                 + "        nf_naming:\n"
824                 + "          ecomp_generated_naming: true\n"
825                 + "        skip_post_instantiation_configuration: true\n"
826                 + "        multi_stage_design: 'false'\n"
827                 + "        controller_actor: SO-REF-DATA\n"
828                 + "        availability_zone_max_count: 1\n"
829                 + "      capabilities:\n"
830                 + "        mme_ipu_vdu.scalable:\n"
831                 + "          properties:\n"
832                 + "            max_instances: 1\n"
833                 + "            min_instances: 1\n"
834                 + "        mme_ipu_vdu.nfv_compute:\n"
835                 + "          properties:\n"
836                 + "            num_cpus: '2'\n"
837                 + "            flavor_extra_specs: {\n"
838                 + "              }\n"
839                 + "            mem_size: '8192'\n"
840                 + "    ExtCP 0:\n"
841                 + "      type: org.openecomp.resource.cp.extCP\n"
842                 + "      metadata:\n"
843                 + "        invariantUUID: 9b772728-93f5-424f-bb07-f4cae2783614\n"
844                 + "        UUID: 424ac220-4864-453e-b757-917fe4568ff8\n"
845                 + "        customizationUUID: 6e65d8a8-4379-4693-87aa-82f9e34b92fd\n"
846                 + "        version: '1.0'\n"
847                 + "        name: ExtCP\n"
848                 + "        description: The AT&T Connection Point base type all other CP derive from\n"
849                 + "        type: CP\n"
850                 + "        category: Generic\n"
851                 + "        subcategory: Network Elements\n"
852                 + "        resourceVendor: ONAP (Tosca)\n"
853                 + "        resourceVendorRelease: 1.0.0.wd03\n"
854                 + "        resourceVendorModelNumber: ''\n"
855                 + "      properties:\n"
856                 + "        mac_requirements:\n"
857                 + "          mac_count_required:\n"
858                 + "            is_required: false\n"
859                 + "        exCP_naming:\n"
860                 + "          ecomp_generated_naming: true\n"
861                 + "    zxjTestImportServiceAb 0:\n"
862                 + "      type: org.openecomp.resource.vf.Zxjtestimportserviceab\n"
863                 + "      metadata:\n"
864                 + "        invariantUUID: 41474f7f-3195-443d-a0a2-eb6020a56279\n"
865                 + "        UUID: 92e32e49-55f8-46bf-984d-a98c924037ec\n"
866                 + "        customizationUUID: 98c7a6c7-a867-45fb-8597-dd464f98e4aa\n"
867                 + "        version: '1.0'\n"
868                 + "        name: zxjTestImportServiceAb\n"
869                 + "        description: zxjTestImportServiceAbstract\n"
870                 + "        type: VF\n"
871                 + "        category: Generic\n"
872                 + "        subcategory: Abstract\n"
873                 + "        resourceVendor: zxjImportService\n"
874                 + "        resourceVendorRelease: '1.0'\n"
875                 + "        resourceVendorModelNumber: ''\n"
876                 + "      properties:\n"
877                 + "        nf_naming:\n"
878                 + "          ecomp_generated_naming: true\n"
879                 + "        skip_post_instantiation_configuration: true\n"
880                 + "        multi_stage_design: 'false'\n"
881                 + "        controller_actor: SO-REF-DATA\n"
882                 + "        availability_zone_max_count: 1\n"
883                 + "      requirements:\n"
884                 + "      - mme_ipu_vdu.dependency:\n"
885                 + "          capability: feature\n"
886                 + "          node: ExtCP 0\n"
887                 + "      - imagefile.dependency:\n"
888                 + "          capability: feature\n"
889                 + "          node: ext ZTE VL 0\n"
890                 + "      capabilities:\n"
891                 + "        mme_ipu_vdu.scalable:\n"
892                 + "          properties:\n"
893                 + "            max_instances: 1\n"
894                 + "            min_instances: 1\n"
895                 + "        mme_ipu_vdu.nfv_compute:\n"
896                 + "          properties:\n"
897                 + "            num_cpus: '2'\n"
898                 + "            flavor_extra_specs: {\n"
899                 + "              }\n"
900                 + "            mem_size: '8192'\n"
901                 + "  substitution_mappings:\n"
902                 + "    node_type: org.openecomp.service.Ser09080002\n"
903                 + "    capabilities:\n"
904                 + "      extcp0.feature:\n"
905                 + "      - ExtCP 0\n"
906                 + "      - feature\n"
907                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.monitoring_parameter:\n"
908                 + "      - zxjTestServiceNotAbatract 0\n"
909                 + "      - mme_ipu_vdu.monitoring_parameter\n"
910                 + "      zxjtestimportserviceab0.imagefile.guest_os:\n"
911                 + "      - zxjTestImportServiceAb 0\n"
912                 + "      - imagefile.guest_os\n"
913                 + "      zxjtestimportserviceab0.imagefile.feature:\n"
914                 + "      - zxjTestImportServiceAb 0\n"
915                 + "      - imagefile.feature\n"
916                 + "      zxjtestservicenotabatract0.imagefile.guest_os:\n"
917                 + "      - zxjTestServiceNotAbatract 0\n"
918                 + "      - imagefile.guest_os\n"
919                 + "      zxjtestimportserviceab0.ipu_cpd.feature:\n"
920                 + "      - zxjTestImportServiceAb 0\n"
921                 + "      - ipu_cpd.feature\n"
922                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.virtualbinding:\n"
923                 + "      - zxjTestServiceNotAbatract 0\n"
924                 + "      - mme_ipu_vdu.virtualbinding\n"
925                 + "      zxjtestimportserviceab0.mme_ipu_vdu.feature:\n"
926                 + "      - zxjTestImportServiceAb 0\n"
927                 + "      - mme_ipu_vdu.feature\n"
928                 + "      extztevl0.feature:\n"
929                 + "      - ext ZTE VL 0\n"
930                 + "      - feature\n"
931                 + "      zxjtestimportserviceab0.imagefile.image_fle:\n"
932                 + "      - zxjTestImportServiceAb 0\n"
933                 + "      - imagefile.image_fle\n"
934                 + "      zxjtestimportserviceab0.mme_ipu_vdu.monitoring_parameter:\n"
935                 + "      - zxjTestImportServiceAb 0\n"
936                 + "      - mme_ipu_vdu.monitoring_parameter\n"
937                 + "      zxjtestservicenotabatract0.ipu_cpd.feature:\n"
938                 + "      - zxjTestServiceNotAbatract 0\n"
939                 + "      - ipu_cpd.feature\n"
940                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.nfv_compute:\n"
941                 + "      - zxjTestServiceNotAbatract 0\n"
942                 + "      - mme_ipu_vdu.nfv_compute\n"
943                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.scalable:\n"
944                 + "      - zxjTestServiceNotAbatract 0\n"
945                 + "      - mme_ipu_vdu.scalable\n"
946                 + "      extcp0.internal_connectionPoint:\n"
947                 + "      - ExtCP 0\n"
948                 + "      - internal_connectionPoint\n"
949                 + "      zxjtestimportserviceab0.mme_ipu_vdu.virtualbinding:\n"
950                 + "      - zxjTestImportServiceAb 0\n"
951                 + "      - mme_ipu_vdu.virtualbinding\n"
952                 + "      zxjtestservicenotabatract0.imagefile.image_fle:\n"
953                 + "      - zxjTestServiceNotAbatract 0\n"
954                 + "      - imagefile.image_fle\n"
955                 + "      extztevl0.virtual_linkable:\n"
956                 + "      - ext ZTE VL 0\n"
957                 + "      - virtual_linkable\n"
958                 + "      zxjtestservicenotabatract0.imagefile.feature:\n"
959                 + "      - zxjTestServiceNotAbatract 0\n"
960                 + "      - imagefile.feature\n"
961                 + "      zxjtestimportserviceab0.localstorage.feature:\n"
962                 + "      - zxjTestImportServiceAb 0\n"
963                 + "      - localstorage.feature\n"
964                 + "      zxjtestservicenotabatract0.localstorage.local_attachment:\n"
965                 + "      - zxjTestServiceNotAbatract 0\n"
966                 + "      - localstorage.local_attachment\n"
967                 + "      zxjtestimportserviceab0.mme_ipu_vdu.scalable:\n"
968                 + "      - zxjTestImportServiceAb 0\n"
969                 + "      - mme_ipu_vdu.scalable\n"
970                 + "      zxjtestservicenotabatract0.localstorage.feature:\n"
971                 + "      - zxjTestServiceNotAbatract 0\n"
972                 + "      - localstorage.feature\n"
973                 + "      zxjtestimportserviceab0.mme_ipu_vdu.nfv_compute:\n"
974                 + "      - zxjTestImportServiceAb 0\n"
975                 + "      - mme_ipu_vdu.nfv_compute\n"
976                 + "      zxjtestimportserviceab0.localstorage.local_attachment:\n"
977                 + "      - zxjTestImportServiceAb 0\n"
978                 + "      - localstorage.local_attachment\n"
979                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.feature:\n"
980                 + "      - zxjTestServiceNotAbatract 0\n"
981                 + "      - mme_ipu_vdu.feature\n"
982                 + "      zxjtestimportserviceab0.ipu_cpd.forwarder:\n"
983                 + "      - zxjTestImportServiceAb 0\n"
984                 + "      - ipu_cpd.forwarder\n"
985                 + "      zxjtestservicenotabatract0.ipu_cpd.forwarder:\n"
986                 + "      - zxjTestServiceNotAbatract 0\n"
987                 + "      - ipu_cpd.forwarder\n"
988                 + "    requirements:\n"
989                 + "      zxjtestservicenotabatract0.imagefile.dependency:\n"
990                 + "      - zxjTestServiceNotAbatract 0\n"
991                 + "      - imagefile.dependency\n"
992                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.local_storage:\n"
993                 + "      - zxjTestServiceNotAbatract 0\n"
994                 + "      - mme_ipu_vdu.local_storage\n"
995                 + "      zxjtestservicenotabatract0.ipu_cpd.dependency:\n"
996                 + "      - zxjTestServiceNotAbatract 0\n"
997                 + "      - ipu_cpd.dependency\n"
998                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.volume_storage:\n"
999                 + "      - zxjTestServiceNotAbatract 0\n"
1000                 + "      - mme_ipu_vdu.volume_storage\n"
1001                 + "      zxjtestservicenotabatract0.ipu_cpd.virtualbinding:\n"
1002                 + "      - zxjTestServiceNotAbatract 0\n"
1003                 + "      - ipu_cpd.virtualbinding\n"
1004                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.dependency:\n"
1005                 + "      - zxjTestServiceNotAbatract 0\n"
1006                 + "      - mme_ipu_vdu.dependency\n"
1007                 + "      zxjtestservicenotabatract0.localstorage.dependency:\n"
1008                 + "      - zxjTestServiceNotAbatract 0\n"
1009                 + "      - localstorage.dependency\n"
1010                 + "      zxjtestimportserviceab0.imagefile.dependency:\n"
1011                 + "      - zxjTestImportServiceAb 0\n"
1012                 + "      - imagefile.dependency\n"
1013                 + "      zxjtestimportserviceab0.mme_ipu_vdu.volume_storage:\n"
1014                 + "      - zxjTestImportServiceAb 0\n"
1015                 + "      - mme_ipu_vdu.volume_storage\n"
1016                 + "      zxjtestimportserviceab0.ipu_cpd.virtualbinding:\n"
1017                 + "      - zxjTestImportServiceAb 0\n"
1018                 + "      - ipu_cpd.virtualbinding\n"
1019                 + "      extcp0.virtualLink:\n"
1020                 + "      - ExtCP 0\n"
1021                 + "      - virtualLink\n"
1022                 + "      extcp0.virtualBinding:\n"
1023                 + "      - ExtCP 0\n"
1024                 + "      - virtualBinding\n"
1025                 + "      zxjtestimportserviceab0.mme_ipu_vdu.guest_os:\n"
1026                 + "      - zxjTestImportServiceAb 0\n"
1027                 + "      - mme_ipu_vdu.guest_os\n"
1028                 + "      extcp0.dependency:\n"
1029                 + "      - ExtCP 0\n"
1030                 + "      - dependency\n"
1031                 + "      zxjtestimportserviceab0.localstorage.dependency:\n"
1032                 + "      - zxjTestImportServiceAb 0\n"
1033                 + "      - localstorage.dependency\n"
1034                 + "      zxjtestservicenotabatract0.ipu_cpd.virtualLink:\n"
1035                 + "      - zxjTestServiceNotAbatract 0\n"
1036                 + "      - ipu_cpd.virtualLink\n"
1037                 + "      extztevl0.dependency:\n"
1038                 + "      - ext ZTE VL 0\n"
1039                 + "      - dependency\n"
1040                 + "      zxjtestimportserviceab0.ipu_cpd.dependency:\n"
1041                 + "      - zxjTestImportServiceAb 0\n"
1042                 + "      - ipu_cpd.dependency\n"
1043                 + "      zxjtestimportserviceab0.mme_ipu_vdu.dependency:\n"
1044                 + "      - zxjTestImportServiceAb 0\n"
1045                 + "      - mme_ipu_vdu.dependency\n"
1046                 + "      zxjtestimportserviceab0.mme_ipu_vdu.local_storage:\n"
1047                 + "      - zxjTestImportServiceAb 0\n"
1048                 + "      - mme_ipu_vdu.local_storage\n"
1049                 + "      zxjtestimportserviceab0.ipu_cpd.virtualLink:\n"
1050                 + "      - zxjTestImportServiceAb 0\n"
1051                 + "      - ipu_cpd.virtualLink\n"
1052                 + "      extcp0.external_virtualLink:\n"
1053                 + "      - ExtCP 0\n"
1054                 + "      - external_virtualLink\n"
1055                 + "      zxjtestservicenotabatract0.mme_ipu_vdu.guest_os:\n"
1056                 + "      - zxjTestServiceNotAbatract 0\n"
1057                 + "      - mme_ipu_vdu.guest_os\n"
1058                 + "      zxjtestimportserviceab0.ipu_cpd.forwarder:\n"
1059                 + "      - zxjTestImportServiceAb 0\n"
1060                 + "      - ipu_cpd.forwarder\n"
1061                 + "      zxjtestservicenotabatract0.ipu_cpd.forwarder:\n"
1062                 + "      - zxjTestServiceNotAbatract 0\n"
1063                 + "      - ipu_cpd.forwarder\n";
1064     }
1065
1066     protected void assertComponentException(ComponentException e, ActionStatus expectedStatus, String... variables) {
1067         ResponseFormat actualResponse = e.getResponseFormat() != null ?
1068                 e.getResponseFormat() : componentsUtils.getResponseFormat(e.getActionStatus(), e.getParams());
1069         assertResponse(actualResponse, expectedStatus, variables);
1070     }
1071
1072     protected void assertResponse(ResponseFormat actualResponse, ActionStatus expectedStatus, String... variables) {
1073         ResponseFormat expectedResponse = responseManager.getResponseFormat(expectedStatus, variables);
1074         assertEquals(expectedResponse.getStatus(), actualResponse.getStatus());
1075         assertEquals("assert error description", expectedResponse.getFormattedMessage(), actualResponse.getFormattedMessage());
1076     }
1077
1078 }