use of org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException in project so by onap.
the class RequestHandlerUtils method buildErrorOnDuplicateRecord.
public void buildErrorOnDuplicateRecord(InfraActiveRequests currentActiveReq, Actions action, Map<String, String> instanceIdMap, String instanceName, String requestScope, InfraActiveRequests dup) throws ApiException {
String instance = null;
if (instanceName != null) {
instance = instanceName;
} else {
instance = instanceIdMap.get(requestScope + "InstanceId");
}
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
DuplicateRequestException dupException = new DuplicateRequestException.Builder(requestScope, instance, dup.getRequestStatus(), dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, dupException.getMessage());
throw dupException;
}
use of org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException in project so by onap.
the class ApiExceptionMapperTest method testDuplicateRequestResponse.
@Test
public void testDuplicateRequestResponse() throws IOException {
DuplicateRequestException duplicateRequestException = new DuplicateRequestException.Builder("Test1", "Test2", "Test3", "Test4", HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_BAD_PARAMETER).build();
Response resp = mapper.toResponse((ApiException) duplicateRequestException);
assertEquals(resp.getStatus(), HttpStatus.SC_BAD_GATEWAY);
}
Aggregations