/** * The method retrieves a specific operation and returns a view that displays the retrieved operation. * @param soapProjectId The id of the project that the operation belongs to * @param soapPortId The id of the port that the operation belongs to * @param soapOperationId The id of the operation that will be retrieved * @return A view that displays the retrieved operation */ @PreAuthorize("hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "/{soapProjectId}/port/{soapPortId}/operation/{soapOperationId}/update", method = RequestMethod.GET) public ModelAndView defaultPage(@PathVariable final String soapProjectId, @PathVariable final String soapPortId, @PathVariable final String soapOperationId) { final ReadSoapOperationOutput output = serviceProcessor.process(ReadSoapOperationInput.builder() .projectId(soapProjectId) .portId(soapPortId) .operationId(soapOperationId) .build()); final ModelAndView model = createPartialModelAndView(PAGE); model.addObject(COMMAND, output.getOperation()); model.addObject(SOAP_PROJECT_ID, soapProjectId); model.addObject(SOAP_PORT_ID, soapPortId); model.addObject(SOAP_OPERATION_ID, soapOperationId); model.addObject(SOAP_MOCK_RESPONSE_STRATEGIES, SoapResponseStrategy.values()); model.addObject(SOAP_OPERATION_STATUSES, getSoapOperationStatuses()); model.addObject(SOAP_OPERATION_IDENTIFY_STRATEGIES, SoapOperationIdentifyStrategy.values()); return model; }
@Test public void updateSoapOperationGet() throws Exception { final SoapProject soapProject = SoapProjectGenerator.generateSoapProject(); final SoapPort soapPort = SoapPortGenerator.generateSoapPort(); final SoapOperation soapOperation = SoapOperationGenerator.generateSoapOperation(); final List<SoapOperationStatus> soapOperationStatuses = Arrays.asList(SoapOperationStatus.values()); when(serviceProcessor.process(any(Input.class))).thenReturn(ReadSoapOperationOutput.builder() .operation(soapOperation) .build()); final MockHttpServletRequestBuilder message = MockMvcRequestBuilders.get(SERVICE_URL + PROJECT + SLASH + soapProject.getId() + SLASH + PORT + SLASH + soapPort.getId() + SLASH + OPERATION + SLASH + soapOperation.getId() + SLASH + UPDATE + SLASH); mockMvc.perform(message) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.model().size(7 + GLOBAL_VIEW_MODEL_COUNT)) .andExpect(MockMvcResultMatchers.forwardedUrl(INDEX)) .andExpect(MockMvcResultMatchers.model().attribute(PARTIAL, PAGE)) .andExpect(MockMvcResultMatchers.model().attribute(SOAP_PROJECT_ID, soapProject.getId())) .andExpect(MockMvcResultMatchers.model().attribute(SOAP_PORT_ID, soapPort.getId())) .andExpect(MockMvcResultMatchers.model().attribute(SOAP_OPERATION_ID, soapOperation.getId())) .andExpect(MockMvcResultMatchers.model().attribute(COMMAND, soapOperation)) .andExpect(MockMvcResultMatchers.model().attribute(SOAP_OPERATION_STATUSES, soapOperationStatuses)) .andExpect(MockMvcResultMatchers.model().attribute(SOAP_OPERATION_IDENTIFY_STRATEGIES, SoapOperationIdentifyStrategy.values())) .andExpect(MockMvcResultMatchers.model().attribute(SOAP_MOCK_RESPONSE_STRATEGIES, SoapResponseStrategy.values())); }