Apply Valid Value Constraints validation

Service consumption scenario fix

Change-Id: I5ad7beb18b0490385d24ce30b750ca5c2ebb28a8
Issue-ID: SDC-2224
Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
index 364b007..83d6730 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
@@ -669,19 +669,30 @@
 
 	private Either<Boolean, ResponseFormat> validateOperationInputConstraint(
 			OperationInputDefinition operationInputDefinition, String value, String type) {
-		ComponentInstanceProperty propertyDefinition = new ComponentInstanceProperty();
-		propertyDefinition.setType(operationInputDefinition.getParentPropertyType());
 
-		InputDefinition inputDefinition = new InputDefinition();
-		inputDefinition.setDefaultValue(value);
-		inputDefinition.setInputPath(operationInputDefinition.getSubPropertyInputPath());
-		inputDefinition.setType(type);
-		if (Objects.nonNull(operationInputDefinition.getParentPropertyType())) {
+		if (Objects.nonNull(operationInputDefinition.getParentPropertyType())
+				&& !operationInputDefinition.getParentPropertyType().equals(operationInputDefinition.getType())) {
+			InputDefinition inputDefinition = new InputDefinition();
+			inputDefinition.setDefaultValue(value);
+			inputDefinition.setInputPath(operationInputDefinition.getSubPropertyInputPath());
+			inputDefinition.setName(operationInputDefinition.getName());
+			inputDefinition.setType(type);
+
+			ComponentInstanceProperty propertyDefinition = new ComponentInstanceProperty();
+			propertyDefinition.setType(operationInputDefinition.getParentPropertyType());
 			inputDefinition.setProperties(Collections.singletonList(propertyDefinition));
-		}
 
-		return PropertyValueConstraintValidationUtil.getInstance()
-				.validatePropertyConstraints(Collections.singletonList(inputDefinition), applicationDataTypeCache);
+			return PropertyValueConstraintValidationUtil.getInstance()
+					.validatePropertyConstraints(Collections.singletonList(inputDefinition), applicationDataTypeCache);
+		} else {
+			PropertyDefinition propertyDefinition = new PropertyDefinition();
+			propertyDefinition.setType(operationInputDefinition.getType());
+			propertyDefinition.setValue(value);
+			propertyDefinition.setName(operationInputDefinition.getName());
+
+			return PropertyValueConstraintValidationUtil.getInstance()
+					.validatePropertyConstraints(Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+		}
 	}
 
 	private void addStaticValueToInputOperation(String value, Operation operation,