Search in sources :

Example 26 with Note

use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.

the class OsmNotesDownloadTest method createANote.

private Note createANote() {
    Note note = new Note();
    note.id = 4;
    note.position = new OsmLatLon(6.0, 7.0);
    note.status = Note.Status.OPEN;
    note.dateCreated = new Date();
    NoteComment comment = new NoteComment();
    comment.date = new Date();
    comment.action = NoteComment.Action.OPENED;
    comment.text = "hurp durp";
    note.comments.add(comment);
    return note;
}
Also used : NoteComment(de.westnordost.osmapi.notes.NoteComment) Note(de.westnordost.osmapi.notes.Note) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) Date(java.util.Date)

Example 27 with Note

use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.

the class NoteDaoTest method testDeleteUnreferenced.

public void testDeleteUnreferenced() {
    Note note = createNote();
    dao.put(note);
    assertEquals(1, dao.deleteUnreferenced());
    dao.put(note);
    new OsmNoteQuestDao(dbHelper, serializer, new OsmNoteQuestType()).add(new OsmNoteQuest(note, new OsmNoteQuestType()));
    assertEquals(0, dao.deleteUnreferenced());
}
Also used : Note(de.westnordost.osmapi.notes.Note)

Example 28 with Note

use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.

the class NoteDaoTest method testDelete.

public void testDelete() {
    Note note = createNote();
    assertFalse(dao.delete(note.id));
    dao.put(note);
    assertTrue(dao.delete(note.id));
    assertNull(dao.get(note.id));
}
Also used : Note(de.westnordost.osmapi.notes.Note)

Example 29 with Note

use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.

the class NoteDaoTest method testPutGetNoClosedDate.

public void testPutGetNoClosedDate() {
    Note note = createNote();
    dao.put(note);
    Note dbNote = dao.get(note.id);
    checkEqual(note, dbNote);
}
Also used : Note(de.westnordost.osmapi.notes.Note)

Example 30 with Note

use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.

the class OsmNoteQuestDaoTest method testAddTwice.

public void testAddTwice() {
    // tests if the "unique" property is set correctly in the table
    Note note = NoteDaoTest.createNote();
    noteDao.put(note);
    OsmNoteQuest quest = new OsmNoteQuest(note, questType);
    dao.add(quest);
    OsmNoteQuest questForSameNote = new OsmNoteQuest(note, questType);
    questForSameNote.setStatus(QuestStatus.HIDDEN);
    boolean result = dao.add(questForSameNote);
    List<OsmNoteQuest> quests = dao.getAll(null, null);
    assertEquals(1, quests.size());
    assertEquals(QuestStatus.NEW, quests.get(0).getStatus());
    assertFalse(result);
    assertNull(questForSameNote.getId());
}
Also used : Note(de.westnordost.osmapi.notes.Note)

Aggregations

Note (de.westnordost.osmapi.notes.Note)32 OsmLatLon (de.westnordost.osmapi.map.data.OsmLatLon)10 Date (java.util.Date)8 LatLon (de.westnordost.osmapi.map.data.LatLon)5 ArrayList (java.util.ArrayList)5 BoundingBox (de.westnordost.osmapi.map.data.BoundingBox)4 NoteComment (de.westnordost.osmapi.notes.NoteComment)3 Way (de.westnordost.osmapi.map.data.Way)2 QuestStatus (de.westnordost.streetcomplete.data.QuestStatus)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 View (android.view.View)1 Button (android.widget.Button)1 TextView (android.widget.TextView)1 Handler (de.westnordost.osmapi.common.Handler)1 SingleElementHandler (de.westnordost.osmapi.common.SingleElementHandler)1 OsmConflictException (de.westnordost.osmapi.common.errors.OsmConflictException)1 NotesDao (de.westnordost.osmapi.notes.NotesDao)1 User (de.westnordost.osmapi.user.User)1 QuestGroup (de.westnordost.streetcomplete.data.QuestGroup)1 VisibleQuestListener (de.westnordost.streetcomplete.data.VisibleQuestListener)1