IDEMPIERE-5147 Fix QueryTest.testPaging failing - IDEMPIERE-5004 (#1129)

Co-authored-by: hengsin <hengsin@gmail.com>
This commit is contained in:
Carlos Ruiz 2022-01-12 13:12:22 +01:00 committed by GitHub
parent a9c4b932c4
commit e9f85bd985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -49,6 +49,7 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
/**
* @author hengsin
@ -71,6 +72,8 @@ public class MappedModelFactoryTest extends AbstractTestCase {
(rs, trxName) -> new MyTest(Env.getCtx(), rs, trxName));
PO po = MTable.get(MyTest.Table_ID).getPO(0, getTrxName());
assertTrue(po instanceof MyTest, "PO not instanceof MyTest. PO.className="+po.getClass().getName());
mappedFactory.removeMapping(MyTest.Table_Name);
CacheMgt.get().reset();
}
@Test
@ -79,10 +82,12 @@ public class MappedModelFactoryTest extends AbstractTestCase {
BundleContext bc = TestActivator.context;
Dictionary<String, Object> properties = new Hashtable<String, Object>();
properties.put("service.ranking", Integer.valueOf(2));
bc.registerService(IModelFactory.class, new MyFactory(), properties);
ServiceRegistration<IModelFactory> registration = bc.registerService(IModelFactory.class, new MyFactory(), properties);
CacheMgt.get().reset();
PO po = MTable.get(MyTest2.Table_ID).getPO(0, getTrxName());
assertTrue(po instanceof MyTest2, "PO not instanceof MyTest2. PO.className="+po.getClass().getName());
registration.unregister();
CacheMgt.get().reset();
}
@Test
@ -93,6 +98,8 @@ public class MappedModelFactoryTest extends AbstractTestCase {
CacheMgt.get().reset();
PO po = MTable.get(MColor.Table_ID).getPO(0, getTrxName());
assertTrue(po instanceof MyAnnotatedColorModel, "PO not instanceof MyAnnotatedColorModel. PO.className="+po.getClass().getName());
Core.getMappedModelFactory().removeMapping(MColor.Table_Name);
CacheMgt.get().reset();
}
private final static class MyFactory extends MappedModelFactory {