diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
index c7710c5..4c0207c 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
@@ -319,6 +319,9 @@
     PLAN:
         acceptedTypes:
             - xml
+    WORKFLOW:
+        acceptedTypes:
+
 
 resourceDeploymentArtifacts:
     HEAT:
@@ -444,6 +447,9 @@
         validForResourceTypes:
             - VF
             - VFC
+    WORKFLOW:
+        acceptedTypes:
+        validForResourceTypes: *allResourceTypes
 
 resourceInstanceDeploymentArtifacts:
     HEAT_ENV:
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
index 4ef2e06..ebdbcea 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
@@ -3145,9 +3145,11 @@
 
         Operation operation = optionalOperation.get();
         ArtifactDefinition implementationArtifact =  operation.getImplementationArtifact();
-        implementationArtifact.setArtifactName(operation.getName() + "_" + artifactInfo.getArtifactName());
+        implementationArtifact.setArtifactName(artifactInfo.getArtifactName());
         implementationArtifact.setDescription(artifactInfo.getDescription());
         implementationArtifact.setArtifactType(artifactInfo.getArtifactType());
+        implementationArtifact.setArtifactLabel(artifactInfo.getUniqueId());
+        implementationArtifact.setEsId(artifactInfo.getEsId());
         operation.setImplementation(implementationArtifact);
         gotInterface.setOperationsMap(operationsMap);
         Either<InterfaceDefinition, StorageOperationStatus> interfaceDefinitionStorageOperationStatusEither =
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
index 6f822fd..26e256f 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java
@@ -259,8 +259,8 @@
         String artifactUUID = UUID.randomUUID().toString();
         artifactDefinition.setArtifactUUID(artifactUUID);
         artifactDefinition.setUniqueId(artifactUUID);
-        artifactDefinition.setArtifactType(ArtifactTypeEnum.PLAN.getType());
-        artifactDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.LIFE_CYCLE);
+        artifactDefinition.setArtifactType(ArtifactTypeEnum.WORKFLOW.getType());
+        artifactDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT);
         operation.setUniqueId(UUID.randomUUID().toString());
         operation.setImplementation(artifactDefinition);
     }
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
index 066b657..bea65cf 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
@@ -23,6 +23,7 @@
 
 import fj.data.Either;
 import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.commons.lang.WordUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -35,7 +36,6 @@
 import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
 import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
 import org.openecomp.sdc.be.dao.cassandra.SdcSchemaFilesCassandraDao;
-import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.impl.ComponentsUtils;
 import org.openecomp.sdc.be.model.*;
@@ -94,8 +94,6 @@
 	public static final String RESOURCES_PATH = "Resources/";
 	public static final String INFORMATIONAL_ARTIFACTS = "Informational/";
 	public static final String DEPLOYMENT_ARTIFACTS = "Deployment/";
-	public static final String WORKFLOW_ARTIFACT_DIR = "Workflows" + File.separator + "BPMN" + File.separator;
-	public static final String DEPLOYMENT_ARTIFACTS_DIR = "Deployment" + File.separator;
 
 	public static final String DEFINITIONS_PATH = "Definitions/";
 	private static final String CSAR_META_VERSION = "1.0";
@@ -249,7 +247,7 @@
 		// US798487 - Abstraction of complex types
 		if (!ModelConverter.isAtomicComponent(component)) {
 			log.debug("Component {} is complex - generating abstract type for it..", component.getName());
-			writeComponentInterface(component, zip, fileName);
+			writeComponentInterface(component, zip, fileName, false);
 		}
 
 		if (dependencies == null) {
@@ -308,7 +306,7 @@
 
 				// add component interface to zip
 				if (!ModelConverter.isAtomicComponent(innerComponent)) {
-					writeComponentInterface(innerComponent, zip, icFileName);
+					writeComponentInterface(innerComponent, zip, icFileName, true);
 				}
 			}
 		}
@@ -433,10 +431,10 @@
 	}
 
 	private Either<ZipOutputStream, ResponseFormat> writeComponentInterface(Component component, ZipOutputStream zip,
-			String fileName) {
+			String fileName, boolean isAssociatedResourceComponent) {
 		try {
 			Either<ToscaRepresentation, ToscaError> componentInterface = toscaExportUtils
-					.exportComponentInterface(component);
+					.exportComponentInterface(component, isAssociatedResourceComponent);
 			ToscaRepresentation componentInterfaceYaml = componentInterface.left().value();
 			String mainYaml = componentInterfaceYaml.getMainYaml();
 			String interfaceFileName = DEFINITIONS_PATH + ToscaExportHandler.getInterfaceFilename(fileName);
@@ -858,74 +856,9 @@
 				return Either.right(writeComponentArtifactsToSpecifiedPath.right().value());
 			}
 		}
-		writeComponentArtifactsToSpecifiedPath = writeOperationsArtifactsToCsar(mainComponent, zipstream);
-
-		if (writeComponentArtifactsToSpecifiedPath.isRight()) {
-			return Either.right(writeComponentArtifactsToSpecifiedPath.right().value());
-		}
 		return Either.left(zipstream);
 	}
 
