Package edu.wpi.cs.wpisuitetng

Examples of edu.wpi.cs.wpisuitetng.Session


   * Tests failure in update's ObjectMapper.
   * @throws WPISuiteException  on success
   */
  public void testUpdateFailure() throws WPISuiteException
  {
    Session ses = null;
    String updateString = "{ \"idNum\": 99,  \"username\": \"updated\", \"role\": \"ADMIN\",  \"name\": \"zach\",,,,,,,,,,, }"; // extra commas cause problems in ObjectMapper
   
    this.test.update(ses, temp, updateString);
   
    fail("Exception should have been thrown");
View Full Code Here


  public void testLogout()
  {   
    int test = this.sessions.sessionCount();
    String ssid = this.sessions.createSession(this.u);
   
    Session uSes = this.sessions.getSession(ssid);
   
    assertEquals(test+1, this.sessions.sessionCount());
   
    // logout the user
    this.auth.logout(ssid);
View Full Code Here

    int test = this.sessions.sessionCount();
    // generate a login token (password hardcoded)
    String hashedPassword = new Sha256Password().generateHash("jayms");
    String token = BasicAuth.generateBasicAuth(this.u.getUsername(), "jayms");
   
    Session ses = this.auth.login(token); // login
   
    // check if session created for the user
    assertEquals(test+1, this.sessions.sessionCount());
    assertEquals(this.u.getUsername(), ses.getUsername());
  }
View Full Code Here

    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

  @Before
  public void setUp() throws Exception {
    mockSsid = "abc123";
    bob = new User("bob", "bob", "1234", 1);
    testProject = new Project("test", "1");
    defaultSession = new Session(bob, testProject, mockSsid);
    defect = new Defect(1, "title", "description", bob);
    goodComment = new Comment(1, bob, "this defect is stupid, and so are you");
   
    db = new MockData(new HashSet<Object>());
    db.save(defect, testProject);
View Full Code Here

    otherDefect = new Defect(2, "A defect in a different project", "", bob);
    otherProject = new Project("other", "2");
   
    testProject = new Project("test", "1");
    mockSsid = "abc123";
    defaultSession = new Session(bob, testProject, mockSsid);
   
    //need copies to simulate db4o cross-container problem
    tagCopy = new Tag("tag");
    bobCopy = new User(null, "bob", null, -1);
    goodNewDefect = new Defect(-1, "This is a good title", "", bobCopy);
View Full Code Here

  }
 
  @Test
  public void testGoodUpdatedDefect() {
    // make sure users other than creator can update
    checkNoIssues(new Session(new User(null, "someguy", null, 50), testProject, mockSsid), goodUpdatedDefect,
        Mode.EDIT);
    assertEquals("A changed title", goodUpdatedDefect.getTitle());
    assertEquals("A changed description", goodUpdatedDefect.getDescription());
    assertSame(existingUser, goodUpdatedDefect.getAssignee());
    assertSame(bob, goodUpdatedDefect.getCreator());
View Full Code Here

  @Before
  public void setUp() throws Exception {
    bob = new User("bob", "bob", "1234", 1);
    testProject = new Project("test", "1");
    mockSsid = "abc123";
    defaultSession = new Session(bob, testProject, mockSsid);
    defect = new Defect(1, "title", "description", bob);
   
    User bobCopy = new User(null, "bob", null, -1);
    goodNewComment = new Comment(1, bobCopy, "hello");
   
View Full Code Here

    User admin = new User("admin", "admin", "1234", 27);
    admin.setRole(Role.ADMIN);
    testProject = new Project("test", "1");
    otherProject = new Project("other", "2");
    mockSsid = "abc123";
    adminSession = new Session(admin, testProject, mockSsid);
   
    existingUser = new User("joe", "joe", "1234", 2);
    existingDefect = new Defect(1, "An existing defect", "", existingUser);
    existingDefect.setCreationDate(new Date(0));
    existingDefect.setLastModifiedDate(new Date(0));
    existingDefect.setEvents(new ArrayList<DefectEvent>());
   
    otherDefect = new Defect(2, "A defect in a different project", "", existingUser);
   
    tag = new Tag("tag");
    goodUpdatedDefect = new Defect(1, "A changed title", "A changed description", bob);
    goodUpdatedDefect.setAssignee(existingUser);
    goodUpdatedDefect.setEvents(new ArrayList<DefectEvent>());
    goodUpdatedDefect.getTags().add(tag);
    goodUpdatedDefect.setStatus(DefectStatus.CONFIRMED);
   
    defaultSession = new Session(existingUser, testProject, mockSsid);
    newDefect = new Defect(-1, "A new defect", "A description", existingUser);
   
    db = new MockData(new HashSet<Object>());
    db.save(existingDefect, testProject);
    db.save(existingUser);
View Full Code Here

    temp.setPermission(Permission.WRITE, tempUser);
    updateTemp = new Project("0", "proj0");
    updateTemp.setPermission(Permission.WRITE, tempUser);
    conflict = new Project("test", "5");
    conflict.setPermission(Permission.WRITE, tempUser);
    tempSession = new Session(tempUser, mockSsid);
    json = new Gson();
  }
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.