final String methodType = methodElement.getAttribute("name"); final RestMethod restMethod = new RestMethod(); restMethod.setName(methodName); restMethod.setHttpMethod(HttpMethod.valueOf(methodType));
public static RestMethod generateRestMethod(){ final RestMethod restMethod = new RestMethod(); restMethod.setId("REST METHOD"); restMethod.setName("REST method name"); restMethod.setForwardedEndpoint("Forward endpoint"); restMethod.setDefaultBody("Default body"); restMethod.setCurrentResponseSequenceIndex(1); restMethod.setStatus(RestMethodStatus.MOCKED); restMethod.setHttpMethod(HttpMethod.GET); restMethod.setMockResponses(new ArrayList<RestMockResponse>()); restMethod.setResponseStrategy(RestResponseStrategy.RANDOM); return restMethod; } }
RestMethod restMethod = new RestMethod(); restMethod.setName(httpMethod.name()); restMethod.setStatus(RestMethodStatus.MOCKED);
RestMethod restMethod = new RestMethod(); restMethod.setName(method.displayName().value()); restMethod.setStatus(RestMethodStatus.MOCKED);
final HttpMethod httpMethod, final String forwardAddress, final boolean generateResponse){ final RestMethod restMethod = new RestMethod();
@Test public void projectFunctionalityUpdate() throws Exception { final String projectId = "projectId"; final String applicationId = "applicationId"; final String resourceId = "resourceId"; final String[] restMethodIds = {"restMethod1", "restMethod2"}; final RestMethodModifierCommand command = new RestMethodModifierCommand(); command.setRestMethodIds(restMethodIds); command.setRestMethodStatus("MOCKED"); final RestMethod restMethod1 = new RestMethod(); restMethod1.setId("restMethod1"); restMethod1.setName("restMethod1"); final RestMethod restMethod2 = new RestMethod(); restMethod2.setId("restMethod2"); restMethod2.setName("restMethod2"); Mockito.when(serviceProcessor.process(Mockito.any(ReadRestMethodInput.class))) .thenReturn(ReadRestMethodOutput.builder().restMethod(restMethod1).build()) .thenReturn(ReadRestMethodOutput.builder().restMethod(restMethod2).build()); final MockHttpServletRequestBuilder message = MockMvcRequestBuilders.post(SERVICE_URL + PROJECT + SLASH + projectId + SLASH + APPLICATION + SLASH + applicationId + SLASH + RESOURCE + SLASH + resourceId) .param("action", "update") .flashAttr("command", command); mockMvc.perform(message) .andExpect(MockMvcResultMatchers.status().is3xxRedirection()) .andExpect(MockMvcResultMatchers.model().size(1)) .andExpect(MockMvcResultMatchers.redirectedUrl("/web/rest/project/" + projectId + "/application/" + applicationId + "/resource/" + resourceId)); Mockito.verify(serviceProcessor, Mockito.times(2)).process(Mockito.isA(ReadRestMethodInput.class)); Mockito.verify(serviceProcessor, Mockito.times(2)).process(Mockito.isA(UpdateRestMethodInput.class)); }
final String[] restMethodIds = {"restMethod1", "restMethod2"}; final RestMethod restMethod1 = new RestMethod(); restMethod1.setName("restMethod1"); final RestMethod restMethod2 = new RestMethod(); restMethod2.setName("restMethod2");
final String[] restMethodIds = {"restMethod1", "restMethod2"}; final RestMethod restMethod1 = new RestMethod(); restMethod1.setName("restMethod1"); final RestMethod restMethod2 = new RestMethod(); restMethod2.setName("restMethod2");
final RestMethod restMethod = new RestMethod(); restMethod.setCurrentResponseSequenceIndex(0); restMethod.setForwardedEndpoint(FORWARD_ENDPOINT);
RestMethod restMethod = new RestMethod(); restMethod.setStatus(methodV1.getStatus()); restMethod.setSimulateNetworkDelay(methodV1.getSimulateNetworkDelay());
final RestMethod restMethod = new RestMethod(); restMethod.setCurrentResponseSequenceIndex(0); restMethod.setForwardedEndpoint(FORWARD_ENDPOINT);