IDEMPIERE-206 / Fitnesse fixes:

- Sync sample test cases with latest changes
- Use configurable port on ZkSuite
- Fix context problem on Login and RunProcess
- Fix jasper checking on RunProcess (same bug on webservices)
- Implement context variable parsing on Util
- Change log of post event on core to inform error when a fitnesse posting fails
- Improve error on posting material receipt requiring order line
This commit is contained in:
Carlos Ruiz 2013-06-28 17:38:38 -05:00
parent 197afc88af
commit daece5d52c
14 changed files with 119 additions and 74 deletions

View File

@ -65,15 +65,15 @@ Check the inventory level after the document
|@ExpectedInventoryLevelAfter@|@SQL=SELECT SUM(s.qtyonhand) FROM m_storage s, m_locator l, m_warehouse w WHERE s.m_product_id=133 AND s.m_locator_id = l.m_locator_id AND l.m_warehouse_id=w.m_warehouse_id AND w.m_warehouse_id=103|
Check the bp balance after the document
Check the bp balance after the document (with the new cash payment is applied immediately so there must not be variance on the bp balance)
!|Assert Record|
|*Table* |C_bpartner |
|*Where* |c_bpartner_id=120 |
|*Read* | |
|actuallifetimevalue|@SQL=SELECT @C_bpartner.actuallifetimevalue@ + @c_order.grandtotal@ FROM DUAL|
|so_creditused |@SQL=SELECT @C_bpartner.so_creditused@ + @c_order.grandtotal@ FROM DUAL |
|totalopenbalance |@SQL=SELECT @C_bpartner.totalopenbalance@ + @c_order.grandtotal@ FROM DUAL |
|so_creditused |@SQL=SELECT @C_bpartner.so_creditused@ FROM DUAL |
|totalopenbalance |@SQL=SELECT @C_bpartner.totalopenbalance@ FROM DUAL |
Check existance of shipment
@ -123,17 +123,14 @@ Check existance of invoice
|qtyinvoiced | |
|linenetamt | |
Check existance of cash journal line
Check existance of cash payment (now on payment table)
!|Read Record|
|*Table* |C_CashLine |
|*Table* |C_Payment |
|C_Invoice_id|@C_Invoice.C_Invoice_id@|
|*Read* | |
|line | |
|c_cash_id | |
|line | |
|documentno | |
|description | |
|amount | |
|isgenerated | |
|processed | |

View File

@ -1,4 +1,4 @@
This test tries to create a reference in the database, intentionally the !-ValidationType-! is left to a wrong value (Y) to make it fail.
This test tries to create a reference in the database, intentionally the !-ValidationType-! is set to a wrong value (Y) to make it fail.
!include TestLoginSystem
@ -7,4 +7,4 @@ This test tries to create a reference in the database, intentionally the !-Valid
|Name |Fitnesse Test|
|ValidationType|Y |
|invalidcolumn|Y |
|*Save* | |
|*Save*Error* |java.lang.Exception: Cannot set value of column|

View File

@ -2,12 +2,16 @@ This test creates a new tenant in the database.
!include TestLoginSystem
!|Run Process|
!|Set Variable |
|@random_string@|@random_string(,,6)|
!|Run Process |
|*ProcessValue* |InitialClientSetup |
|ClientName |Prueba |
|OrgName |Prueba |
|AdminUserName |PruebaAdmin |
|NormalUserName |PruebaUser |
|ClientName |TestClient @random_string@ |
|OrgName |TestOrg @random_string@ |
|AdminUserName |@random_string@Admin |
|NormalUserName |@random_string@User |
|C_Currency_ID |230 |
|C_Country_ID |156 |
|CityName |Bogotá |
@ -16,5 +20,5 @@ This test creates a new tenant in the database.
|IsUseProjectDimension |Y |
|IsUseCampaignDimension |N |
|IsUseSalesRegionDimension|N |
|CoAFile |/home/carlos/hgAdempiere/adempiere361/data/import/AccountingUS.csv|
|CoAFile |${fitnesse_home}/../org.adempiere.server-feature/data/import/AccountingUS.csv|
|*Run* | |

