Package edu.wpi.cs.wpisuitetng

Examples of edu.wpi.cs.wpisuitetng.Session


 
  @Before
  public void setUp()
  {
    this.u1 = new User("Prometheus", "twack", null, 0);
    this.ses1 = new Session(u1, ssid1);
   
    this.u2 = new User("Bob", "caveman", null, 1);
    this.ses2 = new Session(u2, ssid2);
  }
View Full Code Here


 
  @Test
  public void testGetProject()
  {
    Project p1 = new Project("defectTracker", "proj1");
    Session projectSes = new Session(u2, p1, ssid1);
   
    assertTrue(p1.equals(projectSes.getProject()));
  }
View Full Code Here

  @Test
  public void testCreateSession()
  {
    String ssid = this.man.createSession(this.u1);
   
    Session createdSession = this.man.getSession(ssid);
   
    assertEquals(this.man.sessionCount(), 1); // check that only one exists in the Manager.
    assertTrue(createdSession.getUsername().equals(this.u1.getUsername())); // check that the session is the right user
  }
View Full Code Here

    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));
   
    try
    {
      projects.deleteEntity(projectSession, p.toJSON())
    }
View Full Code Here

    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

    test = new UserManager(MockDataStore.getMockDataStore());
    testWithRealDB = new UserManager(DataStore.getDataStore());
    temp = new User("test","test","test",0);
    secondUser = new User ("Sam", "sammy","trouty", 1);
    conflict = new User("steve", "steve",null, 0);
    tempSession = new Session(temp, mockSsid);
    admin = new User("adam","adam","password",4);
    admin.setRole(Role.ADMIN);
    adminSession = new Session(admin, mockSsid);
    json = new Gson();
  }
View Full Code Here

    jsonUser = jsonUser.substring(0, jsonUser.length() - 1);
    jsonUser += ", \"password\":\"abcde\"}";
    System.out.println(jsonUser);
   
    try {
      u = test.makeEntity(new Session(temp, mockSsid), jsonUser);
    } catch (WPISuiteException e) {
      fail("unexpected exception");
    }
   
    assertTrue(u.equals(temp));
View Full Code Here

  }

  @Test
  @Ignore
  public void testGetAll() throws WPISuiteException {
    User[] initList = testWithRealDB.getAll(new Session(temp, mockSsid));
    int initCount = initList.length;
   
    testWithRealDB.save(tempSession, temp);
    testWithRealDB.save(tempSession, secondUser);
    User[] myList = testWithRealDB.getAll(new Session(temp, mockSsid));
    assertEquals(initCount + 2, myList.length);
    testWithRealDB.deleteAll(new Session(temp, mockSsid));
  }
View Full Code Here

  @Test
  public void testDeleteAll() throws WPISuiteException {
    testWithRealDB.save(tempSession, temp);
    testWithRealDB.save(tempSession, secondUser);
    User[] myList = testWithRealDB.getAll(new Session(temp, mockSsid));
    testWithRealDB.deleteAll(new Session(temp, mockSsid));
   
    myList = testWithRealDB.getAll(new Session(temp, mockSsid));
    assertEquals(1, myList.length);
    assertEquals(myList[0], null);
  }
View Full Code Here

   *   the changes to the given User.
   * @throws WPISuiteException
   */
  public void testUpdate() throws WPISuiteException
  {
    Session ses = null;
    String updateString = "{ \"idNum\": 99, \"role\":\"ADMIN\",  \"username\": \"zach\", \"name\": \"zach\" }";
    User newTemp = this.test.update(adminSession, temp, updateString);
   
    // TODO: find a way to retrieve the User from storage to run assertions on.
   
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.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.