aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-25 12:40:50 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-25 16:41:14 +0000
commita45577d6d9e5a67ea8313b760b5180c974fc63d7 (patch)
treea8a5deca77fb26083ad85f586546c304d77f1a85
parentde9224b1ae01755c7cc46e4bdd1a50c1bc08936e (diff)
Fix CRITICAL BUGs
Change-Id: I2924e68c03a6b640644fd0360ca23f29f9bb5f5b Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3529
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java217
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.component.ts40
-rw-r--r--catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts328
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java1126
4 files changed, 870 insertions, 841 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
index 621b275a67..b0f2fa5010 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
@@ -29,17 +29,45 @@
*/
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.ArgumentMatchers;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
@@ -49,13 +77,15 @@ import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
-import org.openecomp.sdc.be.datatypes.enums.PromoteVersionEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.PromoteVersionEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.AttributeDefinition;
import org.openecomp.sdc.be.model.Component;
@@ -63,11 +93,13 @@ import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceAttribute;
import org.openecomp.sdc.be.model.ComponentInstanceOutput;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.OutputDefinition;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.ComponentParametersView;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.OutputDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
@@ -76,41 +108,10 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.model.DataTypeDefinition;
-import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.Collections;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyMap;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
@RunWith(MockitoJUnitRunner.class)
public class ToscaOperationFacadeTest {
+
private static final String COMPONENT_ID = "componentId";
private static final String PROPERTY1_NAME = "prop1";
private static final String PROPERTY1_TYPE = "string";
@@ -151,10 +152,12 @@ public class ToscaOperationFacadeTest {
List<GraphVertex> mockVertices = getMockVertices(2);
Either<List<GraphVertex>, JanusGraphOperationStatus> returnedVertices = Either.left(mockVertices);
- when(janusGraphDaoMock.getByCriteria(eq(null), criteriaCapture.capture(), criteriaNotCapture.capture(), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(returnedVertices);
+ when(janusGraphDaoMock.getByCriteria(eq(null), criteriaCapture.capture(), criteriaNotCapture.capture(), eq(JsonParseFlagEnum.ParseMetadata)))
+ .thenReturn(returnedVertices);
when(topologyTemplateOperationMock.getToscaElement(mockVertices.get(0), dataFilter)).thenReturn(Either.left(getResourceToscaElement("0")));
when(topologyTemplateOperationMock.getToscaElement(mockVertices.get(1), dataFilter)).thenReturn(Either.left(getResourceToscaElement("1")));
- Either<List<Component>, StorageOperationStatus> fetchedComponents = testInstance.fetchMetaDataByResourceType(ResourceTypeEnum.VF.getValue(), dataFilter);
+ Either<List<Component>, StorageOperationStatus> fetchedComponents = testInstance
+ .fetchMetaDataByResourceType(ResourceTypeEnum.VF.getValue(), dataFilter);
verifyCriteriaForHighestVersionAndVfResourceType(criteriaCapture);
verifyCriteriaNotIsDeleted(criteriaNotCapture);
@@ -167,16 +170,16 @@ public class ToscaOperationFacadeTest {
}
private void verifyCriteriaForHighestVersionAndVfResourceType(ArgumentCaptor<Map> criteriaCapture) {
- Map<GraphPropertyEnum, Object> criteria = (Map<GraphPropertyEnum, Object>)criteriaCapture.getValue();
+ Map<GraphPropertyEnum, Object> criteria = (Map<GraphPropertyEnum, Object>) criteriaCapture.getValue();
assertEquals(2, criteria.size());
- assertEquals(criteria.get(GraphPropertyEnum.RESOURCE_TYPE), "VF");
- assertEquals(criteria.get(GraphPropertyEnum.IS_HIGHEST_VERSION), true);
+ assertEquals("VF", criteria.get(GraphPropertyEnum.RESOURCE_TYPE));
+ assertEquals(true, criteria.get(GraphPropertyEnum.IS_HIGHEST_VERSION));
}
private void verifyCriteriaNotIsDeleted(ArgumentCaptor<Map> criteriaNotCapture) {
- Map<GraphPropertyEnum, Object> notCriteria = (Map<GraphPropertyEnum, Object>)criteriaNotCapture.getValue();
+ Map<GraphPropertyEnum, Object> notCriteria = (Map<GraphPropertyEnum, Object>) criteriaNotCapture.getValue();
assertEquals(1, notCriteria.size());
- assertEquals(notCriteria.get(GraphPropertyEnum.IS_DELETED), true);
+ assertEquals(true, notCriteria.get(GraphPropertyEnum.IS_DELETED));
}
@SuppressWarnings("unchecked")
@@ -184,47 +187,48 @@ public class ToscaOperationFacadeTest {
public void fetchMetaDataByResourceType_failedToGetData() throws Exception {
when(janusGraphDaoMock.getByCriteria(eq(null), anyMap(), anyMap(), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(Either.right(
JanusGraphOperationStatus.GENERAL_ERROR));
- Either<List<Component>, StorageOperationStatus> fetchedComponents = testInstance.fetchMetaDataByResourceType(ResourceTypeEnum.VF.getValue(), new ComponentParametersView());
+ Either<List<Component>, StorageOperationStatus> fetchedComponents = testInstance
+ .fetchMetaDataByResourceType(ResourceTypeEnum.VF.getValue(), new ComponentParametersView());
assertTrue(fetchedComponents.isRight());
assertEquals(StorageOperationStatus.GENERAL_ERROR, fetchedComponents.right().value());
}
@Test
- public void associatePolicyToComponentSuccessTest(){
+ public void associatePolicyToComponentSuccessTest() {
Either<PolicyDefinition, StorageOperationStatus> result = associatePolicyToComponentWithStatus(StorageOperationStatus.OK);
assertTrue(result.isLeft());
}
@Test
- public void associatePolicyToComponentFailureTest(){
+ public void associatePolicyToComponentFailureTest() {
Either<PolicyDefinition, StorageOperationStatus> result = associatePolicyToComponentWithStatus(StorageOperationStatus.BAD_REQUEST);
assertTrue(result.isRight() && result.right().value() == StorageOperationStatus.BAD_REQUEST);
}
@Test
- public void updatePolicyOfComponentSuccessTest(){
+ public void updatePolicyOfComponentSuccessTest() {
Either<PolicyDefinition, StorageOperationStatus> result = updatePolicyOfComponentWithStatus(StorageOperationStatus.OK);
assertTrue(result.isLeft());
}
@Test
- public void updatePolicyOfComponentFailureTest(){
+ public void updatePolicyOfComponentFailureTest() {
Either<PolicyDefinition, StorageOperationStatus> result = updatePolicyOfComponentWithStatus(StorageOperationStatus.NOT_FOUND);
assertTrue(result.isRight() && result.right().value() == StorageOperationStatus.NOT_FOUND);
}
@Test
- public void removePolicyFromComponentSuccessTest(){
+ public void removePolicyFromComponentSuccessTest() {
removePolicyFromComponentWithStatus(StorageOperationStatus.OK);
}
@Test
- public void removePolicyFromComponentFailureTest(){
+ public void removePolicyFromComponentFailureTest() {
removePolicyFromComponentWithStatus(StorageOperationStatus.NOT_FOUND);
}
@Test
- public void testFindLastCertifiedToscaElementByUUID(){
+ public void testFindLastCertifiedToscaElementByUUID() {
Either<Component, StorageOperationStatus> result;
Component component = new Resource();
List<GraphVertex> list = new ArrayList<>();
@@ -235,15 +239,16 @@ public class ToscaOperationFacadeTest {
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
ToscaElement toscaElement = getToscaElementForTest();
- when(topologyTemplateOperationMock.getToscaElement(ArgumentMatchers.eq(graphVertex),any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
+ when(topologyTemplateOperationMock.getToscaElement(ArgumentMatchers.eq(graphVertex), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(toscaElement));
when(janusGraphDaoMock.getByCriteria(ModelConverter.getVertexType(component), props)).thenReturn(Either.left(list));
result = testInstance.findLastCertifiedToscaElementByUUID(component);
Component resultComp = result.left().value();
- assertEquals(resultComp.getToscaType(),ToscaElementTypeEnum.TOPOLOGY_TEMPLATE.getValue());
+ assertEquals(resultComp.getToscaType(), ToscaElementTypeEnum.TOPOLOGY_TEMPLATE.getValue());
}
@Test
- public void testLatestComponentByToscaResourceName(){
+ public void testLatestComponentByToscaResourceName() {
Either<Component, StorageOperationStatus> result;
TopologyTemplate toscaElement = new TopologyTemplate();
toscaElement.setComponentType(ComponentTypeEnum.SERVICE);
@@ -260,11 +265,13 @@ public class ToscaOperationFacadeTest {
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(list));
- when(topologyTemplateOperationMock.getToscaElement(ArgumentMatchers.eq(graphVertex),any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll))
+ .thenReturn(Either.left(list));
+ when(topologyTemplateOperationMock.getToscaElement(ArgumentMatchers.eq(graphVertex), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(toscaElement));
result = testInstance.getFullLatestComponentByToscaResourceName("toscaResourceName");
- assertThat(result.isLeft());
+ assertTrue(result.isLeft());
}
@Test
@@ -309,9 +316,10 @@ public class ToscaOperationFacadeTest {
topologyTemplate.setComponentType(ComponentTypeEnum.SERVICE);
when(janusGraphDaoMock.getByCriteria(VertexTypeEnum.NODE_TYPE, props, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(vertexList));
when(janusGraphDaoMock.getVertexById(uniqueId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
- when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(topologyTemplate));
+ when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(topologyTemplate));
result = testInstance.getLatestCertifiedNodeTypeByToscaResourceName(toscaResourceName);
- assertThat(result.isLeft());
+ assertTrue(result.isLeft());
}
@Test
@@ -393,7 +401,8 @@ public class ToscaOperationFacadeTest {
GraphVertex graphVertex = getTopologyTemplateVertex();
ToscaElement toscaElement = getToscaElementForTest();
when(janusGraphDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
- when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
+ when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(toscaElement));
result = testInstance.getToscaElement(id, JsonParseFlagEnum.ParseAll);
assertTrue(result.isLeft());
}
@@ -408,7 +417,7 @@ public class ToscaOperationFacadeTest {
when(janusGraphDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
when(nodeTypeOperationMock.markComponentToDelete(graphVertex)).thenReturn(Either.left(graphVertex));
result = testInstance.markComponentToDelete(component);
- assertEquals(result, StorageOperationStatus.OK);
+ assertEquals(StorageOperationStatus.OK, result);
}
@Test
@@ -443,8 +452,10 @@ public class ToscaOperationFacadeTest {
graphVertex.setMetadataProperties(props);
graphVertexList.add(graphVertex);
- when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertexList));
- when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata))
+ .thenReturn(Either.left(graphVertexList));
+ when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(toscaElement));
result = testInstance.getLatestByToscaResourceName(toscaResourceName);
assertTrue(result.isLeft());
}
@@ -468,11 +479,13 @@ public class ToscaOperationFacadeTest {
graphVertex.setUniqueId(toscaResourceName);
Map<JsonPresentationFields, Object> props = new HashMap<>();
props.put(JsonPresentationFields.VERSION, "1.0");
- graphVertex.setJsonMetadataField(JsonPresentationFields.VERSION, props.get(JsonPresentationFields.VERSION));
+ graphVertex.setJsonMetadataField(JsonPresentationFields.VERSION, props.get(JsonPresentationFields.VERSION));
graphVertexList.add(graphVertex);
- when(janusGraphDaoMock.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(graphVertexList));
- when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
+ when(janusGraphDaoMock.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata))
+ .thenReturn(Either.left(graphVertexList));
+ when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(toscaElement));
when(janusGraphDaoMock.getVertexById(toscaResourceName, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex));
@@ -517,8 +530,10 @@ public class ToscaOperationFacadeTest {
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(componentVertices));
- when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll))
+ .thenReturn(Either.left(componentVertices));
+ when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(toscaElement));
result = testInstance.getBySystemName(componentTypeEnum, sysName);
assertTrue(result.isLeft());
assertEquals(1, result.left().value().size());
@@ -543,7 +558,8 @@ public class ToscaOperationFacadeTest {
hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true);
hasProperties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
when(janusGraphDaoMock.getByCriteria(null, hasProperties, hasNotProperties, parseFlag)).thenReturn(Either.left(graphVertexList));
- when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement));
+ when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(toscaElement));
result = testInstance.getComponentByNameAndVersion(componentType, name, version, parseFlag);
assertTrue(result.isLeft());
}
@@ -555,13 +571,13 @@ public class ToscaOperationFacadeTest {
}
@Test
- public void addDataTypesToComponentSuccessTest(){
+ public void addDataTypesToComponentSuccessTest() {
Either<List<DataTypeDefinition>, StorageOperationStatus> result = addDataTypesToComponentWithStatus(StorageOperationStatus.OK);
assertTrue(result.isLeft());
}
@Test
- public void addDataTypesToComponentFailureTest_BadRequest(){
+ public void addDataTypesToComponentFailureTest_BadRequest() {
Either<List<DataTypeDefinition>, StorageOperationStatus> result = addDataTypesToComponentWithStatus(StorageOperationStatus.BAD_REQUEST);
assertTrue(result.isRight() && result.right().value() == StorageOperationStatus.BAD_REQUEST);
}
@@ -609,7 +625,7 @@ public class ToscaOperationFacadeTest {
dataTypes.put("dataType3", dataType3);
GraphVertex vertex;
- if(status == StorageOperationStatus.OK){
+ if (status == StorageOperationStatus.OK) {
vertex = getTopologyTemplateVertex();
} else {
vertex = getNodeTypeVertex();
@@ -617,7 +633,7 @@ public class ToscaOperationFacadeTest {
Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = Either.left(vertex);
when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(getVertexEither);
when(topologyTemplateOperationMock.addToscaDataToToscaElement(eq(vertex),
- eq(EdgeLabelEnum.DATA_TYPES), eq(VertexTypeEnum.DATA_TYPES), anyMap(), eq(JsonPresentationFields.NAME))).thenReturn(status);
+ eq(EdgeLabelEnum.DATA_TYPES), eq(VertexTypeEnum.DATA_TYPES), anyMap(), eq(JsonPresentationFields.NAME))).thenReturn(status);
return testInstance.addDataTypesToComponent(dataTypes, componentId);
}
@@ -635,21 +651,20 @@ public class ToscaOperationFacadeTest {
@Test
public void testDeleteDataTypeOfComponent() {
- StorageOperationStatus result;
Component component = new Resource();
String id = "id";
component.setUniqueId(id);
- String datatype = null;
DataTypeDefinition dataType1 = new DataTypeDefinition();
dataType1.setName("name1");
Map<String, DataTypeDataDefinition> dataTypeDataMap = new HashMap<>();
dataTypeDataMap.put("datatype1", dataType1);
- List<DataTypeDefinition> dataTypeMap = dataTypeDataMap.values().stream().map(e -> { DataTypeDefinition dataType = new DataTypeDefinition(e);return dataType; }).collect(Collectors.toList());
+ List<DataTypeDefinition> dataTypeMap = dataTypeDataMap.values().stream().map(e -> {
+ return new DataTypeDefinition(e);
+ }).collect(Collectors.toList());
component.setDataTypes(dataTypeMap);
GraphVertex graphVertex = getTopologyTemplateVertex();
- result = testInstance.deleteDataTypeOfComponent(component, "datatype1");
- assertEquals(datatype, result);
+ assertNull(testInstance.deleteDataTypeOfComponent(component, "datatype1"));
}
@Test
@@ -717,12 +732,13 @@ public class ToscaOperationFacadeTest {
containerComponent, originalComponent, componentInstance, false, user);
assertTrue(result.isLeft());
- assertEquals(componentInstance.getIcon(), ICON_NAME);
- assertEquals(result.left().value().getRight(), COMPONENT_ID);
+ assertEquals(ICON_NAME, componentInstance.getIcon());
+ assertEquals(COMPONENT_ID, result.left().value().getRight());
// the instance counter must be 1 because the service proxy instance with suffix 0 already exists.
verify(nodeTemplateOperationMock, times(1))
.addComponentInstanceToTopologyTemplate(any(), any(), eq("1"), eq(componentInstance), eq(false), eq(user));
}
+
@Test
public void testAddComponentInstanceToTopologyTemplate_ServiceSubstitution() {
Component containerComponent = new Service();
@@ -766,26 +782,29 @@ public class ToscaOperationFacadeTest {
@Test
public void testUpdateComponentInstanceRequirement() {
String containerComponentId = "containerComponentId";
- String componentInstanceUniqueId= "componentInstanceUniqueId";
- RequirementDataDefinition requirementDataDefinition= Mockito.mock(RequirementDataDefinition.class);
+ String componentInstanceUniqueId = "componentInstanceUniqueId";
+ RequirementDataDefinition requirementDataDefinition = Mockito.mock(RequirementDataDefinition.class);
- when(nodeTemplateOperationMock.updateComponentInstanceRequirement(containerComponentId, componentInstanceUniqueId, requirementDataDefinition)).thenReturn(StorageOperationStatus.OK);
- StorageOperationStatus result = testInstance.updateComponentInstanceRequirement(containerComponentId, componentInstanceUniqueId, requirementDataDefinition);
+ when(nodeTemplateOperationMock.updateComponentInstanceRequirement(containerComponentId, componentInstanceUniqueId, requirementDataDefinition))
+ .thenReturn(StorageOperationStatus.OK);
+ StorageOperationStatus result = testInstance
+ .updateComponentInstanceRequirement(containerComponentId, componentInstanceUniqueId, requirementDataDefinition);
assertEquals(StorageOperationStatus.OK, result);
- verify(nodeTemplateOperationMock, times(1)).updateComponentInstanceRequirement(containerComponentId, componentInstanceUniqueId, requirementDataDefinition);
+ verify(nodeTemplateOperationMock, times(1))
+ .updateComponentInstanceRequirement(containerComponentId, componentInstanceUniqueId, requirementDataDefinition);
}
@Test
- public void associateCapabilitiesToServiceFailureTest(){
+ public void associateCapabilitiesToServiceFailureTest() {
StorageOperationStatus result = associateCapabilitiesToServiceWithStatus(StorageOperationStatus.BAD_REQUEST);
- assertTrue(result == StorageOperationStatus.BAD_REQUEST);
+ assertSame(StorageOperationStatus.BAD_REQUEST, result);
}
@Test
- public void associateCapabilitiesToServiceSuccessTest(){
+ public void associateCapabilitiesToServiceSuccessTest() {
StorageOperationStatus result = associateCapabilitiesToServiceWithStatus(StorageOperationStatus.OK);
- assertTrue(result == StorageOperationStatus.OK);
+ assertSame(StorageOperationStatus.OK, result);
}
private StorageOperationStatus associateCapabilitiesToServiceWithStatus(StorageOperationStatus status) {
@@ -796,7 +815,7 @@ public class ToscaOperationFacadeTest {
capabilitiesMap.put("capabilities1", listCapabilityDataDefinition1);
GraphVertex vertex;
- if(status == StorageOperationStatus.OK){
+ if (status == StorageOperationStatus.OK) {
vertex = getTopologyTemplateVertex();
} else {
vertex = getNodeTypeVertex();
@@ -810,15 +829,15 @@ public class ToscaOperationFacadeTest {
}
@Test
- public void associateRequirementsToServiceFailureTest(){
+ public void associateRequirementsToServiceFailureTest() {
StorageOperationStatus result = associateRequirementsToServiceWithStatus(StorageOperationStatus.BAD_REQUEST);
- assertTrue(result == StorageOperationStatus.BAD_REQUEST);
+ assertSame(StorageOperationStatus.BAD_REQUEST, result);
}
@Test
public void associateRequirementsToServiceSuccessTest() {
StorageOperationStatus result = associateRequirementsToServiceWithStatus(StorageOperationStatus.OK);
- assertTrue(result == StorageOperationStatus.OK);
+ assertSame(StorageOperationStatus.OK, result);
}
@Test
@@ -1062,13 +1081,13 @@ public class ToscaOperationFacadeTest {
String componentId = "componentId";
int counter = 0;
GraphVertex vertex;
- if(status == StorageOperationStatus.OK){
+ if (status == StorageOperationStatus.OK) {
vertex = getTopologyTemplateVertex();
} else {
vertex = getNodeTypeVertex();
}
Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = Either.left(vertex);
- when(janusGraphDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.ParseMetadata))).thenReturn(getVertexEither);
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata)).thenReturn(getVertexEither);
when(topologyTemplateOperationMock.addPolicyToToscaElement(eq(vertex), any(PolicyDefinition.class), anyInt())).thenReturn(status);
return testInstance.associatePolicyToComponent(componentId, policy, counter);
}
@@ -1077,7 +1096,7 @@ public class ToscaOperationFacadeTest {
PolicyDefinition policy = new PolicyDefinition();
String componentId = "componentId";
GraphVertex vertex = getTopologyTemplateVertex();
- when(janusGraphDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.NoParse))).thenReturn(Either.left(vertex));
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(Either.left(vertex));
when(topologyTemplateOperationMock.updatePolicyOfToscaElement(eq(vertex), any(PolicyDefinition.class))).thenReturn(status);
return testInstance.updatePolicyOfComponent(componentId, policy, PromoteVersionEnum.NONE);
}
@@ -1087,8 +1106,8 @@ public class ToscaOperationFacadeTest {
String policyId = "policyId";
GraphVertex vertex = getTopologyTemplateVertex();
Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = Either.left(vertex);
- when(janusGraphDaoMock.getVertexById(eq(componentId), eq(JsonParseFlagEnum.NoParse))).thenReturn(getVertexEither);
- when(topologyTemplateOperationMock.removePolicyFromToscaElement(eq(vertex), eq(policyId))).thenReturn(status);
+ when(janusGraphDaoMock.getVertexById(componentId, JsonParseFlagEnum.NoParse)).thenReturn(getVertexEither);
+ when(topologyTemplateOperationMock.removePolicyFromToscaElement(vertex, policyId)).thenReturn(status);
StorageOperationStatus result = testInstance.removePolicyFromComponent(componentId, policyId);
assertSame(result, status);
}
diff --git a/catalog-ui/src/app/ng2/pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.component.ts b/catalog-ui/src/app/ng2/pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.component.ts
index 2cd4f4d1c7..3781a5163d 100644
--- a/catalog-ui/src/app/ng2/pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.component.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.component.ts
@@ -19,24 +19,23 @@
* ============LICENSE_END=========================================================
*/
-import { Component } from '@angular/core';
+import {Component} from '@angular/core';
import {InputBEModel, PropertyBEModel, PropertyModel} from 'app/models';
-import { OPERATOR_TYPES } from 'app/ng2/components/logic/service-dependencies/service-dependencies.component';
-import { DropdownValue } from 'app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component';
-import { ServiceServiceNg2 } from 'app/ng2/services/component-services/service.service';
-import { PROPERTY_DATA } from 'app/utils';
-import { ServiceInstanceObject } from '../../../../models/service-instance-properties-and-interfaces';
+import {OPERATOR_TYPES} from 'app/ng2/components/logic/service-dependencies/service-dependencies.component';
+import {DropdownValue} from 'app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component';
+import {ServiceServiceNg2} from 'app/ng2/services/component-services/service.service';
+import {PROPERTY_DATA} from 'app/utils';
+import {ServiceInstanceObject} from '../../../../models/service-instance-properties-and-interfaces';
import {CapabilitiesConstraintObjectUI} from "../../../components/logic/capabilities-constraint/capabilities-constraint.component";
export class UIDropDownSourceTypesElement extends DropdownValue {
options: any[];
assignedLabel: string;
type: string;
+
constructor(input?: any) {
+ super(input ? input.value || '' : "", input ? input.label || '' : "");
if (input) {
- const value = input.value || '';
- const label = input.label || '';
- super(value, label);
this.options = input.options;
this.assignedLabel = input.assignedLabel;
this.type = input.type;
@@ -52,9 +51,6 @@ export class UIDropDownSourceTypesElement extends DropdownValue {
})
export class CapabilitiesFilterPropertiesEditorComponent {
- constructor() {
- }
-
input: {
serviceRuleIndex: number,
serviceRules: CapabilitiesConstraintObjectUI[],
@@ -100,7 +96,8 @@ export class CapabilitiesFilterPropertiesEditorComponent {
capabilityName: this.SOURCE_TYPES.CAPABILITY_NAME.value,
sourceName: this.SOURCE_TYPES.STATIC.value,
sourceType: this.SOURCE_TYPES.STATIC.value, value: '',
- constraintOperator: OPERATOR_TYPES.EQUAL});
+ constraintOperator: OPERATOR_TYPES.EQUAL
+ });
this.currentServiceName = this.input.currentServiceName;
this.operatorTypes = this.input.operatorTypes;
@@ -111,8 +108,13 @@ export class CapabilitiesFilterPropertiesEditorComponent {
}
initSourceTypes() {
- this.sourceTypes.push({label: this.SOURCE_TYPES.STATIC.label, value: this.SOURCE_TYPES.STATIC.value,
- options: [], assignedLabel: this.SOURCE_TYPES.STATIC.label, type: this.SOURCE_TYPES.STATIC.value});
+ this.sourceTypes.push({
+ label: this.SOURCE_TYPES.STATIC.label,
+ value: this.SOURCE_TYPES.STATIC.value,
+ options: [],
+ assignedLabel: this.SOURCE_TYPES.STATIC.label,
+ type: this.SOURCE_TYPES.STATIC.value
+ });
this.sourceTypes.push({
label: this.input.compositeServiceName,
value: this.input.compositeServiceName,
@@ -135,7 +137,7 @@ export class CapabilitiesFilterPropertiesEditorComponent {
if (!this.currentRule.sourceName && this.currentRule.sourceType === this.SOURCE_TYPES.STATIC.value) {
this.currentRule.sourceName = this.SOURCE_TYPES.STATIC.value;
}
- if (!this.input.componentInstanceCapabilitiesMap){
+ if (!this.input.componentInstanceCapabilitiesMap) {
this.selectedCapabilitiesPropertyObject = Array.from(this.input.componentInstanceCapabilitiesMap
.get(this.currentRule.capabilityName))
.find(property => property.name == this.currentRule.servicePropertyName);
@@ -158,7 +160,7 @@ export class CapabilitiesFilterPropertiesEditorComponent {
const selectedSourceType: UIDropDownSourceTypesElement = this.sourceTypes.find(
(t) => t.value === this.currentRule.sourceName && t.type === this.currentRule.sourceType
);
- if(selectedSourceType) {
+ if (selectedSourceType) {
this.listOfSourceOptions = selectedSourceType.options || [];
this.assignedValueLabel = selectedSourceType.assignedLabel || this.SOURCE_TYPES.STATIC.label;
this.filterOptionsByType();
@@ -166,7 +168,7 @@ export class CapabilitiesFilterPropertiesEditorComponent {
}
}
- onCapabilityNameChanged= (value: any): void => {
+ onCapabilityNameChanged = (value: any): void => {
this.selectedPropertiesByCapabilityName = this.input.componentInstanceCapabilitiesMap.get(value);
this.capabilityProperties = _.map(this.selectedPropertiesByCapabilityName, (prop) => new DropdownValue(prop.name, prop.name));
this.selectedCapabilityName = value;
@@ -193,7 +195,7 @@ export class CapabilitiesFilterPropertiesEditorComponent {
this.listOfValuesToAssign = [];
return;
}
- this.listOfValuesToAssign = this.listOfSourceOptions.reduce((result, op: PropertyModel) => {
+ this.listOfValuesToAssign = this.listOfSourceOptions.reduce((result, op: PropertyModel) => {
if (op.type === this.selectedCapabilitiesPropertyObject.type && (!op.schemaType || op.schemaType === this.selectedCapabilitiesPropertyObject.schemaType)) {
result.push(new DropdownValue(op.name, op.name));
}
diff --git a/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts b/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts
index 003c6dc515..084ab32b5c 100644
--- a/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts
+++ b/catalog-ui/src/app/ng2/pages/service-dependencies-editor/service-dependencies-editor.component.ts
@@ -13,183 +13,193 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import { Component } from '@angular/core';
-import { InputBEModel, PropertyBEModel } from 'app/models';
-import { ConstraintObjectUI, OPERATOR_TYPES } from 'app/ng2/components/logic/service-dependencies/service-dependencies.component';
-import { DropdownValue } from 'app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component';
-import { ServiceServiceNg2 } from 'app/ng2/services/component-services/service.service';
-import { PROPERTY_DATA } from 'app/utils';
-import { ServiceInstanceObject } from '../../../models/service-instance-properties-and-interfaces';
+import {Component} from '@angular/core';
+import {InputBEModel, PropertyBEModel} from 'app/models';
+import {
+ ConstraintObjectUI,
+ OPERATOR_TYPES
+} from 'app/ng2/components/logic/service-dependencies/service-dependencies.component';
+import {DropdownValue} from 'app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component';
+import {ServiceServiceNg2} from 'app/ng2/services/component-services/service.service';
+import {PROPERTY_DATA} from 'app/utils';
+import {ServiceInstanceObject} from '../../../models/service-instance-properties-and-interfaces';
export class UIDropDownSourceTypesElement extends DropdownValue {
- options: any[];
- assignedLabel: string;
- type: string;
- constructor(input?: any) {
- if (input) {
- const value = input.value || '';
- const label = input.label || '';
- // const hidden = input.hidden || '';
- // const selected = input.selected || '';
- super(value, label);
- this.options = input.options;
- this.assignedLabel = input.assignedLabel;
- this.type = input.type;
- }
+ options: any[];
+ assignedLabel: string;
+ type: string;
+
+ constructor(input?: any) {
+ super(input ? input.value || '' : "", input ? input.label || '' : "");
+ if (input) {
+ this.options = input.options;
+ this.assignedLabel = input.assignedLabel;
+ this.type = input.type;
}
+ }
}
// tslint:disable-next-line:max-classes-per-file
@Component({
- selector: 'service-dependencies-editor',
- templateUrl: './service-dependencies-editor.component.html',
- styleUrls: ['./service-dependencies-editor.component.less'],
- providers: [ServiceServiceNg2]
+ selector: 'service-dependencies-editor',
+ templateUrl: './service-dependencies-editor.component.html',
+ styleUrls: ['./service-dependencies-editor.component.less'],
+ providers: [ServiceServiceNg2]
})
export class ServiceDependenciesEditorComponent {
- input: {
- serviceRuleIndex: number,
- serviceRules: ConstraintObjectUI[],
- compositeServiceName: string,
- currentServiceName: string,
- parentServiceInputs: InputBEModel[],
- selectedInstanceProperties: PropertyBEModel[],
- operatorTypes: DropdownValue[],
- selectedInstanceSiblings: ServiceInstanceObject[]
- };
- currentServiceName: string;
- selectedServiceProperties: PropertyBEModel[];
- selectedPropertyObj: PropertyBEModel;
- ddValueSelectedServicePropertiesNames: DropdownValue[];
- operatorTypes: DropdownValue[];
- sourceTypes: UIDropDownSourceTypesElement[] = [];
- currentRule: ConstraintObjectUI;
- currentIndex: number;
- listOfValuesToAssign: DropdownValue[];
- listOfSourceOptions: PropertyBEModel[];
- assignedValueLabel: string;
- serviceRulesList: ConstraintObjectUI[];
-
- SOURCE_TYPES = {
- STATIC: {label: 'Static', value: 'static'},
- SERVICE_PROPERTY: {label: 'Service Property', value: 'property'}
- };
-
- ngOnInit() {
- this.currentIndex = this.input.serviceRuleIndex;
- this.serviceRulesList = this.input.serviceRules;
- this.currentRule = this.serviceRulesList && this.input.serviceRuleIndex >= 0 ?
- this.serviceRulesList[this.input.serviceRuleIndex] :
- new ConstraintObjectUI({sourceName: this.SOURCE_TYPES.STATIC.value, sourceType: this.SOURCE_TYPES.STATIC.value, value: '', constraintOperator: OPERATOR_TYPES.EQUAL});
- this.currentServiceName = this.input.currentServiceName;
- this.operatorTypes = this.input.operatorTypes;
- this.selectedServiceProperties = this.input.selectedInstanceProperties;
- this.ddValueSelectedServicePropertiesNames = _.map(this.input.selectedInstanceProperties, (prop) => new DropdownValue(prop.name, prop.name));
- this.initSourceTypes();
- this.syncRuleData();
- this.updateSourceTypesRelatedValues();
- }
-
- initSourceTypes() {
- this.sourceTypes.push({label: this.SOURCE_TYPES.STATIC.label, value: this.SOURCE_TYPES.STATIC.value,
- options: [], assignedLabel: this.SOURCE_TYPES.STATIC.label, type: this.SOURCE_TYPES.STATIC.value});
- this.sourceTypes.push({
- label: this.input.compositeServiceName,
- value: this.input.compositeServiceName,
- assignedLabel: this.SOURCE_TYPES.SERVICE_PROPERTY.label,
- type: this.SOURCE_TYPES.SERVICE_PROPERTY.value,
- options: this.input.parentServiceInputs
+ input: {
+ serviceRuleIndex: number,
+ serviceRules: ConstraintObjectUI[],
+ compositeServiceName: string,
+ currentServiceName: string,
+ parentServiceInputs: InputBEModel[],
+ selectedInstanceProperties: PropertyBEModel[],
+ operatorTypes: DropdownValue[],
+ selectedInstanceSiblings: ServiceInstanceObject[]
+ };
+ currentServiceName: string;
+ selectedServiceProperties: PropertyBEModel[];
+ selectedPropertyObj: PropertyBEModel;
+ ddValueSelectedServicePropertiesNames: DropdownValue[];
+ operatorTypes: DropdownValue[];
+ sourceTypes: UIDropDownSourceTypesElement[] = [];
+ currentRule: ConstraintObjectUI;
+ currentIndex: number;
+ listOfValuesToAssign: DropdownValue[];
+ listOfSourceOptions: PropertyBEModel[];
+ assignedValueLabel: string;
+ serviceRulesList: ConstraintObjectUI[];
+
+ SOURCE_TYPES = {
+ STATIC: {label: 'Static', value: 'static'},
+ SERVICE_PROPERTY: {label: 'Service Property', value: 'property'}
+ };
+
+ ngOnInit() {
+ this.currentIndex = this.input.serviceRuleIndex;
+ this.serviceRulesList = this.input.serviceRules;
+ this.currentRule = this.serviceRulesList && this.input.serviceRuleIndex >= 0 ?
+ this.serviceRulesList[this.input.serviceRuleIndex] :
+ new ConstraintObjectUI({
+ sourceName: this.SOURCE_TYPES.STATIC.value,
+ sourceType: this.SOURCE_TYPES.STATIC.value,
+ value: '',
+ constraintOperator: OPERATOR_TYPES.EQUAL
});
- _.forEach(this.input.selectedInstanceSiblings, (sib) =>
- this.sourceTypes.push({
- label: sib.name,
- value: sib.name,
- options: sib.properties || [],
- assignedLabel: this.SOURCE_TYPES.SERVICE_PROPERTY.label,
- type: this.SOURCE_TYPES.SERVICE_PROPERTY.value
- })
- );
- }
-
- syncRuleData() {
- if (!this.currentRule.sourceName && this.currentRule.sourceType === this.SOURCE_TYPES.STATIC.value) {
- this.currentRule.sourceName = this.SOURCE_TYPES.STATIC.value;
- }
- this.selectedPropertyObj = _.find(this.selectedServiceProperties, (prop) => prop.name === this.currentRule.servicePropertyName);
- this.updateOperatorTypesList();
- this.updateSourceTypesRelatedValues();
- }
-
- updateOperatorTypesList() {
- if (this.selectedPropertyObj && PROPERTY_DATA.SIMPLE_TYPES_COMPARABLE.indexOf(this.selectedPropertyObj.type) === -1) {
- this.operatorTypes = [{label: '=', value: OPERATOR_TYPES.EQUAL}];
- this.currentRule.constraintOperator = OPERATOR_TYPES.EQUAL;
- } else {
- this.operatorTypes = this.input.operatorTypes;
- }
- }
-
- updateSourceTypesRelatedValues() {
- if (this.currentRule.sourceName) {
- const selectedSourceType: UIDropDownSourceTypesElement = this.sourceTypes.find(
- (t) => t.value === this.currentRule.sourceName && t.type === this.currentRule.sourceType
- );
- if(selectedSourceType) {
- this.listOfSourceOptions = selectedSourceType.options || [];
- this.assignedValueLabel = selectedSourceType.assignedLabel || this.SOURCE_TYPES.STATIC.label;
- this.filterOptionsByType();
- }
- }
+ this.currentServiceName = this.input.currentServiceName;
+ this.operatorTypes = this.input.operatorTypes;
+ this.selectedServiceProperties = this.input.selectedInstanceProperties;
+ this.ddValueSelectedServicePropertiesNames = _.map(this.input.selectedInstanceProperties, (prop) => new DropdownValue(prop.name, prop.name));
+ this.initSourceTypes();
+ this.syncRuleData();
+ this.updateSourceTypesRelatedValues();
+ }
+
+ initSourceTypes() {
+ this.sourceTypes.push({
+ label: this.SOURCE_TYPES.STATIC.label,
+ value: this.SOURCE_TYPES.STATIC.value,
+ options: [],
+ assignedLabel: this.SOURCE_TYPES.STATIC.label,
+ type: this.SOURCE_TYPES.STATIC.value
+ });
+ this.sourceTypes.push({
+ label: this.input.compositeServiceName,
+ value: this.input.compositeServiceName,
+ assignedLabel: this.SOURCE_TYPES.SERVICE_PROPERTY.label,
+ type: this.SOURCE_TYPES.SERVICE_PROPERTY.value,
+ options: this.input.parentServiceInputs
+ });
+ _.forEach(this.input.selectedInstanceSiblings, (sib) =>
+ this.sourceTypes.push({
+ label: sib.name,
+ value: sib.name,
+ options: sib.properties || [],
+ assignedLabel: this.SOURCE_TYPES.SERVICE_PROPERTY.label,
+ type: this.SOURCE_TYPES.SERVICE_PROPERTY.value
+ })
+ );
+ }
+
+ syncRuleData() {
+ if (!this.currentRule.sourceName && this.currentRule.sourceType === this.SOURCE_TYPES.STATIC.value) {
+ this.currentRule.sourceName = this.SOURCE_TYPES.STATIC.value;
}
-
- onChangePage(newIndex) {
- if (newIndex >= 0 && newIndex < this.input.serviceRules.length) {
- this.currentIndex = newIndex;
- this.currentRule = this.serviceRulesList[newIndex];
- this.syncRuleData();
- }
+ this.selectedPropertyObj = _.find(this.selectedServiceProperties, (prop) => prop.name === this.currentRule.servicePropertyName);
+ this.updateOperatorTypesList();
+ this.updateSourceTypesRelatedValues();
+ }
+
+ updateOperatorTypesList() {
+ if (this.selectedPropertyObj && PROPERTY_DATA.SIMPLE_TYPES_COMPARABLE.indexOf(this.selectedPropertyObj.type) === -1) {
+ this.operatorTypes = [{label: '=', value: OPERATOR_TYPES.EQUAL}];
+ this.currentRule.constraintOperator = OPERATOR_TYPES.EQUAL;
+ } else {
+ this.operatorTypes = this.input.operatorTypes;
}
-
- onServicePropertyChanged() {
- this.selectedPropertyObj = _.find(this.selectedServiceProperties, (prop) => prop.name === this.currentRule.servicePropertyName);
- this.updateOperatorTypesList();
+ }
+
+ updateSourceTypesRelatedValues() {
+ if (this.currentRule.sourceName) {
+ const selectedSourceType: UIDropDownSourceTypesElement = this.sourceTypes.find(
+ (t) => t.value === this.currentRule.sourceName && t.type === this.currentRule.sourceType
+ );
+ if (selectedSourceType) {
+ this.listOfSourceOptions = selectedSourceType.options || [];
+ this.assignedValueLabel = selectedSourceType.assignedLabel || this.SOURCE_TYPES.STATIC.label;
this.filterOptionsByType();
- this.currentRule.value = '';
+ }
}
+ }
- onSelectSourceType() {
- this.currentRule.sourceType = this.currentRule.sourceName === this.SOURCE_TYPES.STATIC.value ?
- this.SOURCE_TYPES.STATIC.value :
- this.SOURCE_TYPES.SERVICE_PROPERTY.value;
- this.updateSourceTypesRelatedValues();
- this.currentRule.value = '';
+ onChangePage(newIndex) {
+ if (newIndex >= 0 && newIndex < this.input.serviceRules.length) {
+ this.currentIndex = newIndex;
+ this.currentRule = this.serviceRulesList[newIndex];
+ this.syncRuleData();
}
-
- filterOptionsByType() {
- if (!this.selectedPropertyObj) {
- this.listOfValuesToAssign = [];
- return;
- }
- this.listOfValuesToAssign = this.listOfSourceOptions.reduce((result, op: PropertyBEModel) => {
- if (op.type === this.selectedPropertyObj.type && (!op.schemaType || op.schemaType === this.selectedPropertyObj.schemaType)) {
- result.push(new DropdownValue(op.name, op.name));
- }
- return result;
- }, []);
- }
-
- onValueChange(isValidValue) {
- this.currentRule.updateValidity(isValidValue);
+ }
+
+ onServicePropertyChanged() {
+ this.selectedPropertyObj = _.find(this.selectedServiceProperties, (prop) => prop.name === this.currentRule.servicePropertyName);
+ this.updateOperatorTypesList();
+ this.filterOptionsByType();
+ this.currentRule.value = '';
+ }
+
+ onSelectSourceType() {
+ this.currentRule.sourceType = this.currentRule.sourceName === this.SOURCE_TYPES.STATIC.value ?
+ this.SOURCE_TYPES.STATIC.value :
+ this.SOURCE_TYPES.SERVICE_PROPERTY.value;
+ this.updateSourceTypesRelatedValues();
+ this.currentRule.value = '';
+ }
+
+ filterOptionsByType() {
+ if (!this.selectedPropertyObj) {
+ this.listOfValuesToAssign = [];
+ return;
}
-
- checkFormValidForSubmit() {
- if (!this.serviceRulesList) { // for create modal
- const isStatic = this.currentRule.sourceName === this.SOURCE_TYPES.STATIC.value;
- return this.currentRule.isValidRule(isStatic);
- }
- // for update all rules
- return this.serviceRulesList.every((rule) => rule.isValidRule(rule.sourceName === this.SOURCE_TYPES.STATIC.value));
+ this.listOfValuesToAssign = this.listOfSourceOptions.reduce((result, op: PropertyBEModel) => {
+ if (op.type === this.selectedPropertyObj.type && (!op.schemaType || op.schemaType === this.selectedPropertyObj.schemaType)) {
+ result.push(new DropdownValue(op.name, op.name));
+ }
+ return result;
+ }, []);
+ }
+
+ onValueChange(isValidValue) {
+ this.currentRule.updateValidity(isValidValue);
+ }
+
+ checkFormValidForSubmit() {
+ if (!this.serviceRulesList) { // for create modal
+ const isStatic = this.currentRule.sourceName === this.SOURCE_TYPES.STATIC.value;
+ return this.currentRule.isValidRule(isStatic);
}
+ // for update all rules
+ return this.serviceRulesList.every((rule) => rule.isValidRule(rule.sourceName === this.SOURCE_TYPES.STATIC.value));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java
index b2fa3e7666..bcaa12e8e5 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java
@@ -31,19 +31,27 @@ import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidati
import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_SINGLE_NESTED_RESOURCE;
import com.fasterxml.jackson.databind.ObjectMapper;
- import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
-
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.junit.Assert;
-import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType;
-import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
import org.onap.sdc.tosca.datatypes.model.GroupDefinition;
import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
import org.onap.sdc.tosca.datatypes.model.NodeType;
import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
-import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType;
+import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
import org.openecomp.sdc.tosca.services.DataModelUtil;
import org.openecomp.sdc.tosca.services.ToscaConstants;
import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl;
@@ -59,118 +67,103 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida
import org.openecomp.sdc.translator.services.heattotosca.ConsolidationDataUtil;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-
public class ConsolidationDataTestUtil {
- public static void validateVolumeInConsolidationData(String computeNodeTemplateId,
- ComputeTemplateConsolidationData
- computeTemplateConsolidationData,
- ServiceTemplate expectedServiceTemplate,
- String testName) {
- Assert.assertNotNull(computeTemplateConsolidationData);
- //Get the volume information from consolidation data
- Multimap<String, RequirementAssignmentData> volumeConsolidationData =
- computeTemplateConsolidationData.getVolumes();
-
- if(testName.equals("Negative")) {
- Assert.assertNull(volumeConsolidationData);
- return;
- }
+ public static void validateVolumeInConsolidationData(String computeNodeTemplateId,
+ ComputeTemplateConsolidationData
+ computeTemplateConsolidationData,
+ ServiceTemplate expectedServiceTemplate,
+ String testName) {
+ Assert.assertNotNull(computeTemplateConsolidationData);
+ //Get the volume information from consolidation data
+ Multimap<String, RequirementAssignmentData> volumeConsolidationData =
+ computeTemplateConsolidationData.getVolumes();
+
+ if (testName.equals("Negative")) {
+ Assert.assertNull(volumeConsolidationData);
+ return;
+ }
- //Get the volume requirement information from the output translated template
- NodeTemplate computeNode = DataModelUtil.getNodeTemplate(expectedServiceTemplate,
- computeNodeTemplateId);
+ //Get the volume requirement information from the output translated template
+ NodeTemplate computeNode = DataModelUtil.getNodeTemplate(expectedServiceTemplate,
+ computeNodeTemplateId);
- if(!isComputeNodeType(expectedServiceTemplate, computeNode.getType()) ) {
- //According to toplogy only Compute->volume relationship is valid
- Assert.assertNull(volumeConsolidationData);
- return;
- }
+ if (!isComputeNodeType(expectedServiceTemplate, computeNode.getType())) {
+ //According to toplogy only Compute->volume relationship is valid
+ Assert.assertNull(volumeConsolidationData);
+ return;
+ }
- Assert.assertNotNull(computeNode);
- List<String> computeVolumeRequirementsNodes = new ArrayList<>();
- List<Map<String, RequirementAssignment>> requirementList = computeNode.getRequirements();
- if(requirementList != null){
- for(Map<String, RequirementAssignment> req : requirementList){
- Set<String> reqKeySet = req.keySet();
- for(String reqKey : reqKeySet){
- //populating the "node" property of all the requirements "local_storage" related to volume
- if(reqKey.equals(ToscaConstants.LOCAL_STORAGE_REQUIREMENT_ID)){
- RequirementAssignment requirementAssignment = new ObjectMapper().convertValue(req.get
- (reqKey), RequirementAssignment.class);
- computeVolumeRequirementsNodes.add(requirementAssignment.getNode());
- }
+ Assert.assertNotNull(computeNode);
+ List<String> computeVolumeRequirementsNodes = new ArrayList<>();
+ List<Map<String, RequirementAssignment>> requirementList = computeNode.getRequirements();
+ if (requirementList != null) {
+ for (Map<String, RequirementAssignment> req : requirementList) {
+ Set<String> reqKeySet = req.keySet();
+ for (String reqKey : reqKeySet) {
+ //populating the "node" property of all the requirements "local_storage" related to volume
+ if (reqKey.equals(ToscaConstants.LOCAL_STORAGE_REQUIREMENT_ID)) {
+ RequirementAssignment requirementAssignment = new ObjectMapper().convertValue(req.get
+ (reqKey), RequirementAssignment.class);
+ computeVolumeRequirementsNodes.add(requirementAssignment.getNode());
+ }
+ }
+ }
+ isVolumeComputeRequirement(computeVolumeRequirementsNodes, volumeConsolidationData);
}
- }
- isVolumeComputeRequirement(computeVolumeRequirementsNodes, volumeConsolidationData);
}
- }
private static void isVolumeComputeRequirement(List<String> computeVolumeRequirementsNodes,
Multimap<String, RequirementAssignmentData>
- volumeConsolidationData) {
+ volumeConsolidationData) {
Assert.assertEquals(computeVolumeRequirementsNodes.size(), volumeConsolidationData.size());
for (String volumeNodeTemplateId : computeVolumeRequirementsNodes) {
- Assert.assertNotNull(volumeConsolidationData.containsKey(volumeNodeTemplateId));
- Collection<RequirementAssignmentData> requirementAssignmentDataList = volumeConsolidationData.get
- (volumeNodeTemplateId);
+ Assert.assertTrue(volumeConsolidationData.containsKey(volumeNodeTemplateId));
+ Collection<RequirementAssignmentData> requirementAssignmentDataList = volumeConsolidationData.get(volumeNodeTemplateId);
for (RequirementAssignmentData requirementAssignmentData : requirementAssignmentDataList) {
- Assert.assertTrue(requirementAssignmentData.getRequirementId().equals(ToscaConstants
- .LOCAL_STORAGE_REQUIREMENT_ID));
+ Assert.assertEquals(ToscaConstants.LOCAL_STORAGE_REQUIREMENT_ID, requirementAssignmentData.getRequirementId());
}
}
}
-
- public static void validatePortsInConsolidationData(String computeNodeTemplateId,
- ComputeTemplateConsolidationData
- computeTemplateConsolidationData,
- ServiceTemplate outputServiceTemplate){
- Map<String,List<String>> consolidatedMap = computeTemplateConsolidationData.getPorts();
- Map<String,List<String>> expectedMap = getPortsInConsolidationData(outputServiceTemplate).get
- (computeNodeTemplateId);
- if(expectedMap == null && consolidatedMap == null){
- return;
- }
- for(String consolidatedKey : consolidatedMap.keySet()){
- List<String> consolidatedList = consolidatedMap.get(consolidatedKey);
- if (expectedMap != null) {
- List<String> expectedList = expectedMap.get(consolidatedKey);
- if (expectedList == null) {
- Assert.fail();
+ public static void validatePortsInConsolidationData(String computeNodeTemplateId,
+ ComputeTemplateConsolidationData
+ computeTemplateConsolidationData,
+ ServiceTemplate outputServiceTemplate) {
+ Map<String, List<String>> consolidatedMap = computeTemplateConsolidationData.getPorts();
+ Map<String, List<String>> expectedMap = getPortsInConsolidationData(outputServiceTemplate).get
+ (computeNodeTemplateId);
+ if (expectedMap == null && consolidatedMap == null) {
+ return;
}
- if (!CollectionUtils.isEqualCollection(consolidatedList, expectedList)) {
- Assert.fail();
+ for (String consolidatedKey : consolidatedMap.keySet()) {
+ List<String> consolidatedList = consolidatedMap.get(consolidatedKey);
+ if (expectedMap != null) {
+ List<String> expectedList = expectedMap.get(consolidatedKey);
+ if (expectedList == null) {
+ Assert.fail();
+ }
+ if (!CollectionUtils.isEqualCollection(consolidatedList, expectedList)) {
+ Assert.fail();
+ }
+ }
}
- }
}
- }
public static void validateDependsOnInConsolidationData(String computeNodeTemplateId,
ComputeTemplateConsolidationData
- computeTemplateConsolidationData,
+ computeTemplateConsolidationData,
ServiceTemplate outputServiceTemplate,
String testName) {
Map<String, NodeTemplate> outputNodeTemplates = outputServiceTemplate.getTopology_template()
- .getNode_templates();
+ .getNode_templates();
Multimap<String, RequirementAssignmentData> nodesConnectedIn =
- computeTemplateConsolidationData.getNodesConnectedIn();
+ computeTemplateConsolidationData.getNodesConnectedIn();
Multimap<String, RequirementAssignmentData> nodesConnectedOut =
- computeTemplateConsolidationData.getNodesConnectedOut();
+ computeTemplateConsolidationData.getNodesConnectedOut();
if (testName.equals(TEST_DEPENDS_ON_INVALID_DEPENDENCY_CANDIDATE) ||
- testName.equals(TEST_DEPENDS_ON_NO_DEPENDENCY)) {
+ testName.equals(TEST_DEPENDS_ON_NO_DEPENDENCY)) {
Assert.assertNull(nodesConnectedIn);
Assert.assertNull(nodesConnectedOut);
return;
@@ -197,131 +190,136 @@ public class ConsolidationDataTestUtil {
if (testName.equals(TEST_DEPENDS_ON_NODES_CONNECTED_OUT)) {
Assert.assertNull(nodesConnectedIn);
validateDependsOnNodesConnectedOut(computeNodeTemplateId, nodesConnectedOut,
- outputDependsOnNodeRequirementMap, outputServiceTemplate);
+ outputDependsOnNodeRequirementMap, outputServiceTemplate);
}
if (testName.equals(TEST_DEPENDS_ON_NODES_CONNECTED_IN)) {
Assert.assertNull(nodesConnectedOut);
validateDependsOnNodesConnectedIn(computeNodeTemplateId, nodesConnectedIn,
- outputDependsOnNodeRequirementMap,
- outputServiceTemplate);
+ outputDependsOnNodeRequirementMap,
+ outputServiceTemplate);
}
if (testName.equals(TEST_DEPENDS_ON_NODES_CONNECTED_IN_AND_OUT)) {
Assert.assertNotNull(nodesConnectedIn);
Assert.assertNotNull(nodesConnectedOut);
validateDependsOnNodesConnectedOut(computeNodeTemplateId, nodesConnectedOut,
- outputDependsOnNodeRequirementMap,
- outputServiceTemplate);
+ outputDependsOnNodeRequirementMap,
+ outputServiceTemplate);
validateDependsOnNodesConnectedIn(computeNodeTemplateId, nodesConnectedIn,
- outputDependsOnNodeRequirementMap,
- outputServiceTemplate);
+ outputDependsOnNodeRequirementMap,
+ outputServiceTemplate);
}
if (testName.equals(TEST_DEPENDS_ON_MULTIPLE_COMPUTE)) {
if (nodesConnectedOut != null) {
validateDependsOnNodesConnectedOut(computeNodeTemplateId, nodesConnectedOut,
- outputDependsOnNodeRequirementMap,
- outputServiceTemplate);
+ outputDependsOnNodeRequirementMap,
+ outputServiceTemplate);
}
if (nodesConnectedIn != null) {
validateDependsOnNodesConnectedIn(computeNodeTemplateId, nodesConnectedIn,
- outputDependsOnNodeRequirementMap,
- outputServiceTemplate);
+ outputDependsOnNodeRequirementMap,
+ outputServiceTemplate);
}
}
}
- private static void validateDependsOnNodesConnectedIn(String computeNodeTemplateId,
- Multimap<String, RequirementAssignmentData>
- nodesConnectedIn,
- Multimap<String, RequirementAssignment>
- outputDependsOnNodeRequirementMap,
- ServiceTemplate outputServiceTemplate) {
- ToscaAnalyzerServiceImpl analyzerService = new ToscaAnalyzerServiceImpl();
- for(String sourceNodeTemplateId : outputDependsOnNodeRequirementMap.keySet()) {
- Optional<NodeTemplate> sourceNodeTemplate = analyzerService.getNodeTemplateById
- (outputServiceTemplate, sourceNodeTemplateId);
- String sourceNodeType = sourceNodeTemplate.get().getType();
- for(Object obj : outputDependsOnNodeRequirementMap.get(sourceNodeTemplateId)){
- RequirementAssignment req = new ObjectMapper().convertValue(obj, RequirementAssignment
- .class);
- String targetNodeTemplateId = req.getNode();
- Optional<NodeTemplate> targetNodeTemplate = analyzerService.getNodeTemplateById
- (outputServiceTemplate, targetNodeTemplateId);
-
- String targetNodeType = targetNodeTemplate.get().getType();
- boolean isValidTargetForConnectedIn = false;
- if(isComputeNodeType(outputServiceTemplate, targetNodeType)) {
- isValidTargetForConnectedIn = true;
- } else if(isPortNodeType(outputServiceTemplate, targetNodeType)) {
- isValidTargetForConnectedIn = true;
- }
+ private static void validateDependsOnNodesConnectedIn(String computeNodeTemplateId,
+ Multimap<String, RequirementAssignmentData>
+ nodesConnectedIn,
+ Multimap<String, RequirementAssignment>
+ outputDependsOnNodeRequirementMap,
+ ServiceTemplate outputServiceTemplate) {
+ ToscaAnalyzerServiceImpl analyzerService = new ToscaAnalyzerServiceImpl();
+ for (String sourceNodeTemplateId : outputDependsOnNodeRequirementMap.keySet()) {
+ Optional<NodeTemplate> sourceNodeTemplate = analyzerService.getNodeTemplateById
+ (outputServiceTemplate, sourceNodeTemplateId);
+ String sourceNodeType = sourceNodeTemplate.get().getType();
+ for (Object obj : outputDependsOnNodeRequirementMap.get(sourceNodeTemplateId)) {
+ RequirementAssignment req = new ObjectMapper().convertValue(obj, RequirementAssignment
+ .class);
+ String targetNodeTemplateId = req.getNode();
+ Optional<NodeTemplate> targetNodeTemplate = analyzerService.getNodeTemplateById
+ (outputServiceTemplate, targetNodeTemplateId);
- if(isValidTargetForConnectedIn) {
- //Should be present if target node is compute or port
- if(computeNodeTemplateId.equals(sourceNodeTemplateId))
- Assert.assertTrue(nodesConnectedIn.containsKey(sourceNodeTemplateId));
- }
+ String targetNodeType = targetNodeTemplate.get().getType();
+ boolean isValidTargetForConnectedIn = false;
+ if (isComputeNodeType(outputServiceTemplate, targetNodeType)) {
+ isValidTargetForConnectedIn = true;
+ } else if (isPortNodeType(outputServiceTemplate, targetNodeType)) {
+ isValidTargetForConnectedIn = true;
+ }
- if(sourceNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
- && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
- || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
- || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
- //Ignore Compute->Port, Compute->Compute, Compute->Volume relationship
- Assert.assertFalse(nodesConnectedIn.containsKey(targetNodeTemplateId));
- }
+ if (isValidTargetForConnectedIn) {
+ //Should be present if target node is compute or port
+ if (computeNodeTemplateId.equals(sourceNodeTemplateId)) {
+ Assert.assertTrue(nodesConnectedIn.containsKey(sourceNodeTemplateId));
+ }
+ }
+
+ if (sourceNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
+ && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
+ || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
+ || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
+ //Ignore Compute->Port, Compute->Compute, Compute->Volume relationship
+ Assert.assertFalse(nodesConnectedIn.containsKey(targetNodeTemplateId));
+ }
- if(sourceNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
- && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
- || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
- || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
- //Ignore Port->Port, Port->Compute, Port->Volume relationship
- Assert.assertFalse(nodesConnectedIn.containsKey(targetNodeTemplateId));
+ if (sourceNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
+ && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
+ || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
+ || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
+ //Ignore Port->Port, Port->Compute, Port->Volume relationship
+ Assert.assertFalse(nodesConnectedIn.containsKey(targetNodeTemplateId));
+ }
+ }
}
- }
}
- }
- private static boolean isComputeNodeType(ServiceTemplate serviceTemplate,
- String nodeType) {
+ private static boolean isComputeNodeType(ServiceTemplate serviceTemplate,
+ String nodeType) {
- if(nodeType.equals(ToscaNodeType.NOVA_SERVER) ||
- nodeType.equals(ToscaNodeType.NATIVE_COMPUTE))
- return true;
+ if (nodeType.equals(ToscaNodeType.NOVA_SERVER) ||
+ nodeType.equals(ToscaNodeType.NATIVE_COMPUTE)) {
+ return true;
+ }
- Map<String, NodeType> nodeTypes = serviceTemplate.getNode_types();
- if(nodeTypes.containsKey(nodeType)) {
- NodeType nodeTypeInfo = nodeTypes.get(nodeType);
- if(nodeTypeInfo.getDerived_from().equals(ToscaNodeType.NOVA_SERVER))
- return true;
+ Map<String, NodeType> nodeTypes = serviceTemplate.getNode_types();
+ if (nodeTypes.containsKey(nodeType)) {
+ NodeType nodeTypeInfo = nodeTypes.get(nodeType);
+ if (nodeTypeInfo.getDerived_from().equals(ToscaNodeType.NOVA_SERVER)) {
+ return true;
+ }
+ }
+ return false;
}
- return false;
- }
-
- private static boolean isPortNodeType(ServiceTemplate serviceTemplate,
- String nodeType) {
- if(nodeType.equals(ToscaNodeType.NEUTRON_PORT) ||
- nodeType.equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))
- return true;
-
- Map<String, NodeType> nodeTypes = serviceTemplate.getNode_types();
- if(nodeTypes.containsKey(nodeType)) {
- NodeType nodeTypeInfo = nodeTypes.get(nodeType);
- if(nodeTypeInfo.getDerived_from().equals(ToscaNodeType.NEUTRON_PORT) ||
- nodeTypeInfo.getDerived_from().equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))
- return true;
+
+ private static boolean isPortNodeType(ServiceTemplate serviceTemplate,
+ String nodeType) {
+ if (nodeType.equals(ToscaNodeType.NEUTRON_PORT) ||
+ nodeType.equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE)) {
+ return true;
+ }
+
+ Map<String, NodeType> nodeTypes = serviceTemplate.getNode_types();
+ if (nodeTypes.containsKey(nodeType)) {
+ NodeType nodeTypeInfo = nodeTypes.get(nodeType);
+ if (nodeTypeInfo.getDerived_from().equals(ToscaNodeType.NEUTRON_PORT) ||
+ nodeTypeInfo.getDerived_from().equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE)) {
+ return true;
+ }
+ }
+ return false;
}
- return false;
- }
private static void validateDependsOnNodesConnectedOut(String computeNodeTemplateId,
Multimap<String, RequirementAssignmentData>
- nodesConnectedOut,
+ nodesConnectedOut,
Multimap<String, RequirementAssignment>
- outputDependsOnNodeRequirementMap,
+ outputDependsOnNodeRequirementMap,
ServiceTemplate outputServiceTemplate) {
ToscaAnalyzerServiceImpl analyzerService = new ToscaAnalyzerServiceImpl();
//Iterating the map <nodeTemplateId, all the requirements of that node>
@@ -329,7 +327,7 @@ public class ConsolidationDataTestUtil {
.entrySet()) {*/
for (String sourceNodeTemplateId : outputDependsOnNodeRequirementMap.keySet()) {
Optional<NodeTemplate> sourceNodeTemplate = analyzerService.getNodeTemplateById
- (outputServiceTemplate, sourceNodeTemplateId);
+ (outputServiceTemplate, sourceNodeTemplateId);
String sourceNodeType = sourceNodeTemplate.get().getType();
boolean isValidSourceForConnectedOut = false;
@@ -340,10 +338,10 @@ public class ConsolidationDataTestUtil {
}
for (Object obj : outputDependsOnNodeRequirementMap.get(sourceNodeTemplateId)) {
RequirementAssignment req = new ObjectMapper().convertValue(obj, RequirementAssignment
- .class);
+ .class);
String targetNodeTemplateId = req.getNode();
Optional<NodeTemplate> targetNodeTemplate = analyzerService.getNodeTemplateById
- (outputServiceTemplate, targetNodeTemplateId);
+ (outputServiceTemplate, targetNodeTemplateId);
String targetNodeType = targetNodeTemplate.get().getType();
if (isValidSourceForConnectedOut) {
@@ -354,17 +352,17 @@ public class ConsolidationDataTestUtil {
}
if (sourceNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
- && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
- || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
- || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
+ && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
+ || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
+ || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
//Ignore Compute->Port, Compute->Compute, Compute->Volume relationship
Assert.assertFalse(nodesConnectedOut.containsKey(targetNodeTemplateId));
}
if (sourceNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
- && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
- || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
- || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
+ && (targetNodeType.startsWith(ToscaNodeType.NOVA_SERVER)
+ || targetNodeType.startsWith(ToscaNodeType.NEUTRON_PORT)
+ || targetNodeType.startsWith(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE))) {
//Ignore Port->Port, Port->Compute, Port->Volume relationship
Assert.assertFalse(nodesConnectedOut.containsKey(targetNodeTemplateId));
}
@@ -373,112 +371,113 @@ public class ConsolidationDataTestUtil {
}
- private static Map<String,Map<String,List<String>>> getPortsInConsolidationData(ServiceTemplate
- output){
- Map<String,Map<String,List<String>>> portMap = new LinkedHashMap<>();
- Map<String, NodeTemplate> nodeTempMap = output.getTopology_template().getNode_templates();
- for(String nodeName : nodeTempMap.keySet()){
- NodeTemplate node = nodeTempMap.get(nodeName);
- if(ToscaNodeType.NEUTRON_PORT.equals(node.getType()) || ToscaNodeType
- .CONTRAILV2_VIRTUAL_MACHINE_INTERFACE.equals(node.getType())){
- List<Map<String, RequirementAssignment>> reqAssignList = node.getRequirements();
- if(reqAssignList != null) {
- for (Map<String, RequirementAssignment> reqAssignMap : reqAssignList) {
- //RequirementAssignment req = reqAssignMap.get("binding");
- RequirementAssignment req = new ObjectMapper().convertValue(reqAssignMap.get("binding"),
- RequirementAssignment.class);
-
- if (req != null) {
- String portNode = req.getNode();
- if (!portMap.containsKey(portNode)) {
- portMap.put(portNode, new LinkedHashMap<>());
- }
- Map<String, List<String>> portTypMaps = portMap.get(portNode);
- String id = ConsolidationDataUtil.getPortType(nodeName, "a");
- if (!portTypMaps.containsKey(id)) {
- portTypMaps.put(id, new ArrayList<>());
- }
- List<String> portIds = portTypMaps.get(id);
- portIds.add(nodeName);
+ private static Map<String, Map<String, List<String>>> getPortsInConsolidationData(ServiceTemplate
+ output) {
+ Map<String, Map<String, List<String>>> portMap = new LinkedHashMap<>();
+ Map<String, NodeTemplate> nodeTempMap = output.getTopology_template().getNode_templates();
+ for (String nodeName : nodeTempMap.keySet()) {
+ NodeTemplate node = nodeTempMap.get(nodeName);
+ if (ToscaNodeType.NEUTRON_PORT.equals(node.getType()) || ToscaNodeType
+ .CONTRAILV2_VIRTUAL_MACHINE_INTERFACE.equals(node.getType())) {
+ List<Map<String, RequirementAssignment>> reqAssignList = node.getRequirements();
+ if (reqAssignList != null) {
+ for (Map<String, RequirementAssignment> reqAssignMap : reqAssignList) {
+ //RequirementAssignment req = reqAssignMap.get("binding");
+ RequirementAssignment req = new ObjectMapper().convertValue(reqAssignMap.get("binding"),
+ RequirementAssignment.class);
+
+ if (req != null) {
+ String portNode = req.getNode();
+ if (!portMap.containsKey(portNode)) {
+ portMap.put(portNode, new LinkedHashMap<>());
+ }
+ Map<String, List<String>> portTypMaps = portMap.get(portNode);
+ String id = ConsolidationDataUtil.getPortType(nodeName, "a");
+ if (!portTypMaps.containsKey(id)) {
+ portTypMaps.put(id, new ArrayList<>());
+ }
+ List<String> portIds = portTypMaps.get(id);
+ portIds.add(nodeName);
+ }
+ }
+ }
}
- }
}
- }
+ return portMap;
}
- return portMap;
- }
-
- public static void validateGroupsInConsolidationData(String computeNodeTemplateId,
- ComputeTemplateConsolidationData
- computeTemplateConsolidationData,
- ServiceTemplate expectedServiceTemplate) {
- Assert.assertNotNull(computeTemplateConsolidationData);
- List<String> groupIds = computeTemplateConsolidationData.getGroupIds();
- if (groupIds != null) {
- for (String groupId : groupIds) {
- isComputeGroupMember(expectedServiceTemplate, computeNodeTemplateId, groupId);
- }
+
+ public static void validateGroupsInConsolidationData(String computeNodeTemplateId,
+ ComputeTemplateConsolidationData
+ computeTemplateConsolidationData,
+ ServiceTemplate expectedServiceTemplate) {
+ Assert.assertNotNull(computeTemplateConsolidationData);
+ List<String> groupIds = computeTemplateConsolidationData.getGroupIds();
+ if (groupIds != null) {
+ for (String groupId : groupIds) {
+ isComputeGroupMember(expectedServiceTemplate, computeNodeTemplateId, groupId);
+ }
+ }
}
- }
-
- private static void isComputeGroupMember(ServiceTemplate expectedServiceTemplate, String
- computeNodeTemplateId, String groupId) {
- //Check if the collected group id is in the member list of the groups
- GroupDefinition group = expectedServiceTemplate.getTopology_template().getGroups().get(groupId);
- List<String> groupMembers = group.getMembers();
- Assert.assertNotNull(groupMembers);
- Assert.assertTrue(groupMembers.contains(computeNodeTemplateId));
- }
-
- public static void validateNestedConsolidationDataNodeTemplateIds(ConsolidationData consolidationData,
- Map<String, ServiceTemplate>
- expectedServiceTemplateModels ){
- Map<String,List<String>> consolidatedMap = getSubstituteNodeTemplateIds(consolidationData);
- Map<String,List<String>> expectedMap = getSubstituteMapping(expectedServiceTemplateModels);
- for(String consolidatedKey : consolidatedMap.keySet()){
- List<String> consolidatedList = consolidatedMap.get(consolidatedKey);
- List<String> expectedList = expectedMap.get(consolidatedKey);
- if(expectedList == null ){
- Assert.fail();
- } if(!CollectionUtils.isEqualCollection(consolidatedList,expectedList)){
- Assert.fail();
- }
+
+ private static void isComputeGroupMember(ServiceTemplate expectedServiceTemplate, String
+ computeNodeTemplateId, String groupId) {
+ //Check if the collected group id is in the member list of the groups
+ GroupDefinition group = expectedServiceTemplate.getTopology_template().getGroups().get(groupId);
+ List<String> groupMembers = group.getMembers();
+ Assert.assertNotNull(groupMembers);
+ Assert.assertTrue(groupMembers.contains(computeNodeTemplateId));
}
- }
-
- private static Map<String,List<String>> getSubstituteNodeTemplateIds(ConsolidationData
- consolidationData) {
- Map<String,List<String>> nestedNodeTemplateIdMap = new HashMap<>();
- NestedConsolidationData nestedConsolidationData =
- consolidationData.getNestedConsolidationData();
- Set<String> serviceTemplateFileNames =
- nestedConsolidationData.getAllServiceTemplateFileNames();
- for (String fileName : serviceTemplateFileNames) {
- FileNestedConsolidationData fileNestedConsolidationData =
- nestedConsolidationData.getFileNestedConsolidationData(fileName);
- if (Objects.isNull(fileNestedConsolidationData)) {
- continue;
- }
- Set<String> nestedNodeTemplateIds =
- fileNestedConsolidationData.getAllNestedNodeTemplateIds();
- if (nestedNodeTemplateIds != null) {
- List<String> fileNestedNodeTemplateIds = new ArrayList<>(nestedNodeTemplateIds);
- nestedNodeTemplateIdMap.put(fileName, fileNestedNodeTemplateIds);
- }
+
+ public static void validateNestedConsolidationDataNodeTemplateIds(ConsolidationData consolidationData,
+ Map<String, ServiceTemplate>
+ expectedServiceTemplateModels) {
+ Map<String, List<String>> consolidatedMap = getSubstituteNodeTemplateIds(consolidationData);
+ Map<String, List<String>> expectedMap = getSubstituteMapping(expectedServiceTemplateModels);
+ for (String consolidatedKey : consolidatedMap.keySet()) {
+ List<String> consolidatedList = consolidatedMap.get(consolidatedKey);
+ List<String> expectedList = expectedMap.get(consolidatedKey);
+ if (expectedList == null) {
+ Assert.fail();
+ }
+ if (!CollectionUtils.isEqualCollection(consolidatedList, expectedList)) {
+ Assert.fail();
+ }
+ }
+ }
+
+ private static Map<String, List<String>> getSubstituteNodeTemplateIds(ConsolidationData
+ consolidationData) {
+ Map<String, List<String>> nestedNodeTemplateIdMap = new HashMap<>();
+ NestedConsolidationData nestedConsolidationData =
+ consolidationData.getNestedConsolidationData();
+ Set<String> serviceTemplateFileNames =
+ nestedConsolidationData.getAllServiceTemplateFileNames();
+ for (String fileName : serviceTemplateFileNames) {
+ FileNestedConsolidationData fileNestedConsolidationData =
+ nestedConsolidationData.getFileNestedConsolidationData(fileName);
+ if (Objects.isNull(fileNestedConsolidationData)) {
+ continue;
+ }
+ Set<String> nestedNodeTemplateIds =
+ fileNestedConsolidationData.getAllNestedNodeTemplateIds();
+ if (nestedNodeTemplateIds != null) {
+ List<String> fileNestedNodeTemplateIds = new ArrayList<>(nestedNodeTemplateIds);
+ nestedNodeTemplateIdMap.put(fileName, fileNestedNodeTemplateIds);
+ }
+ }
+ return nestedNodeTemplateIdMap;
}
- return nestedNodeTemplateIdMap;
- }
private static Map<String, List<String>> getSubstituteMapping(Map<String, ServiceTemplate>
- expectedServiceTemplateModels) {
+ expectedServiceTemplateModels) {
Map<String, List<String>> map = new LinkedHashMap<>();
for (String key : expectedServiceTemplateModels.keySet()) {
ServiceTemplate serviceTemplate = expectedServiceTemplateModels.get(key);
if (serviceTemplate.getTopology_template() != null && serviceTemplate
- .getTopology_template().getNode_templates() != null) {
+ .getTopology_template().getNode_templates() != null) {
for (String key1 : serviceTemplate.getTopology_template().getNode_templates().keySet()) {
NodeTemplate nodeTemplate = serviceTemplate.getTopology_template().getNode_templates()
- .get(key1);
+ .get(key1);
if (nodeTemplate.getType().contains(ToscaNodeType.ABSTRACT_NODE_TYPE_PREFIX + "heat.")) {
List<String> subNodeTempIdList = map.computeIfAbsent(key, k -> new ArrayList<>());
subNodeTempIdList.add(key1);
@@ -490,10 +489,10 @@ public class ConsolidationDataTestUtil {
}
public static void validateComputeConnectivityIn(ComputeTemplateConsolidationData
- computeTemplateConsolidationData,
+ computeTemplateConsolidationData,
ServiceTemplate expectedServiceTemplate) {
Multimap<String, RequirementAssignmentData> nodesConnectedIn =
- computeTemplateConsolidationData.getNodesConnectedIn();
+ computeTemplateConsolidationData.getNodesConnectedIn();
if (nodesConnectedIn == null) {
return;
}
@@ -505,7 +504,7 @@ public class ConsolidationDataTestUtil {
ComputeTemplateConsolidationData computeTemplateConsolidationData,
ServiceTemplate expectedServiceTemplate) {
Multimap<String, RequirementAssignmentData> nodesConnectedOut =
- computeTemplateConsolidationData.getNodesConnectedOut();
+ computeTemplateConsolidationData.getNodesConnectedOut();
if (nodesConnectedOut == null) {
return;
}
@@ -516,7 +515,7 @@ public class ConsolidationDataTestUtil {
public static void validatePortConnectivityIn(PortTemplateConsolidationData portTemplateConsolidationData,
ServiceTemplate expectedServiceTemplate) {
Multimap<String, RequirementAssignmentData> nodesConnectedIn =
- portTemplateConsolidationData.getNodesConnectedIn();
+ portTemplateConsolidationData.getNodesConnectedIn();
if (nodesConnectedIn == null) {
return;
}
@@ -528,7 +527,7 @@ public class ConsolidationDataTestUtil {
PortTemplateConsolidationData portTemplateConsolidationData,
ServiceTemplate expectedServiceTemplate) {
Multimap<String, RequirementAssignmentData> nodesConnectedOut =
- portTemplateConsolidationData.getNodesConnectedOut();
+ portTemplateConsolidationData.getNodesConnectedOut();
if (nodesConnectedOut == null) {
return;
}
@@ -543,23 +542,23 @@ public class ConsolidationDataTestUtil {
for (String nodeIdConnTo : nodesConnected.keySet()) {
Collection<RequirementAssignmentData> connectToList = nodesConnected.get(nodeIdConnTo);
List<Map<String, RequirementAssignment>> requirementsList = expectedServiceTemplate
- .getTopology_template().getNode_templates()
- .get(nodeTemplateId != null ? nodeTemplateId : nodeIdConnTo).getRequirements();
+ .getTopology_template().getNode_templates()
+ .get(nodeTemplateId != null ? nodeTemplateId : nodeIdConnTo).getRequirements();
for (RequirementAssignmentData requirementAssignmentData : connectToList) {
for (Map<String, RequirementAssignment> requirementAssignmentMap : requirementsList) {
RequirementAssignment requirementAssignment =
- new ObjectMapper().convertValue(requirementAssignmentMap.values().iterator().next(),
- RequirementAssignment.class);
+ new ObjectMapper().convertValue(requirementAssignmentMap.values().iterator().next(),
+ RequirementAssignment.class);
if (requirementAssignment.getNode()
- .equals(requirementAssignmentData.getRequirementAssignment().getNode())) {
+ .equals(requirementAssignmentData.getRequirementAssignment().getNode())) {
Assert.assertEquals(requirementAssignment.getCapability(),
- requirementAssignmentData.getRequirementAssignment().getCapability());
+ requirementAssignmentData.getRequirementAssignment().getCapability());
Assert.assertEquals(requirementAssignment.getNode(),
- requirementAssignmentData.getRequirementAssignment().getNode());
+ requirementAssignmentData.getRequirementAssignment().getNode());
Assert.assertEquals(requirementAssignment.getRelationship(),
- requirementAssignmentData.getRequirementAssignment()
- .getRelationship());
+ requirementAssignmentData.getRequirementAssignment()
+ .getRelationship());
found = true;
}
}
@@ -571,167 +570,167 @@ public class ConsolidationDataTestUtil {
}
}
- public static void validateGetAttr(TranslationContext translationContext, String testName){
- ConsolidationData consolidationData = translationContext.getConsolidationData();
- Assert.assertNotNull(consolidationData);
- if(TestConstants.TEST_GET_ATTR_FOR_MORE_THAN_ONE_ATTR_IN_ATTR_LIST.equals(testName)){
- PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
- .getPortConsolidationData().getFilePortConsolidationData("ep-jsa_netServiceTemplate.yaml")
- .getPortTemplateConsolidationData("VMI1");
- Assert.assertNotNull(portTemplateConsolidationData);
- Assert.assertEquals(2, portTemplateConsolidationData.getNodesGetAttrIn().size());
- List<GetAttrFuncData> attrFuncDataList = portTemplateConsolidationData.getNodesGetAttrIn()
- .get("FSB1");
- Assert.assertEquals(1,attrFuncDataList.size());
- Assert.assertEquals("name",attrFuncDataList.get(0).getFieldName());
- Assert.assertEquals("name",attrFuncDataList.get(0).getAttributeName());
-
- attrFuncDataList = portTemplateConsolidationData.getNodesGetAttrIn()
- .get("FSB2");
- Assert.assertEquals(1,attrFuncDataList.size());
- Assert.assertEquals("name",attrFuncDataList.get(0).getFieldName());
- Assert.assertEquals("virtual_machine_interface_allowed_address_pairs",attrFuncDataList.get(0).getAttributeName());
-
- ComputeTemplateConsolidationData computeTemplateConsolidationDataFSB2 = consolidationData
- .getComputeConsolidationData()
- .getFileComputeConsolidationData("ep-jsa_netServiceTemplate.yaml")
- .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.FSB2")
- .getComputeTemplateConsolidationData("FSB2");
- Assert.assertEquals(1,computeTemplateConsolidationDataFSB2.getNodesGetAttrOut().size());
- List<GetAttrFuncData> attrFuncDataOutList = computeTemplateConsolidationDataFSB2
- .getNodesGetAttrOut().get("VMI1");
- Assert.assertEquals(1,attrFuncDataOutList.size());
- Assert.assertEquals("name",attrFuncDataOutList.get(0).getFieldName());
- Assert.assertEquals("virtual_machine_interface_allowed_address_pairs",attrFuncDataOutList
- .get(0).getAttributeName());
- ComputeTemplateConsolidationData computeTemplateConsolidationDataFSB1 = consolidationData
- .getComputeConsolidationData()
- .getFileComputeConsolidationData("ep-jsa_netServiceTemplate.yaml")
- .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.FSB1")
- .getComputeTemplateConsolidationData("FSB1");
- Assert.assertEquals(1,computeTemplateConsolidationDataFSB1.getNodesGetAttrOut().size());
- List<GetAttrFuncData> attrFuncDataOutList2 = computeTemplateConsolidationDataFSB1
- .getNodesGetAttrOut().get("VMI1");
- Assert.assertEquals(1,attrFuncDataOutList2.size());
- Assert.assertEquals("name",attrFuncDataOutList2.get(0).getFieldName());
- Assert.assertEquals("name",attrFuncDataOutList2
- .get(0).getAttributeName());
- } else if(TestConstants.TEST_IGNORE_GET_ATTR_FROM_OUTPUT.equals(testName)){
- if(!consolidationData.getPortConsolidationData().getAllServiceTemplateFileNames().isEmpty()){
- Iterator<String> itr = consolidationData.getPortConsolidationData()
- .getFilePortConsolidationData("MainServiceTemplate.yaml").getAllPortNodeTemplateIds()
- .iterator();
- while(itr.hasNext()){
- String key = itr.next();
- PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
- .getPortConsolidationData()
- .getFilePortConsolidationData("MainServiceTemplate.yaml")
- .getPortTemplateConsolidationData(key);
- Assert.assertNull(portTemplateConsolidationData.getOutputParametersGetAttrIn());
+ public static void validateGetAttr(TranslationContext translationContext, String testName) {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Assert.assertNotNull(consolidationData);
+ if (TestConstants.TEST_GET_ATTR_FOR_MORE_THAN_ONE_ATTR_IN_ATTR_LIST.equals(testName)) {
+ PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
+ .getPortConsolidationData().getFilePortConsolidationData("ep-jsa_netServiceTemplate.yaml")
+ .getPortTemplateConsolidationData("VMI1");
+ Assert.assertNotNull(portTemplateConsolidationData);
+ Assert.assertEquals(2, portTemplateConsolidationData.getNodesGetAttrIn().size());
+ List<GetAttrFuncData> attrFuncDataList = portTemplateConsolidationData.getNodesGetAttrIn()
+ .get("FSB1");
+ Assert.assertEquals(1, attrFuncDataList.size());
+ Assert.assertEquals("name", attrFuncDataList.get(0).getFieldName());
+ Assert.assertEquals("name", attrFuncDataList.get(0).getAttributeName());
+
+ attrFuncDataList = portTemplateConsolidationData.getNodesGetAttrIn()
+ .get("FSB2");
+ Assert.assertEquals(1, attrFuncDataList.size());
+ Assert.assertEquals("name", attrFuncDataList.get(0).getFieldName());
+ Assert.assertEquals("virtual_machine_interface_allowed_address_pairs", attrFuncDataList.get(0).getAttributeName());
+
+ ComputeTemplateConsolidationData computeTemplateConsolidationDataFSB2 = consolidationData
+ .getComputeConsolidationData()
+ .getFileComputeConsolidationData("ep-jsa_netServiceTemplate.yaml")
+ .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.FSB2")
+ .getComputeTemplateConsolidationData("FSB2");
+ Assert.assertEquals(1, computeTemplateConsolidationDataFSB2.getNodesGetAttrOut().size());
+ List<GetAttrFuncData> attrFuncDataOutList = computeTemplateConsolidationDataFSB2
+ .getNodesGetAttrOut().get("VMI1");
+ Assert.assertEquals(1, attrFuncDataOutList.size());
+ Assert.assertEquals("name", attrFuncDataOutList.get(0).getFieldName());
+ Assert.assertEquals("virtual_machine_interface_allowed_address_pairs", attrFuncDataOutList
+ .get(0).getAttributeName());
+ ComputeTemplateConsolidationData computeTemplateConsolidationDataFSB1 = consolidationData
+ .getComputeConsolidationData()
+ .getFileComputeConsolidationData("ep-jsa_netServiceTemplate.yaml")
+ .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.FSB1")
+ .getComputeTemplateConsolidationData("FSB1");
+ Assert.assertEquals(1, computeTemplateConsolidationDataFSB1.getNodesGetAttrOut().size());
+ List<GetAttrFuncData> attrFuncDataOutList2 = computeTemplateConsolidationDataFSB1
+ .getNodesGetAttrOut().get("VMI1");
+ Assert.assertEquals(1, attrFuncDataOutList2.size());
+ Assert.assertEquals("name", attrFuncDataOutList2.get(0).getFieldName());
+ Assert.assertEquals("name", attrFuncDataOutList2
+ .get(0).getAttributeName());
+ } else if (TestConstants.TEST_IGNORE_GET_ATTR_FROM_OUTPUT.equals(testName)) {
+ if (!consolidationData.getPortConsolidationData().getAllServiceTemplateFileNames().isEmpty()) {
+ Iterator<String> itr = consolidationData.getPortConsolidationData()
+ .getFilePortConsolidationData("MainServiceTemplate.yaml").getAllPortNodeTemplateIds()
+ .iterator();
+ while (itr.hasNext()) {
+ String key = itr.next();
+ PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
+ .getPortConsolidationData()
+ .getFilePortConsolidationData("MainServiceTemplate.yaml")
+ .getPortTemplateConsolidationData(key);
+ Assert.assertNull(portTemplateConsolidationData.getOutputParametersGetAttrIn());
+ }
+ }
+ } else if (TestConstants.TEST_GET_ATTR_FOR_NOT_SUPPORTED_ATTR_IN_ATTR_LIST.equals(testName)) {
+ Assert.assertNull(consolidationData.getPortConsolidationData()
+ .getFilePortConsolidationData("MainServiceTemplate.yaml")
+ .getPortTemplateConsolidationData("FSB1_Internal2").getNodesGetAttrIn());
+ } else if (TestConstants.TEST_GET_ATTR_FOR_ONLY_RESOURCE_NAME.equals(testName)) {
+ PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
+ .getPortConsolidationData().getFilePortConsolidationData("MainServiceTemplate.yaml")
+ .getPortTemplateConsolidationData("VMI1");
+ Assert.assertNotNull(portTemplateConsolidationData);
+ Assert.assertEquals("name", portTemplateConsolidationData.getNodesGetAttrIn().get("FSB1").
+ get(0).getFieldName());
+ Assert.assertEquals("tenant_id", portTemplateConsolidationData.getNodesGetAttrIn().get("FSB1").
+ get(0).getAttributeName());
+ } else if (TestConstants.TEST_GET_ATTR_FOR_NONE_TO_PORT_OR_COMPUTE.equals(testName)) {
+ ComputeTemplateConsolidationData computeTemplateConsolidationData = consolidationData
+ .getComputeConsolidationData()
+ .getFileComputeConsolidationData("MainServiceTemplate.yaml")
+ .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.compute")
+ .getComputeTemplateConsolidationData("server_compute_get_attr_test");
+ Assert.assertEquals("user_data_format", computeTemplateConsolidationData
+ .getNodesGetAttrOut().get("server_pcm_001").get(0).getFieldName());
+ Assert.assertEquals("oam_net_gw", computeTemplateConsolidationData
+ .getNodesGetAttrOut().get("server_pcm_001").get(0).getAttributeName());
+ } else if (TestConstants.TEST_OUTPUT_GET_ATTR.equals(testName)) {
+ ComputeTemplateConsolidationData computeTemplateConsolidationData1 = consolidationData
+ .getComputeConsolidationData()
+ .getFileComputeConsolidationData("firstnet_fgi_frwlServiceTemplate.yaml")
+ .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.cgi_fw")
+ .getComputeTemplateConsolidationData("CGI_FW_SERVER_1");
+ Assert.assertEquals("cgi_fw_01_left_mac_1", computeTemplateConsolidationData1
+ .getOutputParametersGetAttrIn()
+ .get(0).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData1.getOutputParametersGetAttrIn()
+ .get(0).getAttributeName());
+ ComputeTemplateConsolidationData computeTemplateConsolidationData2 = consolidationData
+ .getComputeConsolidationData()
+ .getFileComputeConsolidationData("firstnet_fgi_frwlServiceTemplate.yaml")
+ .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.cgi_fw")
+ .getComputeTemplateConsolidationData("CGI_FW_SERVER_2");
+ Assert.assertEquals(1, computeTemplateConsolidationData2
+ .getNodesGetAttrIn().get("CGI_FW_SERVER_2").size());
+ Assert.assertEquals("availability_zone", computeTemplateConsolidationData2
+ .getNodesGetAttrIn().get("CGI_FW_SERVER_2").get(0).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getNodesGetAttrIn().get("CGI_FW_SERVER_2").get(0).getAttributeName());
+ Assert.assertEquals(1, computeTemplateConsolidationData2
+ .getNodesGetAttrOut().get("CGI_FW_SERVER_2").size());
+ Assert.assertEquals("availability_zone", computeTemplateConsolidationData2
+ .getNodesGetAttrOut().get("CGI_FW_SERVER_2").get(0).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getNodesGetAttrOut().get("CGI_FW_SERVER_2").get(0).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_2", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(0).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(0).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_3", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(1).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(1).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_4", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(2).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(2).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_5", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(3).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(3).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_5", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(4).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(4).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_6", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(5).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(5).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_9", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(6).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(6).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_10", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(7).getFieldName());
+ Assert.assertEquals("addresses", computeTemplateConsolidationData2
+ .getOutputParametersGetAttrIn().get(7).getAttributeName());
+ PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
+ .getPortConsolidationData().getFilePortConsolidationData("firstnet_fgi_frwlServiceTemplate.yaml")
+ .getPortTemplateConsolidationData("contrail_vmi_subinterface");
+ Assert.assertEquals("cgi_fw_01_left_mac_7", portTemplateConsolidationData
+ .getOutputParametersGetAttrIn().get(0).getFieldName());
+ Assert.assertEquals("virtual_machine_interface_properties", portTemplateConsolidationData
+ .getOutputParametersGetAttrIn().get(0).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_8", portTemplateConsolidationData
+ .getOutputParametersGetAttrIn().get(1).getFieldName());
+ Assert.assertEquals("virtual_machine_interface_allowed_address_pairs",
+ portTemplateConsolidationData.getOutputParametersGetAttrIn()
+ .get(1).getAttributeName());
+ Assert.assertEquals("cgi_fw_01_left_mac_10", portTemplateConsolidationData
+ .getOutputParametersGetAttrIn().get(2).getFieldName());
+ Assert.assertEquals("virtual_machine_interface_allowed_address_pairs",
+ portTemplateConsolidationData.getOutputParametersGetAttrIn()
+ .get(2).getAttributeName());
}
- }
- } else if(TestConstants.TEST_GET_ATTR_FOR_NOT_SUPPORTED_ATTR_IN_ATTR_LIST.equals(testName)){
- Assert.assertNull(consolidationData.getPortConsolidationData()
- .getFilePortConsolidationData("MainServiceTemplate.yaml")
- .getPortTemplateConsolidationData("FSB1_Internal2").getNodesGetAttrIn());
- } else if(TestConstants.TEST_GET_ATTR_FOR_ONLY_RESOURCE_NAME.equals(testName)){
- PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
- .getPortConsolidationData().getFilePortConsolidationData("MainServiceTemplate.yaml")
- .getPortTemplateConsolidationData("VMI1");
- Assert.assertNotNull(portTemplateConsolidationData);
- Assert.assertEquals("name",portTemplateConsolidationData.getNodesGetAttrIn().get("FSB1").
- get(0).getFieldName());
- Assert.assertEquals("tenant_id",portTemplateConsolidationData.getNodesGetAttrIn().get("FSB1").
- get(0).getAttributeName());
- } else if(TestConstants.TEST_GET_ATTR_FOR_NONE_TO_PORT_OR_COMPUTE.equals(testName)){
- ComputeTemplateConsolidationData computeTemplateConsolidationData = consolidationData
- .getComputeConsolidationData()
- .getFileComputeConsolidationData("MainServiceTemplate.yaml")
- .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.compute")
- .getComputeTemplateConsolidationData("server_compute_get_attr_test");
- Assert.assertEquals("user_data_format",computeTemplateConsolidationData
- .getNodesGetAttrOut().get("server_pcm_001").get(0).getFieldName());
- Assert.assertEquals("oam_net_gw",computeTemplateConsolidationData
- .getNodesGetAttrOut().get("server_pcm_001").get(0).getAttributeName());
- } else if(TestConstants.TEST_OUTPUT_GET_ATTR.equals(testName)){
- ComputeTemplateConsolidationData computeTemplateConsolidationData1 = consolidationData
- .getComputeConsolidationData()
- .getFileComputeConsolidationData("firstnet_fgi_frwlServiceTemplate.yaml")
- .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.cgi_fw")
- .getComputeTemplateConsolidationData("CGI_FW_SERVER_1");
- Assert.assertEquals("cgi_fw_01_left_mac_1",computeTemplateConsolidationData1
- .getOutputParametersGetAttrIn()
- .get(0).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData1.getOutputParametersGetAttrIn()
- .get(0).getAttributeName());
- ComputeTemplateConsolidationData computeTemplateConsolidationData2 = consolidationData
- .getComputeConsolidationData()
- .getFileComputeConsolidationData("firstnet_fgi_frwlServiceTemplate.yaml")
- .getTypeComputeConsolidationData("org.openecomp.resource.vfc.nodes.heat.cgi_fw")
- .getComputeTemplateConsolidationData("CGI_FW_SERVER_2");
- Assert.assertEquals(1,computeTemplateConsolidationData2
- .getNodesGetAttrIn().get("CGI_FW_SERVER_2").size());
- Assert.assertEquals("availability_zone",computeTemplateConsolidationData2
- .getNodesGetAttrIn().get("CGI_FW_SERVER_2").get(0).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getNodesGetAttrIn().get("CGI_FW_SERVER_2").get(0).getAttributeName());
- Assert.assertEquals(1,computeTemplateConsolidationData2
- .getNodesGetAttrOut().get("CGI_FW_SERVER_2").size());
- Assert.assertEquals("availability_zone",computeTemplateConsolidationData2
- .getNodesGetAttrOut().get("CGI_FW_SERVER_2").get(0).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getNodesGetAttrOut().get("CGI_FW_SERVER_2").get(0).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_2",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(0).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(0).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_3",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(1).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(1).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_4",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(2).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(2).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_5",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(3).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(3).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_5",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(4).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(4).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_6",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(5).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(5).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_9",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(6).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(6).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_10",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(7).getFieldName());
- Assert.assertEquals("addresses",computeTemplateConsolidationData2
- .getOutputParametersGetAttrIn().get(7).getAttributeName());
- PortTemplateConsolidationData portTemplateConsolidationData = consolidationData
- .getPortConsolidationData().getFilePortConsolidationData("firstnet_fgi_frwlServiceTemplate.yaml")
- .getPortTemplateConsolidationData("contrail_vmi_subinterface");
- Assert.assertEquals("cgi_fw_01_left_mac_7",portTemplateConsolidationData
- .getOutputParametersGetAttrIn().get(0).getFieldName());
- Assert.assertEquals("virtual_machine_interface_properties",portTemplateConsolidationData
- .getOutputParametersGetAttrIn().get(0).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_8",portTemplateConsolidationData
- .getOutputParametersGetAttrIn().get(1).getFieldName());
- Assert.assertEquals("virtual_machine_interface_allowed_address_pairs",
- portTemplateConsolidationData.getOutputParametersGetAttrIn()
- .get(1).getAttributeName());
- Assert.assertEquals("cgi_fw_01_left_mac_10",portTemplateConsolidationData
- .getOutputParametersGetAttrIn().get(2).getFieldName());
- Assert.assertEquals("virtual_machine_interface_allowed_address_pairs",
- portTemplateConsolidationData.getOutputParametersGetAttrIn()
- .get(2).getAttributeName());
}
- }
public static void validateNestedConsolidationData(TranslationContext context,
String testName) {
@@ -739,9 +738,9 @@ public class ConsolidationDataTestUtil {
if (testName.equals(TEST_SINGLE_NESTED_RESOURCE)) {
String nestedNodeTemplateId = "server_pcm_001";
NestedTemplateConsolidationData nestedTemplateConsolidationData =
- consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId);
+ consolidationData.getNestedConsolidationData()
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId);
//Validate basic null attributes
validateBasicNestedConsolidationData(nestedTemplateConsolidationData);
//Validate nodeTemplateId
@@ -752,23 +751,23 @@ public class ConsolidationDataTestUtil {
//Validate get attribute in
Map<String, List<GetAttrFuncData>> nodesGetAttrIn =
- nestedTemplateConsolidationData.getNodesGetAttrIn();
+ nestedTemplateConsolidationData.getNodesGetAttrIn();
String getAttrNodeTemplateId = "server_compute_get_attr_test";
List<GetAttrFuncData> getAttrFuncData = nodesGetAttrIn.get(getAttrNodeTemplateId);
Assert.assertNotNull(getAttrFuncData);
- Assert.assertEquals(getAttrFuncData.size(), 2);
- Assert.assertEquals(getAttrFuncData.get(0).getFieldName(), "metadata");
- Assert.assertEquals(getAttrFuncData.get(0).getAttributeName(), "server_pcm_id");
- Assert.assertEquals(getAttrFuncData.get(1).getFieldName(), "user_data_format");
- Assert.assertEquals(getAttrFuncData.get(1).getAttributeName(), "oam_net_gw");
+ Assert.assertEquals(2, getAttrFuncData.size());
+ Assert.assertEquals("metadata", getAttrFuncData.get(0).getFieldName());
+ Assert.assertEquals("server_pcm_id", getAttrFuncData.get(0).getAttributeName());
+ Assert.assertEquals("user_data_format", getAttrFuncData.get(1).getFieldName());
+ Assert.assertEquals("oam_net_gw", getAttrFuncData.get(1).getAttributeName());
//Validate output parameter get attribute in
List<GetAttrFuncData> outputParametersGetAttrIn =
- nestedTemplateConsolidationData.getOutputParametersGetAttrIn();
+ nestedTemplateConsolidationData.getOutputParametersGetAttrIn();
Assert.assertNotNull(outputParametersGetAttrIn);
- Assert.assertEquals(outputParametersGetAttrIn.size(), 1);
- Assert.assertEquals(outputParametersGetAttrIn.get(0).getFieldName(), "output_attr_1");
- Assert.assertEquals(outputParametersGetAttrIn.get(0).getAttributeName(), "pcm_vol");
+ Assert.assertEquals(1, outputParametersGetAttrIn.size());
+ Assert.assertEquals("output_attr_1", outputParametersGetAttrIn.get(0).getFieldName());
+ Assert.assertEquals("pcm_vol", outputParametersGetAttrIn.get(0).getAttributeName());
} else if (testName.equals(TEST_MULTIPLE_NESTED_RESOURCE)) {
List<String> nestedNodeTemplateIds = new ArrayList<>();
@@ -778,14 +777,14 @@ public class ConsolidationDataTestUtil {
for (String nestedNodeTemplateId : nestedNodeTemplateIds) {
NestedTemplateConsolidationData nestedTemplateConsolidationData =
- consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId);
+ consolidationData.getNestedConsolidationData()
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId);
//Validate basic null attributes
validateBasicNestedConsolidationData(nestedTemplateConsolidationData);
//Validate nodeTemplateId
Assert.assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(),
- nestedNodeTemplateId);
+ nestedNodeTemplateId);
if (!nestedNodeTemplateId.equals("server_pcm_001")) {
Assert.assertNull(nestedTemplateConsolidationData.getNodesConnectedIn());
}
@@ -794,102 +793,101 @@ public class ConsolidationDataTestUtil {
//Validate get attribute in
NestedTemplateConsolidationData nestedTemplateConsolidationData =
- consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData("server_pcm_002");
+ consolidationData.getNestedConsolidationData()
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData("server_pcm_002");
Map<String, List<GetAttrFuncData>> nodesGetAttrIn =
- nestedTemplateConsolidationData.getNodesGetAttrIn();
+ nestedTemplateConsolidationData.getNodesGetAttrIn();
String getAttrNodeTemplateId = "server_pcm_001";
List<GetAttrFuncData> getAttrFuncData = nodesGetAttrIn.get(getAttrNodeTemplateId);
Assert.assertNotNull(getAttrFuncData);
- Assert.assertEquals(getAttrFuncData.size(), 1);
- Assert.assertEquals(getAttrFuncData.get(0).getFieldName(), "user_data_format");
- Assert.assertEquals(getAttrFuncData.get(0).getAttributeName(), "pcm_vol");
+ Assert.assertEquals(1, getAttrFuncData.size());
+ Assert.assertEquals("user_data_format", getAttrFuncData.get(0).getFieldName());
+ Assert.assertEquals("pcm_vol", getAttrFuncData.get(0).getAttributeName());
//Validate output parameter get attribute in
List<GetAttrFuncData> outputParametersGetAttrIn =
- nestedTemplateConsolidationData.getOutputParametersGetAttrIn();
+ nestedTemplateConsolidationData.getOutputParametersGetAttrIn();
Assert.assertNotNull(outputParametersGetAttrIn);
- Assert.assertEquals(outputParametersGetAttrIn.size(), 1);
- Assert.assertEquals(outputParametersGetAttrIn.get(0).getFieldName(), "output_attr_2");
- Assert.assertEquals(outputParametersGetAttrIn.get(0).getAttributeName(), "oam_net_ip");
-
+ Assert.assertEquals(1, outputParametersGetAttrIn.size());
+ Assert.assertEquals("output_attr_2", outputParametersGetAttrIn.get(0).getFieldName());
+ Assert.assertEquals("oam_net_ip", outputParametersGetAttrIn.get(0).getAttributeName());
nestedTemplateConsolidationData = consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData("server_pcm_001");
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData("server_pcm_001");
nodesGetAttrIn = nestedTemplateConsolidationData.getNodesGetAttrIn();
getAttrNodeTemplateId = "server_pcm_002";
getAttrFuncData = nodesGetAttrIn.get(getAttrNodeTemplateId);
Assert.assertNotNull(getAttrFuncData);
- Assert.assertEquals(getAttrFuncData.size(), 1);
- Assert.assertEquals(getAttrFuncData.get(0).getFieldName(), "metadata");
- Assert.assertEquals(getAttrFuncData.get(0).getAttributeName(), "server_pcm_id");
+ Assert.assertEquals(1, getAttrFuncData.size());
+ Assert.assertEquals("metadata", getAttrFuncData.get(0).getFieldName());
+ Assert.assertEquals("server_pcm_id", getAttrFuncData.get(0).getAttributeName());
//Validate output parameter get attribute in
outputParametersGetAttrIn = nestedTemplateConsolidationData.getOutputParametersGetAttrIn();
Assert.assertNotNull(outputParametersGetAttrIn);
- Assert.assertEquals(outputParametersGetAttrIn.size(), 1);
- Assert.assertEquals(outputParametersGetAttrIn.get(0).getFieldName(), "output_attr_1");
- Assert.assertEquals(outputParametersGetAttrIn.get(0).getAttributeName(), "pcm_vol");
+ Assert.assertEquals(1, outputParametersGetAttrIn.size());
+ Assert.assertEquals("output_attr_1", outputParametersGetAttrIn.get(0).getFieldName());
+ Assert.assertEquals("pcm_vol", outputParametersGetAttrIn.get(0).getAttributeName());
nestedTemplateConsolidationData = consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData("server_pcm_003");
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData("server_pcm_003");
Assert.assertNull(nestedTemplateConsolidationData.getNodesGetAttrIn());
Assert.assertNull(nestedTemplateConsolidationData.getOutputParametersGetAttrIn());
} else if (testName.equals(TEST_MULTIPLE_MULTI_LEVEL_NESTED_RESOURCE)) {
String nestedNodeTemplateId = "test_nested";
NestedTemplateConsolidationData nestedTemplateConsolidationData =
- consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId);
+ consolidationData.getNestedConsolidationData()
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId);
//Validate basic null attributes
validateBasicNestedConsolidationData(nestedTemplateConsolidationData);
//Validate nodeTemplateId
Assert.assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(),
- nestedNodeTemplateId);
+ nestedNodeTemplateId);
//Validate nodes connected in (will only be populated for dependsOn relationships)
Multimap<String, RequirementAssignmentData> nodesConnectedIn =
- nestedTemplateConsolidationData.getNodesConnectedIn();
+ nestedTemplateConsolidationData.getNodesConnectedIn();
List<String> dependentNodes = new LinkedList<>();
dependentNodes.add("packet_mirror_network");
//Validate output parameter get attribute in
List<GetAttrFuncData> getAttrFuncData =
- nestedTemplateConsolidationData.getNodesGetAttrIn().get("packet_mirror_network");
+ nestedTemplateConsolidationData.getNodesGetAttrIn().get("packet_mirror_network");
Assert.assertNotNull(getAttrFuncData);
- Assert.assertEquals(getAttrFuncData.size(), 1);
- Assert.assertEquals(getAttrFuncData.get(0).getFieldName(), "shared");
- Assert.assertEquals(getAttrFuncData.get(0).getAttributeName(), "output_attr_1");
+ Assert.assertEquals(1, getAttrFuncData.size());
+ Assert.assertEquals("shared", getAttrFuncData.get(0).getFieldName());
+ Assert.assertEquals("output_attr_1", getAttrFuncData.get(0).getAttributeName());
Assert.assertNull(nestedTemplateConsolidationData.getOutputParametersGetAttrIn());
nestedNodeTemplateId = "test_nested2";
nestedTemplateConsolidationData = consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData("nestedServiceTemplate.yaml")
- .getNestedTemplateConsolidationData(nestedNodeTemplateId);
+ .getFileNestedConsolidationData("nestedServiceTemplate.yaml")
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId);
//Validate basic null attributes
validateBasicNestedConsolidationData(nestedTemplateConsolidationData);
//Validate nodeTemplateId
Assert.assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(),
- nestedNodeTemplateId);
+ nestedNodeTemplateId);
Assert.assertNull(nestedTemplateConsolidationData.getNodesConnectedIn());
//Validate output parameter get attribute in
getAttrFuncData = nestedTemplateConsolidationData.getNodesGetAttrIn().get("server_cmaui_1");
Assert.assertNotNull(getAttrFuncData);
- Assert.assertEquals(getAttrFuncData.size(), 1);
- Assert.assertEquals(getAttrFuncData.get(0).getFieldName(), "metadata");
- Assert.assertEquals(getAttrFuncData.get(0).getAttributeName(), "availability_zone_0");
+ Assert.assertEquals(1, getAttrFuncData.size());
+ Assert.assertEquals("metadata", getAttrFuncData.get(0).getFieldName());
+ Assert.assertEquals("availability_zone_0", getAttrFuncData.get(0).getAttributeName());
List<GetAttrFuncData> outputParametersGetAttrIn1 =
- nestedTemplateConsolidationData.getOutputParametersGetAttrIn();
+ nestedTemplateConsolidationData.getOutputParametersGetAttrIn();
Assert.assertNotNull(outputParametersGetAttrIn1);
- Assert.assertEquals(outputParametersGetAttrIn1.size(), 1);
- Assert.assertEquals(outputParametersGetAttrIn1.get(0).getFieldName(), "output_attr_1");
- Assert.assertEquals(outputParametersGetAttrIn1.get(0).getAttributeName(), "availability_zone_0");
+ Assert.assertEquals(1, outputParametersGetAttrIn1.size());
+ Assert.assertEquals("output_attr_1", outputParametersGetAttrIn1.get(0).getFieldName());
+ Assert.assertEquals("availability_zone_0", outputParametersGetAttrIn1.get(0).getAttributeName());
}
}
private static void validateBasicNestedConsolidationData(NestedTemplateConsolidationData
- nestedTemplateConsolidationData) {
+ nestedTemplateConsolidationData) {
Assert.assertNull(nestedTemplateConsolidationData.getGroupIds());
Assert.assertNull(nestedTemplateConsolidationData.getNodesConnectedOut());
}
@@ -897,110 +895,110 @@ public class ConsolidationDataTestUtil {
public static void validateNestedNodesConnectedInSecurityRuleToPort(String testName, TranslationContext context) {
ConsolidationData consolidationData = context.getConsolidationData();
if (testName.equals(TEST_SECURITY_RULE_PORT_NESTED_CONNECTION) ||
- testName.equals(TestConstants.TEST_SECURITY_RULE_PORT_NESTED_SHARED_PORT)) {
+ testName.equals(TestConstants.TEST_SECURITY_RULE_PORT_NESTED_SHARED_PORT)) {
String nestedNodeTemplateId = "test_nested";
NestedTemplateConsolidationData nestedTemplateConsolidationData =
- consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId);
+ consolidationData.getNestedConsolidationData()
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId);
//Validate basic null attributes
validateBasicNestedConsolidationData(nestedTemplateConsolidationData);
//Validate nodeTemplateId
Assert
- .assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(), nestedNodeTemplateId);
+ .assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(), nestedNodeTemplateId);
String securityRuleNodeTemplateId = "jsa_security_group1";
validateNestedNodesConnectedInSecurityRuleToPort(HeatToToscaUtil
- .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
- nestedNodeTemplateId, securityRuleNodeTemplateId,
- nestedTemplateConsolidationData);
+ .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
+ nestedNodeTemplateId, securityRuleNodeTemplateId,
+ nestedTemplateConsolidationData);
securityRuleNodeTemplateId = "jsa_security_group2";
validateNestedNodesConnectedInSecurityRuleToPort(HeatToToscaUtil
- .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
- nestedNodeTemplateId, securityRuleNodeTemplateId,
- nestedTemplateConsolidationData);
+ .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
+ nestedNodeTemplateId, securityRuleNodeTemplateId,
+ nestedTemplateConsolidationData);
if (testName.equals(TestConstants.TEST_SECURITY_RULE_PORT_NESTED_SHARED_PORT)) {
nestedNodeTemplateId = "test_nestedArrayParam";
Assert.assertEquals(nestedNodeTemplateId, consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
Assert.assertNull(consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
}
} else if (testName.equals(TEST_SECURITY_RULE_PORT_MULTI_LEVEL_NESTED_CONNECTION) ||
- testName.equals(TEST_SECURITY_RULE_PORT_MULTI_LEVEL_NESTED_SHARED_PORT)) {
+ testName.equals(TEST_SECURITY_RULE_PORT_MULTI_LEVEL_NESTED_SHARED_PORT)) {
String nestedNodeTemplateId = "test_nested2Level";
Assert.assertEquals(nestedNodeTemplateId, consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData("nested1ServiceTemplate.yaml")
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
+ .getFileNestedConsolidationData("nested1ServiceTemplate.yaml")
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
Assert.assertNull(consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData("nested1ServiceTemplate.yaml")
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
+ .getFileNestedConsolidationData("nested1ServiceTemplate.yaml")
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
nestedNodeTemplateId = "test_nested3Level";
Assert.assertEquals(nestedNodeTemplateId, consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData("nested2ServiceTemplate.yaml")
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
+ .getFileNestedConsolidationData("nested2ServiceTemplate.yaml")
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
Assert.assertNull(consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData("nested2ServiceTemplate.yaml")
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
+ .getFileNestedConsolidationData("nested2ServiceTemplate.yaml")
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
nestedNodeTemplateId = "test_nested4Level";
Assert.assertEquals(nestedNodeTemplateId, consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData("nested3ServiceTemplate.yaml")
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
+ .getFileNestedConsolidationData("nested3ServiceTemplate.yaml")
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
Assert.assertNull(consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData("nested3ServiceTemplate.yaml")
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
+ .getFileNestedConsolidationData("nested3ServiceTemplate.yaml")
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
//Validate main service template
nestedNodeTemplateId = "test_nested1Level";
NestedTemplateConsolidationData nestedTemplateConsolidationData =
- consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId);
+ consolidationData.getNestedConsolidationData()
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId);
//Validate basic null attributes
validateBasicNestedConsolidationData(nestedTemplateConsolidationData);
//Validate nodeTemplateId
Assert
- .assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(), nestedNodeTemplateId);
+ .assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(), nestedNodeTemplateId);
String securityRuleNodeTemplateId = "jsa_security_group1";
validateNestedNodesConnectedInSecurityRuleToPort(HeatToToscaUtil
- .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
- nestedNodeTemplateId, securityRuleNodeTemplateId,
- nestedTemplateConsolidationData);
+ .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
+ nestedNodeTemplateId, securityRuleNodeTemplateId,
+ nestedTemplateConsolidationData);
securityRuleNodeTemplateId = "jsa_security_group2";
validateNestedNodesConnectedInSecurityRuleToPort(HeatToToscaUtil
- .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
- nestedNodeTemplateId, securityRuleNodeTemplateId,
- nestedTemplateConsolidationData);
+ .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
+ nestedNodeTemplateId, securityRuleNodeTemplateId,
+ nestedTemplateConsolidationData);
nestedNodeTemplateId = "test_resourceGroup";
nestedTemplateConsolidationData = consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId);
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId);
//Validate basic null attributes
validateBasicNestedConsolidationData(nestedTemplateConsolidationData);
//Validate nodeTemplateId
Assert
- .assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(), nestedNodeTemplateId);
+ .assertEquals(nestedTemplateConsolidationData.getNodeTemplateId(), nestedNodeTemplateId);
securityRuleNodeTemplateId = "jsa_security_group2";
validateNestedNodesConnectedInSecurityRuleToPort(HeatToToscaUtil
- .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
- nestedNodeTemplateId, securityRuleNodeTemplateId,
- nestedTemplateConsolidationData);
+ .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
+ nestedNodeTemplateId, securityRuleNodeTemplateId,
+ nestedTemplateConsolidationData);
securityRuleNodeTemplateId = "jsa_security_group2";
validateNestedNodesConnectedInSecurityRuleToPort(HeatToToscaUtil
- .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
- nestedNodeTemplateId, securityRuleNodeTemplateId,
- nestedTemplateConsolidationData);
+ .getServiceTemplateFromContext(MAIN_SERVICE_TEMPLATE, context).get(),
+ nestedNodeTemplateId, securityRuleNodeTemplateId,
+ nestedTemplateConsolidationData);
nestedNodeTemplateId = "test_nestedInvalidConnectionToNova";
Assert.assertEquals(nestedNodeTemplateId, consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodeTemplateId());
Assert.assertNull(consolidationData.getNestedConsolidationData()
- .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
- .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
+ .getFileNestedConsolidationData(MAIN_SERVICE_TEMPLATE)
+ .getNestedTemplateConsolidationData(nestedNodeTemplateId).getNodesConnectedIn());
}
}
@@ -1008,21 +1006,21 @@ public class ConsolidationDataTestUtil {
String nestedNodeTemplateId,
String securityRuleNodeTemplateId,
NestedTemplateConsolidationData
- nestedTemplateConsolidationData) {
+ nestedTemplateConsolidationData) {
Multimap<String, RequirementAssignmentData> consolidationDataNodesConnectedIn =
- nestedTemplateConsolidationData.getNodesConnectedIn();
+ nestedTemplateConsolidationData.getNodesConnectedIn();
Assert.assertNotNull(consolidationDataNodesConnectedIn);
NodeTemplate securityRuleNodeTemplate = DataModelUtil.getNodeTemplate(serviceTemplate,
- securityRuleNodeTemplateId);
+ securityRuleNodeTemplateId);
List<Map<String, RequirementAssignment>> securityRuleNodeTemplateRequirements =
- securityRuleNodeTemplate.getRequirements();
+ securityRuleNodeTemplate.getRequirements();
for (Map<String, RequirementAssignment> req : securityRuleNodeTemplateRequirements) {
String requirementId = req.keySet().toArray()[0].toString();
if (requirementId.equals(ToscaConstants.PORT_REQUIREMENT_ID)) {
RequirementAssignment requirementAssignment = req.get(requirementId);
if (requirementAssignment.getNode().equals(nestedNodeTemplateId)) {
validateSecurityRulePortNestedConsolidationData(requirementAssignment,
- securityRuleNodeTemplateId, consolidationDataNodesConnectedIn);
+ securityRuleNodeTemplateId, consolidationDataNodesConnectedIn);
}
}
}
@@ -1031,15 +1029,15 @@ public class ConsolidationDataTestUtil {
private static void validateSecurityRulePortNestedConsolidationData(RequirementAssignment requirementAssignment,
String securityRuleNodeTemplateId,
Multimap<String, RequirementAssignmentData>
- consolidationDataNodesConnectedIn) {
+ consolidationDataNodesConnectedIn) {
Collection<RequirementAssignmentData> requirementAssignmentDataList =
- consolidationDataNodesConnectedIn.get(securityRuleNodeTemplateId);
+ consolidationDataNodesConnectedIn.get(securityRuleNodeTemplateId);
Assert.assertNotNull(requirementAssignmentDataList);
boolean result = false;
for (RequirementAssignmentData data : requirementAssignmentDataList) {
RequirementAssignment dataRequirementAssignment = data.getRequirementAssignment();
result = DataModelUtil
- .compareRequirementAssignment(requirementAssignment, dataRequirementAssignment);
+ .compareRequirementAssignment(requirementAssignment, dataRequirementAssignment);
if (result) {
break;
}