Package net.sf.sahi.session

Examples of net.sf.sahi.session.Session


        session.addRequestCredentials(request.getParameter("authRealm"),
            request.getParameter("authUser"), request.getParameter("authPassword"));
    }   
   
    public void removeAllCredentials(HttpRequest request){
        Session session = request.session();
        session.removeAllRequestCredentials();
    }
View Full Code Here


    public void start(final HttpRequest request) {
        startRecorder(request);
    }

    public void record(final HttpRequest request) {
      Session session = request.session();
    if (session.isRecording())
        session.getRecorder().record(request.getParameter("step"));
    }
View Full Code Here

    if (session.isRecording())
        session.getRecorder().record(request.getParameter("step"));
    }

    public void stop(final HttpRequest request) {
      Session session = request.session();
      if (session.isRecording())
        session.getRecorder().stop();
      session.setIsRecording(false);
    }
View Full Code Here

        session.getRecorder().stop();
      session.setIsRecording(false);
    }

    private void startRecorder(final HttpRequest request) {
        Session session = request.session();
        String dir = request.getParameter("dir");
        String fileName = request.getParameter("file");
        if (fileName.indexOf(".") == -1) {
            fileName = fileName + ".sah";
        }
        net.sf.sahi.record.Recorder recorder = session.getRecorder();
        recorder.setDir(dir);
        recorder.start(Utils.concatPaths(dir, fileName));
        session.setIsRecording(true);
//        session.setVariable("sahi_record", "1");
    }
View Full Code Here

  }

  private void executeTest(final int threadNo) throws Exception {
    TestLauncher test = (TestLauncher) tests.get(currentTestIndex);
    test.setThreadNo(threadNo, isMultiThreaded);
    Session session = Session.getInstance(test.getChildSessionId());
    session.touch();
    test.execute(session);
    currentTestIndex++;
  }
View Full Code Here

    return this.suiteName;
  }

  private void markSuiteStatus() {
    Status status = finishedTests.size() > 0 ? Status.SUCCESS : Status.FAILURE;
    Session session;
    for (Iterator<TestLauncher> iterator = tests.iterator(); iterator.hasNext();) {
      TestLauncher testLauncher = (TestLauncher) iterator.next();
      RhinoScriptRunner scriptRunner = testLauncher.getScriptRunner();
      if (scriptRunner == null || scriptRunner.hasErrors()) {
        status = Status.FAILURE;
        break;
      }
    }
    session = Session.getInstance(this.sessionId);
    session.setStatus(status);
  }
View Full Code Here

    session = Session.getInstance(this.sessionId);
    session.setStatus(status);
  }

  public void run() {
    Session session = Session.getInstance(this.sessionId);
    session.setStatus(Status.RUNNING);
    if (useSystemProxy) {
      ProxySwitcher.setSahiAsProxy();
    }
    new Thread(new Culler(this)).start();
    executeSuite();
View Full Code Here

    Iterator<String> keys = testsMap.keySet().iterator();
    long now = System.currentTimeMillis();
    long inactivityLimit = Configuration.getMaxPageLoadTime();
    while (keys.hasNext()) {
      String sessionId = (String) keys.next();
      Session session = Session.getExistingInstance(sessionId);
      if (session == null) continue;
      long lastActiveTime = session.lastActiveTime();
      Status status = session.getStatus();
      if (status != Status.SUCCESS && status != Status.FAILURE
          && status != Status.INITIAL
          && now - lastActiveTime > inactivityLimit) {
        String message = "*** Forcefully terminating script. \nNo response from browser within expected time ("
            + inactivityLimit / 1000 + " seconds).";
        System.out.println(message);
        ScriptRunner scriptRunner = session.getScriptRunner();
        scriptRunner.setStatus(Status.FAILURE);
        Report report = scriptRunner.getReport();
        if (report != null) {
          report.addResult(message, "ERROR", "", "");
        }
View Full Code Here

      }
    }
  }

  private void createIssues() {
    Session session = Session.getInstance(sessionId);
    if (Status.FAILURE.equals(session.getStatus()) && issueReporter != null) {
      issueReporter.reportIssue(tests);
    }
  }
View Full Code Here

  public Status executeTestForSingleSession(String testName, String startURL) throws Exception{
    TestLauncher testLauncher = new TestLauncher(testName, startURL);
    prepareTestLauncher(testLauncher);
    testLauncher.setThreadNo(0, isMultiThreaded);
    Session session = Session.getInstance(testLauncher.getChildSessionId());
    session.touch();
    tests.add(testLauncher);
    testLauncher.execute(session, false, true);
    return testLauncher.getStatus();
  }
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.