Package org.apache.beehive.netui.tools.testrecorder.shared

Examples of org.apache.beehive.netui.tools.testrecorder.shared.TestResults


            error( msg, null, true );
        }
        decrementInProgress();
        playbackSessionBean.addRequestResponseData( filterData.getReqData(), filterData.getRespData() );
        // do diff work ... get TestResults
        TestResults results = new TestResults( testCount() + 1, filterData.getReqData().getPath() );
        // add test and session exceptions to diff results.
        Throwable throwable = null;
        for ( int i = 0; i < filterData.getTestExceptionCount(); i++ ) {
            throwable = filterData.getTestException( i );
            results.addDiffResult( "encountered test exception(" + i + ")( " +
                    Logger.format( throwable, throwable ) + " )" );
        }
        for ( int i = 0; i < filterData.getSessionExceptionCount(); i++ ) {
            throwable = filterData.getSessionException( i );
            results.addDiffResult( "encountered test recorder session exception(" + i + ")( " +
                    Logger.format( throwable, throwable ) + " )" );
        }
        try {
            DiffEngine engine = DiffEngineFactory.getInstance( filterData );

            String resp = filterData.getRespData().getBody();
            String body = null;
            // replace the CDATA in the body. We escape the CDATA so we can nest this.
            int pos = resp.indexOf("<![CDATA[");
            if (pos != -1) {
                body = resp;
                resp = resp.replaceAll("\\Q<![CDATA[\\E","&lt;![CDATA[");
                resp = resp.replaceAll("\\Q]]>","]]&gt;");
                filterData.getRespData().setBody(resp);
            }
            results = engine.diff( recordSessionBean.getRequestData( testCount() ),
                    recordSessionBean.getResponseData( testCount() ),
                    filterData.getReqData(), filterData.getRespData(), results );
            if (body != null) {
                filterData.getRespData().setBody(body);
            }
        }
        catch ( Exception e ) {
            String msg = "Failed diffing results for session( " + getSessionName() +
                    " ), test count(" + testCount() + "), exception( " + e.getMessage() + " )";
            results.addDiffResult( "Test Recorder ERROR: " + msg, true );
            results.addDiffResult( Logger.format( "EXCEPTION: ", e ) );
            error( msg, e, true );
        }
        finally {
            playbackSessionBean.addTestResults( results );
            // cleans up the session if getSessionState() == STOP and inProgressCnt() == 0
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.tools.testrecorder.shared.TestResults

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.