diff options
author | sourabh_sourabh <sourabh.sourabh@est.tech> | 2022-01-18 21:57:46 +0530 |
---|---|---|
committer | sourabh_sourabh <sourabh.sourabh@est.tech> | 2022-01-25 21:55:25 +0530 |
commit | 05e7b8a207b1c641468e77d754fe1a5ae9e1a51e (patch) | |
tree | b0df8d9b8a08ca001120d6fa544f1e2c5da4f59d /cps-rest/src/test/groovy/org | |
parent | db1e983f40be1db7bca5acacf5a3369d74a29c95 (diff) |
Replace gson mapper with jackson mapper
We introduced JsonObjectMapper (wapper) as Spring component.
Issue-ID: CPS-751
Change-Id: I536b0771a3a263325e6907717baf6941d70c0d6c
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-rest/src/test/groovy/org')
3 files changed, 22 insertions, 15 deletions
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy index fbb5636566..4d75848cf7 100755 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation + * Copyright (C) 2021-2022 Nordix Foundation * Modifications Copyright (C) 2021 Pantheon.tech * Modifications Copyright (C) 2021 Bell Canada. * ================================================================================ @@ -22,10 +22,12 @@ package org.onap.cps.rest.controller +import com.fasterxml.jackson.databind.ObjectMapper import org.onap.cps.api.CpsDataService import org.onap.cps.spi.model.DataNode import org.onap.cps.spi.model.DataNodeBuilder import org.onap.cps.utils.DateTimeUtility +import org.onap.cps.utils.JsonObjectMapper import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value @@ -50,6 +52,9 @@ class DataRestControllerSpec extends Specification { @SpringBean CpsDataService mockCpsDataService = Mock() + @SpringBean + JsonObjectMapper jsonObjectMapper = new JsonObjectMapper(new ObjectMapper()) + @Autowired MockMvc mvc diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy index 550dec972e..1e42a0060a 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/QueryRestControllerSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation + * Copyright (C) 2021-2022 Nordix Foundation * Modifications Copyright (C) 2021 Bell Canada. * Modifications Copyright (C) 2021 Pantheon.tech * ================================================================================ @@ -22,17 +22,12 @@ package org.onap.cps.rest.controller -import org.onap.cps.spi.model.DataNode - import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get -import com.google.gson.Gson -import org.modelmapper.ModelMapper -import org.onap.cps.api.CpsAdminService -import org.onap.cps.api.CpsDataService -import org.onap.cps.api.CpsModuleService +import com.fasterxml.jackson.databind.ObjectMapper +import org.onap.cps.utils.JsonObjectMapper import org.onap.cps.api.CpsQueryService import org.onap.cps.spi.model.DataNodeBuilder import org.spockframework.spring.SpringBean @@ -49,6 +44,9 @@ class QueryRestControllerSpec extends Specification { @SpringBean CpsQueryService mockCpsQueryService = Mock() + @SpringBean + JsonObjectMapper jsonObjectMapper = new JsonObjectMapper(new ObjectMapper()) + @Autowired MockMvc mvc diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy index 658dcaa70e..a2eaa525e0 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020 Pantheon.tech - * Modifications Copyright (C) 2021 Nordix Foundation + * Modifications Copyright (C) 2021-2022 Nordix Foundation * Modifications Copyright (C) 2021 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,6 +38,7 @@ import org.onap.cps.spi.exceptions.ModelValidationException import org.onap.cps.spi.exceptions.NotFoundInDataspaceException import org.onap.cps.spi.exceptions.SchemaSetInUseException import org.onap.cps.spi.exceptions.DataspaceInUseException +import org.onap.cps.utils.JsonObjectMapper import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value @@ -58,19 +59,22 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder class CpsRestExceptionHandlerSpec extends Specification { @SpringBean - CpsAdminService mockCpsAdminService = Mock() + CpsAdminService mockCpsAdminService = Stub() @SpringBean - CpsModuleService mockCpsModuleService = Mock() + CpsModuleService mockCpsModuleService = Stub() @SpringBean - CpsDataService mockCpsDataService = Mock() + CpsDataService mockCpsDataService = Stub() @SpringBean - CpsQueryService mockCpsQueryService = Mock() + CpsQueryService mockCpsQueryService = Stub() @SpringBean - ModelMapper modelMapper = Mock() + ModelMapper modelMapper = Stub() + + @SpringBean + JsonObjectMapper jsonObjectMapper = Stub() @Autowired MockMvc mvc |