@Test @Category(UnitTest.class) public void testGetWithScoreMin() throws Exception { ReviewTestUtils.createPreparedData(resource()); ReviewTestUtils.markSomeItemsReviewed(); final ReviewableItemsStatistics response = execGet(String.valueOf(mapId), "0.928", null); Assert.assertEquals(mapId, response.getMapId()); Assert.assertEquals(54, response.getNumTotalItems()); Assert.assertEquals(5, response.getNumReviewableItems()); Assert.assertEquals(3, response.getNumReviewedItems()); }
// This behavior differs between Jersey and WPS. Jersey will automatically insert the default // value for empty numeric and boolean params. This would be a 400 with WPS. // TODO: unify the behavior of the two tests?? @Test @Category(UnitTest.class) public void testGetEmptyReviewScoreMinParam() throws Exception { ReviewTestUtils.createPreparedData(resource()); // effectively, reviewScoreMinThreshold = 0.0 final ReviewableItemsStatistics response = execGet(String.valueOf(mapId), "", null); Assert.assertEquals(mapId, response.getMapId()); Assert.assertEquals(54, response.getNumTotalItems()); Assert.assertEquals(16, response.getNumReviewableItems()); Assert.assertEquals(0, response.getNumReviewedItems()); }
@Test @Category(UnitTest.class) public void testGetByBounds() throws Exception { final BoundingBox queryBounds = ReviewTestUtils.createTestQueryBounds(); ReviewTestUtils.createPreparedData(resource()); ReviewTestUtils.markSomeItemsReviewed(); final ReviewableItemsStatistics response = execGet(String.valueOf(mapId), null, queryBounds.toServicesString()); Assert.assertEquals(mapId, response.getMapId()); Assert.assertEquals(54, response.getNumTotalItems()); // TODO: fix - this should be returning 7 instead; I believe its ignoring way -44, whose review // against item is a relation with a node inside the query bounds; oddly enough the review get // resource test performs this query correctly, and they use nearly the same query code Assert.assertEquals(6, response.getNumReviewableItems()); Assert.assertEquals(3, response.getNumReviewedItems()); }
@Test @Category(UnitTest.class) public void testGetNoReviewableData() throws Exception { ReviewTestUtils.createDataToPrepare(); // make a review map and job entry but don't write the reviewed data final String jobId = UUID.randomUUID().toString(); DbUtils.insertJobStatus(jobId, JOB_STATUS.COMPLETE.toInt(), conn); ReviewMap mapReviewInfo = new ReviewMap(); mapReviewInfo.setMapId(mapId); mapReviewInfo.setReviewPrepareJobId(jobId); QReviewMap reviewMap = QReviewMap.reviewMap; new SQLInsertClause(conn, DbUtils.getConfiguration(mapId), reviewMap) .populate(mapReviewInfo) .execute(); final ReviewableItemsStatistics response = execGet(String.valueOf(mapId), null, null); Assert.assertEquals(mapId, response.getMapId()); Assert.assertEquals(54, response.getNumTotalItems()); Assert.assertEquals(0, response.getNumReviewableItems()); Assert.assertEquals(0, response.getNumReviewedItems()); }