aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java22
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java6
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java7
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java18
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogicTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java2
19 files changed, 54 insertions, 52 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
index e2c3df172d..f4daea703f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
@@ -446,7 +446,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
}
final Component service = getServiceResult.left().value();
final Either<Component, StorageOperationStatus> getServiceDerivedFromTypeResult = toscaOperationFacade
- .getLatestByToscaResourceName(service.getDerivedFromGenericType());
+ .getLatestByToscaResourceName(service.getDerivedFromGenericType(), service.getModel());
if (getServiceDerivedFromTypeResult.isRight()) {
throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(getServiceResult.right().value()));
}
@@ -2835,7 +2835,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
final Component service = getServiceResult.left().value();
final Either<Component, StorageOperationStatus> getServiceDerivedFromTypeResult = toscaOperationFacade
- .getLatestByToscaResourceName(service.getDerivedFromGenericType());
+ .getLatestByToscaResourceName(service.getDerivedFromGenericType(), service.getModel());
if (getServiceDerivedFromTypeResult.isRight()) {
throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(getServiceResult.right().value()));
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java
index 3b92e62e72..1bffb4e789 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java
@@ -1288,11 +1288,11 @@ public class ElementBusinessLogic extends BaseBusinessLogic {
}
}
- public Either<List<BaseType>, ActionStatus> getBaseTypes(final String categoryName, final String userId) {
+ public Either<List<BaseType>, ActionStatus> getBaseTypes(final String categoryName, final String userId, final String modelName) {
final ActionStatus status = validateUserExistsActionStatus(userId);
if (ActionStatus.OK != status) {
return Either.right(status);
}
- return Either.left(elementOperation.getBaseTypes(categoryName));
+ return Either.left(elementOperation.getBaseTypes(categoryName, modelName));
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
index 4983c0160f..321ed99ae7 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
@@ -107,7 +107,7 @@ public class GroupTypeImportManager {
for (String member : groupType.getMembers()) {
// Verify that such Resource exist
Either<org.openecomp.sdc.be.model.Resource, StorageOperationStatus> eitherMemberExist = toscaOperationFacade
- .getLatestByToscaResourceName(member);
+ .getLatestByToscaResourceName(member, groupType.getModel());
if (eitherMemberExist.isRight()) {
StorageOperationStatus operationStatus = eitherMemberExist.right().value();
log.debug("Error when fetching parent resource {}, error: {}", member, operationStatus);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
index d10680db0d..9fa8e303ac 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
@@ -105,7 +105,7 @@ public class PolicyTypeImportManager {
}
if (result.isLeft()) {
for (String targetId : policyType.getTargets()) {
- boolean isValid = toscaOperationFacade.getLatestByToscaResourceName(targetId).isLeft();
+ boolean isValid = toscaOperationFacade.getLatestByToscaResourceName(targetId, policyType.getModel()).isLeft();
if (!isValid) { // check if it is a groupType
final Either<GroupTypeDefinition, StorageOperationStatus> groupTypeFound = groupTypeOperation
.getLatestGroupTypeByType(targetId, policyType.getModel(), false);
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 c401948495..152b78b15c 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
@@ -802,7 +802,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
componentsUtils.auditResource(responseFormat, csarInfo.getModifier(), resource, AuditingActionEnum.CREATE_RESOURCE);
throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(status), csarInfo.getCsarUUID());
} else if (StringUtils.isNotEmpty(currVfcToscaName)) {
- return (Resource) toscaOperationFacade.getLatestByToscaResourceName(currVfcToscaName).left()
+ return (Resource) toscaOperationFacade.getLatestByToscaResourceName(currVfcToscaName, resource.getModel()).left()
.on(st -> findVfcResource(csarInfo, resource, previousVfcToscaName, null, st));
}
return null;
@@ -1969,7 +1969,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
String nodeName, String substitutableAsNodeType) {
try {
for (Entry<String, NodeTypeInfo> nodeTypeEntry : nodeTypesInfo.entrySet()) {
- if (nodeTypeEntry.getValue().isNested() && !nodeTypeAlreadyExists(nodeTypeEntry.getKey())) {
+ if (nodeTypeEntry.getValue().isNested() && !nodeTypeAlreadyExists(nodeTypeEntry.getKey(), resource.getModel())) {
handleNestedVfc(resource, nodeTypesArtifactsToHandle, nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo,
nodeTypeEntry.getKey());
log.trace("************* finished to create node {}", nodeTypeEntry.getKey());
@@ -1997,8 +1997,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
}
- private boolean nodeTypeAlreadyExists(final String toscaResourceName) {
- return toscaOperationFacade.getLatestByToscaResourceName(toscaResourceName).isLeft();
+ private boolean nodeTypeAlreadyExists(final String toscaResourceName, String modelName) {
+ return toscaOperationFacade.getLatestByToscaResourceName(toscaResourceName, modelName).isLeft();
}
private Either<Resource, ResponseFormat> handleVfCsarArtifacts(Resource resource, CsarInfo csarInfo, List<ArtifactDefinition> createdArtifacts,
@@ -3490,7 +3490,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
final CsarInfo csarInfo, final boolean isNested,
final String nodeName) {
final Either<Component, StorageOperationStatus> latestByToscaName = toscaOperationFacade.getLatestByToscaResourceName(
- buildNestedToscaResourceName(resource.getResourceType().name(), csarInfo.getVfResourceName(), nodeName).getRight());
+ buildNestedToscaResourceName(resource.getResourceType().name(), csarInfo.getVfResourceName(), nodeName).getRight(), resource.getModel());
if (latestByToscaName.isLeft()) {
final Resource nestedResource = (Resource) latestByToscaName.left().value();
log.debug(VALIDATE_DERIVED_BEFORE_UPDATE);
@@ -3676,7 +3676,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
private Component getParentComponent(Resource newResource) {
String toscaResourceNameDerivedFrom = newResource.getDerivedFrom().get(0);
Either<Component, StorageOperationStatus> latestByToscaResourceName = toscaOperationFacade
- .getLatestByToscaResourceName(toscaResourceNameDerivedFrom);
+ .getLatestByToscaResourceName(toscaResourceNameDerivedFrom, newResource.getModel());
if (latestByToscaResourceName.isRight()) {
BeEcompErrorManager.getInstance()
.logInternalDataError("mergeOldResourceMetadataWithNew", "derived from resource not found", ErrorSeverity.ERROR);
@@ -4601,7 +4601,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
String currentTemplateName = currentResource.getDerivedFrom().get(0);
String updatedTemplateName = updateInfoResource.getDerivedFrom().get(0);
Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade
- .validateToscaResourceNameExtends(currentTemplateName, updatedTemplateName);
+ .validateToscaResourceNameExtends(currentTemplateName, updatedTemplateName, currentResource.getModel());
if (dataModelResponse.isRight()) {
StorageOperationStatus storageStatus = dataModelResponse.right().value();
BeEcompErrorManager.getInstance().logBeDaoSystemError("Create/Update Resource - validateDerivingFromExtendingType");
@@ -4905,20 +4905,20 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
log.debug("validate resource properties default values");
List<PropertyDefinition> properties = resource.getProperties();
if (properties != null) {
- iterateOverProperties(properties);
+ iterateOverProperties(properties, resource.getModel());
}
return true;
}
- public void iterateOverProperties(List<PropertyDefinition> properties) {
+ public void iterateOverProperties(List<PropertyDefinition> properties, String model) {
String type = null;
String innerType = null;
for (PropertyDefinition property : properties) {
- if (!propertyOperation.isPropertyTypeValid(property, null)) {
+ if (!propertyOperation.isPropertyTypeValid(property, model)) {
log.info("Invalid type for property {}", property);
throw new ByActionStatusComponentException(ActionStatus.INVALID_PROPERTY_TYPE, property.getType(), property.getName());
}
- Map<String, DataTypeDefinition> allDataTypes = componentsUtils.getAllDataTypes(applicationDataTypeCache, property.getModel());
+ Map<String, DataTypeDefinition> allDataTypes = componentsUtils.getAllDataTypes(applicationDataTypeCache, model);
type = property.getType();
if (type.equals(ToscaPropertyType.LIST.getType()) || type.equals(ToscaPropertyType.MAP.getType())) {
ResponseFormat responseFormat = validateMapOrListPropertyType(property, innerType, allDataTypes);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java
index 9f1669c135..4f65230383 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java
@@ -215,7 +215,7 @@ public class ResourceImportManager {
}
final Either<Resource, StorageOperationStatus> resourceEither =
toscaOperationFacade.getComponentByNameAndVendorRelease(resource.getComponentType(), resource.getName(),
- resource.getVendorRelease(), JsonParseFlagEnum.ParseAll);
+ resource.getVendorRelease(), JsonParseFlagEnum.ParseAll, resource.getModel());
if (resourceEither.isLeft() && toscaOperationFacade.isNodeAssociatedToModel(resource.getModel(), resource)) {
if (resource.getModel() == null) {
throw new ByActionStatusComponentException(ActionStatus.COMPONENT_WITH_VENDOR_RELEASE_ALREADY_EXISTS,
@@ -528,7 +528,7 @@ public class ResourceImportManager {
String derivedFrom = toscaDerivedFromElement.left().value();
log.debug("Derived from TOSCA name is {}", derivedFrom);
resource.setDerivedFrom(Arrays.asList(new String[]{derivedFrom}));
- Either<Resource, StorageOperationStatus> latestByToscaResourceName = toscaOperationFacade.getLatestByToscaResourceName(derivedFrom);
+ Either<Resource, StorageOperationStatus> latestByToscaResourceName = toscaOperationFacade.getLatestByToscaResourceName(derivedFrom, resource.getModel());
if (latestByToscaResourceName.isRight()) {
StorageOperationStatus operationStatus = latestByToscaResourceName.right().value();
if (operationStatus == StorageOperationStatus.NOT_FOUND) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java
index 3404323c9d..994092911f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogic.java
@@ -313,7 +313,7 @@ public class ServiceImportParseLogic {
log.debug("Error occured during fetching node type with tosca name {}, error: {}", currVfcToscaName, status);
throw new ComponentException(componentsUtils.convertFromStorageResponse(status), csarInfo.getCsarUUID());
} else if (org.apache.commons.lang.StringUtils.isNotEmpty(currVfcToscaName)) {
- return (Resource) toscaOperationFacade.getLatestByToscaResourceName(currVfcToscaName).left()
+ return (Resource) toscaOperationFacade.getLatestByToscaResourceName(currVfcToscaName, resource.getModel()).left()
.on(st -> findVfcResource(csarInfo, resource, previousVfcToscaName, null, st));
}
return null;
@@ -1504,7 +1504,7 @@ public class ServiceImportParseLogic {
String currentTemplateName = currentResource.getDerivedFrom().get(0);
String updatedTemplateName = updateInfoResource.getDerivedFrom().get(0);
Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade
- .validateToscaResourceNameExtends(currentTemplateName, updatedTemplateName);
+ .validateToscaResourceNameExtends(currentTemplateName, updatedTemplateName, currentResource.getModel());
if (dataModelResponse.isRight()) {
StorageOperationStatus storageStatus = dataModelResponse.right().value();
BeEcompErrorManager.getInstance().logBeDaoSystemError("Create/Update Resource - validateDerivingFromExtendingType");
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java
index 6cf4327a99..07d71eabb4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java
@@ -72,7 +72,7 @@ public class GenericTypeBusinessLogic {
return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERIC_TYPE_NOT_FOUND, component.assetType(), genericTypeToscaName));
}
} else {
- genericType = toscaOperationFacade.getByToscaResourceNameAndVersion(genericTypeToscaName, component.getDerivedFromGenericVersion());
+ genericType = toscaOperationFacade.getByToscaResourceNameAndVersion(genericTypeToscaName, component.getDerivedFromGenericVersion(), component.getModel());
}
Resource genericTypeResource = genericType.left().value();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java
index 4efca8a2b8..f79650ddc7 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java
@@ -202,11 +202,11 @@ public class ElementServlet extends BeGenericServlet {
@PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
public Response getCategoryBaseTypes(@PathParam(value = "categoryName") final String categoryName,
@PathParam(value = "componentType") final String componentType, @Context final HttpServletRequest request,
- @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
-
+ @HeaderParam(value = Constants.USER_ID_HEADER) String userId,
+ @Parameter(description = "model", required = false) @QueryParam("model") String modelName) {
try {
final ElementBusinessLogic elementBL = getElementBL(request.getSession().getServletContext());
- final Either<List<BaseType>, ActionStatus> either = elementBL.getBaseTypes(categoryName, userId);
+ final Either<List<BaseType>, ActionStatus> either = elementBL.getBaseTypes(categoryName, userId, modelName);
if (either.isRight() || either.left().value() == null) {
log.debug("No base types were found");
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 ef5192c048..8b8c3153cf 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
@@ -220,7 +220,7 @@ public class ToscaExportHandler {
if (component.getDerivedFromGenericType() != null && !component.getDerivedFromGenericType()
.startsWith("org.openecomp.resource.abstract.nodes.")) {
final Either<Component, StorageOperationStatus> baseType = toscaOperationFacade
- .getByToscaResourceNameAndVersion(component.getDerivedFromGenericType(), component.getDerivedFromGenericVersion());
+ .getByToscaResourceNameAndVersion(component.getDerivedFromGenericType(), component.getDerivedFromGenericVersion(), component.getModel());
if (baseType.isLeft() && baseType.left().value() != null) {
addDependencies(imports, dependencies, baseType.left().value());
} else {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java b/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java
index 5d05e65886..117ef9cc5a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java
@@ -282,7 +282,7 @@ public class ElementOperationMock implements IElementOperation {
}
@Override
- public List<BaseType> getBaseTypes(String categoryName) {
+ public List<BaseType> getBaseTypes(String categoryName, String modelName) {
// TODO Auto-generated method stub
return null;
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
index 00e0681c8d..1609299e66 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java
@@ -110,7 +110,7 @@ public class ResourceImportManagerTest {
public static void beforeClass() {
importManager = new ResourceImportManager(componentsUtils, capabilityTypeOperation, interfaceDefinitionHandler);
importManager.setAuditingManager(auditingManager);
- when(toscaOperationFacade.getLatestByToscaResourceName(Mockito.anyString())).thenReturn(Either.left(null));
+ when(toscaOperationFacade.getLatestByToscaResourceName(Mockito.anyString(), Mockito.any())).thenReturn(Either.left(null));
when(toscaOperationFacade.getLatestByToscaResourceNameAndModel(Mockito.anyString(), Mockito.any())).thenReturn(Either.left(null));
importManager.setResponseFormatManager(responseFormatManager);
importManager.setResourceBusinessLogic(resourceBusinessLogic);
@@ -130,7 +130,7 @@ public class ResourceImportManagerTest {
Mockito.reset(auditingManager, responseFormatManager, resourceBusinessLogic, userAdmin);
Either<Component, StorageOperationStatus> notFound = Either.right(StorageOperationStatus.NOT_FOUND);
when(toscaOperationFacade.getComponentByNameAndVendorRelease(any(ComponentTypeEnum.class), anyString(), anyString(),
- any(JsonParseFlagEnum.class))).thenReturn(notFound);
+ any(JsonParseFlagEnum.class), any())).thenReturn(notFound);
}
@Test
@@ -308,7 +308,7 @@ public class ResourceImportManagerTest {
setResourceBusinessLogicMock();
final Either<Component, StorageOperationStatus> foundResourceEither = Either.left(Mockito.mock(Resource.class));
when(toscaOperationFacade.getComponentByNameAndVendorRelease(any(ComponentTypeEnum.class), anyString(), anyString(),
- any(JsonParseFlagEnum.class))).thenReturn(foundResourceEither);
+ any(JsonParseFlagEnum.class), any())).thenReturn(foundResourceEither);
when(toscaOperationFacade.isNodeAssociatedToModel(eq(null), any(Resource.class))).thenReturn(true);
String jsonContent = ImportUtilsTest.loadFileNameToJsonString("normative-types-new-blockStorage.yml");
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
index a2996c531d..3029bf7bc1 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
@@ -33,6 +33,7 @@ import static org.junit.jupiter.api.DynamicTest.dynamicTest;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anySet;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -1851,7 +1852,7 @@ class ComponentInstanceBusinessLogicTest {
.thenReturn(Either.left(service));
when(toscaOperationFacade.getToscaFullElement(eq(ORIGIN_COMPONENT_ID)))
.thenReturn(Either.left(originService));
- when(toscaOperationFacade.getLatestByToscaResourceName(eq(originService.getDerivedFromGenericType())))
+ when(toscaOperationFacade.getLatestByToscaResourceName(eq(originService.getDerivedFromGenericType()), isNull()))
.thenReturn(Either.left(serviceBaseComponent));
when(toscaOperationFacade.getToscaElement(eq(ORIGIN_COMPONENT_ID), any(ComponentParametersView.class)))
.thenReturn(Either.left(originService));
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java
index 36eee96848..f52ae209db 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java
@@ -312,16 +312,17 @@ public class ElementBusinessLogicTest extends BaseBusinessLogicMock {
List<BaseType> baseTypes = new ArrayList<>();
baseTypes.add(new BaseType("org.openecomp.type"));
String categoryName = "CAT01";
+ String modelName = "MODEL01";
when(userValidations.validateUserExistsActionStatus(eq(user.getUserId()))).thenReturn(ActionStatus.OK);
- when(elementDao.getBaseTypes(categoryName)).thenReturn(baseTypes);
- Assert.assertTrue(elementBusinessLogic.getBaseTypes(categoryName, user.getUserId())
+ when(elementDao.getBaseTypes(categoryName, modelName)).thenReturn(baseTypes);
+ Assert.assertTrue(elementBusinessLogic.getBaseTypes(categoryName, user.getUserId(), modelName)
.isLeft());
}
@Test
public void testGetBaseTypes_givenUserValidationFails_thenReturnsException() {
when(userValidations.validateUserExistsActionStatus(eq(user.getUserId()))).thenReturn(ActionStatus.RESTRICTED_OPERATION);
- Assert.assertTrue(elementBusinessLogic.getBaseTypes("CAT01", user.getUserId()).isRight());
+ Assert.assertTrue(elementBusinessLogic.getBaseTypes("CAT01", user.getUserId(), null).isRight());
}
} \ No newline at end of file
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 a2893af2ba..cfbd63363a 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
@@ -1460,7 +1460,7 @@ public class ResourceBusinessLogicTest {
YamlTemplateParsingHandler yamlTemplateParser = new YamlTemplateParsingHandler(mockJanusGraphDao, null, Mockito.mock(AnnotationBusinessLogic.class), null);
final ParsedToscaYamlInfo parsedToscaYamlInfo = yamlTemplateParser.parseResourceInfoFromYAML("Definitions/my_vnf.yml", resourceYml, Collections.EMPTY_MAP, Collections.EMPTY_MAP, "myVnf", resourceResponse);
- when(toscaOperationFacade.getLatestByToscaResourceName(anyString())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
+ when(toscaOperationFacade.getLatestByToscaResourceName(anyString(), any())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
Resource vduCp = new Resource();
vduCp.setToscaResourceName("tosca.nodes.nfv.VduCp");
vduCp.setState(LifecycleStateEnum.CERTIFIED);
@@ -1673,7 +1673,7 @@ public class ResourceBusinessLogicTest {
when(toscaOperationFacade.getToscaElement(resource.getUniqueId())).thenReturn(eitherUpdate);
Either<Boolean, StorageOperationStatus> isToscaNameExtending = Either.left(true);
- when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString()))
+ when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString(), anyString()))
.thenReturn(isToscaNameExtending);
Either<Map<String, PropertyDefinition>, StorageOperationStatus> findPropertiesOfNode = Either
@@ -1703,7 +1703,7 @@ public class ResourceBusinessLogicTest {
when(toscaOperationFacade.getToscaElement(resource.getUniqueId())).thenReturn(eitherUpdate);
Either<Boolean, StorageOperationStatus> isToscaNameExtending = Either.left(false);
- when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString()))
+ when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString(), anyString()))
.thenReturn(isToscaNameExtending);
resource.setVersion("1.0");
@@ -1740,7 +1740,7 @@ public class ResourceBusinessLogicTest {
assertThat(createdResource).isNotNull();
Either<Resource, StorageOperationStatus> getLatestResult = Either.left(createdResource);
Either<Component, StorageOperationStatus> getCompLatestResult = Either.left(createdResource);
- when(toscaOperationFacade.getLatestByToscaResourceName(resourceExist.getToscaResourceName()))
+ when(toscaOperationFacade.getLatestByToscaResourceName(resourceExist.getToscaResourceName(), null))
.thenReturn(getCompLatestResult);
when(toscaOperationFacade.getLatestByToscaResourceNameAndModel(resourceExist.getToscaResourceName(), null))
.thenReturn(getCompLatestResult);
@@ -1851,9 +1851,9 @@ public class ResourceBusinessLogicTest {
.getRight();
when(toscaOperationFacade.getLatestByName(resourceToUpdate.getName(), null))
.thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
- when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdate.getToscaResourceName()))
+ when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdate.getToscaResourceName(), null))
.thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
- when(toscaOperationFacade.getLatestByToscaResourceName(nestedResourceName))
+ when(toscaOperationFacade.getLatestByToscaResourceName(nestedResourceName, null))
.thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
when(toscaOperationFacade.getLatestByToscaResourceNameAndModel(resourceToUpdate.getToscaResourceName(), null))
@@ -1889,11 +1889,11 @@ public class ResourceBusinessLogicTest {
.getRight();
when(toscaOperationFacade.getLatestByName(resourceToUpdate.getName(), null))
.thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
- when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdate.getToscaResourceName()))
+ when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdate.getToscaResourceName(), null))
.thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
when(toscaOperationFacade.getLatestByToscaResourceNameAndModel(resourceToUpdate.getToscaResourceName(), null))
.thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
- when(toscaOperationFacade.getLatestByToscaResourceName(nestedResourceName))
+ when(toscaOperationFacade.getLatestByToscaResourceName(nestedResourceName, null))
.thenReturn(Either.left(resourceResponse));
when(toscaOperationFacade.overrideComponent(any(Resource.class), any(Resource.class)))
.thenReturn(Either.left(resourceResponse));
@@ -2283,7 +2283,7 @@ public class ResourceBusinessLogicTest {
private Resource createRoot() {
rootType = setupGenericTypeMock(GENERIC_ROOT_NAME);
- when(toscaOperationFacade.getLatestByToscaResourceName(GENERIC_ROOT_NAME))
+ when(toscaOperationFacade.getLatestByToscaResourceName(GENERIC_ROOT_NAME, null))
.thenReturn(Either.left(rootType));
return rootType;
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogicTest.java
index a3232f61ce..ccc7139fa6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportParseLogicTest.java
@@ -203,7 +203,7 @@ class ServiceImportParseLogicTest extends ServiceImportBussinessLogicBaseTestSet
final Service service = createServiceObject(false);
Resource resource = new Resource();
Either<Component, StorageOperationStatus> getCompLatestResult = Either.left(resource);
- when(toscaOperationFacade.getLatestByToscaResourceName(anyString()))
+ when(toscaOperationFacade.getLatestByToscaResourceName(anyString(), any()))
.thenReturn(getCompLatestResult);
final CsarInfo csarInfo = getCsarInfo();
@@ -229,7 +229,7 @@ class ServiceImportParseLogicTest extends ServiceImportBussinessLogicBaseTestSet
final Service service = createServiceObject(false);
Resource resource = new Resource();
Either<Component, StorageOperationStatus> getCompLatestResult = Either.left(resource);
- when(toscaOperationFacade.getLatestByToscaResourceName(anyString()))
+ when(toscaOperationFacade.getLatestByToscaResourceName(anyString(), any()))
.thenReturn(getCompLatestResult);
Assertions.assertNotNull(extractedVfcsArtifacts);
testSubject.findAddNodeTypeArtifactsToHandle(getCsarInfo(), nodeTypesArtifactsToHandle, service,
@@ -1205,7 +1205,7 @@ class ServiceImportParseLogicTest extends ServiceImportBussinessLogicBaseTestSet
updatedDerivedFromList.add("23344567778");
updateInfoResource.setDerivedFrom(updatedDerivedFromList);
- when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString()))
+ when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString(), any()))
.thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
Assertions.assertNotNull(
@@ -1218,7 +1218,7 @@ class ServiceImportParseLogicTest extends ServiceImportBussinessLogicBaseTestSet
Resource currentResource = createParseResourceObject(true);
Resource updateInfoResource = createParseResourceObject(true);
- when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString()))
+ when(toscaOperationFacade.validateToscaResourceNameExtends(anyString(), anyString(), any()))
.thenReturn(Either.left(false));
Assertions.assertNotNull(
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java
index 3774332b23..3fbd84f6a4 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java
@@ -55,12 +55,12 @@ public class ForwardingPathToscaOperationFacade extends ToscaOperationFacade {
}
@Override
- public <T extends Component> Either<T, StorageOperationStatus> getLatestByToscaResourceName(String toscaResourceName) {
+ public <T extends Component> Either<T, StorageOperationStatus> getLatestByToscaResourceName(String toscaResourceName, String model) {
if(toscaResourceName.equals(ForwardingPathUtils.FORWARDING_PATH_NODE_NAME) || toscaResourceName.equals(ForwardingPathUtils.FORWARDER_CAPABILITY)){
Resource component = new Resource();
component.setToscaResourceName(GENERIC_SERVICE_NAME);
return Either.left((T)component);
}
- return super.getLatestByToscaResourceName(toscaResourceName);
+ return super.getLatestByToscaResourceName(toscaResourceName, model);
}
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java
index 4d2c3621d9..c1837846f6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java
@@ -1110,7 +1110,7 @@ class ElementServletTest extends JerseyTest {
void getBaseTypesTest() {
String path = "/v1/category/services/CAT1/baseTypes";
Either<List<BaseType>, ActionStatus> baseTypesEither = Either.left(new ArrayList<>());
- when(elementBusinessLogic.getBaseTypes("CAT1", designerUser.getUserId()))
+ when(elementBusinessLogic.getBaseTypes("CAT1", designerUser.getUserId(), null))
.thenReturn(baseTypesEither);
Response response = target()
@@ -1128,7 +1128,7 @@ class ElementServletTest extends JerseyTest {
String path = "/v1/category/services/CAT1/baseTypes";
Either<List<BaseType>, ActionStatus> baseTypesEither = Either.right(ActionStatus.NO_CONTENT);
- when(elementBusinessLogic.getBaseTypes("CAT1", designerUser.getUserId()))
+ when(elementBusinessLogic.getBaseTypes("CAT1", designerUser.getUserId(), null))
.thenReturn(baseTypesEither);
Response response = target()
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 38c72922fd..325a003133 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
@@ -529,7 +529,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
component.setDerivedFromGenericType("org.typeA");
component.setDerivedFromGenericVersion("1.0");
- when(toscaOperationFacade.getByToscaResourceNameAndVersion("org.typeA", "1.0")).thenReturn(Either.left(baseType));
+ when(toscaOperationFacade.getByToscaResourceNameAndVersion("org.typeA", "1.0", null)).thenReturn(Either.left(baseType));
// default test
result = Deencapsulation.invoke(testSubject, "fillImports", component, toscaTemplate);