Tabnine Logo
RestMockResponse.setHttpHeaders
Code IndexAdd Tabnine to your IDE (free)

How to use
setHttpHeaders
method
in
com.castlemock.core.mock.rest.model.project.domain.RestMockResponse

Best Java code snippets using com.castlemock.core.mock.rest.model.project.domain.RestMockResponse.setHttpHeaders (Showing top 5 results out of 315)

origin: castlemock/castlemock

/**
 * The method provides the functionality to forward a request to another endpoint. The response
 * will be recorded and can later be used as a mocked response
 * @param restRequest The incoming request
 * @param restMethod The REST method which the incoming request belongs to
 * @return The response received from the external endpoint
 */
protected RestResponse forwardRequestAndRecordResponse(final RestRequest restRequest,
                            final String projectId,
                            final String applicationId,
                            final String resourceId,
                            final RestMethod restMethod,
                            final Map<String, String> pathParameters){
  final RestResponse response = forwardRequest(restRequest, projectId, applicationId, resourceId, restMethod, pathParameters);
  final RestMockResponse mockResponse = new RestMockResponse();
  final Date date = new Date();
  mockResponse.setBody(response.getBody());
  mockResponse.setStatus(RestMockResponseStatus.ENABLED);
  mockResponse.setHttpHeaders(response.getHttpHeaders());
  mockResponse.setName(RECORDED_RESPONSE_NAME + SPACE + DATE_FORMAT.format(date));
  mockResponse.setHttpStatusCode(response.getHttpStatusCode());
  serviceProcessor.processAsync(CreateRestMockResponseInput.builder()
      .projectId(projectId)
      .applicationId(applicationId)
      .resourceId(resourceId)
      .methodId(restMethod.getId())
      .mockResponse(mockResponse)
      .build());
  return response;
}
origin: castlemock/castlemock

restMockResponse1.setBody(XML_RESPONSE_BODY);
restMockResponse1.setContentEncodings(new ArrayList<>());
restMockResponse1.setHttpHeaders(Arrays.asList(contentTypeHeader, acceptHeader));
restMockResponse1.setHttpStatusCode(200);
restMockResponse1.setId("MockResponseId1");
restMockResponse2.setBody(QUERY_DEFAULT_RESPONSE_BODY);
restMockResponse2.setContentEncodings(new ArrayList<>());
restMockResponse2.setHttpHeaders(Arrays.asList(contentTypeHeader, acceptHeader));
restMockResponse2.setHttpStatusCode(200);
restMockResponse2.setId("MockResponseId2");
origin: castlemock/castlemock

restMockResponse.setBody(XML_RESPONSE_BODY);
restMockResponse.setContentEncodings(new ArrayList<>());
restMockResponse.setHttpHeaders(Arrays.asList(contentTypeHeader, acceptHeader));
restMockResponse.setHttpStatusCode(200);
restMockResponse.setId("MockResponseId");
origin: castlemock/castlemock

mockResponse.setHttpHeaders(httpHeaders);
mockResponse.setContentEncodings(contentEncodings);
mockResponse.setMethodId(restMethod.getId());
origin: castlemock/castlemock

  /**
   * 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<UpdateRestMockResponseOutput> process(final ServiceTask<UpdateRestMockResponseInput> serviceTask) {
    final UpdateRestMockResponseInput input = serviceTask.getInput();
    final RestMockResponse existing = this.mockResponseRepository.findOne(input.getRestMockResponseId());
    final RestMockResponse updatedRestMockResponse = input.getRestMockResponse();

    existing.setName(updatedRestMockResponse.getName());
    existing.setBody(updatedRestMockResponse.getBody());
    existing.setHttpStatusCode(updatedRestMockResponse.getHttpStatusCode());
    existing.setHttpHeaders(updatedRestMockResponse.getHttpHeaders());
    existing.setStatus(updatedRestMockResponse.getStatus());
    existing.setUsingExpressions(updatedRestMockResponse.isUsingExpressions());
    existing.setParameterQueries(updatedRestMockResponse.getParameterQueries());
    existing.setXpathExpressions(updatedRestMockResponse.getXpathExpressions());
    existing.setJsonPathExpressions(updatedRestMockResponse.getJsonPathExpressions());

    this.mockResponseRepository.update(input.getRestMockResponseId(), existing);
    return createServiceResult(UpdateRestMockResponseOutput.builder()
        .updatedRestMockResponse(updatedRestMockResponse)
        .build());
  }
}
com.castlemock.core.mock.rest.model.project.domainRestMockResponsesetHttpHeaders

Popular methods of RestMockResponse

  • <init>
  • setName
  • setBody
  • setHttpStatusCode
  • setId
  • setStatus
  • getId
  • getName
  • setParameterQueries
  • setUsingExpressions
  • getBody
  • getContentEncodings
  • getBody,
  • getContentEncodings,
  • getHttpHeaders,
  • getHttpStatusCode,
  • getJsonPathExpressions,
  • getMethodId,
  • getStatus,
  • getXpathExpressions,
  • isUsingExpressions

Popular in Java

  • Making http post requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now