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

Examples of org.apache.beehive.netui.tools.testrecorder.shared.config.WebappConfig


    public void doLink( HttpServletRequest request, HttpServletResponse response )
            throws IOException, ServletException, ConfigException {
        String sessionName = request.getParameter( Constants.FILE );
        TestDefinition test = getTest( sessionName );
        WebappConfig config = TestRecorderFilter.instance().getWebapp();
        try {
            if ( test == null ) {
                String msg = "No test was found for name( " + sessionName + " )";
                forward( request, response, msg, Constants.ERROR_PAGE, true );
                return;
            }

            File recFile = getRecordSessionFile( test );
            if ( !recFile.exists() ) {
                String msg = "No file was found for test( " + test.getName() + " ), file( " +
                        recFile.getAbsolutePath() + " )";
                forward( request, response, msg, Constants.ERROR_PAGE, true );
                return;
            }

            RecordSessionBean bean = null;
            try {
                bean = XMLHelper.getRecordSessionBean( recFile );
            }
            catch ( SessionXMLException e ) {
                String msg = "Failed processing file for record session( " + test.getName() + " ), file( " +
                        recFile.getAbsolutePath() + " )";
                forward( request, response, msg, Constants.ERROR_PAGE, true );
                return;
            }
            RequestData rd = bean.getRequestData( 0 );
            if ( rd == null ) {
                String msg = "Unable to find the first request in the test ( " + test.getName() + " ), file( " +
                        recFile.getAbsolutePath() + " )";
                forward( request, response, msg, Constants.ERROR_PAGE, true );
                return;
            }
            String host = config.getServer().getHostname();
            if ( host.equals( "localhost" ) )
            {
                host = request.getServerName();
            }
            response.sendRedirect( rd.getUri( host, config.getServer().getPort() ) );
            return;
        }
        catch ( Exception e ) {
            String msg = "ERROR: failed to display test details, exception( " + e.getMessage() +
                    " ), test( " + test.getName() + " )";
View Full Code Here


            throw new RuntimeConfigException( msg );
        }
        // Delete results file for all webapps used, create results directory if it doesn't exist
        // TODO move to server to allow for playback from remote server
        Iterator it = webappMap.values().iterator();
        WebappConfig webapp = null;
        while ( it.hasNext() ) {
            webapp = (WebappConfig) it.next();
            // delete all results only if requested
            if ( delete ) {
                log.info( "Deleting results for webapp( " + webapp.getName() + " )" );
                if ( !webapp.deleteResults() ) {
                    String msg = "WARNING: unable to delete all results files for webapp( " + webapp.getName() +
                            " )";
                    System.out.println( msg );
                    log.warn( msg );
                }
            }
            if ( !webapp.createResultsDirectory() ) {
                String msg = "ERROR: unable to create results directory( " + webapp.getResultsDirectory() +
                        " ), for webapp( " + webapp.getName() + " )";
                System.err.println( msg );
                log.error( msg );
                throw new RuntimeConfigException( msg );
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.tools.testrecorder.shared.config.WebappConfig

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.