Esempio n. 1
0
  @Test
  public void testGet() {
    // get retrospective
    RetrospectiveObject retrospective = RetrospectiveDAO.getInstance().get(mRtrospectiveId);

    // assert
    assertNotNull(retrospective);
    assertEquals("TEST_RETROSPECTIVE_NAME", retrospective.getName());
    assertEquals("TEST_RETROSPECTIVE_DESCRIPTION", retrospective.getDescription());
    assertEquals(RetrospectiveObject.TYPE_GOOD, retrospective.getType());
    assertEquals(RetrospectiveObject.STATUS_NEW, retrospective.getStatus());
  }
Esempio n. 2
0
 @Test
 public void testGetRetrospectivesBySprintId() {
   long sprintId = 2;
   ArrayList<RetrospectiveObject> retrospectives =
       RetrospectiveDAO.getInstance().getRetrospectivesBySprintId(sprintId);
   assertEquals(0, retrospectives.size());
   RetrospectiveObject retrospective1 = new RetrospectiveObject(mProject.getId());
   retrospective1.setSprintId(sprintId).save();
   RetrospectiveObject retrospective2 = new RetrospectiveObject(mProject.getId());
   retrospective2.setSprintId(sprintId).save();
   RetrospectiveObject retrospective3 = new RetrospectiveObject(mProject.getId());
   retrospective3.setSprintId(sprintId).save();
   retrospectives = RetrospectiveDAO.getInstance().getRetrospectivesBySprintId(sprintId);
   assertEquals(3, retrospectives.size());
   assertEquals(retrospectives.get(0).getId(), retrospective1.getId());
   assertEquals(retrospectives.get(1).getId(), retrospective2.getId());
   assertEquals(retrospectives.get(2).getId(), retrospective3.getId());
 }
Esempio n. 3
0
  private long createRetrospective() {
    // Test data
    String name = "TEST_RETROSPECTIVE_NAME";
    String description = "TEST_RETROSPECTIVE_DESCRIPTION";
    String type = RetrospectiveObject.TYPE_GOOD;
    String status = RetrospectiveObject.STATUS_NEW;
    long sprintId = 1;

    // Create Retrospective
    RetrospectiveObject retrospective = new RetrospectiveObject(mProject.getId());
    retrospective
        .setName(name)
        .setDescription(description)
        .setType(type)
        .setStatus(status)
        .setSprintId(sprintId);

    // Test create method
    long retrospectiveId = RetrospectiveDAO.getInstance().create(retrospective);
    assertTrue(retrospectiveId > 0);

    return retrospectiveId;
  }
Esempio n. 4
0
  @Test
  public void testCreate() throws SQLException {
    // Test data
    String name = "TEST_RETROSPECTIVE_NAME";
    String description = "TEST_RETROSPECTIVE_DESCRIPTION";
    String type = RetrospectiveObject.TYPE_GOOD;
    String status = RetrospectiveObject.STATUS_NEW;
    long sprintId = 1;

    // Create Retrospective
    RetrospectiveObject retrospective = new RetrospectiveObject(mProject.getId());
    retrospective
        .setName(name)
        .setDescription(description)
        .setType(type)
        .setStatus(status)
        .setSprintId(sprintId);

    // Test create method
    long retrospectiveId = RetrospectiveDAO.getInstance().create(retrospective);
    assertTrue(retrospectiveId > 0);

    // Get Data From DB
    IQueryValueSet valueSet = new MySQLQuerySet();
    valueSet.addTableName(RetrospectiveEnum.TABLE_NAME);
    valueSet.addEqualCondition(RetrospectiveEnum.ID, retrospectiveId);

    String query = valueSet.getSelectQuery();
    ResultSet result = mControl.executeQuery(query);

    RetrospectiveObject retrospectiveFromDB = null;

    if (result.next()) {
      retrospectiveFromDB = RetrospectiveDAO.convert(result);
    }
    closeResultSet(result);

    // Verify Data
    assertEquals(name, retrospectiveFromDB.getName());
    assertEquals(description, retrospectiveFromDB.getDescription());
    assertEquals(type, retrospectiveFromDB.getType());
    assertEquals(status, retrospectiveFromDB.getStatus());
    assertEquals(sprintId, retrospectiveFromDB.getSprintId());
  }
Esempio n. 5
0
  @Test
  public void testUpdate() {
    // Test data
    String name = "TEST_RETROSPECTIVE_NAME_UPDATE";
    String description = "TEST_RETROSPECTIVE_DESCRIPTION_UPDATE";
    String type = RetrospectiveObject.TYPE_IMPROVEMENT;
    String status = RetrospectiveObject.STATUS_CLOSED;

    // Get retrospective
    RetrospectiveObject retrospective = RetrospectiveDAO.getInstance().get(mRtrospectiveId);
    retrospective.setName(name).setDescription(description).setType(type).setStatus(status);

    // Test update method
    boolean isUpdateSuccess = RetrospectiveDAO.getInstance().update(retrospective);
    assertTrue(isUpdateSuccess);

    RetrospectiveObject retrospectiveFromDB = RetrospectiveDAO.getInstance().get(mRtrospectiveId);
    // Verify
    assertEquals(name, retrospectiveFromDB.getName());
    assertEquals(description, retrospectiveFromDB.getDescription());
    assertEquals(type, retrospectiveFromDB.getType());
    assertEquals(status, retrospectiveFromDB.getStatus());
  }