001    /**
002     * Copyright 2005-2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krms.test;
017    
018    import org.kuali.rice.core.api.lifecycle.Lifecycle;
019    import org.kuali.rice.core.framework.resourceloader.SpringResourceLoader;
020    import org.kuali.rice.test.BaselineTestCase;
021    import org.kuali.rice.test.BaselineTestCase.BaselineMode;
022    import org.kuali.rice.test.BaselineTestCase.Mode;
023    
024    import javax.xml.namespace.QName;
025    import java.util.ArrayList;
026    import java.util.List;
027    
028    /**
029     * This is test base that should be used for all KRMS integration tests.
030     *
031     * @author Kuali Rice Team (rice.collab@kuali.org)
032     */
033    // @BaselineMode(Mode.ROLLBACK_CLEAR_DB)
034    public abstract class KRMSTestCase extends BaselineTestCase {
035    
036            private static final String KRMS_MODULE_NAME = "krms";
037            
038            private SpringResourceLoader krmsTestResourceLoader;
039            
040            public KRMSTestCase() {
041                    super(KRMS_MODULE_NAME);
042            }
043            
044            @Override
045            protected List<Lifecycle> getSuiteLifecycles() {
046                    List<Lifecycle> suiteLifecycles = super.getSuiteLifecycles();
047                    return suiteLifecycles;
048            }
049            
050            @Override
051            protected void loadSuiteTestData() throws Exception {
052                    super.loadSuiteTestData();
053            }
054            
055            
056            
057            @Override
058            protected Lifecycle getLoadApplicationLifecycle() {
059                if (krmsTestResourceLoader == null) {
060                    krmsTestResourceLoader = new SpringResourceLoader(new QName("KRMSTestHarnessApplicationResourceLoader"), "classpath:KRMSTestHarnessSpringBeans.xml", null);
061                    krmsTestResourceLoader.setParentSpringResourceLoader(getTestHarnessSpringResourceLoader());
062                    getTestHarnessSpringResourceLoader().addResourceLoader(krmsTestResourceLoader);
063                }
064            return krmsTestResourceLoader;
065            }
066    
067            
068            protected List<String> getPerTestTablesNotToClear() {
069                    List<String> tablesNotToClear = new ArrayList<String>();
070                    tablesNotToClear.add("KRIM_.*");
071                    tablesNotToClear.add("KRNS_.*");
072                    tablesNotToClear.add("KREW_.*");
073                    tablesNotToClear.add("KREN_.*");
074            tablesNotToClear.add("KRCR_.*");
075                    return tablesNotToClear;
076            }
077    
078    
079            /**
080         * @see org.kuali.rice.test.RiceTestCase#getModuleName()
081         */
082            @Override
083            protected String getModuleName() {
084                    return KRMS_MODULE_NAME;
085            }
086    }