diff options
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java | 19 | ||||
-rw-r--r-- | src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java | 17 |
2 files changed, 2 insertions, 34 deletions
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 @@ -87,23 +87,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("{}")); assertTrue(!RestUtil.isEmptyJson("{Not Empty}")); |