IDEMPIERE-851 fitnesse improvements / Peer Review
This commit is contained in:
parent
c0d9c39f0d
commit
4a33f4434e
|
@ -67,7 +67,7 @@ public class AssertRecord extends TableFixture {
|
||||||
POInfo poinfo = null;
|
POInfo poinfo = null;
|
||||||
boolean alreadyread = false;
|
boolean alreadyread = false;
|
||||||
StringBuilder whereclause = new StringBuilder("");
|
StringBuilder whereclause = new StringBuilder("");
|
||||||
boolean error=false;
|
boolean isErrorExpected = false;
|
||||||
for (int i = 0; i < rows; i++) {
|
for (int i = 0; i < rows; i++) {
|
||||||
String cell_title = getText(i, 0);
|
String cell_title = getText(i, 0);
|
||||||
String cell_value = getText(i, 1);
|
String cell_value = getText(i, 1);
|
||||||
|
@ -93,7 +93,7 @@ public class AssertRecord extends TableFixture {
|
||||||
whereclause.append(cell_value);
|
whereclause.append(cell_value);
|
||||||
} else if (cell_title.equalsIgnoreCase("*Read*") || cell_title.equalsIgnoreCase("*Read*Error*") )
|
} else if (cell_title.equalsIgnoreCase("*Read*") || cell_title.equalsIgnoreCase("*Read*Error*") )
|
||||||
{
|
{
|
||||||
error= "*Read*Error*".equalsIgnoreCase(cell_title);
|
isErrorExpected = "*Read*Error*".equalsIgnoreCase(cell_title);
|
||||||
if (! tableOK) {
|
if (! tableOK) {
|
||||||
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
||||||
wrong(i, 1);
|
wrong(i, 1);
|
||||||
|
@ -113,45 +113,41 @@ public class AssertRecord extends TableFixture {
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
gpo = table.getPO(rs, null);
|
gpo = table.getPO(rs, null);
|
||||||
if(error){
|
if (isErrorExpected) {
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
getCell(i, 1).addToBody("No record found: " + sql);
|
getCell(i, 1).addToBody("No record found: " + sql);
|
||||||
boolean value=Util.evaluateError("No record found: ",cell_value,error);
|
boolean ok = Util.evaluateError("No record found: ", cell_value, isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(i,1);
|
right(i,1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
getCell(i, 1).addToBody("More than one record found: " + sql);
|
getCell(i, 1).addToBody("More than one record found: " + sql);
|
||||||
boolean value=Util.evaluateError("More than one record found: ",cell_value,error);
|
boolean ok = Util.evaluateError("More than one record found: ", cell_value, isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(i,1);
|
right(i,1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
boolean value=Util.evaluateError(e.getMessage(),cell_value,error);
|
boolean ok = Util.evaluateError(e.getMessage(), cell_value, isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), e);
|
exception(getCell(i, 1), e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -196,7 +192,7 @@ public class AssertRecord extends TableFixture {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//end while
|
}
|
||||||
}
|
}
|
||||||
// set the variables at the end
|
// set the variables at the end
|
||||||
// read - set context variables
|
// read - set context variables
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class CreateRecord extends TableFixture {
|
||||||
String columnName = null;
|
String columnName = null;
|
||||||
boolean tableOK = false;
|
boolean tableOK = false;
|
||||||
boolean columnsOK = true;
|
boolean columnsOK = true;
|
||||||
boolean error="*Save*Error*".equalsIgnoreCase(getText(rows-1, 0));
|
boolean isErrorExpected = "*Save*Error*".equalsIgnoreCase(getText(rows-1, 0));
|
||||||
MTable table = null;
|
MTable table = null;
|
||||||
POInfo poinfo = null;
|
POInfo poinfo = null;
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ public class CreateRecord extends TableFixture {
|
||||||
// TODO : verify if the record already exists
|
// TODO : verify if the record already exists
|
||||||
table = MTable.get(ctx, tableName);
|
table = MTable.get(ctx, tableName);
|
||||||
if (table == null || table.get_ID() <= 0) {
|
if (table == null || table.get_ID() <= 0) {
|
||||||
boolean value=Util.evaluateError("Table " + tableName + " does not exist", cell_value, error);
|
boolean ok = Util.evaluateError("Table " + tableName + " does not exist", cell_value, isErrorExpected);
|
||||||
if(value)
|
if (ok)
|
||||||
right(i,1);
|
right(i,1);
|
||||||
else
|
else
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
|
@ -100,8 +100,8 @@ public class CreateRecord extends TableFixture {
|
||||||
|
|
||||||
if (! tableOK) {
|
if (! tableOK) {
|
||||||
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
||||||
boolean value=Util.evaluateError("Table " + tableName + " does not exist", cell_value, error);
|
boolean ok = Util.evaluateError("Table " + tableName + " does not exist", cell_value, isErrorExpected);
|
||||||
if(value)
|
if (ok)
|
||||||
right(i,1);
|
right(i,1);
|
||||||
else
|
else
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
|
@ -118,13 +118,13 @@ public class CreateRecord extends TableFixture {
|
||||||
msg.append("Error: " + vnp.getName());
|
msg.append("Error: " + vnp.getName());
|
||||||
}
|
}
|
||||||
getCell(i, 1).addToBody(msg.toString());
|
getCell(i, 1).addToBody(msg.toString());
|
||||||
boolean value=Util.evaluateError(msg.toString(),cell_value,error);
|
boolean ok = Util.evaluateError(msg.toString(),cell_value,isErrorExpected);
|
||||||
if(value)
|
if (ok)
|
||||||
right(i,1);
|
right(i,1);
|
||||||
else
|
else
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
} else {
|
} else {
|
||||||
if(error){
|
if (isErrorExpected) {
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
} else {
|
} else {
|
||||||
right(i, 1);
|
right(i, 1);
|
||||||
|
@ -194,16 +194,16 @@ public class CreateRecord extends TableFixture {
|
||||||
try {
|
try {
|
||||||
if (!gpo.set_ValueOfColumnReturningBoolean(columnName, value)) {
|
if (!gpo.set_ValueOfColumnReturningBoolean(columnName, value)) {
|
||||||
columnsOK = false;
|
columnsOK = false;
|
||||||
boolean value1=Util.evaluateError("Cannot set value of column",cell_value,error);
|
boolean ok = Util.evaluateError("Cannot set value of column", cell_value, isErrorExpected);
|
||||||
if(value1)
|
if (ok)
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
else
|
else
|
||||||
exception(getCell(i, 1), new Exception("Cannot set value of column"));
|
exception(getCell(i, 1), new Exception("Cannot set value of column"));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
columnsOK = false;
|
columnsOK = false;
|
||||||
boolean value1=Util.evaluateError("Cannot set value of column",cell_value,error);
|
boolean ok = Util.evaluateError(e.getMessage(), cell_value, isErrorExpected);
|
||||||
if(value1)
|
if (ok)
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
else
|
else
|
||||||
exception(getCell(i, 1), e);
|
exception(getCell(i, 1), e);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* This file is part of Adempiere ERP Bazaar *
|
* This file is part of iDempiere ERP Bazaar *
|
||||||
* http://www.adempiere.org *
|
* http://www.idempiere.org *
|
||||||
* *
|
|
||||||
* *
|
* *
|
||||||
* Copyright (C) Contributors *
|
* Copyright (C) Contributors *
|
||||||
* *
|
* *
|
||||||
|
@ -20,7 +19,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||||
* MA 02110-1301, USA. *
|
* MA 02110-1301, USA. *
|
||||||
* *
|
* *
|
||||||
***********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
package org.idempiere.fitnesse.fixture;
|
package org.idempiere.fitnesse.fixture;
|
||||||
|
|
||||||
|
@ -31,14 +30,9 @@ import java.util.Properties;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.idempiere.fitnesse.fixture.Instance;
|
|
||||||
import org.idempiere.fitnesse.fixture.Static_iDempiereInstance;
|
|
||||||
import org.idempiere.fitnesse.fixture.Util;
|
|
||||||
|
|
||||||
import fitnesse.fixtures.TableFixture;
|
import fitnesse.fixtures.TableFixture;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author juliana
|
* @author juliana
|
||||||
*
|
*
|
||||||
|
@ -72,7 +66,7 @@ public class DeleteRecord extends TableFixture {
|
||||||
|
|
||||||
boolean alreadyread = false;
|
boolean alreadyread = false;
|
||||||
StringBuilder whereclause = new StringBuilder("");
|
StringBuilder whereclause = new StringBuilder("");
|
||||||
boolean error = false;
|
boolean isErrorExpected = false;
|
||||||
String msgerror = null;
|
String msgerror = null;
|
||||||
|
|
||||||
for (int i = 0; i < rows; i++) {
|
for (int i = 0; i < rows; i++) {
|
||||||
|
@ -99,7 +93,7 @@ public class DeleteRecord extends TableFixture {
|
||||||
}
|
}
|
||||||
whereclause.append(cell_value);
|
whereclause.append(cell_value);
|
||||||
} else if (cell_title.equalsIgnoreCase("*Delete*") || cell_title.equalsIgnoreCase("*Delete*Error*")) {
|
} else if (cell_title.equalsIgnoreCase("*Delete*") || cell_title.equalsIgnoreCase("*Delete*Error*")) {
|
||||||
error = "*Delete*Error*".equalsIgnoreCase(cell_title);
|
isErrorExpected = "*Delete*Error*".equalsIgnoreCase(cell_title);
|
||||||
msgerror = cell_value;
|
msgerror = cell_value;
|
||||||
if (!tableOK) {
|
if (!tableOK) {
|
||||||
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
||||||
|
@ -121,26 +115,23 @@ public class DeleteRecord extends TableFixture {
|
||||||
gpo = table.getPO(rs, null);
|
gpo = table.getPO(rs, null);
|
||||||
} else {
|
} else {
|
||||||
getCell(i, 1).addToBody("No record found: " + sql);
|
getCell(i, 1).addToBody("No record found: " + sql);
|
||||||
boolean value = Util.evaluateError("No record found: ",cell_value, error);
|
boolean ok = Util.evaluateError("No record found: ",cell_value, isErrorExpected);
|
||||||
if (value) {
|
if (ok) {
|
||||||
right(i, 1);
|
right(i, 1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i, 1);
|
wrong(i, 1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
getCell(i, 1).addToBody("More than one record found: " + sql);
|
getCell(i, 1).addToBody("More than one record found: " + sql);
|
||||||
boolean value = Util.evaluateError("More than one record found: ", cell_value,error);
|
boolean ok = Util.evaluateError("More than one record found: ", cell_value,isErrorExpected);
|
||||||
if (value) {
|
if (ok) {
|
||||||
right(i, 1);
|
right(i, 1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i, 1);
|
wrong(i, 1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpo != null) {
|
if (gpo != null) {
|
||||||
|
@ -148,14 +139,13 @@ public class DeleteRecord extends TableFixture {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
boolean value = Util.evaluateError(e.getMessage(),msgerror, error);
|
boolean ok = Util.evaluateError(e.getMessage(), msgerror, isErrorExpected);
|
||||||
if (value) {
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), e);
|
exception(getCell(i, 1), e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null;
|
rs = null;
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class Login extends TableFixture {
|
||||||
if (adempiereInstance == null) {
|
if (adempiereInstance == null) {
|
||||||
adempiereInstance = Static_iDempiereInstance.getInstance();
|
adempiereInstance = Static_iDempiereInstance.getInstance();
|
||||||
}
|
}
|
||||||
boolean error="*Login*Error*".equalsIgnoreCase(getText(rows-1, 0));
|
boolean isErrorExpected = "*Login*Error*".equalsIgnoreCase(getText(rows-1, 0));
|
||||||
String msgerror = getText(rows-1, 1);
|
String msgerror = getText(rows-1, 1);
|
||||||
for (int i = 0; i < rows; i++) {
|
for (int i = 0; i < rows; i++) {
|
||||||
String cell_title = getText(i, 0);
|
String cell_title = getText(i, 0);
|
||||||
|
@ -107,8 +107,8 @@ public class Login extends TableFixture {
|
||||||
|| m_role_id < 0
|
|| m_role_id < 0
|
||||||
|| m_client_id < 0) {
|
|| m_client_id < 0) {
|
||||||
|
|
||||||
boolean value=Util.evaluateError("Incomplete data to login, needed User|Password|AD_Role_ID|AD_Client_ID", msgerror, error);
|
boolean ok = Util.evaluateError("Incomplete data to login, needed User|Password|AD_Role_ID|AD_Client_ID", msgerror, isErrorExpected);
|
||||||
if(value)
|
if (ok)
|
||||||
right(i,1);
|
right(i,1);
|
||||||
else
|
else
|
||||||
exception(getCell(rows-1, 1), new Exception("Incomplete data to login, needed User|Password|AD_Role_ID|AD_Client_ID"));
|
exception(getCell(rows-1, 1), new Exception("Incomplete data to login, needed User|Password|AD_Role_ID|AD_Client_ID"));
|
||||||
|
@ -117,7 +117,7 @@ public class Login extends TableFixture {
|
||||||
String msg = modelLogin();
|
String msg = modelLogin();
|
||||||
if (msg == null || msg.length() == 0) {
|
if (msg == null || msg.length() == 0) {
|
||||||
MSession.get (Env.getCtx(), true);// Start Session
|
MSession.get (Env.getCtx(), true);// Start Session
|
||||||
if(error){
|
if (isErrorExpected) {
|
||||||
wrong(rows-1, 0);
|
wrong(rows-1, 0);
|
||||||
wrong(rows-1, 1);
|
wrong(rows-1, 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,11 +126,10 @@ public class Login extends TableFixture {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
boolean value=Util.evaluateError(msg, msgerror, error);
|
boolean ok = Util.evaluateError(msg, msgerror, isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(rows-1, 0);
|
right(rows-1, 0);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
wrong(rows-1, 0);
|
wrong(rows-1, 0);
|
||||||
exception(getCell(rows-1, 1), new Exception(msg));
|
exception(getCell(rows-1, 1), new Exception(msg));
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class ReadRecord extends TableFixture {
|
||||||
POInfo poinfo = null;
|
POInfo poinfo = null;
|
||||||
boolean alreadyread = false;
|
boolean alreadyread = false;
|
||||||
String whereclause = new String("");
|
String whereclause = new String("");
|
||||||
boolean error=false;
|
boolean isErrorExpected = false;
|
||||||
for (int i = 0; i < rows; i++) {
|
for (int i = 0; i < rows; i++) {
|
||||||
String cell_title = getText(i, 0);
|
String cell_title = getText(i, 0);
|
||||||
String cell_value = getText(i, 1);
|
String cell_value = getText(i, 1);
|
||||||
|
@ -97,7 +97,7 @@ public class ReadRecord extends TableFixture {
|
||||||
wrong(i, 1);
|
wrong(i, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error="*Read*Error*".equalsIgnoreCase(cell_title);
|
isErrorExpected="*Read*Error*".equalsIgnoreCase(cell_title);
|
||||||
if (whereclause.length() == 0) {
|
if (whereclause.length() == 0) {
|
||||||
getCell(i, 1).addToBody("No where clause");
|
getCell(i, 1).addToBody("No where clause");
|
||||||
wrong(i, 1);
|
wrong(i, 1);
|
||||||
|
@ -112,42 +112,39 @@ public class ReadRecord extends TableFixture {
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
gpo = table.getPO(rs, null);
|
gpo = table.getPO(rs, null);
|
||||||
if(error){
|
if (isErrorExpected) {
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getCell(i, 1).addToBody("No record found: " + sql);
|
getCell(i, 1).addToBody("No record found: " + sql);
|
||||||
boolean value=Util.evaluateError("No record found: ",cell_value,error);
|
boolean ok = Util.evaluateError("No record found: ", cell_value, isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(i,1);
|
right(i,1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
getCell(i, 1).addToBody("More than one record found: " + sql);
|
getCell(i, 1).addToBody("More than one record found: " + sql);
|
||||||
boolean value=Util.evaluateError("More than one record found: ",cell_value,error);
|
boolean ok = Util.evaluateError("More than one record found: ",cell_value,isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(i,1);
|
right(i,1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i,1);
|
wrong(i,1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
boolean value=Util.evaluateError(e.getMessage(),cell_value,error);
|
boolean ok = Util.evaluateError(e.getMessage(),cell_value,isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), e);
|
exception(getCell(i, 1), e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class RunProcess extends TableFixture {
|
||||||
HashMap<String,Object> fmap = new HashMap<String,Object>();
|
HashMap<String,Object> fmap = new HashMap<String,Object>();
|
||||||
int recordID = 0;
|
int recordID = 0;
|
||||||
String docAction = null;
|
String docAction = null;
|
||||||
boolean error="*Run*Error*".equalsIgnoreCase(getText(rows-1, 0));
|
boolean isErrorExpected = "*Run*Error*".equalsIgnoreCase(getText(rows-1, 0));
|
||||||
String msgerror1 = getText(rows-1, 1);
|
String msgerror1 = getText(rows-1, 1);
|
||||||
for (int i = 0; i < rows; i++) {
|
for (int i = 0; i < rows; i++) {
|
||||||
String cell_title = getText(i, 0);
|
String cell_title = getText(i, 0);
|
||||||
|
@ -96,13 +96,13 @@ public class RunProcess extends TableFixture {
|
||||||
String processValue = cell_value;
|
String processValue = cell_value;
|
||||||
int processID = MProcess.getProcess_ID(processValue, null);
|
int processID = MProcess.getProcess_ID(processValue, null);
|
||||||
if (processID <= 0) {
|
if (processID <= 0) {
|
||||||
boolean value=Util.evaluateError(msgerror1,"Process with Value=" + processValue + " doesn't exist", error);
|
boolean ok = Util.evaluateError(msgerror1,"Process with Value=" + processValue + " doesn't exist", isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), new Exception("Process with Value=" + processValue + " doesn't exist"));
|
exception(getCell(i, 1), new Exception("Process with Value=" + processValue + " doesn't exist"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
process = new MProcess(ctx, processID, null);
|
process = new MProcess(ctx, processID, null);
|
||||||
} else if (cell_title.equalsIgnoreCase("*ProcessID*")) {
|
} else if (cell_title.equalsIgnoreCase("*ProcessID*")) {
|
||||||
|
@ -113,13 +113,13 @@ public class RunProcess extends TableFixture {
|
||||||
int processID = getInt(i, 1);
|
int processID = getInt(i, 1);
|
||||||
process = new MProcess(ctx, processID, null);
|
process = new MProcess(ctx, processID, null);
|
||||||
if (process == null || process.get_ID() <= 0) {
|
if (process == null || process.get_ID() <= 0) {
|
||||||
boolean value=Util.evaluateError(msgerror1,"Process with ID=" + processID + " doesn't exist", error);
|
boolean ok = Util.evaluateError(msgerror1,"Process with ID=" + processID + " doesn't exist", isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), new Exception("Process with ID=" + processID + " doesn't exist"));
|
exception(getCell(i, 1), new Exception("Process with ID=" + processID + " doesn't exist"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else if (cell_title.equalsIgnoreCase("*Run*") || cell_title.equalsIgnoreCase("*Run*Error*")) {
|
} else if (cell_title.equalsIgnoreCase("*Run*") || cell_title.equalsIgnoreCase("*Run*Error*")) {
|
||||||
if (i != rows-1) {
|
if (i != rows-1) {
|
||||||
|
@ -131,9 +131,9 @@ public class RunProcess extends TableFixture {
|
||||||
MPInstancePara[] iParams = pInstance.getParameters();
|
MPInstancePara[] iParams = pInstance.getParameters();
|
||||||
String errorMsg = setParams(process, iParams, fmap);
|
String errorMsg = setParams(process, iParams, fmap);
|
||||||
if (errorMsg != null) {
|
if (errorMsg != null) {
|
||||||
boolean value=Util.evaluateError(msgerror1,errorMsg, error);
|
boolean ok = Util.evaluateError(msgerror1,errorMsg, isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), new Exception(errorMsg));
|
exception(getCell(i, 1), new Exception(errorMsg));
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,6 @@ public class RunProcess extends TableFixture {
|
||||||
// Start
|
// Start
|
||||||
if (process.isWorkflow())
|
if (process.isWorkflow())
|
||||||
{
|
{
|
||||||
boolean value=Util.evaluateError(msgerror1,pi.getSummary(), error);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int AD_Workflow_ID = process.getAD_Workflow_ID();
|
int AD_Workflow_ID = process.getAD_Workflow_ID();
|
||||||
|
@ -192,33 +191,33 @@ public class RunProcess extends TableFixture {
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
PO po = table.getPO(recordID, null);
|
PO po = table.getPO(recordID, null);
|
||||||
if (!docAction.equals(po.get_Value("DocStatus"))) {
|
if (!docAction.equals(po.get_Value("DocStatus"))) {
|
||||||
if(value){
|
boolean ok = Util.evaluateError(Msg.parseTranslation(ctx, pi.getSummary()), msgerror1, isErrorExpected);
|
||||||
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
} else {
|
} else {
|
||||||
wrong(getCell(i, 1));
|
wrong(getCell(i, 1));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (value) {
|
|
||||||
right(getCell(i, 1));
|
|
||||||
} else {
|
} else {
|
||||||
|
if (isErrorExpected) {
|
||||||
wrong(getCell(i, 1));
|
wrong(getCell(i, 1));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(value){
|
|
||||||
right(getCell(i, 1));
|
|
||||||
} else {
|
} else {
|
||||||
|
right(getCell(i, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isErrorExpected) {
|
||||||
wrong(getCell(i, 1));
|
wrong(getCell(i, 1));
|
||||||
|
} else {
|
||||||
|
right(getCell(i, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
if(value){
|
boolean ok = Util.evaluateError(ex.getMessage(), cell_value, isErrorExpected);
|
||||||
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), ex);
|
exception(getCell(i, 1), ex);
|
||||||
|
@ -243,8 +242,8 @@ public class RunProcess extends TableFixture {
|
||||||
}
|
}
|
||||||
if (!processOK || pi.isError())
|
if (!processOK || pi.isError())
|
||||||
{
|
{
|
||||||
boolean value=Util.evaluateError(msgerror1,pi.getSummary(), error);
|
boolean ok = Util.evaluateError(msgerror1,pi.getSummary(), isErrorExpected);
|
||||||
if(value){
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
processOK = true;
|
processOK = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -254,7 +253,7 @@ public class RunProcess extends TableFixture {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(error){
|
if (isErrorExpected) {
|
||||||
wrong(getCell(i, 1));
|
wrong(getCell(i, 1));
|
||||||
} else {
|
} else {
|
||||||
getCell(i, 1).addToBody(Msg.parseTranslation(ctx, pi.getSummary()));
|
getCell(i, 1).addToBody(Msg.parseTranslation(ctx, pi.getSummary()));
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* This file is part of Adempiere ERP Bazaar *
|
* This file is part of iDempiere ERP Bazaar *
|
||||||
* http://www.adempiere.org *
|
* http://www.idempiere.org *
|
||||||
* *
|
|
||||||
* *
|
* *
|
||||||
* Copyright (C) Contributors *
|
* Copyright (C) Contributors *
|
||||||
* *
|
* *
|
||||||
|
@ -20,7 +19,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||||
* MA 02110-1301, USA. *
|
* MA 02110-1301, USA. *
|
||||||
* *
|
* *
|
||||||
***********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
package org.idempiere.fitnesse.fixture;
|
package org.idempiere.fitnesse.fixture;
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ public class UpdateRecord extends TableFixture {
|
||||||
|
|
||||||
boolean alreadyread = false;
|
boolean alreadyread = false;
|
||||||
StringBuilder whereclause = new StringBuilder("");
|
StringBuilder whereclause = new StringBuilder("");
|
||||||
boolean error = false;
|
boolean isErrorExpected = false;
|
||||||
String msgerror = null;
|
String msgerror = null;
|
||||||
for (int i = 0; i < rows; i++) {
|
for (int i = 0; i < rows; i++) {
|
||||||
String cell_title = getText(i, 0);
|
String cell_title = getText(i, 0);
|
||||||
|
@ -97,7 +96,7 @@ public class UpdateRecord extends TableFixture {
|
||||||
}
|
}
|
||||||
whereclause.append(cell_value);
|
whereclause.append(cell_value);
|
||||||
} else if (cell_title.equalsIgnoreCase("*Update*") || cell_title.equalsIgnoreCase("*Update*Error*")) {
|
} else if (cell_title.equalsIgnoreCase("*Update*") || cell_title.equalsIgnoreCase("*Update*Error*")) {
|
||||||
error = "*Update*Error*".equalsIgnoreCase(cell_title);
|
isErrorExpected = "*Update*Error*".equalsIgnoreCase(cell_title);
|
||||||
msgerror = cell_value;
|
msgerror = cell_value;
|
||||||
if (!tableOK) {
|
if (!tableOK) {
|
||||||
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
||||||
|
@ -119,36 +118,32 @@ public class UpdateRecord extends TableFixture {
|
||||||
gpo = table.getPO(rs, null);
|
gpo = table.getPO(rs, null);
|
||||||
} else {
|
} else {
|
||||||
getCell(i, 1).addToBody("No record found: " + sql);
|
getCell(i, 1).addToBody("No record found: " + sql);
|
||||||
boolean value = Util.evaluateError("No record found: ",cell_value, error);
|
boolean ok = Util.evaluateError("No record found: ",cell_value, isErrorExpected);
|
||||||
if (value) {
|
if (ok) {
|
||||||
right(i, 1);
|
right(i, 1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i, 1);
|
wrong(i, 1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
getCell(i, 1).addToBody("More than one record found: " + sql);
|
getCell(i, 1).addToBody("More than one record found: " + sql);
|
||||||
boolean value = Util.evaluateError("More than one record found: ", cell_value,error);
|
boolean ok = Util.evaluateError("More than one record found: ", cell_value,isErrorExpected);
|
||||||
if (value) {
|
if (ok) {
|
||||||
right(i, 1);
|
right(i, 1);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wrong(i, 1);
|
wrong(i, 1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
boolean value = Util.evaluateError(e.getMessage(),cell_value, error);
|
boolean ok = Util.evaluateError(e.getMessage(),cell_value, isErrorExpected);
|
||||||
if (value) {
|
if (ok) {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
exception(getCell(i, 1), e);
|
exception(getCell(i, 1), e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null;
|
rs = null;
|
||||||
|
@ -171,19 +166,18 @@ public class UpdateRecord extends TableFixture {
|
||||||
} else {
|
} else {
|
||||||
if (gpo != null) {
|
if (gpo != null) {
|
||||||
if (gpo.set_ValueOfColumnReturningBoolean(cell_title, cell_value)) {
|
if (gpo.set_ValueOfColumnReturningBoolean(cell_title, cell_value)) {
|
||||||
if(error){
|
if (isErrorExpected) {
|
||||||
wrong(getCell(i, 1));
|
wrong(getCell(i, 1));
|
||||||
} else {
|
} else {
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gpo.saveEx();
|
gpo.saveEx();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
boolean value = Util.evaluateError(e.getMessage(),msgerror, error);
|
boolean ok = Util.evaluateError(e.getMessage(),msgerror, isErrorExpected);
|
||||||
if (value)
|
if (ok)
|
||||||
right(getCell(i, 1));
|
right(getCell(i, 1));
|
||||||
else
|
else
|
||||||
exception(getCell(i, 1),e);
|
exception(getCell(i, 1),e);
|
||||||
|
|
|
@ -251,7 +251,7 @@ public class Util {
|
||||||
return evaluate(ctx, windowNo, expr, null);
|
return evaluate(ctx, windowNo, expr, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean evaluateError(String error, String cell,boolean isError) {
|
public static boolean evaluateError(String error, String cell, boolean isExpectedError) {
|
||||||
boolean evaluate = false;
|
boolean evaluate = false;
|
||||||
|
|
||||||
if (error == null)
|
if (error == null)
|
||||||
|
@ -259,7 +259,7 @@ public class Util {
|
||||||
if (cell == null)
|
if (cell == null)
|
||||||
cell = "";
|
cell = "";
|
||||||
|
|
||||||
if (isError) {
|
if (isExpectedError) {
|
||||||
if (cell.length() > 0) {
|
if (cell.length() > 0) {
|
||||||
if (error.contains(cell)) {
|
if (error.contains(cell)) {
|
||||||
evaluate = true;
|
evaluate = true;
|
||||||
|
|
|
@ -294,8 +294,7 @@ public class FitRecorder implements ModelValidator {
|
||||||
writeFile("|*Run*|");
|
writeFile("|*Run*|");
|
||||||
writeFile("\n");
|
writeFile("\n");
|
||||||
|
|
||||||
}else if(po instanceof MSession)
|
} else if (po instanceof MSession) {
|
||||||
{
|
|
||||||
MSession session = (MSession) po;
|
MSession session = (MSession) po;
|
||||||
if (session.isProcessed()) {
|
if (session.isProcessed()) {
|
||||||
closefile();
|
closefile();
|
||||||
|
@ -426,10 +425,8 @@ public class FitRecorder implements ModelValidator {
|
||||||
value=po.get_ValueAsString(colName);
|
value=po.get_ValueAsString(colName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (column.isAllowLogging())
|
if (column.isAllowLogging()) {
|
||||||
{
|
if (column.isKey()) {
|
||||||
if (column.isKey())
|
|
||||||
{
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
writeFile("| *Where* | ");
|
writeFile("| *Where* | ");
|
||||||
writeFile(colName + " = " + value+ " | ");
|
writeFile(colName + " = " + value+ " | ");
|
||||||
|
|
Loading…
Reference in New Issue