diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2021-09-30 16:53:42 +0100 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2021-10-01 08:42:00 +0100 |
commit | 4cbd60b974fa68cab8501e9f3e9edef134eac09b (patch) | |
tree | 2eb45ddbf569afd841d012a43ebbeaab0eb4a358 /src/main | |
parent | 7e148f8eda2c5741d5c08ae37c6fd36f8d861659 (diff) |
Fix issues with SOnar Qube coverage report
-removed invalid jacoco exclude
-removed strange (generated/accidental?) comment in main pom header
-moved manually coded 'models' package (included in coverage now) to separate it
from swagger generated package/classes with same name (exluded in coverage)
-added some missing test scenarios
-increased coverage limit from 70 to 98% to prevent regression
Issue-ID: CPS-475
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Change-Id: I2f1c276c543926d2d259e33b418f21de4abfea96
Diffstat (limited to 'src/main')
9 files changed, 21 insertions, 19 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java index ff3cefcd..0afefeb0 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java @@ -20,6 +20,8 @@ package org.onap.cps.ncmp.dmi.rest.controller; +import static org.onap.cps.ncmp.dmi.model.DmiModuleReadRequestBody.OperationEnum.READ; + import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; @@ -30,12 +32,12 @@ import org.onap.cps.ncmp.dmi.model.CmHandles; import org.onap.cps.ncmp.dmi.model.DataAccessReadRequest; import org.onap.cps.ncmp.dmi.model.DataAccessWriteRequest; import org.onap.cps.ncmp.dmi.model.DmiModuleReadRequestBody; -import org.onap.cps.ncmp.dmi.model.ModuleReference; import org.onap.cps.ncmp.dmi.model.ModuleSet; import org.onap.cps.ncmp.dmi.model.YangResources; import org.onap.cps.ncmp.dmi.rest.api.DmiPluginApi; import org.onap.cps.ncmp.dmi.rest.api.DmiPluginInternalApi; import org.onap.cps.ncmp.dmi.service.DmiService; +import org.onap.cps.ncmp.dmi.service.model.ModuleReference; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -68,7 +70,7 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { public ResponseEntity<YangResources> retrieveModuleResources( final @Valid DmiModuleReadRequestBody dmiModuleReadRequestBody, final String cmHandle) { - if (dmiModuleReadRequestBody.getOperation().toString().equals("read")) { + if (READ.equals(dmiModuleReadRequestBody.getOperation())) { final var moduleReferenceList = convertRestObjectToJavaApiObject(dmiModuleReadRequestBody); final var response = dmiService.getModuleResources(cmHandle, moduleReferenceList); return new ResponseEntity<>(response, HttpStatus.OK); @@ -172,4 +174,4 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { .convertValue(dmiModuleSchemaReadRequestBody.getData().getModules(), new TypeReference<List<ModuleReference>>() {}); } -}
\ No newline at end of file +} diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java index bd0dc600..753810a2 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java @@ -24,9 +24,9 @@ import java.util.List; import java.util.Map; import javax.validation.constraints.NotNull; import org.onap.cps.ncmp.dmi.exception.DmiException; -import org.onap.cps.ncmp.dmi.model.ModuleReference; import org.onap.cps.ncmp.dmi.model.ModuleSet; import org.onap.cps.ncmp.dmi.model.YangResources; +import org.onap.cps.ncmp.dmi.service.model.ModuleReference; /** * Interface for handling Dmi plugin Data. @@ -108,4 +108,4 @@ public interface DmiService { */ String writeResourceDataPassthroughForCmHandle(String cmHandle, String resourceIdentifier, String dataType, String data); -}
\ No newline at end of file +} diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java index 182bdd84..844cc4de 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java @@ -37,16 +37,16 @@ import org.onap.cps.ncmp.dmi.exception.DmiException; import org.onap.cps.ncmp.dmi.exception.ModuleResourceNotFoundException; import org.onap.cps.ncmp.dmi.exception.ModulesNotFoundException; import org.onap.cps.ncmp.dmi.exception.ResourceDataNotFound; -import org.onap.cps.ncmp.dmi.model.CmHandleOperation; -import org.onap.cps.ncmp.dmi.model.CreatedCmHandle; -import org.onap.cps.ncmp.dmi.model.ModuleReference; -import org.onap.cps.ncmp.dmi.model.ModuleSchemaProperties; -import org.onap.cps.ncmp.dmi.model.ModuleSchemas; import org.onap.cps.ncmp.dmi.model.ModuleSet; import org.onap.cps.ncmp.dmi.model.ModuleSetSchemas; import org.onap.cps.ncmp.dmi.model.YangResource; import org.onap.cps.ncmp.dmi.model.YangResources; import org.onap.cps.ncmp.dmi.service.client.NcmpRestClient; +import org.onap.cps.ncmp.dmi.service.model.CmHandleOperation; +import org.onap.cps.ncmp.dmi.service.model.CreatedCmHandle; +import org.onap.cps.ncmp.dmi.service.model.ModuleReference; +import org.onap.cps.ncmp.dmi.service.model.ModuleSchemaProperties; +import org.onap.cps.ncmp.dmi.service.model.ModuleSchemas; import org.onap.cps.ncmp.dmi.service.operation.SdncOperations; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -269,4 +269,4 @@ public class DmiServiceImpl implements DmiService { return responseBodyAsJsonObject.getAsJsonObject(IETF_NETCONF_MONITORING_OUTPUT).getAsJsonPrimitive("data") .toString(); } -}
\ No newline at end of file +} diff --git a/src/main/java/org/onap/cps/ncmp/dmi/model/CmHandleOperation.java b/src/main/java/org/onap/cps/ncmp/dmi/service/model/CmHandleOperation.java index 8ddd42f8..82eac92a 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/model/CmHandleOperation.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/model/CmHandleOperation.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.dmi.model; +package org.onap.cps.ncmp.dmi.service.model; import com.fasterxml.jackson.annotation.JsonInclude; import java.util.List; @@ -32,4 +32,4 @@ public class CmHandleOperation { private String dmiPlugin; private List<CreatedCmHandle> createdCmHandles; -}
\ No newline at end of file +} diff --git a/src/main/java/org/onap/cps/ncmp/dmi/model/CreatedCmHandle.java b/src/main/java/org/onap/cps/ncmp/dmi/service/model/CreatedCmHandle.java index 9198d7da..6ab6a01e 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/model/CreatedCmHandle.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/model/CreatedCmHandle.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.dmi.model; +package org.onap.cps.ncmp.dmi.service.model; import com.fasterxml.jackson.annotation.JsonInclude; import java.util.Map; @@ -33,4 +33,4 @@ public class CreatedCmHandle { private String cmHandle; private Map<String, String> cmHandleProperties; -}
\ No newline at end of file +} diff --git a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleReference.java b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleReference.java index cb9b7cbb..75c37dff 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleReference.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleReference.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.dmi.model; +package org.onap.cps.ncmp.dmi.service.model; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleSchemaList.java b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleSchemaList.java index 1e7dcb0a..a4af1761 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleSchemaList.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleSchemaList.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.dmi.model; +package org.onap.cps.ncmp.dmi.service.model; import java.util.List; import lombok.Getter; diff --git a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleSchemaProperties.java b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleSchemaProperties.java index 507758ad..6de7d131 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleSchemaProperties.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleSchemaProperties.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.dmi.model; +package org.onap.cps.ncmp.dmi.service.model; import java.util.List; import lombok.Getter; diff --git a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleSchemas.java b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleSchemas.java index 5945168b..a7b2430d 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/model/ModuleSchemas.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/model/ModuleSchemas.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.dmi.model; +package org.onap.cps.ncmp.dmi.service.model; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; |