Package edu.wpi.cs.wpisuitetng.modules.defecttracker.models

Examples of edu.wpi.cs.wpisuitetng.modules.defecttracker.models.DefectChangeset


     * then save the original defect again.
     */
    Defect existingDefect = validator.getLastExistingDefect();
    Date originalLastModified = existingDefect.getLastModifiedDate();
   
    DefectChangeset changeset = new DefectChangeset();
    // core should make sure the session user exists
    // if this can't find the user, something's horribly wrong
    changeset.setUser((User) db.retrieve(User.class, "username", session.getUsername()).get(0));
    ChangesetCallback callback = new ChangesetCallback(changeset);
   
    // copy values to old defect and fill in our changeset appropriately
    updateMapper.map(updatedDefect, existingDefect, callback);
   
    if(changeset.getChanges().size() == 0) {
      // stupid user didn't even change anything!
      // don't bother saving to database, reset last modified date
      existingDefect.setLastModifiedDate(originalLastModified);
    } else {
      // add changeset to Defect events, save to database
View Full Code Here


    Defect updated = manager.update(defaultSession, goodUpdatedDefect.toJSON());
    assertSame(existingDefect, updated);
    assertEquals(goodUpdatedDefect.getTitle(), updated.getTitle()); // make sure ModelMapper is used
    assertEquals(1, updated.getEvents().size());
   
    DefectChangeset changeset = (DefectChangeset) updated.getEvents().get(0);
    assertSame(existingUser, changeset.getUser());
    assertEquals(updated.getLastModifiedDate(), changeset.getDate());
   
    Map<String, FieldChange<?>> changes = changeset.getChanges();
    // these fields shouldn't be recorded in the changeset
    // creator was different in goodUpdatedDefect, but should be ignored
    assertFalse(changes.keySet().containsAll(Arrays.asList("events", "lastModifiedDate", "creator")));
   
    FieldChange<String> titleChange = (FieldChange<String>) changes.get("title");
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.modules.defecttracker.models.DefectChangeset

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.