private static final String CHECK_DB_STATUS_NOW_ACTION = "checkDBNow";
+ private static final String UP_RESPONSE="{\"status\":\"UP\",\"groups\":[\"liveness\",\"readiness\"]}";
+
private final AaiGraphChecker aaiGraphChecker;
public EchoResponse(AaiGraphChecker aaiGraphChecker) {
|| CHECK_DB_STATUS_NOW_ACTION.equalsIgnoreCase(myAction)) {
validateDBStatus(myAction);
}
- return generateSuccessResponse(headers, templateVars);
+ return generateSuccessResponse();
} catch (AAIException aaiException) {
LOGGER.error("Error while processing echo request ", aaiException);
}
- private Response generateSuccessResponse(HttpHeaders headers, ArrayList<String> templateVariables) {
- HashMap<AAIException, ArrayList<String>> exceptionList = new HashMap<>();
- exceptionList.put(new AAIException("AAI_0002", "OK"), templateVariables);
+ private Response generateSuccessResponse() {
return Response.status(Status.OK)
- .entity(ErrorLogHelper.getRESTAPIInfoResponse(new ArrayList<>(headers.getAcceptableMediaTypes()), exceptionList))
+ .entity(UP_RESPONSE)
.build();
}
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
}
- @Test
- public void testEchoResultWhenValidHeadersButMediaTypeWrong() {
-
- when(httpHeaders.getAcceptableMediaTypes()).thenThrow(new IllegalStateException()).thenReturn(outputMediaTypes);
-
- Response response = echoResponse.echoResult(httpHeaders, null, "");
-
- assertNotNull(response);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus());
- }
-
@Test
public void testCheckDbAction_CachedSuccess() {
// Prepare