Search in sources :

Example 6 with Meeting

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

the class MeetingDAOTest method test_cannot_update_a_meeting_that_has_already_been_created.

@MediumTest
public void test_cannot_update_a_meeting_that_has_already_been_created() {
    Meeting meeting = new Meeting(new Team("Test Team"), new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120);
    meeting = dao.save(meeting);
    try {
        dao.save(meeting);
        fail("Should have thrown an exception");
    } catch (CannotUpdateMeetingException e) {
        assertTrue(true);
    }
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) CannotUpdateMeetingException(net.johnpwood.android.standuptimer.dao.CannotUpdateMeetingException) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 7 with Meeting

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

the class MeetingTest method test_delete_all_by_team.

@MediumTest
public void test_delete_all_by_team() {
    Team team = new Team("Test Team");
    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());
    Meeting.deleteAllByTeam(team, mContext);
    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 8 with Meeting

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

the class MeetingTest method test_save_a_meeting.

@MediumTest
public void test_save_a_meeting() {
    Meeting meeting = new Meeting(new Team("Test Team"), new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120);
    meeting = meeting.save(mContext);
    assertNotNull(meeting.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)

Example 9 with Meeting

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

the class TeamDetails method deleteMeeting.

private void deleteMeeting(String dateString) {
    try {
        Date date = new SimpleDateFormat(Meeting.DESCRIPTION_FORMAT).parse(dateString);
        Meeting meeting = Meeting.findByTeamAndDate(team, date, this);
        meeting.delete(this);
    } catch (ParseException e) {
        Logger.e(e.getMessage());
        Logger.e("Could not parse the date string '" + dateString + "'.  Will not attempt to delete the meeting.");
    }
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 10 with Meeting

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

the class MeetingDAO method createMeetingFromCursorData.

private Meeting createMeetingFromCursorData(Cursor cursor) {
    long id = cursor.getLong(0);
    String teamName = cursor.getString(1);
    Date meetingTime = new Date(cursor.getLong(2));
    int numParticipants = cursor.getInt(3);
    int individualStatusLength = cursor.getInt(4);
    int meetingLength = cursor.getInt(5);
    int quickestStatus = cursor.getInt(6);
    int longestStatus = cursor.getInt(7);
    return new Meeting(id, new Team(teamName), meetingTime, numParticipants, individualStatusLength, meetingLength, quickestStatus, longestStatus);
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) Team(net.johnpwood.android.standuptimer.model.Team) Date(java.util.Date)

Aggregations

Meeting (net.johnpwood.android.standuptimer.model.Meeting)24 Team (net.johnpwood.android.standuptimer.model.Team)17 GregorianCalendar (java.util.GregorianCalendar)16 MediumTest (android.test.suitebuilder.annotation.MediumTest)14 Date (java.util.Date)5 Cursor (android.database.Cursor)3 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)3 Context (android.content.Context)2 RenamingDelegatingContext (android.test.RenamingDelegatingContext)2 ArrayList (java.util.ArrayList)2 MeetingDAO (net.johnpwood.android.standuptimer.dao.MeetingDAO)2 TeamDAO (net.johnpwood.android.standuptimer.dao.TeamDAO)2 ContentValues (android.content.ContentValues)1 ArrayAdapter (android.widget.ArrayAdapter)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 CannotUpdateMeetingException (net.johnpwood.android.standuptimer.dao.CannotUpdateMeetingException)1 MeetingStats (net.johnpwood.android.standuptimer.model.MeetingStats)1