Search in sources :

Example 1 with TestQuestType

use of de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType in project StreetComplete by westnordost.

the class OsmQuestDaoTest method testDeleteReverted.

public void testDeleteReverted() {
    ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
    OsmQuest quest1 = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
    quest1.setStatus(QuestStatus.CLOSED);
    OsmQuest quest2 = createNewQuest(new TestQuestType2(), 1, Element.Type.NODE, geom);
    quest2.setStatus(QuestStatus.REVERT);
    OsmQuest quest3 = createNewQuest(new TestQuestType2(), 2, Element.Type.NODE, geom);
    quest3.setStatus(QuestStatus.REVERT);
    OsmQuest quest4 = createNewQuest(new TestQuestType2(), 1, Element.Type.WAY, geom);
    quest4.setStatus(QuestStatus.REVERT);
    addToDaos(quest1, quest2);
    assertEquals(1, dao.deleteAllReverted(Element.Type.NODE, 1));
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Example 2 with TestQuestType

use of de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType in project StreetComplete by westnordost.

the class OsmQuestDaoTest method testGetAllByMultipleQuestTypes.

public void testGetAllByMultipleQuestTypes() {
    ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
    OsmQuest quest1 = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
    OsmQuest quest2 = createNewQuest(new TestQuestType2(), 2, Element.Type.NODE, geom);
    addToDaos(quest1, quest2);
    List<OsmQuest> only1 = dao.getAll(null, null, Collections.singletonList(TestQuestType.class.getSimpleName()));
    assertEquals(1, only1.size());
    List<OsmQuest> both = dao.getAll(null, null, Arrays.asList(TestQuestType.class.getSimpleName(), TestQuestType2.class.getSimpleName()));
    assertEquals(2, both.size());
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Example 3 with TestQuestType

use of de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType in project StreetComplete by westnordost.

the class OsmQuestDaoTest method testGetNextNewAt.

public void testGetNextNewAt() {
    ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
    OsmQuest quest = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
    quest.setStatus(QuestStatus.ANSWERED);
    addToDaos(quest, createNewQuest(new TestQuestType2(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType3(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType4(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType5(), 1, Element.Type.NODE, geom));
    OsmQuest nextQuest = dao.getNextNewAt(1, Arrays.asList("TestQuestType4", "TestQuestType3", "TestQuestType5"));
    assertEquals(nextQuest.getType().getClass().getSimpleName(), "TestQuestType4");
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) TestQuestType5(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType5) TestQuestType4(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType4) TestQuestType3(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType3) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Example 4 with TestQuestType

use of de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType in project StreetComplete by westnordost.

the class OsmQuestDaoTest method testGetNoFittingNextNewAt.

public void testGetNoFittingNextNewAt() {
    ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
    OsmQuest quest = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
    quest.setStatus(QuestStatus.ANSWERED);
    addToDaos(quest, createNewQuest(new TestQuestType2(), 2, Element.Type.NODE, geom));
    assertNull(dao.getNextNewAt(1, Arrays.asList("TestQuestType")));
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Example 5 with TestQuestType

use of de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType in project StreetComplete by westnordost.

the class OsmQuestDaoTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    geometryDao = new ElementGeometryDao(dbHelper, serializer);
    List<QuestType> list = new ArrayList<>();
    list.add(new TestQuestType());
    list.add(new TestQuestType2());
    list.add(new TestQuestType3());
    list.add(new TestQuestType4());
    list.add(new TestQuestType5());
    dao = new OsmQuestDao(dbHelper, serializer, new QuestTypeRegistry(list));
}
Also used : TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) OsmElementQuestType(de.westnordost.streetcomplete.data.osm.OsmElementQuestType) QuestType(de.westnordost.streetcomplete.data.QuestType) ArrayList(java.util.ArrayList) TestQuestType5(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType5) QuestTypeRegistry(de.westnordost.streetcomplete.data.QuestTypeRegistry) TestQuestType4(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType4) TestQuestType3(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType3) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Aggregations

TestQuestType (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType)7 TestQuestType2 (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)6 OsmLatLon (de.westnordost.osmapi.map.data.OsmLatLon)5 ElementGeometry (de.westnordost.streetcomplete.data.osm.ElementGeometry)5 OsmQuest (de.westnordost.streetcomplete.data.osm.OsmQuest)5 TestQuestType3 (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType3)3 TestQuestType4 (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType4)3 TestQuestType5 (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType5)3 QuestTypeRegistry (de.westnordost.streetcomplete.data.QuestTypeRegistry)2 QuestType (de.westnordost.streetcomplete.data.QuestType)1 OsmElementQuestType (de.westnordost.streetcomplete.data.osm.OsmElementQuestType)1 ArrayList (java.util.ArrayList)1