Search in sources :

Example 31 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class TeamTest method test_has_meetings.

@MediumTest
public void test_has_meetings() {
    Team team = Team.create("Test Team No Meetings", mContext);
    assertFalse(team.hasMeetings(mContext));
    new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 301, 343, 30, 65).save(mContext);
    assertTrue(team.hasMeetings(mContext));
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 32 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class TeamDAO method createNewTeam.

private Team createNewTeam(SQLiteDatabase db, Team team) {
    if (team.getName() == null || team.getName().trim().length() == 0) {
        String msg = "Attempting to create a team with an empty name";
        Logger.w(msg);
        throw new InvalidTeamNameException(msg);
    }
    if (attemptingToCreateDuplicateTeam(team)) {
        String msg = "Attempting to create duplicate team with the name " + team.getName();
        Logger.w(msg);
        throw new DuplicateTeamException(msg);
    }
    Logger.d("Creating new team with a name of '" + team.getName() + "'");
    ContentValues values = new ContentValues();
    values.put(TEAMS_NAME, team.getName());
    long id = db.insertOrThrow(TEAMS_TABLE_NAME, null, values);
    return new Team(id, team.getName());
}
Also used : ContentValues(android.content.ContentValues) Team(net.johnpwood.android.standuptimer.model.Team)

Example 33 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class StandupTimerTest method test_meeting_stats_are_stored_when_finish_is_clicked.

@MediumTest
public void test_meeting_stats_are_stored_when_finish_is_clicked() {
    a.setMeetingStartTime(System.currentTimeMillis());
    a.setCompletedParticipants(5);
    a.setIndividualStatusEndTime(System.currentTimeMillis());
    a.setQuickestStatus(60);
    a.setLongestStatus(120);
    a.setTeam(new Team("Test team"));
    clickFinishedButton();
    assertTrue(a.wasPersistMeetingCalled());
}
Also used : Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 34 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class TeamDetailsTest method createTestData.

private void createTestData() {
    Context context = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
    TeamDAO teamFixturesDao = daoFactory.getTeamDAO(context);
    MeetingDAO meetingFixturesDao = daoFactory.getMeetingDAO(context);
    Team team = teamFixturesDao.save(new Team("Test Team"));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 301, 343, 30, 65));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 6, 10, 17, 0).getTime(), 8, 534, 550, 32, 120));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 16, 0).getTime(), 2, 234, 300, 23, 122));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 8, 10, 14, 0).getTime(), 3, 765, 765, 15, 78));
    meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 1, 9, 10, 12, 0).getTime(), 9, 444, 445, 10, 93));
}
Also used : Context(android.content.Context) RenamingDelegatingContext(android.test.RenamingDelegatingContext) RenamingDelegatingContext(android.test.RenamingDelegatingContext) Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) TeamDAO(net.johnpwood.android.standuptimer.dao.TeamDAO) MeetingDAO(net.johnpwood.android.standuptimer.dao.MeetingDAO)

Example 35 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class MeetingDAOTest method test_find_by_team_and_date.

@MediumTest
public void test_find_by_team_and_date() {
    Team team = new Team("Test Team");
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    Meeting expected = dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    Meeting actual = dao.findByTeamAndDate(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime());
    assertEquals(expected.getId(), actual.getId());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

Team (net.johnpwood.android.standuptimer.model.Team)37 MediumTest (android.test.suitebuilder.annotation.MediumTest)28 Meeting (net.johnpwood.android.standuptimer.model.Meeting)17 GregorianCalendar (java.util.GregorianCalendar)16 Date (java.util.Date)3 ContentValues (android.content.ContentValues)2 Context (android.content.Context)2 Cursor (android.database.Cursor)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)2 RenamingDelegatingContext (android.test.RenamingDelegatingContext)2 MeetingDAO (net.johnpwood.android.standuptimer.dao.MeetingDAO)2 TeamDAO (net.johnpwood.android.standuptimer.dao.TeamDAO)2 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 CannotUpdateMeetingException (net.johnpwood.android.standuptimer.dao.CannotUpdateMeetingException)1 DuplicateTeamException (net.johnpwood.android.standuptimer.dao.DuplicateTeamException)1 InvalidTeamNameException (net.johnpwood.android.standuptimer.dao.InvalidTeamNameException)1 MeetingStats (net.johnpwood.android.standuptimer.model.MeetingStats)1