Examples of Defect


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

    // print the body
    System.out.println("Received response: " + response.getBody()); //TODO change this to logger
    if (response.getStatusCode() == 200) {
      // parse the defect from the body
      final Defect defect = Defect.fromJSON(response.getBody());

      // make sure the defect isn't null
      if (defect != null) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
View Full Code Here

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

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

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

    // print the body
    System.out.println("Received response: " + response.getBody()); //TODO change this to logger

    if (response.getStatusCode() == 201) {
      // parse the defect from the body
      final Defect defect = Defect.fromJSON(response.getBody());

      // make sure the defect isn't null
      if (defect != null) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
View Full Code Here

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

    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);
    db.save(otherDefect, otherProject);
View Full Code Here

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

    manager = new DefectManager(db);
  }

  @Test
  public void testMakeEntity() throws WPISuiteException {
    Defect created = manager.makeEntity(defaultSession, newDefect.toJSON());
    assertEquals(3, created.getId()); // IDs are unique across projects
    assertEquals("A new defect", created.getTitle());
    assertSame(db.retrieve(Defect.class, "id", 3).get(0), created);
  }
View Full Code Here

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

    assertSame(existingDefect, gotten[0]);
  }
 
  @Test
  public void testSave() {
    Defect newDefect = new Defect(3, "A title", "", existingUser);
    manager.save(defaultSession, newDefect);
    assertSame(newDefect, db.retrieve(Defect.class, "id", 3).get(0));
    assertSame(testProject, newDefect.getProject());
  }
View Full Code Here

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

  /**
   * Constructs a new CreateDefectView where the user can enter the data for a new defect.
   */
  public DefectView() {
    this(new Defect(), Mode.CREATE, null);
  }
View Full Code Here

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

    manager.deleteEntity(defaultSession, Integer.toString(existingDefect.getId()));
  }
 
  @Test
  public void testDeleteAll() throws WPISuiteException {
    Defect anotherDefect = new Defect(-1, "a title", "a description", existingUser);
    manager.makeEntity(defaultSession, anotherDefect.toJSON());
    assertEquals(2, db.retrieveAll(new Defect(), testProject).size());
    manager.deleteAll(adminSession);
    assertEquals(0, db.retrieveAll(new Defect(), testProject).size());
    // otherDefect should still be around
    assertEquals(1, db.retrieveAll(new Defect(), otherProject).size());
  }
View Full Code Here

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

  }
 
  @SuppressWarnings("unchecked")
  @Test
  public void testUpdate() throws WPISuiteException {
    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");
    assertEquals("An existing defect", titleChange.getOldValue());
    assertEquals("A changed title", titleChange.getNewValue());
   
    // make sure events are being saved explicitly to get around a bug
    // TODO: remove this when said bug is fixed
    assertSame(updated.getEvents(), db.retrieveAll(new ArrayList<DefectEvent>()).get(0));
  }
View Full Code Here

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

  }
 
  @Test
  public void testNoUpdate() throws WPISuiteException {
    Date origLastModified = existingDefect.getLastModifiedDate();
    Defect updated = manager.update(defaultSession, existingDefect.toJSON());
    assertSame(existingDefect, updated);
    // there were no changes - make sure lastModifiedDate is same, no new events
    assertEquals(origLastModified, updated.getLastModifiedDate());
    assertEquals(0, updated.getEvents().size());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.