View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.rice.krms.test;
17  
18  import org.kuali.rice.core.api.lifecycle.Lifecycle;
19  import org.kuali.rice.core.framework.resourceloader.SpringResourceLoader;
20  import org.kuali.rice.test.BaselineTestCase;
21  import org.kuali.rice.test.BaselineTestCase.BaselineMode;
22  import org.kuali.rice.test.BaselineTestCase.Mode;
23  
24  import javax.xml.namespace.QName;
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  /**
29   * This is test base that should be used for all KRMS integration tests.
30   *
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  @BaselineMode(Mode.ROLLBACK_CLEAR_DB)
34  public abstract class KRMSTestCase extends BaselineTestCase {
35  
36  	private static final String KRMS_MODULE_NAME = "krms";
37  	
38  	private SpringResourceLoader krmsTestResourceLoader;
39  	
40  	public KRMSTestCase() {
41  		super(KRMS_MODULE_NAME);
42  	}
43  	
44  	@Override
45  	protected List<Lifecycle> getSuiteLifecycles() {
46  		List<Lifecycle> suiteLifecycles = super.getSuiteLifecycles();
47  		return suiteLifecycles;
48  	}
49  	
50  	@Override
51  	protected void loadSuiteTestData() throws Exception {
52  		super.loadSuiteTestData();
53  	}
54  	
55  	
56  	
57  	@Override
58  	protected Lifecycle getLoadApplicationLifecycle() {
59  	    if (krmsTestResourceLoader == null) {
60  	        krmsTestResourceLoader = new SpringResourceLoader(new QName("KRMSTestHarnessApplicationResourceLoader"), "classpath:KRMSTestHarnessSpringBeans.xml", null);
61  	        krmsTestResourceLoader.setParentSpringResourceLoader(getTestHarnessSpringResourceLoader());
62  	        getTestHarnessSpringResourceLoader().addResourceLoader(krmsTestResourceLoader);
63  	    }
64      	return krmsTestResourceLoader;
65  	}
66  
67  	
68  	protected List<String> getPerTestTablesNotToClear() {
69  		List<String> tablesNotToClear = new ArrayList<String>();
70  		tablesNotToClear.add("KRIM_.*");
71  		tablesNotToClear.add("KRNS_.*");
72  		tablesNotToClear.add("KREW_.*");
73  		tablesNotToClear.add("KREN_.*");
74          tablesNotToClear.add("KRCR_.*");
75  		return tablesNotToClear;
76  	}
77  
78  
79  	/**
80       * @see org.kuali.rice.test.RiceTestCase#getModuleName()
81       */
82  	@Override
83  	protected String getModuleName() {
84  		return KRMS_MODULE_NAME;
85  	}
86  }