restMethod.setNetworkDelay(0); restMethod.setResponseStrategy(RestResponseStrategy.SEQUENCE); restMethod.setSimulateNetworkDelay(false); restMethod.setStatus(RestMethodStatus.MOCKED); restMethod.setMockResponses(Arrays.asList(restMockResponse));
/** * 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<UpdateRestMethodOutput> process(final ServiceTask<UpdateRestMethodInput> serviceTask) { final UpdateRestMethodInput input = serviceTask.getInput(); final RestMethod updatedRestMethod = input.getRestMethod(); final RestMethod existing = this.methodRepository.findOne(input.getRestMethodId()); existing.setName(updatedRestMethod.getName()); existing.setHttpMethod(updatedRestMethod.getHttpMethod()); existing.setResponseStrategy(updatedRestMethod.getResponseStrategy()); existing.setStatus(updatedRestMethod.getStatus()); existing.setForwardedEndpoint(updatedRestMethod.getForwardedEndpoint()); existing.setNetworkDelay(updatedRestMethod.getNetworkDelay()); existing.setSimulateNetworkDelay(updatedRestMethod.getSimulateNetworkDelay()); existing.setDefaultMockResponseId(updatedRestMethod.getDefaultMockResponseId()); this.methodRepository.update(input.getRestMethodId(), existing); return createServiceResult(UpdateRestMethodOutput.builder() .restMethod(updatedRestMethod) .build()); } }
RestMethod restMethod = new RestMethod(); restMethod.setStatus(methodV1.getStatus()); restMethod.setSimulateNetworkDelay(methodV1.getSimulateNetworkDelay()); restMethod.setNetworkDelay(methodV1.getNetworkDelay()); restMethod.setResponseStrategy(methodV1.getResponseStrategy());
restMethod.setNetworkDelay(0); restMethod.setResponseStrategy(RestResponseStrategy.SEQUENCE); restMethod.setSimulateNetworkDelay(false); restMethod.setStatus(RestMethodStatus.MOCKED); restMethod.setMockResponses(Arrays.asList(restMockResponse1, restMockResponse2));