-	private Either<ZipOutputStream, ResponseFormat> writeOperationsArtifactsToCsar(Component component,
-			ZipOutputStream zipstream) {
-		if (component instanceof Service) {
-			return Either.left(zipstream);
-		}
-		if (Objects.isNull(((Resource) component).getInterfaces())) {
-			log.debug("Component Name {}- no interfaces found", component.getNormalizedName());
-			return Either.left(zipstream);
-		}
-		final Map<String, InterfaceDefinition> interfaces = ((Resource) component).getInterfaces();
-
-		for (Map.Entry<String, InterfaceDefinition> interfaceEntry : interfaces.entrySet()) {
-			for (OperationDataDefinition operation : interfaceEntry.getValue().getOperations().values()) {
-				try {
-					if (Objects.isNull(operation.getImplementation())) {
-						log.debug(
-								"Component Name {}, Interface Id {}, Operation Name {} - no Operation Implementation found",
-								component.getNormalizedName(), interfaceEntry.getValue().getUniqueId(),
-								operation.getName());
-						continue;
-					}
-					if (Objects.isNull(operation.getImplementation().getArtifactName())) {
-						log.debug("Component Name {}, Interface Id {}, Operation Name {} - no artifact found",
-								component.getNormalizedName(), interfaceEntry.getValue().getUniqueId(),
-								operation.getName());
-						continue;
-					}
-
-					final String artifactUUID = operation.getImplementation().getArtifactUUID();
-
-					final Either<byte[], ActionStatus> artifactFromCassandra = getFromCassandra(artifactUUID);
-					final String artifactName = operation.getImplementation().getArtifactName();
-					if (artifactFromCassandra.isRight()) {
-						log.error("ArtifactName {}, unique ID {}", artifactName, artifactUUID);
-						log.error("Failed to get {} payload from DB reason: {}", artifactName,
-								artifactFromCassandra.right().value());
-						return Either.right(componentsUtils.getResponseFormat(
-								ActionStatus.ARTIFACT_PAYLOAD_NOT_FOUND_DURING_CSAR_CREATION, "Resource",
-								component.getUniqueId(), artifactName, artifactUUID));
-					}
-
-					final byte[] payloadData = artifactFromCassandra.left().value();
-					zipstream.putNextEntry(new ZipEntry(
-							OperationArtifactUtil.createOperationArtifactPath(component.getNormalizedName(),
-									interfaceEntry.getValue().getToscaResourceName(), operation)));
-					zipstream.write(payloadData);
-
-				} catch (IOException | NullPointerException e) {
-					log.error("Component Name {},  Interface Name {}, Operation Name {}", component.getNormalizedName(),
-							interfaceEntry.getKey(), operation.getName());
-					log.error("Error while writing the operation's artifacts to the CSAR " + "{}", e);
-					return Either.right(componentsUtils.getResponseFormat(ActionStatus.ERROR_DURING_CSAR_CREATION,
-							"Resource", component.getUniqueId()));
-				}
-			}
-		}
-		return Either.left(zipstream);
-
-	}
-
 	private Either<ZipOutputStream, ResponseFormat> writeComponentArtifactsToSpecifiedPath(Component mainComponent,
 			ComponentArtifacts componentArtifacts, ZipOutputStream zipstream, String currentPath,
 			boolean isInCertificationRequest) throws IOException {
@@ -958,14 +891,17 @@
 		Set<ArtifactGroupTypeEnum> groupTypeEnumKeySet = artifactsInfo.keySet();
 
 		for (ArtifactGroupTypeEnum artifactGroupTypeEnum : groupTypeEnumKeySet) {
-			String groupTypeFolder = path + WordUtils.capitalizeFully(artifactGroupTypeEnum.getType()) + "/";
+			String groupTypeFolder = path + WordUtils.capitalizeFully(artifactGroupTypeEnum.getType()) + File.separator;
 
 			Map<ArtifactTypeEnum, List<ArtifactDefinition>> artifactTypesMap = artifactsInfo.get(artifactGroupTypeEnum);
 			Set<ArtifactTypeEnum> artifactTypeEnumKeySet = artifactTypesMap.keySet();
 
 			for (ArtifactTypeEnum artifactTypeEnum : artifactTypeEnumKeySet) {
 				List<ArtifactDefinition> artifactDefinitionList = artifactTypesMap.get(artifactTypeEnum);
-				String artifactTypeFolder = groupTypeFolder + artifactTypeEnum.toString() + "/";
+				String artifactTypeFolder = groupTypeFolder + artifactTypeEnum.toString() + File.separator;
+				if (artifactTypeEnum == ArtifactTypeEnum.WORKFLOW) {
+					artifactTypeFolder += OperationArtifactUtil.BPMN_ARTIFACT_PATH + File.separator;
+				}
 
 				Either<ZipOutputStream, ResponseFormat> writeArtifactDefinition = writeArtifactDefinition(mainComponent,
 						zip, artifactDefinitionList, artifactTypeFolder, isInCertificationRequest);
@@ -1046,7 +982,15 @@
 
 		public void addArtifactsToGroup(ArtifactGroupTypeEnum artifactGroup,
 				Map<ArtifactTypeEnum, List<ArtifactDefinition>> artifactsDefinition) {
-			artifactsInfoField.put(artifactGroup, artifactsDefinition);
+			if (artifactsInfoField.get(artifactGroup) == null) {
+				artifactsInfoField.put(artifactGroup, artifactsDefinition);
+			} else {
+				Map<ArtifactTypeEnum, List<ArtifactDefinition>> artifactTypeEnumListMap =
+						artifactsInfoField.get(artifactGroup);
+				artifactTypeEnumListMap.putAll(artifactsDefinition);
+				artifactsInfoField.put(artifactGroup, artifactTypeEnumListMap);
+			}
+
 		}
 
 		public boolean isEmpty() {
@@ -1356,6 +1300,10 @@
 		Map<String, ArtifactDefinition> deploymentArtifacts = component.getDeploymentArtifacts();
 		Map<ArtifactTypeEnum, List<ArtifactDefinition>> deploymentArtifactsByType = collectGroupArtifacts(
 				deploymentArtifacts);
+		Map<String, ArtifactDefinition> interfaceOperationArtifacts =
+				OperationArtifactUtil.getDistinctInterfaceOperationArtifactsByName(component);
+		Map<ArtifactTypeEnum, List<ArtifactDefinition>> interfaceOperationArtifactsByType = collectGroupArtifacts(
+				interfaceOperationArtifacts);
 		ArtifactsInfo artifactsInfo = new ArtifactsInfo();
 		if (!informationalArtifactsByType.isEmpty()) {
 			artifactsInfo.addArtifactsToGroup(ArtifactGroupTypeEnum.INFORMATIONAL, informationalArtifactsByType);
@@ -1363,6 +1311,10 @@
 		if (!deploymentArtifactsByType.isEmpty()) {
 			artifactsInfo.addArtifactsToGroup(ArtifactGroupTypeEnum.DEPLOYMENT, deploymentArtifactsByType);
 		}
+		//Add component interface operation artifacts
+		if(MapUtils.isNotEmpty(interfaceOperationArtifacts)) {
+			artifactsInfo.addArtifactsToGroup(ArtifactGroupTypeEnum.DEPLOYMENT, interfaceOperationArtifactsByType);
+		}
 
 		return artifactsInfo;
 	}
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 41b29e3..69c4cec 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
@@ -151,7 +151,8 @@
         return Either.left(toscaRepresentation);
     }
 
-    public Either<ToscaRepresentation, ToscaError> exportComponentInterface(Component component) {
+    public Either<ToscaRepresentation, ToscaError> exportComponentInterface(Component component,
+                                                                            boolean isAssociatedResourceComponent) {
         if (null == DEFAULT_IMPORTS) {
             log.debug(FAILED_TO_GET_DEFAULT_IMPORTS_CONFIGURATION);
             return Either.right(ToscaError.GENERAL_ERROR);
@@ -160,8 +161,8 @@
         ToscaTemplate toscaTemplate = new ToscaTemplate(TOSCA_VERSION);
         toscaTemplate.setImports(new ArrayList<>(DEFAULT_IMPORTS));
         Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
-        Either<ToscaTemplate, ToscaError> toscaTemplateRes = convertInterfaceNodeType(new HashMap<>(), component, toscaTemplate,
-                nodeTypes);
+        Either<ToscaTemplate, ToscaError> toscaTemplateRes = convertInterfaceNodeType(new HashMap<>(), component,
+                toscaTemplate, nodeTypes, isAssociatedResourceComponent);
         if (toscaTemplateRes.isRight()) {
             return Either.right(toscaTemplateRes.right().value());
         }
@@ -546,8 +547,10 @@
         return convertReqCapAndTypeName(componentsCache, component, toscaNode, nodeTypes, toscaNodeType, dataTypes);
     }
 
-    private Either<ToscaTemplate, ToscaError> convertInterfaceNodeType(Map<String, Component> componentsCache, Component component, ToscaTemplate toscaNode,
-            Map<String, ToscaNodeType> nodeTypes) {
+    private Either<ToscaTemplate, ToscaError> convertInterfaceNodeType(Map<String, Component> componentsCache,
+                                                                       Component component, ToscaTemplate toscaNode,
+                                                                       Map<String, ToscaNodeType> nodeTypes,
+                                                                       boolean isAssociatedResourceComponent) {
         log.debug("start convert node type for {}", component.getUniqueId());
         ToscaNodeType toscaNodeType = createNodeType(component);
         toscaNode.setInterface_types(addInterfaceTypeElement(component));
@@ -561,7 +564,7 @@
 
         List<InputDefinition> inputDef = component.getInputs();
         Map<String, ToscaProperty> inputs = new HashMap<>();
-        addInterfaceDefinitionElement(component, toscaNodeType);
+        addInterfaceDefinitionElement(component, toscaNodeType, isAssociatedResourceComponent);
         if (inputDef != null) {
             inputDef.forEach(i -> {
                 ToscaProperty property = propertyConvertor.convertProperty(dataTypes, i, false);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
index 70fd257..c3628df 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
@@ -95,7 +95,8 @@
      * @param component to work on
      * @param nodeType  to which the interfaces element will be added
      */
-    public static void addInterfaceDefinitionElement(Component component, ToscaNodeType nodeType) {
+    public static void addInterfaceDefinitionElement(Component component, ToscaNodeType nodeType,
+                                                     boolean isAssociatedResourceComponent) {
         if (component instanceof Product) {
             return;
         }
@@ -116,9 +117,8 @@
                 ToscaLifecycleOperationDefinition toscaOperation = new ToscaLifecycleOperationDefinition();
                 if (isArtifactPresent(operationEntry)) {
                     operationArtifactPath = OperationArtifactUtil
-                                                    .createOperationArtifactPath(component.getNormalizedName(),
-                                                            interfaceDefinition.getToscaResourceName(),
-                                                            operationEntry.getValue());
+                            .createOperationArtifactPath(component, operationEntry.getValue(),
+                                    isAssociatedResourceComponent);
                     toscaOperation.setImplementation(operationArtifactPath);
                 }
                 toscaOperation.setDescription(operationEntry.getValue().getDescription());
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java
index 5d0b446..b70ae90 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java
@@ -16,28 +16,94 @@
 
 package org.openecomp.sdc.be.tosca.utils;
 
-import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
-import org.openecomp.sdc.be.tosca.CsarUtils;
-
 import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.WordUtils;
+import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
+import org.openecomp.sdc.be.model.Operation;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.tosca.CsarUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
 
 public class OperationArtifactUtil {
 
+    public static final String BPMN_ARTIFACT_PATH = "BPMN";
+
+    private OperationArtifactUtil() {
+        //Hiding implicit public constructor
+    }
 
     /**
      * This method assumes that operation.getImplementation() is not NULL  ( it should be verified by the caller method)
      *
-     * @param componentName component's normalized name
-     * @param interfaceType the specific interface type
      * @param operation     the specific operation name
      * @return the full path including file name for operation's artifacts
      */
+    static String createOperationArtifactPath(Component component, OperationDataDefinition operation,
+                                                     boolean isAssociatedResourceComponent) {
+        if (!(component instanceof Resource)) {
+            return null;
+        }
+        if (isAssociatedResourceComponent) {
+            ResourceMetadataDataDefinition resourceMetadataDataDefinition = (ResourceMetadataDataDefinition)
+                    component.getComponentMetadataDefinition().getMetadataDataDefinition();
+            return createOperationArtifactPathInService(resourceMetadataDataDefinition.getToscaResourceName() +
+                    "_v" + component.getVersion(), operation);
+        }
+        return createOperationArtifactPathInResource(operation);
+    }
 
-    public static String createOperationArtifactPath(String componentName, String interfaceType,
-            OperationDataDefinition operation) {
-        return CsarUtils.ARTIFACTS + File.separator + componentName + File.separator + interfaceType + File.separator
-                       + CsarUtils.DEPLOYMENT_ARTIFACTS_DIR + CsarUtils.WORKFLOW_ARTIFACT_DIR + operation
-                                                                                                        .getImplementation()
-                                                                                                        .getArtifactName();
+
+    private static String createOperationArtifactPathInResource(OperationDataDefinition operation) {
+        return CsarUtils.ARTIFACTS + File.separator + WordUtils.capitalizeFully(ArtifactGroupTypeEnum.DEPLOYMENT.name())
+                + File.separator + ArtifactTypeEnum.WORKFLOW.name() + File.separator + BPMN_ARTIFACT_PATH
+                + File.separator + operation.getImplementation().getArtifactName();
+    }
+
+    private static String createOperationArtifactPathInService(String toscaComponentName,
+                                                          OperationDataDefinition operation) {
+        return CsarUtils.ARTIFACTS + File.separator + toscaComponentName + File.separator +
+                WordUtils.capitalizeFully(ArtifactGroupTypeEnum.DEPLOYMENT.name()) + File.separator +
+                ArtifactTypeEnum.WORKFLOW.name() + File.separator + BPMN_ARTIFACT_PATH + File.separator +
+                operation.getImplementation().getArtifactName();
+    }
+
+    public static Map<String, ArtifactDefinition> getDistinctInterfaceOperationArtifactsByName(Component originComponent) {
+        Map<String, ArtifactDefinition> distinctInterfaceArtifactsByName = new HashMap<>();
+        Map<String, InterfaceDefinition> interfaces = originComponent.getInterfaces();
+        if (MapUtils.isEmpty(interfaces)) {
+            return distinctInterfaceArtifactsByName;
+        }
+        Map<String, ArtifactDefinition> interfaceArtifacts = interfaces.values().stream()
+                .flatMap(interfaceDefinition -> interfaceDefinition.getOperationsMap().values().stream())
+                .map(Operation::getImplementationArtifact)
+                .collect(Collectors.toMap(ArtifactDataDefinition::getUniqueId,
+                        artifactDefinition -> artifactDefinition));
+        if (MapUtils.isNotEmpty(interfaceArtifacts)) {
+            Set<String> artifactNameSet = new HashSet<>();
+            for (Map.Entry<String, ArtifactDefinition> interfaceArtifactEntry : interfaceArtifacts.entrySet()) {
+                String artifactName = interfaceArtifactEntry.getValue().getArtifactName();
+                if (artifactNameSet.contains(artifactName)) {
+                    continue;
+                }
+                distinctInterfaceArtifactsByName.put(interfaceArtifactEntry.getKey(),
+                        interfaceArtifactEntry.getValue());
+                artifactNameSet.add(artifactName);
+            }
+
+        }
+        return distinctInterfaceArtifactsByName;
     }
 }
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java
index 6dd97bf..8b1fe5f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java
@@ -210,7 +210,7 @@
 				.thenReturn(Either.right(ToscaError.GENERAL_ERROR));
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, false, false);
+			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, false);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -241,7 +241,7 @@
 				.thenReturn(Either.right(ToscaError.GENERAL_ERROR));
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, false, false);
+			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, false);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -361,7 +361,7 @@
 				.thenReturn(Either.left(toscaTemplate));
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true, true);
+			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -412,7 +412,7 @@
 				.thenReturn(Either.left(toscaTemplate));
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true, true);
+			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -466,7 +466,7 @@
 				.thenReturn(Either.right(CassandraOperationStatus.GENERAL_ERROR));
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true, true);
+			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -525,7 +525,7 @@
 				.thenReturn(Either.left(schemaList));
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true, true);
+			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -587,7 +587,7 @@
 				Mockito.any(Boolean.class))).thenReturn(new User());
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true, true);
+			Deencapsulation.invoke(testSubject, "populateZip", component, getFromCS, zip, true);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -697,11 +697,11 @@
 		ToscaRepresentation tosca = new ToscaRepresentation();
 		tosca.setMainYaml("value");
 
-		Mockito.when(toscaExportUtils.exportComponentInterface(Mockito.any(Component.class)))
+		Mockito.when(toscaExportUtils.exportComponentInterface(Mockito.any(Component.class), Mockito.any(Boolean.class)))
 				.thenReturn(Either.left(tosca));
 
 		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "writeComponentInterface", new Resource(), zip, fileName);
+			Deencapsulation.invoke(testSubject, "writeComponentInterface", new Resource(), zip, fileName, false);
 		} catch (IOException e) {
 			e.printStackTrace();
 		}
