diff options
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java | 3 | ||||
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index de35bcf889..773213a80e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -1579,6 +1579,9 @@ public class ToscaExportHandler { */ private boolean isRequirementBelongToRelation(Component originComponent, RelationshipInfo reqAndRelationshipPair, RequirementDefinition requirement, String fromInstanceId) { + if (originComponent.isService() && requirement.getUniqueId().equals(reqAndRelationshipPair.getRequirementUid())) { + return true; + } if (!StringUtils.equals(requirement.getName(), reqAndRelationshipPair.getRequirement())) { log.debug("Failed to find a requirement with name {} and reqAndRelationshipPair {}", requirement.getName(), reqAndRelationshipPair.getRequirement()); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java index 7d16c906c4..30585105b0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java @@ -121,6 +121,7 @@ class ToscaExportHandlerTest extends BaseConfDependent { private static final String RESOURCE_NAME = "resource"; private static final String TOSCA_VERSION = "tosca_simple_yaml_1_1"; private static final String LOCAL_INTERFACE_TYPE = "Local"; + public static final String UNIQUE_ID = "1L"; @InjectMocks private ToscaExportHandler testSubject; @@ -1623,6 +1624,8 @@ class ToscaExportHandlerTest extends BaseConfDependent { Component originComponent = new Service(); RelationshipInfo reqAndRelationshipPair = new RelationshipInfo(); RequirementDefinition requirement = new RequirementDefinition(); + requirement.setUniqueId(UNIQUE_ID); + reqAndRelationshipPair.setRequirementUid(UNIQUE_ID); String fromInstanceId = ""; boolean result; |