View File

@ -4,43 +4,49 @@ https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2713724&group_id=17
!include -c TestLoginGardenAdmin
!|Set Variable |
|@InventoryLevelBefore@ |@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101|
|@ExpectedInventoryLevelAfter@|@SQL=SELECT @InventoryLevelBefore@-2 FROM dual |
Create the internal use document
!|Create Record|
|*Table*|M_Inventory |
!|Create Record |
|*Table* |M_Inventory |
|ad_org_id |11 |
|c_doctype_id |144 |
|c_doctype_id |200000 |
|m_warehouse_id|103 |
|movementdate |2009-03-26 00:00:00.0|
|*Save*| |
|movementdate |2013-06-26 00:00:00.0|
|*Save* | |
Create internal use line
!|Create Record|
|*Table*|M_InventoryLine |
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@ |
!|Create Record |
|*Table* |M_InventoryLine |
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@|
|ad_org_id |@M_Inventory.AD_Org_ID@ |
|m_locator_id |101 |
|m_product_id |141 |
|c_charge_id |101 |
|qtyinternaluse|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101 and m_attributesetinstance_id=0|
|qtybook|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101 and m_attributesetinstance_id=0|
|*Save*| |
|qtyinternaluse|2 |
|*Save* | |
Complete the internal use
!|Run Process|
!|Run Process |
|*ProcessValue*|M_Inventory Process |
|*RecordID* |@M_Inventory.M_Inventory_ID@|
|*DocAction* |CO |
|*Run*| |
|*Run* | |
!|Assert Variable |
|@ExpectedInventoryLevelAfter@|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101|
Post
!|Set DocAction|
|*Table* |M_Inventory|
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@ |
!|Set DocAction |
|*Table* |M_Inventory |
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@|
|docAction |PO |
|*Save*| |
|*Save* | |
Check the postings

View File

@ -1,3 +1,9 @@
|IdempiereSuite.TestInitialClientSetup||17:03:35 vie, jun 28, 2013|
|IdempiereSuite.TestPostInternalInventory||15:31:05 vie, jun 28, 2013|
|IdempiereSuite.TestCreateReference||14:44:52 vie, jun 28, 2013|
|IdempiereSuite.TestCashPosOrder||14:42:20 vie, jun 28, 2013|
|ZkSuite.ZkGardenAdminLogin||13:02:13 vie, jun 28, 2013|
|ZkSuite.ZkSystemAdminLogin||13:00:38 vie, jun 28, 2013|
|||12:04:00 jue, dic 20, 2012|
|FitLibraryWeb||01:41:13 Thu, Dec 13, 2012|
|FitLibrary||01:40:51 Thu, Dec 13, 2012|
@ -9,13 +15,9 @@
|CommonTests.CreateProductPrice||01:29:57 mar, abr 03, 2012|
|AvgCostSuite.BasicTest||01:18:34 mar, abr 03, 2012|
|CommonTests.CreatePurchaseOrder||01:13:34 mar, abr 03, 2012|
|IdempiereSuite.TestPostInternalInventory||24:21:25 mar, abr 03, 2012|
|IdempiereSuite.TestInitialClientSetup||24:20:45 mar, abr 03, 2012|
|IdempiereSuite.TestCreateReference||24:20:15 mar, abr 03, 2012|
|IdempiereSuite.TestLoginSystem||24:20:05 mar, abr 03, 2012|
|IdempiereSuite.TestCreateBusinessPartner||24:19:40 mar, abr 03, 2012|
|IdempiereSuite.TestCompletePayment||24:19:18 mar, abr 03, 2012|
|IdempiereSuite.TestCashPosOrder||24:18:46 mar, abr 03, 2012|
|IdempiereSuite||24:17:17 mar, abr 03, 2012|
|IdempiereSuite.TestLoginGardenAdmin||24:17:07 mar, abr 03, 2012|
|IdempiereSuite.QuickTest||24:16:36 mar, abr 03, 2012|

