View Javadoc

1   /*
2    * Copyright 2006-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  
17  package org.rice.krms.test;
18  
19  import org.kuali.rice.core.api.lifecycle.Lifecycle;
20  import org.kuali.rice.core.impl.resourceloader.SpringResourceLoader;
21  import org.kuali.rice.test.BaselineTestCase;
22  import org.kuali.rice.test.BaselineTestCase.BaselineMode;
23  import org.kuali.rice.test.BaselineTestCase.Mode;
24  
25  import javax.xml.namespace.QName;
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  /**
30   * This is test base that should be used for all KRMS integration tests.
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  @BaselineMode(Mode.ROLLBACK_CLEAR_DB)
35  public abstract class KRMSTestCase extends BaselineTestCase {
36  
37  	private static final String KRMS_MODULE_NAME = "krms";
38  	
39  	private SpringResourceLoader krmsTestResourceLoader;
40  	
41  	public KRMSTestCase() {
42  		super(KRMS_MODULE_NAME);
43  	}
44  	
45  	@Override
46  	protected List<Lifecycle> getSuiteLifecycles() {
47  		List<Lifecycle> suiteLifecycles = super.getSuiteLifecycles();
48  		return suiteLifecycles;
49  	}
50  	
51  	@Override
52  	protected void loadSuiteTestData() throws Exception {
53  		super.loadSuiteTestData();
54  	}
55  	
56  	
57  	
58  	@Override
59  	protected Lifecycle getLoadApplicationLifecycle() {
60  	    if (krmsTestResourceLoader == null) {
61  	        krmsTestResourceLoader = new SpringResourceLoader(new QName("KRMSTestHarnessApplicationResourceLoader"), "classpath:KRMSTestHarnessSpringBeans.xml", null);
62  	        krmsTestResourceLoader.setParentSpringResourceLoader(getTestHarnessSpringResourceLoader());
63  	        getTestHarnessSpringResourceLoader().addResourceLoader(krmsTestResourceLoader);
64  	    }
65      	return krmsTestResourceLoader;
66  	}
67  
68  	
69  	protected List<String> getPerTestTablesNotToClear() {
70  		List<String> tablesNotToClear = new ArrayList<String>();
71  		tablesNotToClear.add("KRIM_.*");
72  		tablesNotToClear.add("KRNS_.*");
73  		tablesNotToClear.add("KREW_.*");
74  		tablesNotToClear.add("KREN_.*");
75          tablesNotToClear.add("KRCR_.*");
76  		return tablesNotToClear;
77  	}
78  
79  
80  	/**
81       * @see org.kuali.rice.test.RiceTestCase#getModuleName()
82       */
83  	@Override
84  	protected String getModuleName() {
85  		return KRMS_MODULE_NAME;
86  	}
87  }