Package net.sf.sahi.session

Examples of net.sf.sahi.session.Session


        && Configuration.isHttpsProxyAuthEnabled()
        && host.equals(Configuration.getHttpsProxyHost())
        && (""+port).equals(Configuration.getHttpsProxyPort()))
      return new PasswordAuthentication(Configuration.getHttpsProxyAuthName(),
          Configuration.getHttpsProxyAuthPassword().toCharArray());
    Session session = (Session) ThreadLocalMap.get("session");
    if (session != null){
      String realm = getRequestingPrompt();
      String scheme = getRequestingScheme();
      logger.info("realm=" + realm + "; getRequestingScheme()=" + scheme);
     
      RequestCredentials credentials = session.getMatchingCredentials(realm, scheme);
      if (credentials != null){
        logger.info("Using credentials supplied: " + credentials);
        return new PasswordAuthentication(credentials.username(),
            credentials.password().toCharArray());
      }
View Full Code Here


*/


public class TestReporter {
    public void logTestResult(final HttpRequest request) {
        Session session = request.session();
        ScriptRunner scriptRunner = session.getScriptRunner();
        if (scriptRunner == null) return;
    Report report = scriptRunner.getReport();
        if (report != null) {
            report.addResult(SahiScript.stripSahiFromFunctionNames(request.getParameter("msg")), request.getParameter("type"), request.getParameter("debugInfo"), request.getParameter("failureMsg"));
        }
View Full Code Here

 
    public void start(final HttpRequest request) {
      RecordedSteps recordedSteps = recorders.get(request.session().id());
      if (recordedSteps != null) return;
      recordedSteps = new RecordedSteps();
    Session session = request.session();
    recorders.put(session.id(), recordedSteps);
    }
View Full Code Here

      RecordedSteps recordedSteps = recorders.get(request.session().id());
      if (recordedSteps != null) recordedSteps.clear();
    }
   
    public void stop(final HttpRequest request) {
      Session session = request.session();
//      session.setVariable("sahi_record", "0");
      session.setIsRecording(false);
//    recorders.remove(session.id());
    }   
View Full Code Here

    final SahiTestSuite suite = getSuite(request);
    suite.launchBrowserForSingleSession();
  }
 
  public SimpleHttpResponse executeTestInSingleSession(final HttpRequest request) throws Exception {
    Session session = request.session();
    final SahiTestSuite suite = session.getSuite();
    String initJS = request.getParameter("initJS");
    System.out.println("Setting initJS" + initJS);
    suite.setInitJS(initJS);
    Status status = suite.executeTestForSingleSession(request.getParameter("testName"), request.getParameter("startURL"));
    return new SimpleHttpResponse(status.getName());
View Full Code Here

    Status status = suite.executeTestForSingleSession(request.getParameter("testName"), request.getParameter("startURL"));
    return new SimpleHttpResponse(status.getName());
  }
 
  public void stopSingleSession(final HttpRequest request) {
    Session session = request.session();
    final SahiTestSuite suite = session.getSuite();
    suite.killBrowserForSingleSession(true);
  }
View Full Code Here

  private SahiTestSuite getSuite(final HttpRequest request) {
    if (request.getParameter("browserType") != null) {
      return getPreconfiguredBrowserSuite(request);
      }
        Session session = request.session();
        String suitePath = request.getParameter("suite");
        String base = request.getParameter("base");
        String browser = request.getParameter("browser");
        String browserOption = request.getParameter("browserOption");
        String browserProcessName = request.getParameter("browserProcessName");
        String threads = request.getParameter("threads");
        boolean isSingleSession = "true".equals(request.getParameter("useSingleSession"));
        boolean useSystemProxy = "true".equals(request.getParameter("useSystemProxy"));
        final SahiTestSuite suite = prepareSuite(suitePath, base, browser, session.id(), browserOption,
        browserProcessName, threads, useSystemProxy, isSingleSession, request);
    return suite;
  }
View Full Code Here

   
  private SahiTestSuite getPreconfiguredBrowserSuite(final HttpRequest request) {
    SahiTestSuite suite = null;
    BrowserTypesLoader browserLoader = new BrowserTypesLoader();
      BrowserType browserType = browserLoader.getBrowserType(request);
      Session session = request.session();
        String suitePath = request.getParameter("suite");
        String base = request.getParameter("base");
        boolean isSingleSession = "true".equals(request.getParameter("useSingleSession"));
        final int threads = getThreads(request.getParameter("threads"), browserType.capacity());

        // launches browser with pre configured browser settings
        if(browserType != null){
          suite = prepareSuite(suitePath, base, browserType.path(), session.id(), browserType.options(),
          browserType.processName(), (""+threads), browserType.useSystemProxy(), isSingleSession, request);
        }
        return suite;
  }
View Full Code Here

            suite.addIssueCreator(new JiraIssueCreator(propFile));
        }
    }

    public HttpResponse status(final HttpRequest request) {
        Session session = request.session();
        Status status = session.getStatus();
        if (status == null) status = Status.FAILURE;
        return new NoCacheHttpResponse(status.getName());
    }
View Full Code Here

  private String getLogDir(final String defaultLogDir, String logDir) {
    return logDir.equals("") ? defaultLogDir : net.sf.sahi.config.Configuration.getAbsoluteUserPath(logDir);
  }

    public void kill(final HttpRequest request) {
        Session session = request.session();
        SahiTestSuite suite = SahiTestSuite.getSuite(session.id());
        if (suite != null) suite.kill();
    }
View Full Code Here

TOP

Related Classes of net.sf.sahi.session.Session

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.