@@ -871,174 +871,6 @@
 	}
 
 	@Test
-	public void testWriteAllFilesToCsarWhenWriteOperationsArtifactsToCsarIsRight() {
-		Component component = new Resource();
-		Map<String, ArtifactDefinition> toscaArtifacts = new HashMap<>();
-		ArtifactDefinition artifact = new ArtifactDefinition();
-		artifact.setArtifactName("artifactName");
-		artifact.setEsId("esId");
-		artifact.setArtifactUUID("artifactUUID");
-		artifact.setArtifactType("YANG");
-		toscaArtifacts.put("assettoscatemplate", artifact);
-
-		component.setToscaArtifacts(toscaArtifacts);
-		component.setDeploymentArtifacts(toscaArtifacts);
-		component.setArtifacts(toscaArtifacts);
-		Map<String, InterfaceDefinition> interfaces = new HashMap<>();
-		InterfaceDefinition interfaceDef = new InterfaceDefinition();
-		Map<String, OperationDataDefinition> operations = new HashMap<>();
-		OperationDataDefinition operation = new OperationDataDefinition();
-		ArtifactDataDefinition implementation = new ArtifactDataDefinition();
-		implementation.setArtifactUUID("artifactUUID");
-		implementation.setArtifactName("artifactName");
-		operation.setImplementation(implementation);
-		operations.put("key", operation);
-		interfaceDef.setOperations(operations);
-		interfaces.put("key", interfaceDef);
-		((Resource) component).setInterfaces(interfaces);
-
-		ESArtifactData artifactData = new ESArtifactData();
-		byte[] data = "value".getBytes();
-		artifactData.setDataAsArray(data);
-
-		ToscaTemplate toscaTemplate = new ToscaTemplate("version");
-		List<Triple<String, String, Component>> dependencies = new ArrayList<>();
-		toscaTemplate.setDependencies(dependencies);
-
-		List<SdcSchemaFilesData> filesData = new ArrayList<>();
-		SdcSchemaFilesData filedata = new SdcSchemaFilesData();
-		filedata.setPayloadAsArray(data);
-		filesData.add(filedata);
-
-		Mockito.when(artifactCassandraDao.getArtifact(Mockito.any(String.class))).thenReturn(Either.left(artifactData),
-				Either.right(CassandraOperationStatus.GENERAL_ERROR));
-
-		Mockito.when(componentsUtils.convertFromStorageResponse(Mockito.any(StorageOperationStatus.class)))
-				.thenReturn(ActionStatus.GENERAL_ERROR);
-
-		Mockito.when(toscaExportUtils.getDependencies(Mockito.any(Component.class)))
-				.thenReturn(Either.left(toscaTemplate));
-
-		Mockito.when(
-				sdcSchemaFilesCassandraDao.getSpecificSchemaFiles(Mockito.any(String.class), Mockito.any(String.class)))
-				.thenReturn(Either.left(filesData));
-
-		testSubject.createCsar(component, false, true);
-	}
-
-	@Test
-	public void testWriteOperationsArtifactsToCsarWhenComponentIsService() {
-		Component component = new Service();
-
-		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "writeOperationsArtifactsToCsar", component, zip);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	@Test
-	public void testWriteOperationsArtifactsToCsarWhenOperationGetImplementaionIsNull() {
-		Component component = new Resource();
-		Map<String, InterfaceDefinition> interfaces = new HashMap<>();
-		InterfaceDefinition interfaceDef = new InterfaceDefinition();
-		Map<String, OperationDataDefinition> operations = new HashMap<>();
-		operations.put("key", new OperationDataDefinition());
-		interfaceDef.setOperations(operations);
-		interfaces.put("key", interfaceDef);
-
-		((Resource) component).setInterfaces(interfaces);
-
-		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "writeOperationsArtifactsToCsar", component, zip);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	@Test
-	public void testWriteOperationsArtifactsToCsarWhenOperationGetArtifactNameIsNull() {
-		Component component = new Resource();
-
-		Map<String, InterfaceDefinition> interfaces = new HashMap<>();
-		InterfaceDefinition interfaceDef = new InterfaceDefinition();
-		Map<String, OperationDataDefinition> operations = new HashMap<>();
-		OperationDataDefinition operation = new OperationDataDefinition();
-		ArtifactDataDefinition implementation = new ArtifactDataDefinition();
-		operation.setImplementation(implementation);
-		operations.put("key", operation);
-		interfaceDef.setOperations(operations);
-		interfaces.put("key", interfaceDef);
-		((Resource) component).setInterfaces(interfaces);
-
-		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "writeOperationsArtifactsToCsar", component, zip);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	@Test
-	public void testWriteOperationsArtifactsToCsarWhenGettingArtifactFromCassandra() {
-		Component component = new Resource();
-
-		Map<String, InterfaceDefinition> interfaces = new HashMap<>();
-		InterfaceDefinition interfaceDef = new InterfaceDefinition();
-		Map<String, OperationDataDefinition> operations = new HashMap<>();
-		OperationDataDefinition operation = new OperationDataDefinition();
-		ArtifactDataDefinition implementation = new ArtifactDataDefinition();
-		implementation.setArtifactName("artifactName");
-		implementation.setArtifactUUID("artifactUUID");
-		operation.setImplementation(implementation);
-		operations.put("key", operation);
-		interfaceDef.setOperations(operations);
-		interfaceDef.setToscaResourceName("toscaResourceName");
-		interfaces.put("key", interfaceDef);
-		((Resource) component).setInterfaces(interfaces);
-		component.setNormalizedName("normalizedName");
-
-		ESArtifactData data = new ESArtifactData();
-		data.setDataAsArray("data".getBytes());
-
-		Mockito.when(artifactCassandraDao.getArtifact(Mockito.any(String.class))).thenReturn(Either.left(data));
-
-		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "writeOperationsArtifactsToCsar", component, zip);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	@Test
-	public void testWriteOperationsArtifactsToCsarWhenNullPointerExceptionIsCaught() {
-		Component component = new Resource();
-
-		Map<String, InterfaceDefinition> interfaces = new HashMap<>();
-		InterfaceDefinition interfaceDef = new InterfaceDefinition();
-		Map<String, OperationDataDefinition> operations = new HashMap<>();
-		OperationDataDefinition operation = new OperationDataDefinition();
-		ArtifactDataDefinition implementation = new ArtifactDataDefinition();
-		implementation.setArtifactName("artifactName");
-		implementation.setArtifactUUID("artifactUUID");
-		operation.setImplementation(implementation);
-		operations.put("key", operation);
-		interfaceDef.setOperations(operations);
-		interfaceDef.setToscaResourceName("toscaResourceName");
-		interfaces.put("key", interfaceDef);
-		((Resource) component).setInterfaces(interfaces);
-		component.setNormalizedName("normalizedName");
-
-		Mockito.when(artifactCassandraDao.getArtifact(Mockito.any(String.class)))
-				.thenReturn(Either.left(new ESArtifactData()));
-
-		try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zip = new ZipOutputStream(out);) {
-			Deencapsulation.invoke(testSubject, "writeOperationsArtifactsToCsar", component, zip);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	@Test
 	public void testWriteArtifactDefinition() {
 		Component component = new Service();
 		List<ArtifactDefinition> artifactDefinitionList = new ArrayList<>();
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 4959977..2fabe43 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
@@ -162,14 +162,14 @@
 		Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND));
 
 		// default test when convertInterfaceNodeType is right
