* minor cleanup and javadoc

This commit is contained in:
Heng Sin Low 2007-12-16 03:34:25 +00:00
parent 798b9fad14
commit 3fbe3d6d03
1 changed files with 44 additions and 3 deletions

View File

@ -40,7 +40,7 @@ public class AdempiereTestCase extends TestCase {
// Filename // Filename
public final String fileName_Key = "AdempiereProperties"; public final String fileName_Key = "AdempiereProperties";
private String fileName_DefaultValue = "J:/Trifon-CD-0.3/workspace/adempiere-trunk/adempiere/Adempiere/Adempiere.properties"; private String fileName_DefaultValue = "Adempiere.properties";
private String fileName_Value = ""; private String fileName_Value = "";
// IsClient // IsClient
@ -50,12 +50,12 @@ public class AdempiereTestCase extends TestCase {
// AD_User // AD_User
public final String AD_User_ID_Key = "AD_User_ID"; public final String AD_User_ID_Key = "AD_User_ID";
private String AD_User_ID_DefaultValue = "0"; private String AD_User_ID_DefaultValue = "100"; //SuperUser
private int AD_User_ID_Value = 0; private int AD_User_ID_Value = 0;
// AD_Client // AD_Client
public final String AD_Client_ID_Key = "AD_Client_ID"; public final String AD_Client_ID_Key = "AD_Client_ID";
private String AD_Client_ID_DefaultValue = "11"; private String AD_Client_ID_DefaultValue = "11"; //GardenWorld
private int AD_Client_ID_Value = 11; private int AD_Client_ID_Value = 11;
// LogLevel: // LogLevel:
@ -66,22 +66,42 @@ public class AdempiereTestCase extends TestCase {
// Trx name // Trx name
private String trxName = "test"; private String trxName = "test";
/**
*
* @return environment context
*/
public Properties getCtx() { public Properties getCtx() {
return m_Ctx; return m_Ctx;
} }
/**
*
* @return active transaction name
*/
public String getTrxName() { public String getTrxName() {
return trxName; return trxName;
} }
/**
*
* @return client id
*/
public int getAD_Client_ID() { public int getAD_Client_ID() {
return AD_Client_ID_Value; return AD_Client_ID_Value;
} }
/**
*
* @return user id
*/
public int getAD_User_ID() { public int getAD_User_ID() {
return AD_User_ID_Value; return AD_User_ID_Value;
} }
/**
*
* @return is running as client
*/
public boolean isClient() { public boolean isClient() {
return isClient_Value; return isClient_Value;
} }
@ -130,6 +150,10 @@ public class AdempiereTestCase extends TestCase {
CLogMgt.setLevel(LogLevel_Value); CLogMgt.setLevel(LogLevel_Value);
} }
/**
* Commit active transaction
* @throws Exception
*/
protected void commit() throws Exception { protected void commit() throws Exception {
Trx trx = null; Trx trx = null;
if (trxName != null) if (trxName != null)
@ -144,6 +168,23 @@ public class AdempiereTestCase extends TestCase {
trx = null; trx = null;
} }
/**
* Rollback active transaction
*/
protected void rollback() {
Trx trx = null;
if (trxName != null)
trx = Trx.get(trxName, false);
if (trx != null && trx.isActive()) {
try {
trx.rollback();
} finally {
trx.close();
}
}
trx = null;
}
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
super.tearDown(); super.tearDown();