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; }
for(SoapOperation operation : port.getOperations()){ if(this.operationRepository.exists(operation.getId())){ throw new IllegalArgumentException("An operation with the following key already exists: " + operation.getId());
@Test public void testProcess(){ final SoapProject soapProject = SoapProjectGenerator.generateSoapProject(); final SoapPort soapPort = SoapPortGenerator.generateSoapPort(); final SoapOperation soapOperation = SoapOperationGenerator.generateSoapOperation(); final SoapMockResponse soapMockResponse = SoapMockResponseGenerator.generateSoapMockResponse(); soapProject.getPorts().add(soapPort); soapPort.getOperations().add(soapOperation); soapOperation.getMockResponses().add(soapMockResponse); final DeleteSoapMockResponseInput input = DeleteSoapMockResponseInput.builder() .projectId(soapProject.getId()) .portId(soapPort.getId()) .operationId(soapOperation.getId()) .mockResponseId(soapMockResponse.getId()) .build(); final ServiceTask<DeleteSoapMockResponseInput> serviceTask = new ServiceTask<DeleteSoapMockResponseInput>(input); final ServiceResult<DeleteSoapMockResponseOutput> serviceResult = service.process(serviceTask); serviceResult.getOutput(); Mockito.verify(mockResponseRepository, Mockito.times(1)).delete(Mockito.anyString()); } }
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()); }
SoapPort savedSoapPort = this.portRepository.save(newSoapPort); for(SoapOperation soapOperation : newSoapPort.getOperations()){ soapOperation.setPortId(savedSoapPort.getId()); SoapOperation savedSoapOperation = this.operationRepository.save(soapOperation); for(SoapOperation newSoapOperation : newSoapPort.getOperations()){ SoapOperation existingSoapOperation = this.operationRepository.findWithName(existingSoapPort.getId(), newSoapOperation.getName());
operation.setNetworkDelay(operationV1.getNetworkDelay()); operation.setPortId(port.getId()); port.getOperations().add(operation);