private void testGetAgainstInvalidJobStatus(final JOB_STATUS jobStatus) throws Exception { final String jobId = UUID.randomUUID().toString(); DbUtils.insertJobStatus(jobId, jobStatus.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(); try { execGet(String.valueOf(mapId), null, null); } catch (UniformInterfaceException e) { Assert.assertEquals(Status.PRECONDITION_FAILED.getStatusCode(), e.getResponse().getStatus()); Assert.assertTrue( e.getResponse() .getEntity(String.class) .contains( "The prepare job with ID: " + jobId + " for the map with ID: " + mapId + " has a status of " + jobStatus.toString())); throw e; } }
@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()); }