JUnit test for Feature Request [1772015] Generate java Interface and implementation instead of X_ cla

http://sourceforge.net/tracker/index.php?func=detail&aid=1772015&group_id=176962&atid=879335
This commit is contained in:
trifonnt 2007-08-18 23:46:40 +00:00
parent 368823c08c
commit 3477a34340
1 changed files with 8 additions and 57 deletions

View File

@ -28,20 +28,13 @@
***********************************************************************/
package test.functional;
import java.util.logging.Level;
import org.compiere.Adempiere;
//import org.compiere.model.I_AD_Alert;
//import org.compiere.model.I_AD_AlertProcessor;
import org.compiere.model.MAlert;
import org.compiere.model.X_AD_Alert;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Ini;
import org.compiere.util.Login;
import org.compiere.util.Trx;
import test.AdempiereTestCase;
/**
* Example Test which shows usage of new methods.
@ -49,80 +42,38 @@ import org.compiere.util.Trx;
* @author Trifon Trifonov
* @version $Id$
*/
public class AlertTest implements Runnable
public class AlertTest extends AdempiereTestCase
{
/** Logger */
private static CLogger log = CLogger.getCLogger (AlertTest.class);
/**
* AlertTest
*/
public AlertTest ()
{
super ();
}
/**
* Run
*/
public void run()
public void testAlertCreation() throws Exception
{
Trx trx = Trx.get(Trx.createTrxName("Test"), true);
trx.start();
log.info("trx = " + trx.toString());
// Old way:
//MAlert alert = new MAlert(Env.getCtx(), 1000000, trx.getTrxName());
//MAlert alert = new MAlert(Env.getCtx(), 100, trx.getTrxName());
// New way:
/* I_AD_Alert alert = new MAlert(Env.getCtx(), 1000000, trx.getTrxName());
/* I_AD_Alert alert = new MAlert(Env.getCtx(), 100, trx.getTrxName());
boolean resultSave = ((X_AD_Alert) alert).save();
log.info(alert.toString());
//
System.out.println("Trifon - alert.getAD_AlertProcessor_ID = " + alert.getAD_AlertProcessor_ID());
log.info("alert.getAD_AlertProcessor_ID = " + alert.getAD_AlertProcessor_ID());
I_AD_AlertProcessor alertProcessor = alert.getI_AD_AlertProcessor();
System.out.println("Trifon - I_AD_AlertProcessor.getAD_AlertProcessor_ID = " + alertProcessor.getAD_AlertProcessor_ID());
log.info("I_AD_AlertProcessor.getAD_AlertProcessor_ID = " + alertProcessor.getAD_AlertProcessor_ID());
*/
trx.commit();
trx.close();
}
/**
* Test
* @param args ignored
*/
public static void main (String[] args)
{
Adempiere.startup(true);
CLogMgt.setLoggerLevel(Level.INFO, null);
CLogMgt.setLevel(Level.INFO);
//
Ini.setProperty(Ini.P_UID, "SuperUser");
Ini.setProperty(Ini.P_PWD, "System");
Ini.setProperty(Ini.P_ROLE, "GardenWorld Admin");
Ini.setProperty(Ini.P_CLIENT, "GardenWorld");
Ini.setProperty(Ini.P_ORG, "HQ");
Ini.setProperty(Ini.P_WAREHOUSE, "HQ Warehouse");
Ini.setProperty(Ini.P_LANGUAGE, "English");
Login login = new Login(Env.getCtx());
if (!login.batchLogin(null))
System.exit(1);
//
CLogMgt.setLoggerLevel(Level.WARNING, null);
CLogMgt.setLevel(Level.WARNING);
long time = System.currentTimeMillis();
AlertTest test = new AlertTest();
test.run();
// Wait
time = System.currentTimeMillis() - time;
System.out.println("Time (ms)=" + time);
}
}