aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java7
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java2
2 files changed, 5 insertions, 4 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 0e08be5d7a..c291c571d7 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -3372,9 +3372,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
if (nodeNamespaceMap.containsKey(uploadComponentInstanceInfo.getType())) {
refResource = nodeNamespaceMap.get(uploadComponentInstanceInfo.getType());
} else {
- Either<Resource, StorageOperationStatus> findResourceEither = toscaOperationFacade
- .getByToscaResourceNameMatchingVendorRelease(uploadComponentInstanceInfo.getType(),
- ((ResourceMetadataDataDefinition) resource.getComponentMetadataDefinition().getMetadataDataDefinition()).getVendorRelease());
+ Either<Resource, StorageOperationStatus> findResourceEither = StringUtils.isEmpty(resource.getModel()) ?
+ toscaOperationFacade.getByToscaResourceNameMatchingVendorRelease(uploadComponentInstanceInfo.getType(),
+ ((ResourceMetadataDataDefinition) resource.getComponentMetadataDefinition().getMetadataDataDefinition()).getVendorRelease()):
+ toscaOperationFacade.getLatestByToscaResourceNameAndModel(uploadComponentInstanceInfo.getType(), resource.getModel());
if (findResourceEither.isRight()) {
log.debug("validateResourceInstanceBeforeCreate - not found latest version for resource instance with name {} and type {}",
uploadComponentInstanceInfo.getName(), uploadComponentInstanceInfo.getType());
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
index cfbd63363a..542b142c21 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
@@ -1489,7 +1489,7 @@ public class ResourceBusinessLogicTest {
roleProp.setName("role");
roleProp.setType("string");
vduCp.getProperties().add(roleProp);
- when(toscaOperationFacade.getByToscaResourceNameMatchingVendorRelease("tosca.nodes.nfv.VduCp", "1.0.0")).thenReturn(Either.left(vduCp));
+ when(toscaOperationFacade.getLatestByToscaResourceNameAndModel("tosca.nodes.nfv.VduCp", "testModel")).thenReturn(Either.left(vduCp));
when(yamlTemplateParsingHandler.parseResourceInfoFromYAML(any(), any(), any(), any(), any(), any())).thenReturn(parsedToscaYamlInfo);