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

Examples of edu.wpi.cs.wpisuitetng.modules.core.models.User


  }
 
  @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


  String mockSsid;
  Comment goodNewComment;
 
  @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");
   
    db = new MockData(new HashSet<Object>());
    db.save(defect, testProject);
    db.save(bob);
View Full Code Here

    checkNonFieldIssue(defaultSession, null);
  }
 
  @Test
  public void testAuthorMismatch() {
    goodNewComment.setUser(new User("joe", "joe", "", 2));
    checkFieldIssue(defaultSession, goodNewComment, "user");
  }
View Full Code Here

    checkFieldIssue(defaultSession, goodNewComment, "user");
  }
 
  @Test
  public void testBadAuthor() {
    goodNewComment.setUser(new User(null, null, null, -1));
    checkFieldIssue(defaultSession, goodNewComment, "user");
    goodNewComment.setUser(new User(null, "blah", null, -1));
    checkFieldIssue(defaultSession, goodNewComment, "user");
  }
View Full Code Here

        defect.setCreator(oldDefect.getCreator());
      }
    } else if(defect.getCreator() == null) {
      issues.add(new ValidationIssue("Required", "creator"));
    } else {
      User creator = getExistingUser(defect.getCreator().getUsername(), issues, "creator");
      if(creator != null) {
        if(!creator.getUsername().equals(session.getUsername())) {
          issues.add(new ValidationIssue("Must match currently logged in user", "creator"));
        } else {
          defect.setCreator(creator);
        }
      }
    }
   
    if(defect.getAssignee() != null) { // defects can be missing an assignee
      User assignee = getExistingUser(defect.getAssignee().getUsername(), issues, "assignee");
      if(assignee != null) {
        defect.setAssignee(assignee);
      }
    }
   
View Full Code Here

   */
  public Defect() {
    id = -1;
    title = description = "";
    status = NEW;
    creator = new User("", "", "", -1);
    tags = new HashSet<Tag>();
    creationDate = new Date();
    lastModifiedDate = new Date();
    events = new ArrayList<DefectEvent>();
  }
View Full Code Here

  Project otherProject;
  Defect otherDefect;
 
  @Before
  public void setUp() throws Exception {
    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>());
   
View Full Code Here

      setEditModeDescriptors(defect);
    }
   
    // If this is a new defect, set the creator
    if (editMode == Mode.CREATE) {
      defect.setCreator(new User("", ConfigManager.getConfig().getUserName(), "", -1));
    }
   
    // Instantiate the main create defect panel
    mainPanel = new DefectPanel(this, defect, editMode);
    this.setLayout(new BorderLayout());
View Full Code Here

          content += "</i><br />";
        }
      }
      // handle fields of type User
      else if (User.class.isInstance(newField) || User.class.isInstance(oldField)) {
        User oldValue = (User)oldField;
        User newValue = (User)newField;
        if (oldValue == null) {
          content += " <b>NEW</b><i> " + newValue.getUsername() + "</i><br />";
        }
        else if (newValue == null) {
          content += " <b>REMOVED</b><i> " + oldValue.getUsername() + "</i><br />";
        }
        else {
          content += " <b>FROM</b><i> " + oldValue.getUsername() + " </i><b>TO</b><i> " + newValue.getUsername() + "</i><br />";
        }
      }
      // handle fields of type Set<Tag>
      else if (tagSetClass.isInstance(oldField) && tagSetClass.isInstance(newField)) {
        Set<Tag> oldTags = (Set<Tag>)oldField;
        Set<Tag> newTags = (Set<Tag>)newField;
        if (oldTags.size() > 0) {
          content += " <b>OLD</b><i> ";
          for (Tag tag : oldTags) {
            content += tag.getName() + ", ";
          }
          content += " </i>";
        }
        content += " <b>NEW</b><i> ";
        for (Tag tag : newTags) {
          content += tag.getName() + ", ";
        }
        content += "</i><br />";
      }
      else if (DefectStatus.class.isInstance(newField)) {
        DefectStatus oldValue = (DefectStatus)oldField;
        DefectStatus newValue = (DefectStatus)newField;
        if (oldValue != null && newValue != null) {
          content += " <b>FROM</b><i> " + oldValue.toString() + " </i><b>TO</b><i> " + newValue.toString() + "</i><br />";
        }
      }
      // the field type is not recognized
      else {
        throw new RuntimeException("Cannot handle a FieldChange of generic type " + oldField + " for field name " + fieldName);
View Full Code Here

  Defect b;
 
  @Before
  public void setUp() {
    mapper = new ModelMapper();
    user = new User("a", "a", "a", 1);
    a = new Defect(1, "a", "a", user);
    b = new Defect(2, "b", "b", null);
  }
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.modules.core.models.User

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.