-		result = testSubject.exportComponentInterface(component);
+		result = testSubject.exportComponentInterface(component, false);
 
 		Mockito.when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
 		Mockito.when(capabiltyRequirementConvertor.convertRequirements(Mockito.any(Map.class),Mockito.any(Resource.class),
 				Mockito.any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
 		// default test when convertInterfaceNodeType is left
-		result = testSubject.exportComponentInterface(component);
+		result = testSubject.exportComponentInterface(component, false);
 
 	}
 
@@ -397,7 +397,8 @@
 				Mockito.any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
 		// default test
-		result = Deencapsulation.invoke(testSubject, "convertInterfaceNodeType",new HashMap<>(), component, toscaNode, nodeTypes);
+		result = Deencapsulation.invoke(testSubject, "convertInterfaceNodeType",new HashMap<>(), component, toscaNode
+				, nodeTypes, false);
 	}
 	@Ignore("need to fix change in injected class.")
 	@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
index 7a88d0a..ac53a6d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
@@ -114,7 +114,7 @@
         component.setInterfaces(new HashMap<>());
         component.getInterfaces().put(interfaceType, addedInterface);
         ToscaNodeType nodeType = new ToscaNodeType();
-        InterfacesOperationsToscaUtil.addInterfaceDefinitionElement(component, nodeType);
+        InterfacesOperationsToscaUtil.addInterfaceDefinitionElement(component, nodeType, false);
 
         ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null);
         ToscaTemplate template = new ToscaTemplate(NODE_TYPE_NAME);
