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

Examples of com.eviware.soapui.impl.wsdl.submit.transports.http.support.metrics.SoapUIMetrics


    public BaseHttpResponse(ExtendedHttpMethod httpMethod, AbstractHttpRequestInterface<?> httpRequest,
                            PropertyExpansionContext context) {
        this.httpRequest = new WeakReference<AbstractHttpRequestInterface<?>>(httpRequest);
        this.timeTaken = httpMethod.getTimeTaken();

        SoapUIMetrics metrics = httpMethod.getMetrics();
        method = httpMethod.getMethod();
        version = httpMethod.getProtocolVersion().toString();

        try {
            this.url = httpMethod.getURL();
        } catch (Exception e1) {
            SoapUI.logError(e1);
        }

        if (!httpMethod.isFailed()) {
            Settings settings = httpRequest.getSettings();

            try {
                rawResponseBody = httpMethod.getResponseBody();
            } catch (IOException e) {
                e.printStackTrace();
            }

            if (settings.getBoolean(HttpSettings.INCLUDE_RESPONSE_IN_TIME_TAKEN)) {
                timeTaken += httpMethod.getResponseReadTime();
            }

            // metrics.getReadTimer().add( httpMethod.getResponseReadTimeNanos() );
            // metrics.getTotalTimer().add( httpMethod.getResponseReadTimeNanos() );
            metrics.getReadTimer().add(httpMethod.getResponseReadTime());
            metrics.getTotalTimer().add(httpMethod.getResponseReadTime());

            try {
                this.timestamp = System.currentTimeMillis();
                this.contentType = httpMethod.getResponseContentType();
                this.statusCode = extractStatusCode(httpMethod);
                this.sslInfo = httpMethod.getSSLInfo();
                this.url = httpMethod.getURL();

                metrics.setTimestamp(getTimestamp());
                metrics.setHttpStatus(getStatusCode());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        if (httpRequest instanceof TestRequest) {
            TestCase tc = ((TestRequest) httpRequest).getTestStep().getTestCase();
            if (tc instanceof WsdlTestCase && ((WsdlTestCase) tc).isForLoadTest()) {
                initHeadersForLoadTest(httpMethod);
                return;
            }
        }

        initHeaders(httpMethod);

        AbstractHttpRequestInterface<?> requestInterface = this.httpRequest.get();
        if (requestInterface instanceof HttpRequest) {
            boolean downloadIncludedResources = ((HttpRequest) requestInterface).getDownloadIncludedResources();

            if (downloadIncludedResources) {
                long beforeNanos = System.nanoTime();
                addIncludedContentsAsAttachments();
                long afterNanos = System.nanoTime();
                timeTaken += ((afterNanos - beforeNanos) / 1000000);
                metrics.getTotalTimer().add(afterNanos - beforeNanos);
                context.setProperty(HTMLPageSourceDownloader.MISSING_RESOURCES_LIST, downloader.getMissingResourcesList());
            }
        }
    }
View Full Code Here


    private SoapUIMetrics metrics;

    public HttpMethodSupport() {
        decompress = !SoapUI.getSettings().getBoolean(HttpSettings.DISABLE_RESPONSE_DECOMPRESSION);
        metrics = new SoapUIMetrics(new HttpTransportMetricsImpl(), new HttpTransportMetricsImpl());
    }
View Full Code Here

                .getProperty(BaseHttpRequestTransport.HTTP_METHOD);

        if (httpMethod != null && result.getTestStep() instanceof HttpRequestTestStep) {
            currentTestCaseRunLogTestStepConfig.setEndpoint(httpMethod.getURI().toString());

            SoapUIMetrics metrics = httpMethod.getMetrics();
            currentTestCaseRunLogTestStepConfig.setTimestamp(metrics.getFormattedTimeStamp());
            currentTestCaseRunLogTestStepConfig.setHttpStatus(String.valueOf(metrics.getHttpStatus()));
            currentTestCaseRunLogTestStepConfig.setContentLength(String.valueOf(metrics.getContentLength()));
            currentTestCaseRunLogTestStepConfig.setReadTime(String.valueOf(metrics.getReadTimer().getDuration()));
            currentTestCaseRunLogTestStepConfig.setTotalTime(String.valueOf(metrics.getTotalTimer().getDuration()));
            currentTestCaseRunLogTestStepConfig.setDnsTime(String.valueOf(metrics.getDNSTimer().getDuration()));
            currentTestCaseRunLogTestStepConfig.setConnectTime(String.valueOf(metrics.getConnectTimer().getDuration()));
            currentTestCaseRunLogTestStepConfig.setTimeToFirstByte(String.valueOf(metrics.getTimeToFirstByteTimer()
                    .getDuration()));
            currentTestCaseRunLogTestStepConfig.setHttpMethod(metrics.getHttpMethod());
            currentTestCaseRunLogTestStepConfig.setIpAddress(metrics.getIpAddress());
            //currentTestCaseRunLogTestStepConfig.setPort( metrics.getPort() );
        }

        Throwable error = result.getError();
        if (error != null) {
View Full Code Here

                        conn.opening(sock, target);
                    }
                    prepareSocket(sock, context, params);
                    conn.openCompleted(sf.isSecure(sock), params);

                    SoapUIMetrics metrics = (SoapUIMetrics) conn.getMetrics();

                    if (metrics != null) {
                        metrics.getDNSTimer().set(start, dnsEnd);
                    }

                    return;
                } catch (ConnectException ex) {
                    if (last) {
View Full Code Here

        /**
         * @since 4.1
         */
        protected HttpConnectionMetricsImpl createConnectionMetrics(final HttpTransportMetrics inTransportMetric,
                                                                    final HttpTransportMetrics outTransportMetric) {
            return new SoapUIMetrics(inTransportMetric, outTransportMetric);
        }
View Full Code Here

                RequestWrapper w = (RequestWrapper) request;
                original = w.getOriginal();
            }

            if (original instanceof ExtendedHttpMethod) {
                SoapUIMetrics metrics = ((ExtendedHttpMethod) original).getMetrics();
                metrics.getConnectTimer().stop();
                metrics.getTimeToFirstByteTimer().start();
            }
            super.preProcess(request, processor, context);
        }
View Full Code Here

            }

            while (response == null || statuscode < HttpStatus.SC_OK) {
                response = conn.receiveResponseHeader();

                SoapUIMetrics metrics = null;
                if (original instanceof ExtendedHttpMethod) {
                    metrics = ((ExtendedHttpMethod) original).getMetrics();
                    metrics.getTimeToFirstByteTimer().stop();
                    metrics.getReadTimer().start();
                }

                if (canResponseHaveBody(request, response)) {
                    conn.receiveResponseEntity(response);
                    //  if( metrics != null ) {
                    //  metrics.getReadTimer().stop();
                    // }
                }

                statuscode = response.getStatusLine().getStatusCode();

                if (conn.getMetrics() instanceof SoapUIMetrics) {
                    SoapUIMetrics connectionMetrics = (SoapUIMetrics) conn.getMetrics();

                    if (metrics != null && connectionMetrics != null && !connectionMetrics.isDone()) {
                        metrics.getDNSTimer().set(connectionMetrics.getDNSTimer().getStart(),
                                connectionMetrics.getDNSTimer().getStop());
                        // reset connection-level metrics
                        connectionMetrics.reset();
                    }
                }

            } // while intermediate response
View Full Code Here

    private ExtendedHttpMethod prepareHttpMethodWith(String path) throws URISyntaxException, MalformedURLException {
        ExtendedHttpMethod httpMethod = mock(ExtendedHttpMethod.class);
        when(httpMethod.getResponseContentType()).thenReturn("text/json");
        when(httpMethod.getMethod()).thenReturn("GET");
        when(httpMethod.getProtocolVersion()).thenReturn(new ProtocolVersion("http", 1, 1));
        SoapUIMetrics soapUIMetrics = new SoapUIMetrics(mock(HttpTransportMetrics.class),
                mock(HttpTransportMetrics.class));
        when(httpMethod.getMetrics()).thenReturn(soapUIMetrics);
        when(httpMethod.getAllHeaders()).thenReturn(new Header[0]);
        when(httpMethod.getResponseReadTime()).thenReturn(10L);
        when(httpMethod.getURI()).thenReturn(new java.net.URI(ENDPOINT + path));
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.submit.transports.http.support.metrics.SoapUIMetrics

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.