From b0c3dfc0af156c6b064a9fb3381887327279a63c Mon Sep 17 00:00:00 2001 From: trifonnt Date: Sun, 19 Aug 2007 01:14:42 +0000 Subject: [PATCH] Refactored AlertTest. Enhanced example of old usage and new usage! Feature Request: [1772015] Generate java Interface and implementation instead of X_ classes --- extend/src/test/functional/AlertTest.java | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/extend/src/test/functional/AlertTest.java b/extend/src/test/functional/AlertTest.java index b4b6389958..a7df2e0604 100644 --- a/extend/src/test/functional/AlertTest.java +++ b/extend/src/test/functional/AlertTest.java @@ -31,6 +31,8 @@ package test.functional; //import org.compiere.model.I_AD_Alert; //import org.compiere.model.I_AD_AlertProcessor; import org.compiere.model.MAlert; +import org.compiere.model.PO; +import org.compiere.model.X_AD_Alert; import org.compiere.model.X_AD_AlertProcessor; import org.compiere.util.CLogger; import org.compiere.util.Env; @@ -59,6 +61,7 @@ public class AlertTest extends AdempiereTestCase Trx trx = Trx.get(Trx.createTrxName("Test"), true); trx.start(); log.info("trx = " + trx.toString()); + boolean resultSave = false; //----- Old way: MAlert alertOldWay = new MAlert(Env.getCtx(), 100, trx.getTrxName()); @@ -67,19 +70,29 @@ public class AlertTest extends AdempiereTestCase X_AD_AlertProcessor alertProcessorOldWay = new X_AD_AlertProcessor(Env.getCtx(), alertOldWay.getAD_AlertProcessor_ID(), trx.getTrxName()); log.info("alertProcessorOldWay.getAD_AlertProcessor_ID = " + alertProcessorOldWay.getAD_AlertProcessor_ID()); -/* //----- New way: - I_AD_Alert alert = new MAlert(Env.getCtx(), 100, trx.getTrxName()); + alertOldWay.setDescription("Trifon test"); + resultSave = alertOldWay.save(); + log.info("resultSave = " + resultSave); + + System.out.println("New value of Description = " + alertOldWay.getDescription()); + + //----- New way: +/* I_AD_Alert alert = new MAlert(Env.getCtx(), 100, trx.getTrxName()); log.info(alert.toString()); I_AD_AlertProcessor alertProcessor = alert.getI_AD_AlertProcessor(); log.info("I_AD_AlertProcessor.getAD_AlertProcessor_ID = " + alertProcessor.getAD_AlertProcessor_ID()); log.info("alert.getAD_AlertProcessor_ID = " + alert.getAD_AlertProcessor_ID()); -*/ + alert.setDescription("Trifon test"); //--- Save; TODO - Must be refactored. PO.save must be static method!!! - //boolean resultSave = ((X_AD_Alert) alert).save(); - + //resultSave = ((X_AD_Alert) alert).save(); + resultSave = PO.save(alert); + log.info("resultSave = " + resultSave); + + System.out.println("New value of Description = " + alert.getDescription()); +*/ trx.commit(); trx.close(); }