private Optional<SoapMockResponse> getDefaultMockResponse(final SoapOperation soapOperation, final List<SoapMockResponse> mockResponses){ final String defaultResponseId = soapOperation.getDefaultMockResponseId(); if(defaultResponseId != null && !defaultResponseId.isEmpty()){ LOGGER.info("Use the default response"); for (SoapMockResponse tmpMockResponse : mockResponses) { if(defaultResponseId.equals(tmpMockResponse.getId())){ return Optional.of(tmpMockResponse); } } LOGGER.error("Unable to find the default response"); } return Optional.empty(); }
soapOperation.setMockResponses(mockResponses); if(soapOperation.getDefaultMockResponseId() != null){ if(mockResponse.getId().equals(soapOperation.getDefaultMockResponseId())){ soapOperation.setDefaultResponseName(mockResponse.getName()); defaultXpathMockResponseFound = true;
/** * The process message is responsible for processing an incoming serviceTask and generate * a response based on the incoming serviceTask input * @param serviceTask The serviceTask that will be processed by the service * @return A result based on the processed incoming serviceTask * @see ServiceTask * @see ServiceResult */ @Override public ServiceResult<UpdateSoapOperationOutput> process(final ServiceTask<UpdateSoapOperationInput> serviceTask) { final UpdateSoapOperationInput input = serviceTask.getInput(); final SoapOperation updated = input.getOperation(); final SoapOperation soapOperation = this.operationRepository.findOne(input.getOperationId()); soapOperation.setStatus(updated.getStatus()); soapOperation.setForwardedEndpoint(updated.getForwardedEndpoint()); soapOperation.setResponseStrategy(updated.getResponseStrategy()); soapOperation.setSimulateNetworkDelay(updated.getSimulateNetworkDelay()); soapOperation.setNetworkDelay(updated.getNetworkDelay()); soapOperation.setDefaultMockResponseId(updated.getDefaultMockResponseId()); soapOperation.setMockOnFailure(updated.getMockOnFailure()); soapOperation.setIdentifyStrategy(updated.getIdentifyStrategy()); final SoapOperation updatedSoapOperation = this.operationRepository.update(input.getOperationId(), soapOperation); return createServiceResult(UpdateSoapOperationOutput.builder() .operation(updatedSoapOperation) .build()); } }