diff options
author | marcinrzepeckiwroc <marcin.rzepecki@nokia.com> | 2020-06-30 11:41:31 +0200 |
---|---|---|
committer | marcinrzepeckiwroc <marcin.rzepecki@nokia.com> | 2020-07-01 09:36:10 +0200 |
commit | 1f7a7db265e2f98356e4006631535dd90eab6b7c (patch) | |
tree | 34d03f31d3a176d819ec08b749bc3d8d99c34775 /adapters/mso-openstack-adapters/src/main | |
parent | 1a40b2d2ec54d343573e757396ea7f6bbc62e51b (diff) |
Removed the declarations of thrown exceptions which were a subclass od java.io.IOException,
Added one test to cover not covered usecase,
Added constant field instead of multiple literal duplication.
Issue-ID: SO-1841
Signed-off-by: marcinrzepeckiwroc <marcin.rzepecki@nokia.com>
Change-Id: I686df90ecb463f036687b93069f8d1341ee4e597
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java index 4e8443bf45..200f6375ea 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java @@ -17,6 +17,8 @@ import com.fasterxml.jackson.databind.JsonMappingException; @Component public class AuditDataService { + private static final String AUDIT_STACK_DATA = "AuditStackData"; + @Autowired private RequestsDbClient requestsDbClient; @@ -30,7 +32,7 @@ public class AuditDataService { throws JsonProcessingException { List<RequestProcessingData> requestProcessingDataList = requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(), - auditInventory.getHeatStackName(), "AuditStackData"); + auditInventory.getHeatStackName(), AUDIT_STACK_DATA); if (requestProcessingDataList.isEmpty()) { GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); String auditListString = objectMapper.getMapper().writeValueAsString(auditList);; @@ -39,7 +41,7 @@ public class AuditDataService { requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId()); requestProcessingData.setGroupingId(auditInventory.getVfModuleId()); requestProcessingData.setName(auditInventory.getHeatStackName()); - requestProcessingData.setTag("AuditStackData"); + requestProcessingData.setTag(AUDIT_STACK_DATA); requestProcessingData.setValue(auditListString); requestsDbClient.saveRequestProcessingData(requestProcessingData); @@ -53,12 +55,11 @@ public class AuditDataService { * @throws JsonMappingException * @throws JsonParseException */ - public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory) - throws JsonParseException, JsonMappingException, IOException { + public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory) throws IOException { List<RequestProcessingData> requestProcessingDataList = requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(), - auditInventory.getHeatStackName(), "AuditStackData"); + auditInventory.getHeatStackName(), AUDIT_STACK_DATA); if (!requestProcessingDataList.isEmpty()) { RequestProcessingData requestProcessingData = requestProcessingDataList.get(0); String auditListString = requestProcessingData.getValue(); |