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

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


    validator = new CommentValidator(data);
  }
 
  @Override
  public Comment makeEntity(Session s, String content) throws WPISuiteException {
    Comment newComment = gson.fromJson(content, Comment.class);
   
    List<ValidationIssue> issues = validator.validate(s, newComment);
    if(issues.size() > 0) {
      // TODO: pass errors to client through exception
      throw new BadRequestException();
View Full Code Here


    final String commentText = view.getCommentField().getText();
    if (commentText.length() > 0) {
      final RequestObserver requestObserver = new SaveCommentObserver(this);
      final Request request = Network.getInstance().makeRequest(
          "defecttracker/comment", HttpMethod.PUT);
      final Comment comment = new Comment(model.getId(), model.getCreator(), view.getCommentField().getText());
      view.getCommentField().setText("");
      request.setBody(comment.toJSON());
      request.addObserver(requestObserver);
      request.send();
    }
  }
View Full Code Here

    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);
    validator = new CommentValidator(db);
View Full Code Here

    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);
    db.save(bob);
    manager = new CommentManager(db);
View Full Code Here

    manager = new CommentManager(db);
  }

  @Test
  public void testMakeEntity() throws WPISuiteException {
    Comment created = manager.makeEntity(defaultSession, goodComment.toJSON());
    assertEquals(1, created.getDefectId());
    assertSame(created, defect.getEvents().get(0));
    assertSame(testProject, created.getProject());
  }
View Full Code Here

TOP

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

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.