From 648bda5b3dd53aab7846acbce7b6d27149cca973 Mon Sep 17 00:00:00 2001 From: "Leigh, Phillip (pl876u)" Date: Tue, 5 Feb 2019 16:17:42 -0500 Subject: BugFix:Log info Null XFromAppId &ServiceInstanceId Issue-ID: LOG-688 Change-Id: I9599d35f9971c0607373a87596c80f8c3498c8f3 Signed-off-by: Leigh, Phillip (pl876u) --- .../onap/pomba/contextbuilder/aai/util/RestUtil.java | 19 ++----------------- .../pomba/pomba_aai_context_builder/RestUtilTest.java | 17 ----------------- 2 files changed, 2 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java index 29fd8d0..0d09eb4 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java +++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java @@ -148,29 +148,13 @@ public class RestUtil { throws AuditException { if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { - log.info("Null %s", SERVICE_INSTANCE_ID); + log.error("Null {}", SERVICE_INSTANCE_ID); throw new AuditException(AuditError.INVALID_REQUEST_URL_MISSING_PARAMETER + SERVICE_INSTANCE_ID, Status.BAD_REQUEST); } } - /** - * Validates the URL parameter. - * - * @throws AuditException if there is missing parameter - */ - public static void validateXFromAppId(String xFromAppId) - throws AuditException { - - if (xFromAppId == null || xFromAppId.isEmpty()) { - log.info("Null %s", FROM_APP_ID); - throw new AuditException(AuditError.INVALID_REQUEST_URL_MISSING_PARAMETER + FROM_APP_ID, - Status.BAD_REQUEST); - } - - } - public static void validateBasicAuthorization(HttpHeaders headers, String basicAuthorization) throws AuditException { String authorization = null; @@ -191,6 +175,7 @@ public class RestUtil { fromAppId = headers.getRequestHeaders().getFirst(FROM_APP_ID); if ((fromAppId == null) || fromAppId.trim().isEmpty()) { + log.error("Null {}", FROM_APP_ID); throw new AuditException(AuditError.MISSING_HEADER_PARAMETER + FROM_APP_ID, Status.BAD_REQUEST); } diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java index 969e567..a7be281 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java @@ -86,23 +86,6 @@ public class RestUtilTest { } - @Test - public void testValidateXFromAppId() { - // Missing ServiceInstanceId or it is null - try { - RestUtil.validateXFromAppId(""); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: X-FromAppId")); - } - - try { - RestUtil.validateXFromAppId(null); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: X-FromAppId")); - } - - } - @Test public void testIsEmptyJson() { assertTrue(RestUtil.isEmptyJson("{}")); -- cgit 1.2.3-korg