Package edu.wpi.cs.wpisuitetng

Examples of edu.wpi.cs.wpisuitetng.SessionManager


  {
    this.u1 = new User("Tyler", "twack", "jayms", 2);
    this.u2 = new User("Mike", "mpdelladonna", "yams", 3);
    this.u2.setRole(Role.ADMIN);
   
    this.man = new SessionManager();
  }
View Full Code Here


  public void testSwitchSessionProject() throws WPISuiteException
  {
    // get the Managers out
    ManagerLayer manager = ManagerLayer.getInstance();
    UserManager users = manager.getUsers();
    SessionManager sessions = manager.getSessions();
    ProjectManager projects = manager.getProjects();
   
    String originalSsid = sessions.createSession(u2);
    Session originalSession = sessions.getSession(originalSsid);
   
    String projectId = "proj1";
    Project p = new Project("wpisuite", projectId);
   
    try
    {
      projects.makeEntity(originalSession, p.toJSON());
    }
    catch(ConflictException e)
    {
      // this is okay because it means the project already exists in the database.
    }
   
    String newSsid = sessions.switchToProject(originalSsid, projectId);
    Session projectSession = sessions.getSession(newSsid);
   
    assertFalse(sessions.sessionExists(originalSsid));
    assertTrue(projectSession != null);
   
    assertTrue(originalSession.getProject() == null);
    assertTrue(projectSession.getProject().equals(p));
   
View Full Code Here

  public void testSwitchProjectInvalidSession() throws WPISuiteException
  {
    // get the Managers out
    ManagerLayer manager = ManagerLayer.getInstance();
    UserManager users = manager.getUsers();
    SessionManager sessions = manager.getSessions();
    ProjectManager projects = manager.getProjects();
   
    String originalSsid = "abc123";
   
    String projectId = "proj1";
   
    String newSsid = sessions.switchToProject(originalSsid, projectId); // exception expected here
  }
View Full Code Here

  public void testSwitchProjectInvalidProject() throws WPISuiteException
  {
    // get the Managers out
    ManagerLayer manager = ManagerLayer.getInstance();
    UserManager users = manager.getUsers();
    SessionManager sessions = manager.getSessions();
    ProjectManager projects = manager.getProjects();
   
    String originalSsid = sessions.createSession(u2);
    Session originalSession = sessions.getSession(originalSsid);
   
    String projectId = "proj00";
   
    String newSsid = sessions.switchToProject(originalSsid, projectId); // should throw an exception

  }
View Full Code Here

   * Ensure the Sessions are cleared after each Test.
   */
  public void tearDown()
  {
    ManagerLayer man = ManagerLayer.getInstance();
    SessionManager sessions = man.getSessions();
    UserManager users = man.getUsers();
   
    String ssid = this.sessions.createSession(this.u);
    users.deleteAll(this.sessions.getSession(ssid));
    sessions.clearSessions();
  }
View Full Code Here

      throw new AuthenticationException("An invalid password was given. Please check the password and try again.");
    }
    logger.log(Level.INFO, "Password authentication Success! <" + credentials[0] + ">");
   
    // create a Session mapping in the ManagerLayer
    SessionManager sessions = manager.getSessions();
    String ssid = sessions.createSession(user);
    Session userSession = sessions.getSession(ssid);
   
    System.out.println("DEBUG: Create Session");
   
    logger.log(Level.INFO, "Login Success. <" + credentials[0] + ">");
    return userSession;
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.SessionManager

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.