use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class NoteDao method putAll.
public void putAll(Collection<Note> notes) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
db.beginTransaction();
for (Note note : notes) {
executeInsert(note);
}
db.setTransactionSuccessful();
db.endTransaction();
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class CreateNoteUploadTest method testCreateNoteUploadsImagesAndDisplaysLinks.
public void testCreateNoteUploadsImagesAndDisplaysLinks() {
CreateNote createNote = createACreateNote();
createNote.imagePaths = new ArrayList<>();
createNote.imagePaths.add("hello");
Note note = createNote(null);
when(notesDao.create(any(LatLon.class), anyString())).thenReturn(note);
when(imageUploader.upload(createNote.imagePaths)).thenReturn(Collections.singletonList("hello, too"));
assertNotNull(createNoteUpload.uploadCreateNote(createNote));
verify(imageUploader).upload(createNote.imagePaths);
verify(notesDao).create(createNote.position, "jo ho\n\nAttached photo(s):\nhello, too");
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class CreateNoteUploadTest method testCommentNoteUploadsImagesAndDisplaysLinks.
public void testCommentNoteUploadsImagesAndDisplaysLinks() {
CreateNote createNote = createACreateNote();
createNote.elementType = Element.Type.WAY;
createNote.elementId = 5L;
createNote.imagePaths = new ArrayList<>();
createNote.imagePaths.add("hello");
Note note = createNote(createNote);
setUpThereIsANoteFor(createNote, note);
when(imageUploader.upload(createNote.imagePaths)).thenReturn(Collections.singletonList("hello, too"));
when(notesDao.comment(anyLong(), anyString())).thenReturn(note);
assertNotNull(createNoteUpload.uploadCreateNote(createNote));
verify(notesDao).comment(note.id, "jo ho\n\nAttached photo(s):\nhello, too");
verifyNoteInsertedIntoDb(createNote.id, note);
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class CreateNoteUploadTest method testCreateNoteOnExistingNoteWillCancelWhenConflictException.
public void testCreateNoteOnExistingNoteWillCancelWhenConflictException() {
CreateNote createNote = createACreateNote();
createNote.elementType = Element.Type.WAY;
createNote.elementId = 5L;
Note note = createNote(createNote);
setUpThereIsANoteFor(createNote, note);
when(notesDao.comment(anyLong(), anyString())).thenThrow(OsmConflictException.class);
assertNull(createNoteUpload.uploadCreateNote(createNote));
verify(notesDao).comment(note.id, createNote.text);
verifyNoteNotInsertedIntoDb(createNote.id);
}
use of de.westnordost.osmapi.notes.Note in project StreetComplete by westnordost.
the class OsmNoteQuestChangesUploadTest method createQuest.
private static OsmNoteQuest createQuest() {
Note note = new Note();
note.id = 1;
note.position = new OsmLatLon(1.0, 2.0);
OsmNoteQuest quest = new OsmNoteQuest(note, new OsmNoteQuestType());
quest.setId(3);
quest.setStatus(QuestStatus.NEW);
quest.setComment("blablub");
return quest;
}
Aggregations