soapOperation.setOriginalEndpoint(address.getLocation()); soapOperation.setSoapVersion(address.getVersion()); soapOperation.setMockResponses(new ArrayList<SoapMockResponse>()); soapOperation.setDefaultBody(generateDefaultBody(operationResponseIdentifier)); soapOperation.setCurrentResponseSequenceIndex(DEFAULT_RESPONSE_SEQUENCE_INDEX);
public static SoapProject generateFullSoapProject(){ final SoapProject soapProject = new SoapProject(); soapProject.setId("SOAP PROJECT"); soapProject.setName("Project name"); soapProject.setDescription("Project description"); soapProject.setCreated(new Date()); soapProject.setUpdated(new Date()); soapProject.setPorts(new ArrayList<SoapPort>()); for(int portIndex = 0; portIndex < 3; portIndex++){ final SoapPort soapPort = SoapPortGenerator.generateSoapPort(); soapPort.setOperations(new ArrayList<SoapOperation>()); soapProject.getPorts().add(soapPort); for(int operationIndex = 0; operationIndex < 3; operationIndex++){ final SoapOperation soapOperation = SoapOperationGenerator.generateSoapOperation(); soapOperation.setMockResponses(new ArrayList<SoapMockResponse>()); soapPort.getOperations().add(soapOperation); for(int responseIndex = 0; responseIndex < 3; responseIndex++){ final SoapMockResponse soapMockResponse = SoapMockResponseGenerator.generateSoapMockResponse(); soapOperation.getMockResponses().add(soapMockResponse); } } } return soapProject; }
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; } }
final SoapOperation soapOperation = this.operationRepository.findOne(input.getOperationId()); final List<SoapMockResponse> mockResponses = this.mockResponseRepository.findWithOperationId(input.getOperationId()); soapOperation.setMockResponses(mockResponses);
/** * 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<IdentifySoapOperationOutput> process(final ServiceTask<IdentifySoapOperationInput> serviceTask) { final IdentifySoapOperationInput input = serviceTask.getInput(); final SoapPort port = this.portRepository.findWithUri(input.getProjectId(), input.getUri()); final SoapOperation operation = this.operationRepository.findWithMethodAndVersionAndIdentifier( port.getId(), input.getHttpMethod(), input.getType(), input.getOperationIdentifier()); if(operation == null){ throw new IllegalArgumentException("Unable to identify SOAP operation: " + input.getUri()); } final List<SoapMockResponse> mockResponses = this.mockResponseRepository.findWithOperationId(operation.getId()); operation.setMockResponses(mockResponses); return createServiceResult(IdentifySoapOperationOutput.builder() .projectId(input.getProjectId()) .portId(port.getId()) .operationId(operation.getId()) .operation(operation) .build()); }
soapOperation.setSimulateNetworkDelay(false); soapOperation.setStatus(SoapOperationStatus.MOCKED); soapOperation.setMockResponses(Arrays.asList(soapMockResponse));