use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.
the class MeetingDAOTest method test_delete_a_single_meeting.
@MediumTest
public void test_delete_a_single_meeting() {
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);
meeting = dao.findById(meeting.getId());
assertNotNull(meeting.getId());
dao.delete(meeting);
meeting = dao.findById(meeting.getId());
assertNull(meeting);
}
use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.
the class TeamDAO method updateExistingTeam.
private Team updateExistingTeam(SQLiteDatabase db, Team team) {
Logger.d("Updating team with the name of '" + team.getName() + "'");
ContentValues values = new ContentValues();
values.put(TEAMS_NAME, team.getName());
long id = db.update(TEAMS_TABLE_NAME, values, _ID + " = ?", new String[] { team.getId().toString() });
return new Team(id, team.getName());
}
use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.
the class TeamDAO method findByName.
public Team findByName(String name) {
Cursor cursor = null;
Team team = null;
name = name.trim();
try {
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(TEAMS_TABLE_NAME, TEAMS_ALL_COLUMS, TEAMS_NAME + " = ?", new String[] { name }, null, null, null);
if (cursor.getCount() == 1) {
if (cursor.moveToFirst()) {
long id = cursor.getLong(0);
name = cursor.getString(1);
team = new Team(id, name);
}
}
} finally {
closeCursor(cursor);
}
Logger.d((team == null ? "Unsuccessfully" : "Successfully") + " found team with a name of '" + name + "'");
return team;
}
use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.
the class TeamDAO method findById.
public Team findById(Long id) {
Cursor cursor = null;
Team team = null;
try {
SQLiteDatabase db = getReadableDatabase();
cursor = db.query(TEAMS_TABLE_NAME, TEAMS_ALL_COLUMS, _ID + " = ?", new String[] { id.toString() }, null, null, null);
if (cursor.getCount() == 1) {
if (cursor.moveToFirst()) {
String name = cursor.getString(1);
team = new Team(id, name);
}
}
} finally {
closeCursor(cursor);
}
return team;
}
use of net.johnpwood.android.standuptimer.model.Team 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);
}
}
Aggregations