summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-02-05 16:17:42 -0500
committerLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2019-02-05 17:09:50 -0500
commit648bda5b3dd53aab7846acbce7b6d27149cca973 (patch)
tree64f006011cb0bca08734ab367f11128ee92558cd
parent03a6609e1ffb981e7222fe938b6dd6337b287b87 (diff)
BugFix:Log info Null XFromAppId &ServiceInstanceId
Issue-ID: LOG-688 Change-Id: I9599d35f9971c0607373a87596c80f8c3498c8f3 Signed-off-by: Leigh, Phillip (pl876u) <phillip.leigh@amdocs.com>
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java19
-rw-r--r--src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java17
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}"));