IDEMPIERE-92 Implement Selenium testing framework. Added evaluate method for integration with selenium test using dynamic variables.
This commit is contained in:
parent
9e0d59f543
commit
bf14ca9958
|
@ -105,6 +105,7 @@ public class Util {
|
||||||
if (cell_value.toLowerCase().startsWith("@sql=")) {
|
if (cell_value.toLowerCase().startsWith("@sql=")) {
|
||||||
String sqlcmd = Env.parseContext(ctx, windowNo, lowerContextTableColumn(cell_value.substring(5)), false, false);
|
String sqlcmd = Env.parseContext(ctx, windowNo, lowerContextTableColumn(cell_value.substring(5)), false, false);
|
||||||
String newval = DB.getSQLValueStringEx(null, sqlcmd);
|
String newval = DB.getSQLValueStringEx(null, sqlcmd);
|
||||||
|
if (parse != null)
|
||||||
parse.addToBody("<hr/>" + newval);
|
parse.addToBody("<hr/>" + newval);
|
||||||
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
||||||
return newval;
|
return newval;
|
||||||
|
@ -120,6 +121,7 @@ public class Util {
|
||||||
String whereParsed = Env.parseContext(ctx, windowNo, where, false);
|
String whereParsed = Env.parseContext(ctx, windowNo, where, false);
|
||||||
String columnname = cell_value.substring(pos_clsqb+2);
|
String columnname = cell_value.substring(pos_clsqb+2);
|
||||||
String newval = DB.getSQLValueStringEx(null, "SELECT " + columnname + " FROM " + tablename + " WHERE " + whereParsed);
|
String newval = DB.getSQLValueStringEx(null, "SELECT " + columnname + " FROM " + tablename + " WHERE " + whereParsed);
|
||||||
|
if (parse != null)
|
||||||
parse.addToBody("<hr/>" + newval);
|
parse.addToBody("<hr/>" + newval);
|
||||||
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
||||||
return newval;
|
return newval;
|
||||||
|
@ -131,6 +133,7 @@ public class Util {
|
||||||
String newval = Env.getContext(ctx, windowNo, cell_value.substring(1, cell_value.length()-1));
|
String newval = Env.getContext(ctx, windowNo, cell_value.substring(1, cell_value.length()-1));
|
||||||
if (newval == null)
|
if (newval == null)
|
||||||
return cell_value;
|
return cell_value;
|
||||||
|
if (parse != null)
|
||||||
parse.addToBody("<hr/>" + newval);
|
parse.addToBody("<hr/>" + newval);
|
||||||
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
||||||
return newval;
|
return newval;
|
||||||
|
@ -191,6 +194,7 @@ public class Util {
|
||||||
String newval = randomstr.toString();
|
String newval = randomstr.toString();
|
||||||
if (newval == null)
|
if (newval == null)
|
||||||
return cell_value;
|
return cell_value;
|
||||||
|
if (parse != null)
|
||||||
parse.addToBody("<hr/>" + newval);
|
parse.addToBody("<hr/>" + newval);
|
||||||
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
if (log.isLoggable(Level.CONFIG)) log.config("Cell value " + cell_value + " evaluated to " + newval);
|
||||||
return newval;
|
return newval;
|
||||||
|
@ -239,4 +243,11 @@ public class Util {
|
||||||
} // parseContext
|
} // parseContext
|
||||||
|
|
||||||
|
|
||||||
|
public static String evaluate(String expr) {
|
||||||
|
Instance adempiereInstance = Static_iDempiereInstance.getInstance();
|
||||||
|
Properties ctx = adempiereInstance.getAdempiereService().getCtx();
|
||||||
|
int windowNo = adempiereInstance.getAdempiereService().getWindowNo();
|
||||||
|
|
||||||
|
return evaluate(ctx, windowNo, expr, null);
|
||||||
|
}
|
||||||
} // AdempiereUtil
|
} // AdempiereUtil
|
||||||
|
|
Loading…
Reference in New Issue