From 9f25403b73e8c66d0c0d9f3e8b05d8b5069bb783 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 5 May 2022 23:18:00 +0100 Subject: Fix property validation for data type in model Signed-off-by: MichaelMorris Issue-ID: SDC-3990 Change-Id: I702960519cd9ef6ff7a905d837de7ca5b8f29599 --- .../openecomp/sdc/be/model/operations/impl/PropertyOperation.java | 7 +++++++ .../sdc/be/model/operations/impl/PropertyOperationTest.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'catalog-model/src') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java index bf8d6aed15..931d5993ea 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java @@ -835,6 +835,13 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe } return true; } + + public boolean isPropertyTypeValid(final IComplexDefaultValue property, final Map dataTypes) { + if (property == null) { + return false; + } + return ToscaPropertyType.isValidType(property.getType()) != null || dataTypes.containsKey(property.getType()); + } @Override public ImmutablePair isPropertyInnerTypeValid(IComplexDefaultValue property, Map dataTypes) { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java index a3c9bca4e5..ff41d5dd02 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java @@ -795,7 +795,7 @@ public class PropertyOperationTest extends ModelTestBase { // test 1 testSubject = createTestSubject(); property = null; - result = testSubject.isPropertyTypeValid(property, null); + result = testSubject.isPropertyTypeValid(property, (String)null); Assert.assertEquals(false, result); } -- cgit 1.2.3-korg