@Test( groups = {"load", "invoice_line"}, dataProvider = "generalConfigurationLoader", dataProviderClass = LoaderDataProvider.class) public void shouldFailDueToFileMissing(Map<String, String> gc) { Process p; try { Base.open(getDataSource()); p = (Process) Process.where("name = ?", "INVOICE_LINE_LOAD_PROCESS").limit(1).get(0); Parameter param = (Parameter) Parameter.where( "module = ? and object = ? and pkey = ?", "ARC", "INVOICE_LINE_LOAD_PROCESS", "FILENAME") .get(0); param.set("pvalue", "fileNotFound.txt"); parameterService.updateParameter(param); } finally { Base.close(); } invoiceLineLoader.load(p, gc); Assert.assertEquals(p.get("status"), "FNF"); }
@Test(groups = {"load", "invoice_line"}) public void shouldFailDueToIncorrectConfiguration() { Process p; try { Base.open(getDataSource()); p = (Process) Process.where("name = ?", "INVOICE_LINE_LOAD_PROCESS").limit(1).get(0); Parameter param = (Parameter) Parameter.where( "module = ? and object = ? and pkey = ?", "ARC", "INVOICE_LINE_LOAD_PROCESS", "FILENAME") .get(0); param.set("pvalue", ""); parameterService.updateParameter(param); } finally { Base.close(); } invoiceLineLoader.load(p, null); Assert.assertEquals(p.get("status"), "ERROR"); }
@Test( groups = {"load", "invoice_line"}, dataProvider = "generalConfigurationLoader", dataProviderClass = LoaderDataProvider.class) public void shouldFailDueToConfigurationMissing(Map<String, String> gc) { Process p; try { Base.open(getDataSource()); p = (Process) Process.where("name = ?", "INVOICE_LINE_LOAD_PROCESS").limit(1).get(0); parameterService.deleteParameter(13L); } finally { Base.close(); } invoiceLineLoader.load(p, gc); Assert.assertEquals(p.get("status"), "ERROR"); }