X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=cps-rest%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Frest%2Fcontroller%2FCpsRestInputMapper.java;fp=cps-rest%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fconfig%2FCpsConfigSpec.groovy;h=d0a4a108c87c8848f736c9f77a4dd6f9d8de742c;hb=d5bda8848a661465f214b0bf11211e63b272cfd6;hp=fc96f044710a6bdf8289c8819bd12ce53e7867bb;hpb=3d02e9210625b75419089a3f5612f386c3b997ea;p=cps.git diff --git a/cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestInputMapper.java similarity index 51% rename from cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy rename to cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestInputMapper.java index fc96f0447..d0a4a108c 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/config/CpsConfigSpec.groovy +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestInputMapper.java @@ -1,7 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation - * Modifications Copyright (C) 2021 Bell Canada. + * Copyright (C) 2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,16 +18,25 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.config +package org.onap.cps.rest.controller; -import org.modelmapper.ModelMapper -import spock.lang.Specification +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.NullValueCheckStrategy; +import org.mapstruct.NullValuePropertyMappingStrategy; +import org.onap.cps.rest.model.AnchorDetails; +import org.onap.cps.rest.model.SchemaSetDetails; +import org.onap.cps.spi.model.Anchor; +import org.onap.cps.spi.model.SchemaSet; -class CpsConfigSpec extends Specification { - def objectUnderTest = new CpsConfig() +@Mapper(componentModel = "spring") +public interface CpsRestInputMapper { + + @Mapping(source = "moduleReferences", target = "moduleReferences", + nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS, + nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT) + SchemaSetDetails toSchemaSetDetails(final SchemaSet schemaSet); + + AnchorDetails toAnchorDetails(final Anchor anchor); - def 'CPS configuration has a Model Mapper'() { - expect: 'the CPS configuration has a Model Mapper' - objectUnderTest.modelMapper() instanceof ModelMapper - } }