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
9 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 * SPDX-License-Identifier: Apache-2.0
17 * ============LICENSE_END=========================================================
19 package org.onap.sdc.frontend.ci.tests.execute.sanity;
21 import static org.hamcrest.MatcherAssert.assertThat;
22 import static org.hamcrest.Matchers.empty;
23 import static org.hamcrest.Matchers.emptyString;
24 import static org.hamcrest.Matchers.not;
25 import static org.junit.jupiter.api.Assertions.assertEquals;
26 import static org.junit.jupiter.api.Assertions.assertFalse;
27 import static org.junit.jupiter.api.Assertions.assertNotNull;
28 import static org.junit.jupiter.api.Assertions.assertTrue;
29 import static org.junit.jupiter.api.Assertions.fail;
31 import com.aventstack.extentreports.Status;
32 import java.util.Arrays;
33 import java.util.List;
35 import java.util.Optional;
36 import org.apache.commons.collections.MapUtils;
37 import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType;
38 import org.onap.sdc.backend.ci.tests.datatypes.enums.ResourceCategoryEnum;
39 import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
40 import org.onap.sdc.frontend.ci.tests.datatypes.ComponentData;
41 import org.onap.sdc.frontend.ci.tests.datatypes.ModelName;
42 import org.onap.sdc.frontend.ci.tests.datatypes.ResourceCreateData;
43 import org.onap.sdc.frontend.ci.tests.exception.UnzipException;
44 import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory;
45 import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
46 import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
47 import org.onap.sdc.frontend.ci.tests.flow.AddNodeToCompositionFlow;
48 import org.onap.sdc.frontend.ci.tests.flow.CreateVfFlow;
49 import org.onap.sdc.frontend.ci.tests.flow.CreateVfcFlow;
50 import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow;
51 import org.onap.sdc.frontend.ci.tests.flow.GoToInterfaceDefinitionPageFlow;
52 import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException;
53 import org.onap.sdc.frontend.ci.tests.pages.AttributeModal;
54 import org.onap.sdc.frontend.ci.tests.pages.AttributesPage;
55 import org.onap.sdc.frontend.ci.tests.pages.ComponentPage;
56 import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
57 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionDetailSideBarComponent;
58 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionDetailSideBarComponent.CompositionDetailTabName;
59 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInformationTab;
60 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionInterfaceOperationsTab;
61 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
62 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionOperationsModal;
63 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionOperationsModal.InterfaceOperationsData.InputData;
64 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage;
65 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage;
66 import org.onap.sdc.frontend.ci.tests.pages.home.HomePage;
67 import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
68 import org.openecomp.sdc.be.model.ComponentInstance;
69 import org.openqa.selenium.WebDriver;
70 import org.testng.annotations.BeforeClass;
71 import org.testng.annotations.Test;
72 import org.yaml.snakeyaml.Yaml;
74 public class ImportVfcUiTest extends SetupCDTest {
76 private String filePath;
77 private WebDriver webDriver;
78 private HomePage homePage;
79 private ResourceCreateData vfcCreateData;
80 private ResourceCreateData vfCreateData;
81 private ComponentInstance createdComponentInstance;
82 private final String vfcCategory = ResourceCategoryEnum.NETWORK_L4.getSubCategory();
85 public void beforeClass() {
86 filePath = FileHandling.getFilePath("VFCs/");
87 webDriver = DriverFactory.getDriver();
88 homePage = new HomePage(webDriver);
92 public void importVFC_createVF_addVFC2VF_test() throws UnzipException {
93 ComponentPage componentPage;
94 // TC - Import VFC with root namespace
95 String fileName = "org.openecomp.resource.VFC-root.yml";
96 CreateVfcFlow createVfcFlow = createVFC(fileName, ModelName.DEFAULT_MODEL_NAME.getName(), vfcCategory);
98 componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
99 componentPage.isLoaded();
100 componentPage.certifyComponent();
101 componentPage.isLoaded();
103 Map<String, Object> yamlObject = downloadToscaArtifact(componentPage);
104 checkMetadata(yamlObject, vfcCreateData);
105 checkNodeTypes(yamlObject);
106 homePage.getTopNavComponent().clickOnHome();
108 // TC - Import hierarchy of VFCs
109 fileName = "org.openecomp.resource.VFC-child.yml";
110 createVfcFlow = createVFC(fileName, ModelName.DEFAULT_MODEL_NAME.getName(), vfcCategory);
111 componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
112 componentPage.isLoaded();
114 componentPage = manageAttributes(componentPage);
115 componentPage.isLoaded();
116 componentPage.certifyComponent();
117 componentPage.isLoaded();
119 yamlObject = downloadToscaArtifact(componentPage);
120 checkMetadata(yamlObject, vfcCreateData);
121 checkNodeTypes(yamlObject);
123 componentPage = viewInterfaceDefinitionFromVFC(componentPage);
124 componentPage.isLoaded();
126 homePage.getTopNavComponent().clickOnHome();
128 // TC - Import VFC with interface inputs
129 // TC - Import VFC with attributes
130 final CreateVfFlow createVfFlow = createVF();
131 componentPage = createVfFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
132 componentPage.isLoaded();
134 final CompositionPage compositionPage = addInterfaceOperations(componentPage);
135 componentPage = compositionPage.goToGeneral();
136 componentPage.isLoaded();
137 componentPage.certifyComponent();
138 componentPage.isLoaded();
140 yamlObject = downloadToscaArtifact(componentPage);
141 checkMetadata(yamlObject, vfCreateData);
142 checkTopologyTemplate(yamlObject);
147 public void importVFC_createVF_etsi_addVFC2VF_test() throws UnzipException {
148 ComponentPage componentPage;
149 // TC - Import VFC with root namespace
150 String fileName = "org.openecomp.resource.VFC-root.yml";
151 String subCategory = ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory();
152 CreateVfcFlow createVfcFlow = createVFC(fileName, ModelName.ETSI_SOL001_v2_5_1.getName(), subCategory);
154 componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
155 componentPage.isLoaded();
156 componentPage.certifyComponent();
157 componentPage.isLoaded();
159 Map<String, Object> yamlObject = downloadToscaArtifact(componentPage);
160 checkEtsiMetadata(yamlObject, vfcCreateData);
161 checkNodeTypes(yamlObject);
162 homePage.getTopNavComponent().clickOnHome();
164 // TC - Import hierarchy of VFCs
165 fileName = "org.openecomp.resource.VFC-child.yml";
166 createVfcFlow = createVFC(fileName, ModelName.ETSI_SOL001_v2_5_1.getName(), subCategory);
167 componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
168 componentPage.isLoaded();
170 componentPage = manageAttributes(componentPage);
171 componentPage.isLoaded();
172 componentPage.certifyComponent();
173 componentPage.isLoaded();
175 yamlObject = downloadToscaArtifact(componentPage);
176 checkEtsiMetadata(yamlObject, vfcCreateData);
177 checkNodeTypes(yamlObject);
179 componentPage = viewInterfaceDefinitionFromVFC(componentPage);
180 componentPage.isLoaded();
182 homePage.getTopNavComponent().clickOnHome();
184 // TC - Import VFC with interface inputs
185 // TC - Import VFC with attributes
186 final CreateVfFlow createVfFlow = createVF();
187 componentPage = createVfFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
188 componentPage.isLoaded();
190 final CompositionPage compositionPage = addInterfaceOperations(componentPage);
191 componentPage = compositionPage.goToGeneral();
192 componentPage.isLoaded();
193 componentPage.certifyComponent();
194 componentPage.isLoaded();
196 yamlObject = downloadToscaArtifact(componentPage);
197 checkMetadata(yamlObject, vfCreateData);
198 checkTopologyTemplate(yamlObject);
202 private ComponentPage viewInterfaceDefinitionFromVFC(final ComponentPage componentPage) {
203 final GoToInterfaceDefinitionPageFlow goToInterfaceDefinitionPageFlow = new GoToInterfaceDefinitionPageFlow(webDriver);
204 goToInterfaceDefinitionPageFlow.run(componentPage);
205 final InterfaceDefinitionPage interfaceDefinitionPage = goToInterfaceDefinitionPageFlow.getLandedPage()
206 .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return InterfaceDefinitionPage"));
207 final var operationName = "create";
208 assertTrue(interfaceDefinitionPage.isInterfaceDefinitionOperationPresent(operationName));
209 final InterfaceDefinitionOperationsModal interfaceDefinitionOperationsModal =
210 interfaceDefinitionPage.clickOnInterfaceDefinitionOperation(operationName);
211 interfaceDefinitionOperationsModal.isLoaded(true);
213 .takeScreenshot(Status.INFO, "clickOnOInterfaceOperation", "Interface Definition Operation Modal opened");
214 checkInterfaceDefinitionData(interfaceDefinitionOperationsModal);
215 interfaceDefinitionOperationsModal.clickOnCancel();
216 return interfaceDefinitionPage;
220 public void importVfcWithModel() {
221 final String fileName = "VFC-For-Model.yaml";
222 final CreateVfcFlow createVfcFlow = createVFC(fileName, ModelName.ETSI_SOL001_v2_5_1.getName(), vfcCategory);
223 final ComponentPage componentPage = createVfcFlow.getLandedPage()
224 .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
225 componentPage.isLoaded();
226 componentPage.certifyComponent();
227 componentPage.isLoaded();
230 private void checkInterfaceDefinitionData(final InterfaceDefinitionOperationsModal interfaceDefinitionOperationsModal) {
231 assertFalse(interfaceDefinitionOperationsModal.getDescription().isEmpty());
232 assertEquals("path/to/my/implementation.sh", interfaceDefinitionOperationsModal.getImplementationName());
233 final List<InputData> inputList = interfaceDefinitionOperationsModal.getInputs();
234 assertTrue(inputList.stream().anyMatch(inputData -> "first".equals(inputData.getName())), "Input of name 'first' expected");
237 private ComponentPage manageAttributes(final ComponentPage componentPage) {
238 final AttributesPage attributesPage = componentPage.goToAttributes();
239 attributesPage.isLoaded();
241 assertTrue(attributesPage.isAttributePresent("test_1"));
242 assertTrue(attributesPage.isAttributePresent("test_2"));
243 assertTrue(attributesPage.isAttributePresent("test_3"));
244 assertTrue(attributesPage.isAttributePresent("test_4"));
246 attributesPage.deleteAttribute("test_2");
247 assertFalse(attributesPage.isAttributePresent("test_2"));
248 ExtentTestActions.takeScreenshot(Status.INFO, "attributesPage.deleteAttribute", "Attribute 'test_2' successfully deleted");
249 attributesPage.addAttribute(new AttributeModal.AttributeData("test_9", "Additional attribute added from UI", "string", "one More Attribute"));
250 attributesPage.isLoaded();
251 assertTrue(attributesPage.isAttributePresent("test_9"));
252 ExtentTestActions.takeScreenshot(Status.INFO, "attributesPage.addAttribute", "Additional Attribute 'test_9' successfully added");
254 attributesPage.editAttribute(new AttributeModal.AttributeData("test_9", "Additional attribute added from UI".toUpperCase(), "string",
255 "one More Attribute".toUpperCase()));
256 attributesPage.isLoaded();
257 assertTrue(attributesPage.isAttributePresent("test_9"));
258 ExtentTestActions.takeScreenshot(Status.INFO, "attributesPage.editAttribute", "Additional Attribute 'test_9' successfully altered");
260 return attributesPage.clickOnGeneralMenuItem(ResourceCreatePage.class);
263 private CompositionPage addInterfaceOperations(final ComponentPage componentPage) {
264 final AddNodeToCompositionFlow addNodeToCompositionFlow = addNodeToCompositionFlow(componentPage);
265 final CompositionPage compositionPage = addNodeToCompositionFlow.getLandedPage()
266 .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return CompositionPage"));
267 final CompositionDetailSideBarComponent detailSideBar = compositionPage.getDetailSideBar();
268 detailSideBar.isLoaded();
270 createdComponentInstance = addNodeToCompositionFlow.getCreatedComponentInstance()
271 .orElseThrow(() -> new UiTestFlowRuntimeException("Expecting a ComponentInstance"));
273 compositionPage.selectNode(createdComponentInstance.getName());
275 CompositionInterfaceOperationsTab compositionInterfaceOperationsTab =
276 (CompositionInterfaceOperationsTab) detailSideBar.selectTab(CompositionDetailTabName.INTERFACE_OPERATIONS);
277 compositionInterfaceOperationsTab.isLoaded();
278 ExtentTestActions.takeScreenshot(Status.INFO, "compositionInterfaceOperationsTab", "Composition Interface Operations Tab opened");
279 assertTrue(compositionInterfaceOperationsTab.isOperationPresent("create"));
280 InterfaceDefinitionOperationsModal compositionInterfaceOperationsModal = compositionInterfaceOperationsTab.clickOnOperation("create");
281 compositionInterfaceOperationsModal.isLoaded();
283 .takeScreenshot(Status.INFO, "compositionInterfaceOperationsTab.clickOnOperation", "Composition Interface Operations Modal opened");
284 compositionInterfaceOperationsModal.deleteInput("first");
285 ExtentTestActions.takeScreenshot(Status.INFO, "compositionInterfaceOperationsModal.clickOnDelete", "Input deleted");
287 List<InputData> inputDataList = List.of(
288 new InputData("stringInput", "string", "1"),
289 new InputData("booleanInput", "boolean", true),
290 new InputData("integerInput", "integer", 1)
292 final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData =
293 new InterfaceDefinitionOperationsModal.InterfaceOperationsData(
294 "This is CREATE operation", "fullPath/to/my/newImplementation.sh", inputDataList
296 compositionInterfaceOperationsModal.updateInterfaceOperation(interfaceOperationsData);
297 compositionInterfaceOperationsTab.isLoaded();
299 final CompositionInformationTab compositionInformationTab =
300 (CompositionInformationTab) detailSideBar.selectTab(CompositionDetailTabName.INFORMATION);
301 compositionInformationTab.isLoaded();
303 compositionInterfaceOperationsTab =
304 (CompositionInterfaceOperationsTab) detailSideBar.selectTab(CompositionDetailTabName.INTERFACE_OPERATIONS);
305 compositionInterfaceOperationsTab.isLoaded();
307 assertTrue(compositionInterfaceOperationsTab.isOperationPresent("create"));
308 assertTrue(compositionInterfaceOperationsTab.isDescriptionPresent());
309 ExtentTestActions.takeScreenshot(Status.INFO, "isDescriptionPresent", "Description is present");
310 compositionInterfaceOperationsModal = compositionInterfaceOperationsTab.clickOnOperation("create");
311 compositionInterfaceOperationsModal.isLoaded();
313 .takeScreenshot(Status.INFO, "compositionInterfaceOperationsTab.clickOnOperation", "Composition Interface Operations Modal opened");
315 checkCompositionInterfaceOperations(compositionInterfaceOperationsModal, interfaceOperationsData);
316 compositionInterfaceOperationsModal.clickOnCancel();
317 compositionInterfaceOperationsTab.isLoaded();
318 return compositionPage;
321 private AddNodeToCompositionFlow addNodeToCompositionFlow(final ComponentPage componentPage) {
322 componentPage.isLoaded();
323 final ComponentData parentComponent = new ComponentData();
324 parentComponent.setName(vfCreateData.getName());
325 parentComponent.setVersion("0.1");
326 parentComponent.setComponentType(ComponentType.RESOURCE);
327 final ComponentData componentToAdd = new ComponentData();
328 componentToAdd.setName(vfcCreateData.getName());
329 componentToAdd.setVersion("1.0");
330 componentToAdd.setComponentType(ComponentType.RESOURCE);
331 final AddNodeToCompositionFlow addNodeToCompositionFlow = new AddNodeToCompositionFlow(webDriver, parentComponent, componentToAdd);
332 addNodeToCompositionFlow.run(componentPage.goToComposition());
333 return addNodeToCompositionFlow;
336 private Map<String, Object> downloadToscaArtifact(final ComponentPage componentPage) throws UnzipException {
337 final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadCsarArtifact(componentPage);
338 final ToscaArtifactsPage toscaArtifactsPage = downloadCsarArtifactFlow.getLandedPage()
339 .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ToscaArtifactsPage"));
341 assertThat("No artifact download was found", toscaArtifactsPage.getDownloadedArtifactList(), not(empty()));
342 final String downloadedCsarName = toscaArtifactsPage.getDownloadedArtifactList().get(0);
343 final String downloadFolderPath = getConfig().getDownloadAutomationFolder();
344 final Map<String, byte[]> filesFromZip = FileHandling.getFilesFromZip(downloadFolderPath, downloadedCsarName);
345 final Optional<String> resourceEntryOpt = filesFromZip.keySet().stream()
346 .filter(s -> s.equals("Definitions/" + downloadedCsarName.replace("-csar.csar", "-template.yml")))
348 if (resourceEntryOpt.isEmpty()) {
349 fail("Could not find the resource package in Definitions");
351 return loadYamlObject(filesFromZip.get(resourceEntryOpt.get()));
354 private Map<String, Object> getMapEntry(final Map<String, Object> yamlObj, final String entryName) {
356 return (Map<String, Object>) yamlObj.get(entryName);
357 } catch (final Exception e) {
358 final String errorMsg = String.format("Could not get the '%s' entry.", entryName);
359 fail(errorMsg + "Error message: " + e.getMessage());
364 private Map<String, Object> loadYamlObject(final byte[] mainDefinitionFileBytes) {
365 return new Yaml().load(new String(mainDefinitionFileBytes));
368 private DownloadCsarArtifactFlow downloadCsarArtifact(final ComponentPage componentPage) {
369 final DownloadCsarArtifactFlow downloadCsarArtifactFlow = new DownloadCsarArtifactFlow(webDriver);
370 downloadCsarArtifactFlow.setWaitBeforeGetTheFile(5L);
371 downloadCsarArtifactFlow.run(componentPage);
372 return downloadCsarArtifactFlow;
375 private CreateVfcFlow createVFC(final String fileName, final String model, final String category) {
376 vfcCreateData = createVfcFormData(model, category);
377 final CreateVfcFlow createVfcFlow = new CreateVfcFlow(webDriver, vfcCreateData, filePath + fileName);
378 createVfcFlow.run(homePage);
379 return createVfcFlow;
382 private CreateVfFlow createVF() {
383 vfCreateData = createVfFormData();
384 final CreateVfFlow createVfFlow = new CreateVfFlow(webDriver, vfCreateData);
385 createVfFlow.run(homePage);
389 private ResourceCreateData createVfcFormData(final String model, final String category) {
390 final ResourceCreateData vfcCreateData = new ResourceCreateData();
391 vfcCreateData.setRandomName(ElementFactory.getResourcePrefix() + "-VFC");
392 vfcCreateData.setModel(model);
393 vfcCreateData.setCategory(category);
394 vfcCreateData.setTagList(Arrays.asList(vfcCreateData.getName(), "importVFC"));
395 vfcCreateData.setDescription("aDescription");
396 vfcCreateData.setVendorName("Ericsson");
397 vfcCreateData.setVendorRelease("1.2.3");
398 vfcCreateData.setVendorModelNumber("4.5.6");
399 return vfcCreateData;
402 private ResourceCreateData createVfFormData() {
403 final ResourceCreateData vfCreateData = new ResourceCreateData();
404 vfCreateData.setRandomName(ElementFactory.getResourcePrefix() + "-VF");
405 vfCreateData.setCategory(ResourceCategoryEnum.NETWORK_L4.getSubCategory());
406 vfCreateData.setTagList(Arrays.asList(vfCreateData.getName(), "createVF"));
407 vfCreateData.setDescription("aDescription");
408 vfCreateData.setVendorName("Ericsson");
409 vfCreateData.setVendorRelease("6.5.4");
410 vfCreateData.setVendorModelNumber("3.2.1");
414 private void checkMetadata(final Map<String, Object> map, final ResourceCreateData createdData) {
415 final Map<String, Object> metadata = getMapEntry(map, "metadata");
417 assertEquals(createdData.getName(), metadata.get("name"));
418 assertEquals(createdData.getDescription(), metadata.get("description"));
419 assertEquals("Network L4+", metadata.get("category"));
420 assertThat((String) metadata.get("type"), not(emptyString()));
421 assertEquals(createdData.getCategory(), metadata.get("subcategory"));
422 assertEquals(createdData.getVendorName(), metadata.get("resourceVendor"));
423 assertEquals(createdData.getVendorRelease(), metadata.get("resourceVendorRelease"));
424 assertEquals(createdData.getVendorModelNumber(), metadata.get("reourceVendorModelNumber"));
427 private void checkEtsiMetadata(final Map<String, Object> map, final ResourceCreateData createdData) {
428 final Map<String, Object> metadata = getMapEntry(map, "metadata");
430 assertEquals(createdData.getName(), metadata.get("name"));
431 assertEquals(createdData.getDescription(), metadata.get("description"));
432 assertEquals("Application L4+", metadata.get("category"));
433 assertThat((String) metadata.get("type"), not(emptyString()));
434 assertEquals(createdData.getCategory(), metadata.get("subcategory"));
435 assertEquals(createdData.getVendorName(), metadata.get("resourceVendor"));
436 assertEquals(createdData.getVendorRelease(), metadata.get("resourceVendorRelease"));
437 assertEquals(createdData.getVendorModelNumber(), metadata.get("reourceVendorModelNumber"));
440 private void checkNodeTypes(final Map<String, Object> map) {
441 final Map<String, Object> mapEntry = getMapEntry(map, "node_types");
442 final Map<String, Object> nodeTypes = getMapEntry(mapEntry, mapEntry.keySet().iterator().next());
444 assertFalse(MapUtils.isEmpty(nodeTypes));
445 assertEquals("aDescription", nodeTypes.get("description"));
447 final Map<String, Object> properties = getMapEntry(nodeTypes, "properties");
448 assertFalse(MapUtils.isEmpty(properties));
450 final Map<String, Object> attributes = getMapEntry(nodeTypes, "attributes");
451 assertFalse(MapUtils.isEmpty(attributes));
453 final Map<String, Object> interfaces = getMapEntry(nodeTypes, "interfaces");
454 assertFalse(MapUtils.isEmpty(interfaces));
458 private void checkTopologyTemplate(final Map<String, Object> map) {
459 final Map<String, Object> topologyTemplate = getMapEntry(map, "topology_template");
460 assertNotNull(topologyTemplate);
462 final Map<String, Object> inputs = getMapEntry(topologyTemplate, "inputs");
463 assertFalse(MapUtils.isEmpty(inputs));
465 final Map<String, Object> nodeTemplates = getMapEntry(topologyTemplate, "node_templates");
466 assertFalse(MapUtils.isEmpty(nodeTemplates));
468 final Map<String, Object> attributes = getMapEntry((Map<String, Object>) nodeTemplates.get(createdComponentInstance.getName()), "attributes");
469 assertTrue(MapUtils.isEmpty(attributes));
471 final Map<String, Object> substitutionMappings = getMapEntry(topologyTemplate, "substitution_mappings");
472 assertFalse(MapUtils.isEmpty(substitutionMappings));
476 private void checkCompositionInterfaceOperations(final InterfaceDefinitionOperationsModal compositionInterfaceOperationsModal,
477 final InterfaceDefinitionOperationsModal.InterfaceOperationsData interfaceOperationsData) {
478 assertEquals(interfaceOperationsData.getDescription(), compositionInterfaceOperationsModal.getDescription());
479 assertEquals(interfaceOperationsData.getImplementationName(), compositionInterfaceOperationsModal.getImplementationName());
480 interfaceOperationsData.getInputList().forEach(inputData -> {
481 final boolean hasInput = compositionInterfaceOperationsModal.getInputs().stream()
482 .anyMatch(inputData1 -> inputData1.getName().equals(inputData.getName()));
483 assertTrue(hasInput, String.format("Expecting input '%s'", inputData.getName()));