Search in sources :

Example 1 with Team

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

the class MeetingDetails method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.meeting_details);
    String teamName = getIntent().getStringExtra("teamName");
    String meetingTime = getIntent().getStringExtra("meetingTime");
    Logger.i("Looking for meeting for '" + teamName + "' at '" + meetingTime + "'");
    Date date = null;
    try {
        date = new SimpleDateFormat(Meeting.DESCRIPTION_FORMAT).parse(meetingTime);
    } catch (ParseException e) {
        String msg = "Could not parse the date/time '" + meetingTime + "'. " + e.getMessage();
        Logger.e(msg);
        throw new RuntimeException(msg);
    }
    Team team = Team.findByName(teamName, this);
    meeting = Meeting.findByTeamAndDate(team, date, this);
    displayMeetingStats(team, date);
}
Also used : Team(net.johnpwood.android.standuptimer.model.Team) ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 2 with Team

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

the class MeetingTest method test_delete_a_meeting.

@MediumTest
public void test_delete_a_meeting() {
    Team team = new Team("Test Team");
    Meeting meeting = new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120);
    meeting = meeting.save(mContext);
    assertEquals(1, Meeting.findAllByTeam(team, mContext).size());
    meeting.delete(mContext);
    assertEquals(0, Meeting.findAllByTeam(team, mContext).size());
}
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 3 with Team

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

the class TeamTest method test_deleting_a_team_deletes_its_meetings_as_well.

@MediumTest
public void test_deleting_a_team_deletes_its_meetings_as_well() {
    Team team = Team.create("Test Team", mContext);
    new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    assertFalse(Meeting.findAllByTeam(team, mContext).isEmpty());
    team.delete(mContext);
    assertEquals(0, Team.findAllTeamNames(mContext).size());
    assertTrue(Meeting.findAllByTeam(team, mContext).isEmpty());
}
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 4 with Team

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

the class TeamTest method test_create_a_team.

@MediumTest
public void test_create_a_team() {
    Team team = Team.create("Test Team", mContext);
    assertNotNull(team.getId());
}
Also used : Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 5 with Team

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

the class StandupTimerTest method test_individual_status_end_time_is_set_if_finish_is_clicked_early.

@MediumTest
public void test_individual_status_end_time_is_set_if_finish_is_clicked_early() {
    a.setMeetingStartTime(System.currentTimeMillis());
    a.setCompletedParticipants(5);
    a.setQuickestStatus(60);
    a.setLongestStatus(120);
    a.setTeam(new Team("Test team"));
    clickFinishedButton();
    assertTrue(0L != a.getIndividualStatusEndTime());
    assertTrue(a.wasPersistMeetingCalled());
}
Also used : 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