001 package org.rice.krms.test; 002 003 import javax.xml.namespace.QName; 004 005 import org.junit.AfterClass; 006 import org.junit.Before; 007 import org.junit.BeforeClass; 008 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; 009 import org.kuali.rice.test.BaselineTestCase.BaselineMode; 010 import org.kuali.rice.test.BaselineTestCase.Mode; 011 012 @BaselineMode(Mode.ROLLBACK) 013 public abstract class AbstractBoTest extends KRMSTestCase { 014 015 private GenericTestDao dao; 016 private TestBoService boService; 017 018 // TODO: get rid of this hack that is needed to set up the OJB properties location at the right time. 019 // BEGIN hack 020 021 private static String ojbPropertiesBefore; 022 023 @BeforeClass 024 public static void beforeClass() { 025 ojbPropertiesBefore = System.getProperty("OJB.properties"); 026 // TODO: this is extra annoying, we have to have our own copy of RiceOJB.properties >:-[ 027 System.setProperty("OJB.properties", /*"./org/kuali/rice/core/ojb/RiceOJB.properties"*/ "./RiceOJB.properties"); 028 } 029 030 @AfterClass 031 public static void afterClass() { 032 if (ojbPropertiesBefore != null) { 033 System.setProperty("OJB.properties", ojbPropertiesBefore); 034 } else { 035 System.clearProperty("OJB.properties"); 036 } 037 } 038 039 // END hack 040 041 042 @Before 043 public void setup() { 044 dao = (GenericTestDao)GlobalResourceLoader.getService(new QName("genericTestDao")); 045 boService = new TestBoService(dao); 046 } 047 048 protected TestBoService getBoService() { 049 return boService; 050 } 051 052 protected GenericTestDao getDao() { 053 return dao; 054 } 055 }