View Javadoc

1   package org.rice.krms.test;
2   
3   import javax.xml.namespace.QName;
4   
5   import org.junit.AfterClass;
6   import org.junit.Before;
7   import org.junit.BeforeClass;
8   import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
9   import org.kuali.rice.test.BaselineTestCase.BaselineMode;
10  import org.kuali.rice.test.BaselineTestCase.Mode;
11  
12  @BaselineMode(Mode.ROLLBACK)
13  public abstract class AbstractBoTest extends KRMSTestCase {
14  	
15  	private GenericTestDao dao;
16  	private TestBoService boService;
17  	
18  	// TODO: get rid of this hack that is needed to set up the OJB properties location at the right time. 
19  	// BEGIN hack
20  	
21  	private static String ojbPropertiesBefore;
22  	
23  	@BeforeClass
24  	public static void beforeClass() {
25  		ojbPropertiesBefore = System.getProperty("OJB.properties");
26  		// TODO: this is extra annoying, we have to have our own copy of RiceOJB.properties >:-[
27  		System.setProperty("OJB.properties", /*"./org/kuali/rice/core/ojb/RiceOJB.properties"*/ "./RiceOJB.properties");
28  	}
29  	
30  	@AfterClass
31  	public static void afterClass() {
32  		if (ojbPropertiesBefore != null) {
33  			System.setProperty("OJB.properties", ojbPropertiesBefore);
34  		} else {
35  			System.clearProperty("OJB.properties");
36  		}
37  	}
38  	
39  	// END hack
40  	
41  	
42  	@Before
43  	public void setup() {
44  	    dao = (GenericTestDao)GlobalResourceLoader.getService(new QName("genericTestDao"));
45  		boService = new TestBoService(dao);
46  	}
47  	
48  	protected TestBoService getBoService() {
49  		return boService;
50  	}
51  	
52  	protected GenericTestDao getDao() {
53  		return dao;
54  	}
55  }