/** * Process the incoming message by forwarding it to the main process method in * the AbstractServiceController class. However, the Protocol value SOAP is being * sent to the AbstractServiceController. This is used by AbstractServiceController * to indicate the type of the incoming request * @param projectId The id of the project which the incoming request and mocked response belongs to * @param httpServletRequest The incoming request * @param httpServletResponse The outgoing response * @return Returns the response as an String */ protected ResponseEntity process(final String projectId, final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse){ try{ Preconditions.checkNotNull(projectId, "THe project id cannot be null"); Preconditions.checkNotNull(httpServletRequest, "The HTTP Servlet Request cannot be null"); final SoapRequest request = prepareRequest(projectId, httpServletRequest); final IdentifySoapOperationOutput output = serviceProcessor.process(IdentifySoapOperationInput.builder() .projectId(projectId) .operationIdentifier(request.getOperationIdentifier()) .uri(request.getUri()) .httpMethod(request.getHttpMethod()) .type(request.getSoapVersion()) .build()); final SoapOperation operation = output.getOperation(); request.setOperationName(operation.getName()); return process(projectId, output.getPortId(), operation, request, httpServletResponse); }catch(Exception exception){ LOGGER.debug("SOAP service exception: " + exception.getMessage(), exception); throw new SoapException(exception.getMessage()); } }
final String projectId = this.portRepository.getProjectId(operation.getPortId()); final SearchResult searchResult = new SearchResult(); searchResult.setTitle(operation.getName()); searchResult.setLink(SOAP + SLASH + PROJECT + SLASH + projectId + SLASH + PORT + SLASH + operation.getPortId() + SLASH + OPERATION + SLASH + operation.getId());
@Test public void testFindWithName() { soapOperationMongoRepository.save(createSoapOperation("port2", "operation1")); soapOperationMongoRepository.save(createSoapOperation("port1", "operation1")); soapOperationMongoRepository.save(createSoapOperation("port1", "operation2")); soapOperationMongoRepository.save(createSoapOperation("port1", "operation1")); SoapOperation soapOperation = soapOperationMongoRepository.findWithName("port1", "operation1"); assertThat(soapOperation.getPortId()).isEqualTo("port1"); assertThat(soapOperation.getName()).isEqualTo("operation1"); }
throw new SoapException("No mocked response created for operation " + soapOperation.getName()); } else if(soapOperation.getResponseStrategy().equals(SoapResponseStrategy.RANDOM)){ final Integer responseIndex = RANDOM.nextInt(mockResponses.size()); throw new SoapException("No mocked response created for operation " + soapOperation.getName());
SoapResponse response = null; try { event = new SoapEvent(soapOperation.getName(), request, soapProjectId, soapPortId, soapOperation.getId()); if (SoapOperationStatus.DISABLED.equals(soapOperation.getStatus())) { throw new SoapException("The requested soap operation, " + soapOperation.getName() + ", is disabled"); } else if (SoapOperationStatus.FORWARDED.equals(soapOperation.getStatus()) || SoapOperationStatus.RECORDING.equals(soapOperation.getStatus()) ||
Mockito.verify(operationRepository, Mockito.times(1)).update(operation.getId(), operation); Assert.assertEquals(operation.getId(), returnedSoapOperation.getId()); Assert.assertEquals(operation.getName(), returnedSoapOperation.getName()); Assert.assertEquals(operation.getStatus(), returnedSoapOperation.getStatus()); Assert.assertEquals(operation.getForwardedEndpoint(), returnedSoapOperation.getForwardedEndpoint());
private void verify(final SoapPort soapPort, final String name, final SoapVersion soapVersion){ Assert.assertEquals(name + ".Endpoint", soapPort.getName()); Assert.assertEquals(name + ".Endpoint", soapPort.getUri()); Assert.assertEquals(1, soapPort.getOperations().size()); SoapOperation soapOperation = soapPort.getOperations().get(0); Assert.assertEquals(name, soapOperation.getName()); Assert.assertEquals(SoapResponseStrategy.RANDOM, soapOperation.getResponseStrategy()); Assert.assertEquals(SoapOperationStatus.MOCKED, soapOperation.getStatus()); Assert.assertEquals(soapVersion, soapOperation.getSoapVersion()); Assert.assertEquals(HttpMethod.POST, soapOperation.getHttpMethod()); SoapOperationIdentifier operationIdentifier = soapOperation.getOperationIdentifier(); Assert.assertNotNull(operationIdentifier); Assert.assertEquals("Request", operationIdentifier.getName()); Assert.assertEquals("http://Services/ServiceExample/ServiceExample/1/Schema", operationIdentifier.getNamespace()); }
this.operationRepository.findWithName(existingSoapPort.getId(), newSoapOperation.getName());