diff options
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java index 48aff6627a..9dda8cbb5d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.datamodel; import static org.assertj.core.api.Assertions.assertThat; import java.util.Collections; +import java.util.LinkedList; import org.junit.Before; import org.junit.Test; @@ -10,10 +11,15 @@ import org.openecomp.sdc.be.components.utils.PolicyDefinitionBuilder; import org.openecomp.sdc.be.components.utils.ResourceBuilder; import org.openecomp.sdc.be.components.utils.ServiceBuilder; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; +import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum; +import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; +import org.openecomp.sdc.be.ui.model.UiComponentMetadata; + +import mockit.Deencapsulation; public class UiComponentDataConverterTest { @@ -57,7 +63,32 @@ public class UiComponentDataConverterTest { UiComponentDataTransfer componentDTO = UiComponentDataConverter.getUiDataTransferFromServiceByParams(resourceWithPolicies, Collections.singletonList("policies")); assertThat(componentDTO.getPolicies()).isEqualTo(resourceWithPolicies.resolvePoliciesList()); } - + + @Test + public void testAll() { + Service resourceWithPolicies = buildServiceWithPolicies(); + Resource resource = new Resource(); + Service service = new Service(); + UiComponentMetadata componentDTO = UiComponentDataConverter.convertToUiComponentMetadata(resource); + componentDTO = UiComponentDataConverter.convertToUiComponentMetadata(service); + + UiComponentDataTransfer dataTransfer = new UiComponentDataTransfer(); + + + for (ComponentFieldsEnum iterable_element : ComponentFieldsEnum.values()) { + Deencapsulation.invoke(UiComponentDataConverter.class, "setUiTranferDataByFieldName", dataTransfer, resource, iterable_element.getValue()); + } + + LinkedList<String> linkedList = new LinkedList<>(); + + for (ComponentFieldsEnum object : ComponentFieldsEnum.values()) { + linkedList.add(object.getValue()); + } + + UiComponentDataConverter.getUiDataTransferFromResourceByParams(resource, linkedList); + + } + private Resource buildResourceWithPolicies() { return new ResourceBuilder() .addPolicy(policy1) |