diff options
author | MichaelMorris <michael.morris@est.tech> | 2021-05-25 09:32:31 +0100 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-06-08 06:57:55 +0000 |
commit | b08daeee5442d8422e2e23047ed13aa10d8303f9 (patch) | |
tree | c40477f7e3f200b4af3021f1523962de04315af3 /catalog-be/src/test | |
parent | 2a62c13ecfcf3fe0c22d8cd21d66d46e58105018 (diff) |
Support adding data types to model
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-3611
Change-Id: Ia9fd2437b71a2cd4fc853ff6a1f4fd37fe09a685
Diffstat (limited to 'catalog-be/src/test')
3 files changed, 6 insertions, 22 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java index 548ef1ace9..308d272a79 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java @@ -469,7 +469,7 @@ public class InputsBusinessLogicTest { // for BaseOperation.getAllDataTypes: when(applicationDataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap // for BaseOperation.validatePropertyDefaultValue: - when(propertyOperation.isPropertyTypeValid(any())).thenReturn(true); + when(propertyOperation.isPropertyTypeValid(any(), any())).thenReturn(true); when(propertyOperation.isPropertyInnerTypeValid(any(),any())).thenReturn(new ImmutablePair<>(listInput.getSchemaType(), true)); when(propertyOperation.isPropertyDefaultValueValid(any(), any())).thenReturn(true); // for createListInputsInGraph: @@ -565,12 +565,12 @@ public class InputsBusinessLogicTest { when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID); when(applicationDataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap // for BaseOperation.validatePropertyDefaultValue: - when(propertyOperation.isPropertyTypeValid(any())).thenReturn(false); + when(propertyOperation.isPropertyTypeValid(any(), any())).thenReturn(false); Either<List<InputDefinition>, ResponseFormat> result = testInstance.createListInput(USER_ID, COMPONENT_ID, ComponentTypeEnum.SERVICE, createListInputParams, true, false); assertThat(result.isRight()).isTrue(); - verify(propertyOperation, times(1)).isPropertyTypeValid(any()); + verify(propertyOperation, times(1)).isPropertyTypeValid(any(), any()); } @Test @@ -585,7 +585,7 @@ public class InputsBusinessLogicTest { when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID); when(applicationDataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap // for BaseOperation.validatePropertyDefaultValue: - when(propertyOperation.isPropertyTypeValid(any())).thenReturn(true); + when(propertyOperation.isPropertyTypeValid(any(), any())).thenReturn(true); when(propertyOperation.isPropertyInnerTypeValid(any(),any())).thenReturn(new ImmutablePair<>(listInput.getSchemaType(), true)); when(propertyOperation.isPropertyDefaultValueValid(any(), any())).thenReturn(true); when(toscaOperationFacadeMock.addInputsToComponent(anyMap(), eq(COMPONENT_ID))).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); 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 09f4ac72de..17078bcb75 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 @@ -1720,7 +1720,7 @@ public class ResourceBusinessLogicTest { List<PropertyDefinition> properties = new ArrayList<>(); properties.add(property); basic.setProperties(properties); - when(propertyOperation.isPropertyTypeValid(property)).thenReturn(true); + when(propertyOperation.isPropertyTypeValid(property, null)).thenReturn(true); when(propertyOperation.isPropertyDefaultValueValid(property, emptyDataTypes)).thenReturn(true); Boolean validatePropertiesDefaultValues = bl.validatePropertiesDefaultValues(basic); assertTrue(validatePropertiesDefaultValues); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/PropertyValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/PropertyValidatorTest.java index 9a9e9578b6..f85ec2953a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/PropertyValidatorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/PropertyValidatorTest.java @@ -59,8 +59,7 @@ public class PropertyValidatorTest { Mockito.when(propertyOperation.validateAndUpdatePropertyValue( Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(Either.left("")); - PropertyValidator propertyValidator = new PropertyValidator(propertyOperation, componentsUtils, - applicationDataTypeCache, exceptionUtils); + PropertyValidator propertyValidator = new PropertyValidator(propertyOperation, componentsUtils, exceptionUtils); List<PropertyDefinition> props = new ArrayList<>(); List<PropertyDefinition> dbProps = new ArrayList<>(); PropertyDefinition prop = new PropertyDefinition(); @@ -73,19 +72,4 @@ public class PropertyValidatorTest { Mockito.verify(propertyOperation).validateAndUpdatePropertyValue(TYPE, VALUE, null, Collections.emptyMap()); } - - @Test - public void shouldIterateOverPropertiesOnInvalidType() { - PropertyValidator propertyValidator = new PropertyValidator(propertyOperation, componentsUtils, - applicationDataTypeCache, exceptionUtils); - List<PropertyDefinition> props = new ArrayList<>(); - PropertyDefinition prop = new PropertyDefinition(); - prop.setName(TEST); - prop.setValue(VALUE); - prop.setType(TYPE); - props.add(prop); - Either<Boolean, ResponseFormat> booleanResponseFormatEither = propertyValidator.iterateOverProperties(props); - - assertTrue(booleanResponseFormatEither.isRight()); - } }
\ No newline at end of file |