Package com.eviware.soapui.impl.wsdl.submit.transports.http

Examples of com.eviware.soapui.impl.wsdl.submit.transports.http.HttpResponse


        });

        addProperty(new DefaultTestStepProperty("RawRequest", true, this) {
            @Override
            public String getValue() {
                HttpResponse response = testRequest.getResponse();
                return response == null ? null : response.getRequestContent();
            }
        });
    }
View Full Code Here


    public TestStepResult run(TestCaseRunner runner, TestCaseRunContext runContext) {
        RestRequestStepResult testStepResult = new RestRequestStepResult(this);

        try {
            submit = testRequest.submit(runContext, false);
            HttpResponse response = (HttpResponse) submit.getResponse();

            if (submit.getStatus() != Submit.Status.CANCELED) {
                if (submit.getStatus() == Submit.Status.ERROR) {
                    testStepResult.setStatus(TestStepStatus.FAILED);
                    testStepResult.addMessage(submit.getError().toString());

                    testRequest.setResponse(null, runContext);
                } else if (response == null) {
                    testStepResult.setStatus(TestStepStatus.FAILED);
                    testStepResult.addMessage("Request is missing response");

                    testRequest.setResponse(null, runContext);
                } else {
                    runContext.setProperty(AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, testStepResult);
                    testRequest.setResponse(response, runContext);

                    testStepResult.setTimeTaken(response.getTimeTaken());
                    testStepResult.setSize(response.getContentLength());
                    testStepResult.setResponse(response);

                    switch (testRequest.getAssertionStatus()) {
                        case FAILED:
                            testStepResult.setStatus(TestStepStatus.FAILED);
                            break;
                        case VALID:
                            testStepResult.setStatus(TestStepStatus.OK);
                            break;
                        case UNKNOWN:
                            testStepResult.setStatus(TestStepStatus.UNKNOWN);
                            break;
                    }
                }
            } else {
                testStepResult.setStatus(TestStepStatus.CANCELED);
                testStepResult.addMessage("Request was canceled");
            }

            if (response != null) {
                testStepResult.setRequestContent(response.getRequestContent());
                testStepResult.addProperty("URL", response.getURL() == null ? "<missing>" : response.getURL().toString());
                testStepResult.addProperty("Method", String.valueOf(response.getMethod()));
                testStepResult.addProperty("StatusCode", String.valueOf(response.getStatusCode()));
                testStepResult.addProperty("HTTP Version", response.getHttpVersion());
            } else {
                testStepResult.addMessage("Missing Response");
                testStepResult.setRequestContent(testRequest.getRequestContent());
            }
        } catch (SubmitException e) {
View Full Code Here

        mediaTypeHandler = new JsonMediaTypeHandler();
    }

    @Test
    public void retainsUriInFirstSubmitAsNamespaceUri() throws Exception {
        HttpResponse response = submitRequestAndReceiveResponse(restRequest, "/original/path");

        String originalXml = mediaTypeHandler.createXmlRepresentation(response);
        HttpResponse responseWithNewPath = submitRequestAndReceiveResponse(restRequest, "/another/path");
        assertThat(mediaTypeHandler.createXmlRepresentation(responseWithNewPath), is(equalTo(originalXml)));
    }
View Full Code Here

        String originalPath = "/original/{user}";
        restRequest.setPath(originalPath);

        SubmitContext submitContext = submitRequest(restRequest, originalPath);
        HttpResponse response = makeResponseFor(restRequest, "/original/billy");
        restRequest.setResponse(response, submitContext);

        assertThat(mediaTypeHandler.createXmlRepresentation(response), containsString("/original/billy"));
    }
View Full Code Here

    private HttpResponse submitRequestAndReceiveResponse(RestRequest restRequest, String originalPath) throws Exception {
        restRequest.setPath(originalPath);

        SubmitContext submitContext = submitRequest(restRequest, originalPath);
        HttpResponse response = makeResponseFor(restRequest, originalPath);
        // this simulates that we receive a response
        restRequest.setResponse(response, submitContext);
        return response;
    }
View Full Code Here

        SoapUI.getSettings().setBoolean(HttpSettings.START_MOCK_SERVICE, FALSE);
        SoapUI.getSettings().setBoolean(HttpSettings.LEAVE_MOCKENGINE, FALSE);
    }

    public void setUpResponse() {
        HttpResponse response = mock(HttpResponse.class);

        StringToStringsMap headers = new StringToStringsMap();
        headers.add(ONE_HEADER, "oneValue");
        headers.add(ANOTHER_HEADER, "anotherValue");
        headers.add(HEADER_STATUS, "HTTP/1.1 200 OK");
        headers.add(HEADER_CONTENT_LENGTH, "456");
        headers.add(HEADER_CONTENT_TYPE, "application/xml");

        when(response.getResponseHeaders()).thenReturn(headers);
        when(response.getContentType()).thenReturn("application/xml");

        restRequest.setResponse(response, null);
    }
View Full Code Here

        }
        mockResponse.setResponseHeaders(requestHeaders);
    }

    private void copyResponseContent(RestRequest restRequest, RestMockResponse mockResponse) {
        HttpResponse response = restRequest.getResponse();

        if (response.getContentAsString() != null) {
            mockResponse.setResponseContent(response.getContentAsString());
            mockResponse.setContentType(response.getContentType());
        }

    }
View Full Code Here

        setTitle(sslInfoTabTitle);
    }

    public void propertyChange(PropertyChangeEvent evt) {
        HttpResponse response = request.getResponse();
        updateSSLInfo(response == null ? null : response.getSSLInfo());
        setEnabled(response != null && response.getSSLInfo() != null);
    }
View Full Code Here

  }

  @Override
  public boolean configure() {
    HttpRequestTestStep parent = (HttpRequestTestStep) this.getParent();
    HttpResponse response = parent.getHttpRequest().getResponse();
    String namespaces = "";
    if (response != null) {
      String xmlContent = response.getContentAsXml();
      try {
        namespaces = XmlUtils.declareXPathNamespaces(xmlContent);
      } catch (XmlException e) {
        SoapUI.logError(e);
      }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.submit.transports.http.HttpResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.