@@ -146,7 +146,7 @@
         component.setInterfaces(new HashMap<>());
         component.getInterfaces().put(interfaceType, addedInterface);
         ToscaNodeType nodeType = new ToscaNodeType();
-        InterfacesOperationsToscaUtil.addInterfaceDefinitionElement(component, nodeType);
+        InterfacesOperationsToscaUtil.addInterfaceDefinitionElement(component, nodeType, true);
 
         ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null);
         ToscaTemplate template = new ToscaTemplate("testService");
@@ -177,7 +177,7 @@
         component.setInterfaces(new HashMap<>());
         component.getInterfaces().put(interfaceType, addedInterface);
         ToscaNodeType nodeType = new ToscaNodeType();
-        InterfacesOperationsToscaUtil.addInterfaceDefinitionElement(component, nodeType);
+        InterfacesOperationsToscaUtil.addInterfaceDefinitionElement(component, nodeType, false);
 
         ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null);
         ToscaTemplate template = new ToscaTemplate("test");
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java
index 66983d7..9998822 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java
@@ -15,19 +15,30 @@
  */
 package org.openecomp.sdc.be.tosca.utils;
 
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openecomp.sdc.be.DummyConfigurationManager;
-import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.InterfaceDefinition;
-import org.openecomp.sdc.be.model.Resource;
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.be.tosca.utils.OperationArtifactUtil.BPMN_ARTIFACT_PATH;
 
 import java.io.File;
 import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
 
