@Test @Category(IntegrationTest.class) public void testWpsError() throws Exception { ReviewTestUtils.createDataToPrepare(); final String response = testWps(true, true, String.valueOf(mapId + 2)); verifyWpsErrorResponse(response, Status.NOT_FOUND, "No record exists"); }
@Test @Category(IntegrationTest.class) public void testWpsPostXml() throws Exception { ReviewTestUtils.createDataToPrepare(); final String response = testWps(false, false, String.valueOf(mapId)); final String jobId = verifyWpsResponse(response); (new JobStatusWebPoller(resource(), conn)).pollJobStatusUntilCompleteOrFail(jobId, false); ReviewTestUtils.jobId = jobId; ReviewTestUtils.verifyDataPrepared(mapId); }
@Test(expected = UniformInterfaceException.class) @Category(UnitTest.class) public void testGetDataNotPrepared() throws Exception { ReviewTestUtils.createDataToPrepare(); try { execGet(String.valueOf(mapId), null, null); } catch (UniformInterfaceException e) { int statcode1 = Status.PRECONDITION_FAILED.getStatusCode(); int statcode2 = e.getResponse().getStatus(); Assert.assertEquals(Status.PRECONDITION_FAILED.getStatusCode(), e.getResponse().getStatus()); Assert.assertTrue( e.getResponse() .getEntity(String.class) .contains("The map with ID: " + mapId + " has not had review data prepared for it.")); 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()); }