@BeforeMethod(groups = {"webservice", "webserviceSmoke"}) public void setUp() throws InterruptedException, SQLException, IOException { super.setup(); super.setupTestData(false); super.setupDataRequisitionApprove(); createVirtualFacilityThroughApi("V10", "F10"); dbWrapper.insertProcessingPeriod( "current", "current period", "2013-01-30", "2016-01-30", 1, "M"); dbWrapper.insertRoleAssignmentForSupervisoryNodeForProgramId1("700", "store in-charge", "N1"); dbWrapper.insertFulfilmentRoleAssignment("commTrack", "store in-charge", "F10"); dbWrapper.updateRestrictLogin("commTrack", true); }
@Test(groups = {"webserviceSmoke"}) public void testRequisitionStatusUsingCommTrackUserForExportOrderFlagFalse() throws IOException, SQLException, ParserConfigurationException, SAXException { HttpClient client = new HttpClient(); client.createContext(); submitRnRThroughApi("V10", "HIV", "P10", 1, 10, 1, 0, 0, 2); Long id = (long) dbWrapper.getMaxRnrID(); ResponseEntity responseEntity = client.SendJSON("", URL + "recent", "GET", "", ""); assertEquals(200, responseEntity.getStatus()); assertEquals(StringUtils.countMatches(responseEntity.getResponse(), ":"), 41); List<String> feedJSONList = XmlUtils.getNodeValues(responseEntity.getResponse(), "content"); checkRequisitionStatusOnFeed("INITIATED", feedJSONList.get(0), id); checkRequisitionStatusOnFeed("SUBMITTED", feedJSONList.get(1), id); checkRequisitionStatusOnFeed("AUTHORIZED", feedJSONList.get(2), id); dbWrapper.setExportOrdersFlagInSupplyLinesTable(false, "F10"); approveRequisition(id, 65); dbWrapper.updateRestrictLogin("commTrack", false); convertToOrder("commTrack", "Admin123"); dbWrapper.updateRestrictLogin("commTrack", true); responseEntity = client.SendJSON("", URL + "1", "GET", "", ""); assertEquals(200, responseEntity.getStatus()); feedJSONList = XmlUtils.getNodeValues(responseEntity.getResponse(), "content"); checkRequisitionStatusOnFeed("APPROVED", feedJSONList.get(3), id); checkRequisitionStatusOnFeed("RELEASED", feedJSONList.get(4), id); responseEntity = client.SendJSON("", URL + "recent", "GET", "", ""); assertEquals(200, responseEntity.getStatus()); feedJSONList = XmlUtils.getNodeValues(responseEntity.getResponse(), "content"); checkOrderStatusOnFeed("READY_TO_PACK", feedJSONList.get(0), id); dbWrapper.assignRight("store in-charge", "MANAGE_POD"); OrderPOD OrderPODFromJson = JsonUtility.readObjectFromFile(FULL_JSON_POD_TXT_FILE_NAME, OrderPOD.class); OrderPODFromJson.getPodLineItems().get(0).setQuantityReceived(65); OrderPODFromJson.getPodLineItems().get(0).setProductCode("P10"); client.SendJSON( getJsonStringFor(OrderPODFromJson), format(POD_URL, id), "POST", "commTrack", "Admin123"); responseEntity = client.SendJSON("", URL + "recent", "GET", "", ""); assertEquals(200, responseEntity.getStatus()); feedJSONList = XmlUtils.getNodeValues(responseEntity.getResponse(), "content"); checkOrderStatusOnFeed("RECEIVED", feedJSONList.get(1), id); }