1 14 package org.compiere.model; 15 16 import junit.framework.TestCase; 17 18 import org.compiere.util.*; 19 20 27 public class MRoleTest extends TestCase 28 { 29 33 public MRoleTest(String name) 34 { 35 super(name); 36 } 37 38 private MRole m_role = null; 39 40 45 protected void setUp() throws Exception , Exception 46 { 47 org.compiere.Compiere.startupClient(); 48 m_role = MRole.getDefault(Env.getCtx(), false); 49 super.setUp(); 50 } 51 52 59 protected void tearDown() throws Exception 60 { 61 super.tearDown(); 62 } 63 64 68 public void testAddAccessSQL() 69 { 70 String sql = m_role.addAccessSQL( 72 "SELECT r.a,r.b,r.c FROM AD_Role r WHERE EXISTS " 73 + "(SELECT AD_Column c WHERE c.a=c.b) ORDER BY 1", 74 "r", 75 MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); 76 System.out.println(sql); 77 assertEquals(sql, "SELECT r.a,r.b,r.c FROM AD_Role r WHERE EXISTS (SELECT AD_Column c WHERE c.a=c.b) AND r.AD_Client_ID=0 AND r.AD_Org_ID=0 ORDER BY 1"); 78 } 79 80 81 85 public static void main(String [] args) 86 { 87 junit.textui.TestRunner.run(MRoleTest.class); 88 } 89 90 } | Popular Tags |