IDEMPIERE-2699 Performance: Constant visits to database for MTable not cached (#63)

add unit testing
This commit is contained in:
hengsin 2020-05-19 16:05:56 +08:00 committed by GitHub
parent 9009a3c4a7
commit ad756782e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -26,9 +26,15 @@ package org.idempiere.test.performance;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.compiere.model.I_AD_Table;
import org.compiere.model.MColumn;
import org.compiere.model.MOrder;
import org.compiere.model.MRefTable;
import org.compiere.model.MTable;
import org.compiere.model.MWarehouse;
import org.compiere.model.MZoomCondition;
import org.compiere.util.CacheMgt;
import org.compiere.util.Env;
import org.idempiere.test.AbstractTestCase;
import org.junit.jupiter.api.Test;
@ -57,4 +63,21 @@ public class CacheTest extends AbstractTestCase {
assertTrue(conditions3 != null && conditions3.length == conditions1.length);
assertTrue(conditions1 != conditions3);
}
@Test
/**
* https://idempiere.atlassian.net/browse/IDEMPIERE-2699
*/
public void testTableCache() {
MTable table = MTable.get(Env.getCtx(), MOrder.Table_ID);
MColumn column = table.getColumn(MOrder.COLUMNNAME_C_Order_ID);
I_AD_Table table2 = column.getAD_Table();
assertTrue(table == table2);
//M_Warehouse of Client
table = MTable.get(Env.getCtx(), MWarehouse.Table_ID);
MRefTable refTable = MRefTable.get(Env.getCtx(), 197);
table2 = refTable.getAD_Table();
assertTrue(table == table2);
}
}