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

How to use
getHttpHeaders
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.getHttpHeaders (Showing top 8 results out of 315)

origin: castlemock/castlemock

httpHeader.setName(CONTENT_TYPE);
httpHeader.setValue(contentType);
restMockResponse.getHttpHeaders().add(httpHeader);
mockResponses.add(restMockResponse);
origin: castlemock/castlemock

/**
 * The method generates a mocked response based on the provided {@link Response} and the
 * <code>httpStatusCode</code>.
 * @param httpStatusCode The HTTP status code that the mocked response will have. Please note that
 *                       any mock response with status code different from OK (200), will be
 *                       marked as disabled.
 * @param response The Swagger response that the mocked response will be based on.
 * @return A new {@link RestMockResponse} based on the provided {@link Response}.
 */
private RestMockResponse generateResponse(final int httpStatusCode, final Response response){
  RestMockResponse restMockResponse = new RestMockResponse();
  restMockResponse.setName(response.getDescription());
  restMockResponse.setHttpStatusCode(httpStatusCode);
  restMockResponse.setUsingExpressions(true);
  if(httpStatusCode == DEFAULT_RESPONSE_CODE){
    restMockResponse.setStatus(RestMockResponseStatus.ENABLED);
  } else {
    restMockResponse.setStatus(RestMockResponseStatus.DISABLED);
  }
  if(response.getHeaders() != null){
    for(Map.Entry<String, Property> headerEntry : response.getHeaders().entrySet()){
      String headerName = headerEntry.getKey();
      HttpHeader httpHeader = new HttpHeader();
      httpHeader.setName(headerName);
      // Swagger does not include an example value for the response.
      restMockResponse.getHttpHeaders().add(httpHeader);
    }
  }
  return restMockResponse;
}
origin: castlemock/castlemock

httpHeader.setName(parameter.name());
httpHeader.setValue(parameter.defaultValue());
restMockResponse.getHttpHeaders().add(httpHeader);
origin: castlemock/castlemock

httpHeader.setName(parameter.name());
httpHeader.setValue(parameter.defaultValue());
restMockResponse.getHttpHeaders().add(httpHeader);
origin: castlemock/castlemock

    final Collection<String> mockResponseContentTypeValues = getHeaderValues(CONTENT_TYPE, mockResponse.getHttpHeaders());
    mockResponseContentTypeValues.retainAll(acceptHeaderValues);
    if(!mockResponseContentTypeValues.isEmpty()){
response.setMockResponseName(mockResponse.getName());
response.setHttpStatusCode(mockResponse.getHttpStatusCode());
response.setHttpHeaders(mockResponse.getHttpHeaders());
response.setContentEncodings(mockResponse.getContentEncodings());
return response;
origin: castlemock/castlemock

  Assert.assertNull(response200Xml.getId());
  Assert.assertNull(response200Xml.getMethodId());
  Assert.assertEquals(1, response200Xml.getHttpHeaders().size());
  Assert.assertEquals("Content-Type", response200Xml.getHttpHeaders().get(0).getName());
  Assert.assertEquals("application/xml", response200Xml.getHttpHeaders().get(0).getValue());
  Assert.assertNull(response200Json.getId());
  Assert.assertNull(response200Json.getMethodId());
  Assert.assertEquals(1, response200Json.getHttpHeaders().size());
  Assert.assertEquals("Content-Type", response200Json.getHttpHeaders().get(0).getName());
  Assert.assertEquals("application/json", response200Json.getHttpHeaders().get(0).getValue());
  Assert.assertNull(invalidMockResponse.getId());
  Assert.assertNull(invalidMockResponse.getMethodId());
  Assert.assertEquals(0, invalidMockResponse.getHttpHeaders().size());
  Assert.assertNull(notFoundResponse.getId());
  Assert.assertNull(notFoundResponse.getMethodId());
  Assert.assertEquals(0, notFoundResponse.getHttpHeaders().size());
} else {
  Assert.assertEquals(0, getAllMockServicesMethod.getMockResponses().size());
  Assert.assertNull(invalidMockResponse.getId());
  Assert.assertNull(invalidMockResponse.getMethodId());
  Assert.assertEquals(0, invalidMockResponse.getHttpHeaders().size());
  Assert.assertNull(response200Xml.getId());
  Assert.assertNull(response200Xml.getMethodId());
  Assert.assertEquals(1, response200Xml.getHttpHeaders().size());
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());
  }
}
origin: castlemock/castlemock

Assert.assertEquals(RestMockResponseStatus.ENABLED, restMockResponse.getStatus());
Assert.assertTrue(restMockResponse.getContentEncodings().isEmpty());
Assert.assertTrue(restMockResponse.getHttpHeaders().isEmpty());
Assert.assertTrue(restMockResponse.isUsingExpressions());
com.castlemock.core.mock.rest.model.project.domainRestMockResponsegetHttpHeaders

Popular methods of RestMockResponse

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

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Table (org.hibernate.mapping)
    A relational table
  • Top Sublime Text plugins
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