View File

@ -4,7 +4,7 @@
'''start firefox,chrome or phantomjs'''
|''start spider with''|firefox|
|''shutdown browser automatically''|false|
|''get url''|http://localhost:8080/webui/index.zul|
|''get url''|http://localhost:${ADEMPIERE_WEB_PORT}/webui/index.zul|
|''wait response''|

View File

@ -3,7 +3,7 @@
'''start firefox,chrome or phantomjs'''
|''start spider with''|firefox|
|''shutdown browser automatically''|false|
|''get url''|http://localhost:8080/webui/index.zul|
|''get url''|http://localhost:${ADEMPIERE_WEB_PORT}/webui/index.zul|
|''wait response''|

View File

@ -419,7 +419,7 @@ public class Doc_InOut extends Doc
}
else
{
p_Error = "Resubmit - No Costs for " + product.getName();
p_Error = "Resubmit - No Costs for " + product.getName() + " (required order line)";
log.log(Level.WARNING, p_Error);
return null;
}

View File

@ -48,6 +48,7 @@ import org.compiere.model.PO;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Util;
import org.eevolution.model.I_DD_Order;
import org.eevolution.model.I_HR_Process;
import org.eevolution.model.I_PP_Cost_Collector;
@ -489,6 +490,12 @@ public class DocumentEngine implements DocAction
return false;
String error = DocumentEngine.postImmediate(Env.getCtx(), m_document.getAD_Client_ID(), m_document.get_Table_ID(), m_document.get_ID(), true, m_document.get_TrxName());
if (ACTION_Post.equals(m_action)) {
// forced post via process - throw exception to inform the caller about the error
if (! Util.isEmpty(error)) {
throw new AdempiereException(error);
}
}
return (error == null);
} // postIt

View File

@ -52,6 +52,7 @@ Import-Package: fit,
fitnesse.wikitext.widgets,
fitnesseMain,
fitnesseMain.ant,
org.adempiere.util,
org.compiere,
org.compiere.model,
org.compiere.process,

View File