-import static org.junit.Assert.assertEquals;
+import org.apache.commons.lang.WordUtils;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openecomp.sdc.be.DummyConfigurationManager;
+import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentMetadataDefinition;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.tosca.CsarUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
 
 public class OperationArtifactUtilTest {
 
@@ -38,25 +49,92 @@
 
     @Test
     public void testCorrectPathForOperationArtifacts() {
-        Component component =   new Resource();
-        component.setNormalizedName("normalizedComponentName");
-        final InterfaceDefinition addedInterface = new InterfaceDefinition();
+        ResourceMetadataDataDefinition componentMetadataDataDefinition = new ResourceMetadataDataDefinition();
+        componentMetadataDataDefinition.setToscaResourceName("org.openecomp.resource.vf.TestResource");
+        final ComponentMetadataDefinition componentMetadataDefinition =
+                new ComponentMetadataDefinition(componentMetadataDataDefinition);
+        Component component = new Resource(componentMetadataDefinition);
         final OperationDataDefinition op = new OperationDataDefinition();
         final ArtifactDataDefinition implementation = new ArtifactDataDefinition();
         implementation.setArtifactName("createBPMN.bpmn");
         op.setImplementation(implementation);
-        addedInterface.setOperations(new HashMap<>());
-        addedInterface.getOperations().put("create", op);
-        final String interfaceType = "normalizedComponentName-interface";
-        ((Resource) component).setInterfaces(new HashMap<>());
-        ((Resource) component).getInterfaces().put(interfaceType, addedInterface);
-        final String actualArtifactPath = OperationArtifactUtil.createOperationArtifactPath(component.getNormalizedName(), interfaceType, op);
-        String expectedArtifactPath ="Artifacts"+ File.separator+"normalizedComponentName"+File.separator
-                                             +"normalizedComponentName-interface"+File.separator+"Deployment"
-                                             +File.separator+"Workflows"+File.separator+"BPMN"
-                                             +File.separator+"createBPMN.bpmn";
+        final String actualArtifactPath = OperationArtifactUtil.createOperationArtifactPath(component, op, false);
+        String expectedArtifactPath = CsarUtils.ARTIFACTS + File.separator +
+                WordUtils.capitalizeFully(ArtifactGroupTypeEnum.DEPLOYMENT.name()) + File.separator +
+                ArtifactTypeEnum.WORKFLOW.name() + File.separator + BPMN_ARTIFACT_PATH + File.separator +
+                "createBPMN.bpmn";
 
 
         assertEquals(expectedArtifactPath,actualArtifactPath);
     }
+
+    @Test
+    public void testCorrectPathForOperationArtifactsInService() {
+        ResourceMetadataDataDefinition componentMetadataDataDefinition = new ResourceMetadataDataDefinition();
+        componentMetadataDataDefinition.setToscaResourceName("org.openecomp.resource.vf.TestResource");
+        final ComponentMetadataDefinition componentMetadataDefinition =
+                new ComponentMetadataDefinition(componentMetadataDataDefinition);
+        Component component = new Resource(componentMetadataDefinition);
+        component.setVersion("1.0");
+        final OperationDataDefinition op = new OperationDataDefinition();
+        final ArtifactDataDefinition implementation = new ArtifactDataDefinition();
+        implementation.setArtifactName("createBPMN.bpmn");
+        op.setImplementation(implementation);
+        final String actualArtifactPath = OperationArtifactUtil.createOperationArtifactPath(component, op, true);
+        String expectedArtifactPath = CsarUtils.ARTIFACTS + File.separator +
+                "org.openecomp.resource.vf.TestResource_v1.0" + File.separator +
+                WordUtils.capitalizeFully(ArtifactGroupTypeEnum.DEPLOYMENT.name()) + File.separator +
+                ArtifactTypeEnum.WORKFLOW.name() +
+                File.separator + BPMN_ARTIFACT_PATH + File.separator + "createBPMN.bpmn";
+
+
+        assertEquals(expectedArtifactPath,actualArtifactPath);
+    }
+
+    @Test
+    public void testGetDistinctInterfaceOperationArtifactsByName() {
+        Component component =  new Resource();
+        component.setNormalizedName("normalizedComponentName");
+        final InterfaceDefinition addedInterface = new InterfaceDefinition();
+        OperationDataDefinition op1 = createInterfaceOperation("createBPMN.bpmn");
+        OperationDataDefinition op2 = createInterfaceOperation("createBPMN.bpmn");
+        addedInterface.setOperations(new HashMap<>());
+        addedInterface.getOperations().put("create", op1);
+        addedInterface.getOperations().put("update", op2);
+        final String interfaceType = "normalizedComponentName-interface";
+        component.setInterfaces(new HashMap<>());
+        component.getInterfaces().put(interfaceType, addedInterface);
+
+        Map<String, ArtifactDefinition> distinctInterfaceOperationArtifactsByName =
+                OperationArtifactUtil.getDistinctInterfaceOperationArtifactsByName(component);
+        Assert.assertEquals(1, distinctInterfaceOperationArtifactsByName.size());
+    }
+
+    @Test
+    public void testGetDistinctInterfaceOperationArtifactsByNameAllDistinct() {
+        Component component = new Resource();
+        component.setNormalizedName("normalizedComponentName");
+        final InterfaceDefinition addedInterface = new InterfaceDefinition();
+        OperationDataDefinition op1 = createInterfaceOperation("createBPMN.bpmn");
+        OperationDataDefinition op2 = createInterfaceOperation("updateBPMN.bpmn");
+        addedInterface.setOperations(new HashMap<>());
+        addedInterface.getOperations().put("create", op1);
+        addedInterface.getOperations().put("update", op2);
+        final String interfaceType = "normalizedComponentName-interface";
+        component.setInterfaces(new HashMap<>());
+        component.getInterfaces().put(interfaceType, addedInterface);
+
+        Map<String, ArtifactDefinition> distinctInterfaceOperationArtifactsByName =
+                OperationArtifactUtil.getDistinctInterfaceOperationArtifactsByName(component);
+        Assert.assertEquals(2, distinctInterfaceOperationArtifactsByName.size());
+    }
+
+    private OperationDataDefinition createInterfaceOperation(String artifactName) {
+        final OperationDataDefinition op = new OperationDataDefinition();
+        final ArtifactDataDefinition implementation = new ArtifactDataDefinition();
+        implementation.setUniqueId(UUID.randomUUID().toString());
+        implementation.setArtifactName(artifactName);
+        op.setImplementation(implementation);
+        return op;
+    }
 }
\ No newline at end of file
