From d5322dbd0fa1e32d543b24824a28d6bf0a0b5497 Mon Sep 17 00:00:00 2001 From: "Sotiropoulos, Ioannis (is948x)" Date: Tue, 10 Jul 2018 17:57:43 +0100 Subject: Increase code coverage Add tests to increase code coverage above 60 percent. Issue-ID: AAI-1198 Change-Id: I4c2f964ce41d01521cc1313e32e34fb6460d49bf Signed-off-by: Sotiropoulos, Ioannis (is948x) --- src/main/java/org/onap/crud/service/AaiResourceService.java | 5 +++-- src/main/java/org/onap/crud/service/CrudAsyncGraphEventCache.java | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main/java/org/onap/crud/service') diff --git a/src/main/java/org/onap/crud/service/AaiResourceService.java b/src/main/java/org/onap/crud/service/AaiResourceService.java index 881f9fd..c2e0338 100644 --- a/src/main/java/org/onap/crud/service/AaiResourceService.java +++ b/src/main/java/org/onap/crud/service/AaiResourceService.java @@ -169,8 +169,9 @@ public class AaiResourceService { ImmutablePair result = graphDataService.addEdge(EdgeRulesLoader.getLatestSchemaVersion(), type, payload); response = Response.status(Status.CREATED).entity(result.getValue()).tag(result.getKey()).type(mediaType).build(); - } catch (CrudException e) { - + } catch (CrudException ce) { + response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build(); + } catch (Exception e) { response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } } diff --git a/src/main/java/org/onap/crud/service/CrudAsyncGraphEventCache.java b/src/main/java/org/onap/crud/service/CrudAsyncGraphEventCache.java index 3457cff..ff5170a 100644 --- a/src/main/java/org/onap/crud/service/CrudAsyncGraphEventCache.java +++ b/src/main/java/org/onap/crud/service/CrudAsyncGraphEventCache.java @@ -20,17 +20,15 @@ */ package org.onap.crud.service; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; - import java.util.concurrent.TimeUnit; - import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.crud.logging.CrudServiceMsgs; import org.onap.crud.service.CrudAsyncGraphDataService.CollectGraphResponse; import org.onap.crud.util.CrudProperties; import org.onap.crud.util.CrudServiceConstants; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; /** * Self expiring Cache to hold request transactionIds . Events are expired -- cgit 1.2.3-korg