@ -26,6 +26,8 @@
package org.idempiere.fitnesse.fixture;
import java.util.Properties;
import org.compiere.model.MSession;
import org.compiere.model.MUser;
import org.compiere.util.Env;
@ -54,6 +56,7 @@ public class Login extends TableFixture {
if (adempiereInstance == null) {
adempiereInstance = Static_iDempiereInstance.getInstance();
}
Properties ctx = adempiereInstance.getAdempiereService().getCtx();
boolean isErrorExpected = "*Login*Error*".equalsIgnoreCase(getText(rows-1, 0));
String msgerror = getText(rows-1, 1);
for (int i = 0; i < rows; i++) {
@ -116,7 +119,7 @@ public class Login extends TableFixture {
else {
String msg = modelLogin();
if (msg == null || msg.length() == 0) {
MSession.get (Env.getCtx(), true);// Start Session
MSession.get (ctx, true);// Start Session
if (isErrorExpected) {
wrong(rows-1, 0);
wrong(rows-1, 1);

View File

@ -33,6 +33,7 @@ import java.util.HashMap;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.util.ProcessUtil;
import org.compiere.model.Lookup;
import org.compiere.model.MPInstance;
import org.compiere.model.MPInstanceLog;
@ -172,7 +173,14 @@ public class RunProcess extends TableFixture {
if (recordID >0)
pi.setRecord_ID(recordID);
boolean processOK = false;
boolean jasperreport = (process != null && process.getClassname()!=null && process.getClassname().indexOf( "net.sf.compilo.report.ReportStarter" ) >=0 );
boolean jasperreport =
(process != null
&& (process.getJasperReport() != null
|| (process.getClassname() != null
&& process.getClassname().indexOf(ProcessUtil.JASPER_STARTER_CLASS) >= 0
)
)
);
// Start
if (process.isWorkflow())
{
@ -191,6 +199,7 @@ public class RunProcess extends TableFixture {
if (table != null) {
PO po = table.getPO(recordID, null);
if (!docAction.equals(po.get_Value("DocStatus"))) {
getCell(i, 1).addToBody("<br>Expected " + docAction + "<br>Received " + po.get_Value("DocStatus"));
boolean ok = Util.evaluateError(Msg.parseTranslation(ctx, pi.getSummary()), msgerror1, isErrorExpected);
if (ok) {
right(getCell(i, 1));
@ -306,7 +315,7 @@ public class RunProcess extends TableFixture {
if (pil.getP_Number() != null)
getCell(i, 1).addToBody(pil.getP_Number() + " \t");
if (pil.getP_Msg() != null)
getCell(i, 1).addToBody(Msg.parseTranslation(Env.getCtx(), pil.getP_Msg()).replaceAll("\\n", "<br>"));
getCell(i, 1).addToBody(Msg.parseTranslation(adempiereInstance.getAdempiereService().getCtx(), pil.getP_Msg()).replaceAll("\\n", "<br>"));
}
}
}

View File

@ -125,18 +125,6 @@ public class Util {
parse.addToBody("<hr/>" + newval);
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
return newval;
} else if (cell_value.startsWith("@") && cell_value.endsWith("@")) {
int posdot = cell_value.indexOf(".");
if (posdot >= 0) {
cell_value = cell_value.toLowerCase();
}
String newval = Env.getContext(ctx, windowNo, cell_value.substring(1, cell_value.length()-1));
if (newval == null)
return cell_value;
if (parse != null)
parse.addToBody("<hr/>" + newval);
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
return newval;
} else if ((cell_value.toLowerCase().startsWith("@random_number(") || cell_value.toLowerCase().startsWith("@random_string("))
&& cell_value.endsWith(")")) {
// allow @RANDOM_NUMBER(PREFIX,SUFFIX,LENGTH,DECIMALS)@ in column value
@ -198,6 +186,26 @@ public class Util {
parse.addToBody("<hr/>" + newval);
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
return newval;
} else if (cell_value.startsWith("@") && cell_value.endsWith("@")) {
int posdot = cell_value.indexOf(".");
if (posdot >= 0) {
cell_value = cell_value.toLowerCase();
}
String newval = Env.getContext(ctx, windowNo, cell_value.substring(1, cell_value.length()-1));
if (newval == null)
return cell_value;
if (parse != null)
parse.addToBody("<hr/>" + newval);
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
return newval;
} else if (cell_value.matches(".*@.*@.*")) {
String newval = Env.parseContext(ctx, windowNo, cell_value, false, false);
if (newval == null || newval.length() == 0)
return cell_value;
if (parse != null)
parse.addToBody("<hr/>" + newval);
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
return newval;
} else if (cell_value.startsWith("\\@")) {
cell_value = cell_value.substring(1);
}

View File

@ -14,6 +14,7 @@ import javax.xml.namespace.QName;
import net.sf.compilo.report.ReportProcessor;
import net.sf.jasperreports.engine.JasperPrint;
import org.adempiere.util.ProcessUtil;
import org.compiere.model.Lookup;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
@ -288,7 +289,14 @@ public class Process {
}
boolean processOK = false;
boolean jasperreport = (process != null && process.getClassname()!=null && process.getClassname().indexOf( "net.sf.compilo.report.ReportStarter" ) >=0 );
boolean jasperreport =
(process != null
&& (process.getJasperReport() != null
|| (process.getClassname() != null
&& process.getClassname().indexOf(ProcessUtil.JASPER_STARTER_CLASS) >= 0
)
)
);
if (jasperreport)
{