soapOperation.setName(bindingOperation.getName()); soapOperation.setHttpMethod(HttpMethod.POST); soapOperation.setStatus(SoapOperationStatus.MOCKED); soapOperation.setResponseStrategy(SoapResponseStrategy.RANDOM); soapOperation.setForwardedEndpoint(address.getLocation());
/** * 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<UpdateSoapPortsStatusOutput> process(final ServiceTask<UpdateSoapPortsStatusInput> serviceTask) { final UpdateSoapPortsStatusInput input = serviceTask.getInput(); final SoapOperationStatus soapOperationStatus = input.getOperationStatus(); final List<SoapOperation> operations = this.operationRepository.findWithPortId(input.getPortId()); operations.forEach(soapOperation -> { soapOperation.setStatus(soapOperationStatus); this.operationRepository.update(soapOperation.getId(), soapOperation); }); return createServiceResult(UpdateSoapPortsStatusOutput.builder().build()); } }
public static SoapOperation generateSoapOperation(){ final SoapOperation soapOperation = new SoapOperation(); soapOperation.setId("SOAP OPERATION"); soapOperation.setName("Soap operation name"); soapOperation.setCurrentResponseSequenceIndex(1); soapOperation.setDefaultBody("Default body"); soapOperation.setForwardedEndpoint("Forwarded event"); soapOperation.setInvokeAddress("Invoke address"); soapOperation.setOriginalEndpoint("Original endpoint"); soapOperation.setHttpMethod(HttpMethod.POST); soapOperation.setStatus(SoapOperationStatus.MOCKED); soapOperation.setSoapVersion(SoapVersion.SOAP11); soapOperation.setIdentifyStrategy(SoapOperationIdentifyStrategy.ELEMENT_NAMESPACE); soapOperation.setMockResponses(new ArrayList<SoapMockResponse>()); return soapOperation; } }
/** * 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<UpdateSoapOperationsStatusOutput> process(final ServiceTask<UpdateSoapOperationsStatusInput> serviceTask) { final UpdateSoapOperationsStatusInput input = serviceTask.getInput(); final SoapOperation soapOperation = this.operationRepository.findOne(input.getOperationId()); soapOperation.setStatus(input.getOperationStatus()); this.operationRepository.update(input.getOperationId(), soapOperation); return createServiceResult(UpdateSoapOperationsStatusOutput.builder().build()); } }
@Test public void testEcho(){ // Input final HttpServletRequest httpServletRequest = getMockedHttpServletRequest(REQUEST_BODY); final HttpServletResponse httpServletResponse = getHttpServletResponse(); final SoapOperation soapOperation = getSoapOperation(); soapOperation.setResponseStrategy(SoapResponseStrategy.SEQUENCE); soapOperation.setStatus(SoapOperationStatus.ECHO); final IdentifySoapOperationOutput identifySoapOperationOutput = IdentifySoapOperationOutput.builder() .projectId(PROJECT_ID) .portId(SOAP_PORT_ID) .operationId(SOAP_OPERATION_ID) .operation(soapOperation) .build(); when(serviceProcessor.process(any(IdentifySoapOperationInput.class))).thenReturn(identifySoapOperationOutput); when(httpServletRequest.getRequestURI()).thenReturn(CONTEXT + SLASH + MOCK + SLASH + SOAP + SLASH + PROJECT + SLASH + PROJECT_ID + SLASH + SOAP_PORT_ID); final ResponseEntity responseEntity = soapServiceController.postMethod(PROJECT_ID, httpServletRequest, httpServletResponse); Assert.assertEquals(REQUEST_BODY, responseEntity.getBody()); Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); Assert.assertEquals(true, responseEntity.getHeaders().containsKey(CONTENT_TYPE_HEADER)); Assert.assertEquals(false, responseEntity.getHeaders().containsKey(ACCEPT_HEADER)); Assert.assertEquals(APPLICATION_XML, responseEntity.getHeaders().get(CONTENT_TYPE_HEADER).get(0)); }
soapOperation.setStatus(SoapOperationStatus.MOCKED); serviceProcessor.process(UpdateSoapOperationInput.builder().projectId(soapProjectId) .portId(soapPortId)
soapOperation.setResponseStrategy(SoapResponseStrategy.SEQUENCE); soapOperation.setSimulateNetworkDelay(false); soapOperation.setStatus(SoapOperationStatus.MOCKED); soapOperation.setMockResponses(Arrays.asList(soapMockResponse));
/** * 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()); } }
operation.setName(operationV1.getName()); operation.setResponseStrategy(operationV1.getResponseStrategy()); operation.setStatus(operationV1.getStatus()); operation.setHttpMethod(operationV1.getHttpMethod()); operation.setSoapVersion(operationV1.getSoapVersion());