001/**
002 * Copyright 2005-2013 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 */
016package org.kuali.rice.core.test;
017
018import org.junit.Test;
019import org.kuali.rice.test.data.PerSuiteUnitTestData;
020import org.kuali.rice.test.data.PerTestUnitTestData;
021import org.kuali.rice.test.data.UnitTestData;
022
023/**
024 * Used to test the annotation data entry provided by {@link UnitTestData}, {@link PerTestUnitTestData}, and {@link PerSuiteUnitTestData}
025 * 
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028@PerSuiteUnitTestData({
029        @UnitTestData("insert into " + AnnotationTestParent.TEST_TABLE_NAME + " (COL) values ('3')"),
030        @UnitTestData(filename = "classpath:org/kuali/rice/test/DataLoaderAnnotationTestData.sql")
031})
032public class DataLoaderAnnotationTest extends AnnotationTestParent {
033    
034    public DataLoaderAnnotationTest() {}
035
036    @Override
037    protected void setUpInternal() throws Exception {
038        try{
039            resetDb();
040        } catch (Exception e) {
041            // Will error of db not previously loaded, ignore reset error
042        }
043        super.setUpInternal();
044    }
045
046    @Test public void testParentAndSubClassImplementation() throws Exception {
047        // check sql statement from this class
048        verifyExistence("3");
049        verifyCount("3", 1);
050        
051        // check sql file from this class
052        verifyExistence("4");
053        verifyCount("4", 1);
054        
055        // check sql statement from parent class
056        verifyExistence("1");
057        verifyCount("1", 1);
058        
059        // check sql file from parent class
060        verifyExistence("2");
061        verifyCount("2", 1);
062    }
063}